(flex.info)How do I match any string not matched in the preceding rules?


Next: I am trying to port code from AT&T lex that uses yysptr and yysbuf. Prev: How can I build a two-pass scanner? Up: FAQ
Enter node , (file) or (file)node

How do I match any string not matched in the preceding rules?
=============================================================

One way to assign precedence, is to place the more specific rules first.
If two rules would match the same input (same sequence of characters)
then the first rule listed in the 'flex' input wins, e.g.,

     %%
     foo[a-zA-Z_]+    return FOO_ID;
     bar[a-zA-Z_]+    return BAR_ID;
     [a-zA-Z_]+       return GENERIC_ID;

   Note that the rule '[a-zA-Z_]+' must come *after* the others.  It
will match the same amount of text as the more specific rules, and in
that case the 'flex' scanner will pick the first rule listed in your
scanner as the one to match.


automatically generated by info2www version 1.2.2.9