manpagez: man pages & more
info flex
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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.


This document was generated on November 4, 2011 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.