Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » Stop Flex when first matching a TOKEN
Stop Flex when first matching a TOKEN [message #1847960] Mon, 15 November 2021 10:13
ksleini mikeisnie is currently offline ksleini mikeisnieFriend
Messages: 1
Registered: November 2021
Junior Member
I'm writing a flex/bison parser, and need to identify the following pattern using Flex:
/*some code*/

The above pattern may appear a few times inside a code. For example:
/*some code #1*/
/*some code #2*/
/*some code #3*/

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)
Previous Topic:How do i get started?
Next Topic:PDT, MAMP, and Xdebug
Goto Forum:

Current Time: Sat Apr 13 10:07:35 GMT 2024

Powered by FUDForum. Page generated in 0.25541 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top