dcsimg
How to create lexer, that recognizes some tokens and passes all other to parser literally?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Alexander_Slinkin
Posted On:   Monday, January 14, 2002 11:37 PM

Take for example the following text "Hi" I want the parser to see it as three tokens: IF STUFF ENDIF where stuff contains text "Hi" In other words I'd like to filter out something but, rather than ignore it pass to the parser unchanged. It's of course possible to pass every character not recognized as part of a token to the parser using a rule like this: STUFF: . ; but I want the lexer to lump all of them together. Is it feasible in ANTLR? If possible please answer also by email to sas@agama.com.    More>>

Take for example the following text


"Hi"


I want the parser to see it as three tokens:
IF

STUFF

ENDIF



where stuff contains text
"Hi"



In other words I'd like to filter out something but, rather than ignore it pass to the parser unchanged.


It's of course possible to pass every character not recognized as part of a token to the parser using a rule like this:



STUFF:

.

;



but I want the lexer to lump all of them together. Is it feasible in ANTLR?


If possible please answer also by email to sas@agama.com.

   <<Less
About | Sitemap | Contact