[antlr-interest] hollerith string

marcschellens m_schellens at hotmail.com
Fri Aug 15 00:04:10 PDT 2003

How to parse a hollerith string

the format is nHccccc
where n is a number H a 'H' and cccc n characters

5Habcde  is 'abcde'

I did the following (using antlr c++ mode) in the lexer:

	: (DIGIT)+ 
                string text=$getText;
                int len=atoi(text.c_str());
                for( int i=0; i<len; i++)
                    consume(); // appends char

I think it should work, but generally I prefer not to call
internals like 'consume()' directly. So is there a way of avoiding


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

More information about the antlr-interest mailing list