Hi all,
I'm quite new in using bison/flex and I'm getting crazy doing a simple parser for a configuration file. The problem is with these few rules (I wouldn't bored you with the whole problem explanation and I guess I can skip it):

linedbfilter: dbname { printf("DBNAME is (%s)\n",$1); }
    |
dbname tablelist { printf("DBNAME is (%s) with table list: %s\n",$1,$2); }
    |
    COMMENT
    ;

dbname: VALUE { printf("dbname is: (%s)\n", $1);
                $$ = $1 }
    ;

tablelist: O_PAR tables C_PAR { printf("Table list found: %s\n", $$); }
    ;

The message in the rule for dbname is correct but that in linedbfilter is not. In short, in the line:
dbname tablelist { printf("DBNAME is (%s) with table list: %s\n",$1,$2); }

the value in $1 is not that retrieved by the rule dbname. What happens is that in that rule, the value of $1 is not "$$ of dbname rule" but $1 + $2 , that is the two strings "dbname tablelist" concatenated. In other words, in the passage from one rule to another, the value of dbname is lost.

Any advice?

Thanks a lot.

Gianni


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

Reply via email to