[antlr-interest] Fixed Length Tokens

brb0522 brb0522 at yahoo.com
Wed May 28 10:27:47 PDT 2003


Any suggestions on how to handle a file of fixed length fields.
Something like:
IDfirstname   lastname    address    city   <EOL>

I'm trying to get that into a tree structure
ID
|--firstname
|--lastname
|--address
etc...

I found an example out here that will parse CHAR by CHAR for some 
number of characters, but it seems that each character becomes a leaf.

test[int N]
   {int n=N;}
   :
   { n > 1 }? CHAR test[n-1]
   |
   { n == 0 }?
   ;
CHAR is defined as 'a'..'z' | 'A'..'Z' | '0'..'9'

Any help or examples on how to handle fixed length fields will be 
greatly appreciated.

Thanks
-Brian



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list