Frans Englich wrote:

> The relevant parts in my Bison is:
>
> %union
> {
>     int ival;
>     char *sval;
>     KDOM::XPath::ExpressionImpl *expr;
>     KDOM::XPath::ExpressionImpl::List *expressionList;    
>     QPSingleType *singleType; KDOM::XPath::SharedQName *qName;
>     bool emptyAllowed;
> }

> However, when parsing the expression "false()", I get the
> token NCNAME with
> the value "false(". The token is right, but I don't want the
> parantese to be included.
>
> Why is the parantese included in the value, and how do I fix
> it? The regexp
> "[a-zA-Z-]+" really shouldn't match it, right?

This is really a FAQ.

Flex overwrites the '(' with a null character when it
passes the token to bison.
Your bison rule stores only the pointer to the string.
By the time the bison parser gets around to printing
your token (one token later), flex has restored the
'(' character (and overwritten the ')' character).

To fix, save the contents of the string instead of only
the pointer to it.

Vincent Zweije
Development
-- 
WCC Services - Advanced Matching Technology
NL  +31 30 7503222
[EMAIL PROTECTED]
www.wcc-group.com


_______________________________________________
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to