[antlr-interest] Antlr lexers - implementing Here documents

Tommy Nordgren tommy.nordgren at chello.se
Sat Sep 17 05:49:29 PDT 2005


For an application I need to implement a token similar to here  
documents in bash and perl.
Each token is introduced by a special symbol, and an identifier. The  
token is ended by the
start identifier occuring by itself on a line.
Everything after the introducing identifier, and before the  
terminating identifier should be copied
verbatim to the generated token.
Like this:
<<ENDRULE
"This should be copied verbatim"
ENDRULE

After this pattern occurs in the input, a token should be generated  
with the content "This should be copied verbatim",
and an appropriate token code.

Any ideas, folks, on how to implement this?

"Home is not where you are born, but where your heart finds peace" -
Tommy Nordgren, "The dying old crone"



More information about the antlr-interest mailing list