A Scanner for Fixed Column Data

slm29688@ggr.co.uk (Stuart Moodie)
Fri, 1 Sep 1995 14:40:40 GMT

          From comp.compilers

Related articles
A Scanner for Fixed Column Data slm29688@ggr.co.uk (1995-09-01)
A Scanner for Fixed Column Data dave@occl-cam.demon.co.uk (Dave Lloyd) (1995-09-13)
| List of all articles for this month |

Newsgroups: comp.compilers
From: slm29688@ggr.co.uk (Stuart Moodie)
Keywords: lex, question
Organization: GRD
Date: Fri, 1 Sep 1995 14:40:40 GMT

Firstly, apologies if this is not the appropriate place,
but this seems to be the most appropriate group for this query.


I have a flat data file that uses a fixed-column format to store data
items (for those that know a bit about biology and protein stucture I'm
talking about Protein Data Bank (PDB) files). An example of the format
I'm working with is shown below:
HEADER TRANSFERASE (PHOSPHOTRANSFERASE) 17-JAN-90 1AK3 1AK3 2
COMPND ADENYLATE KINASE ISOENZYME-3, /GTP:AMP$ 1AK3 3


ATOM 64 N ILE A 10 7.582 41.473 54.143 1.00 10.79 1AK3 223
ATOM 65 CA ILE A 10 6.230 41.194 53.723 1.00 11.57 1AK3 224


The first line should parse into four tokens occurring between columns 1-6,
11-50, 51-59 and 63-66- there can be any character beteen these columns
nd after them, which means there need not be white-space between adjacent
tokens.


I started to use flex and bison, and can get it to do what I want,
after a fashion, using the @n feature of bison. However, this is far
from ideal and so I would like to find know if there is a lex-like program
that scans and defines tokens by column position. Of couse I could write
my own version of yylex(), but I'd rather have the flexibility of a tool
like (f)lex, since the format is likely to change several times over the next
year or so.


If there is such a tool I would be keen to hear about it.


Cheers,


Stuart.


--
----------------------------------------------------------------------
| Stuart L. Moodie Computational Chemistry Group |
| Glaxo Research and Development Ltd. |
| Medicines Research Centre, |
| Gunnels Wood Road, |
| Stevenage, Herts. SG1 2NY |
| Telephone: (01 438) 745745 ext. 3381 |
| email: slm29688@ggr.co.uk or moodie@gale.demon.co.uk |
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.