help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cookie replacement function


From: Evan Lavelle
Subject: Re: Cookie replacement function
Date: Tue, 08 Nov 2005 16:24:19 +0000
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

A couple of things to watch out for:


[[:alnum:]]+            yylval = yytext; return WORD;
^.*$                    yylval = yytext; return STRING;

what are you trying to match here? Is your reasoning that any alphanumeric will get caught in the 1st rule, and everything else in the 2nd? This won't work - any alphanumeric will actually be caught by the 2nd rule, because of the explicit '$'/NL match. Try to handle your NLs explicitly, and/or use more explicit/descriptive regexps.


cookie: STRING
       |
       '%' '{' WORD '}'

You need a catch-all rule to let through %, {, and }, otherwise this will be matched as a STRING; something like

.  return yytext[0];

HTH -

Evan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]