Stop Flex when first matching a TOKEN [message #1847960] |
Mon, 15 November 2021 05:13 |
Eclipse User |
|
|
|
I'm writing a flex/bison parser, and need to identify the following pattern using Flex:
The above pattern may appear a few times inside a code. For example:
begin
/*some code #1*/
end
/*some code #2*/
begin
/*some code #3*/
end
It is important for me to identify the pattern in the lexer, but when using the following regex:
block "begin"[.\n]*"end"
{block} {return ID_BLOCK}
it catches the first begin and the LAST end. I would like to catch the first end. (please note#1: flex does not support all regex, so I cannot use regex zero length lookahead assertion please note #2: I think that the best way is to stop at the first match of "block" and not continue filling the buffer, I just dont know how to do it)
|
|
|
Powered by
FUDForum. Page generated in 0.02875 seconds