(flex.info)Does flex support recursive pattern definitions?


Next: How do I skip huge chunks of input (tens of megabytes) while using flex? Prev: Why do flex scanners call fileno if it is not ANSI compatible? Up: FAQ
Enter node , (file) or (file)node

Does flex support recursive pattern definitions?
================================================

e.g.,

     %%
     block   "{"({block}|{statement})*"}"

   No.  You cannot have recursive definitions.  The pattern-matching
power of regular expressions in general (and therefore flex scanners,
too) is limited.  In particular, regular expressions cannot "balance"
parentheses to an arbitrary degree.  For example, it's impossible to
write a regular expression that matches all strings containing the same
number of '{'s as '}'s.  For more powerful pattern matching, you need a
parser, such as 'GNU bison'.


automatically generated by info2www version 1.2.2.9