Re: help needed with yacc/bison - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: help needed with yacc/bison
Date
Msg-id 1057089739.7053.24.camel@fuji.krosing.net
Whole thread Raw
In response to help needed with yacc/bison  (Oleg Bartunov <oleg@sai.msu.su>)
Responses Re: help needed with yacc/bison  (Oleg Bartunov <oleg@sai.msu.su>)
List pgsql-hackers
Oleg Bartunov kirjutas T, 01.07.2003 kell 15:49:
> Hi there,
> 
> attached archive contains simple parser demonstrating our
> problem. untar it, make, make test
> 
> Good test:
> echo -n 12 34.1234 ... | ./parser
> INTEGER:        '12'
> CHAR:   ' '
> VERSION:        '34.1234'
> CHAR:   ' '
> DOT:    '.'
> DOT:    '.'
> DOT:    '.'
> Wrong:
> echo -n 12 34.1234. ... | ./parser
> INTEGER:        '12'
> CHAR:   ' '
> yyerror: syntax error, unexpected CHAR, expecting INTEGER
> 
> The problem is recognizing VERSION
> (from gram.y)
> 
> version:
>         INTEGER DOT INTEGER    { $$ = strconcat($1, $3, $2); }
>         | version DOT INTEGER  { $$ = strconcat($1, $3, $2); }

removing the line above seems to fix your problem ;)

> ;
> 
> For last query '34.1234.' we want to print VERSION '34.1234' and
> return DOT.

you can't return DOT as version is <str> and DOT is <opr>

> This is just an test example, actually we know workaround
> for this case, but we need something simple and universal :)

please describe the problem with some more samples, as it will make it
easier which kind of universal you are searching for ;)

------------
Hannu



pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: cvs build failure
Next
From: Stephan Szabo
Date:
Subject: Re: Is Patch Ok for deferred trigger disk queue?