Flex ‘r/s’

29 views
Skip to first unread message

Keepun Keepun

unread,
Aug 27, 2014, 12:47:21 PM8/27/14
to antlr-di...@googlegroups.com

Flex:
r/s
an ‘r’ but only if it is followed by an ‘s’. The text matched by ‘s’ is included when determining whether this rule is the longest match, but is then returned to the input before the action is executed. So the action only sees the text matched by ‘r’. This type of pattern is called trailing context. (There are some combinations of ‘r/s’ that flex cannot match correctly. See Limitations, regarding dangerous trailing context.)


How do this in ANTLRv4 ?

Jim Idle

unread,
Aug 28, 2014, 2:05:12 AM8/28/14
to antlr-di...@googlegroups.com
You might be better asking a different question; sometimes it is possible to ask a question about something that you think you need to do but in fact the answer is "Don't do that" ;). 

So, why do you feel the need to do this? What construct/language are you trying to create a lexer for? Flex has a different set of match behaviors than does ANTLR and this usually means you need to modify your approach to token matching.

Jim


--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages