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

From Oleg Bartunov
Subject help needed with yacc/bison
Date
Msg-id Pine.GSO.4.56.0307011643170.4628@ra.sai.msu.su
Whole thread Raw
Responses Re: help needed with yacc/bison  (Oleg Bartunov <oleg@sai.msu.su>)
Re: help needed with yacc/bison  (Hannu Krosing <hannu@tm.ee>)
List pgsql-hackers
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); }
 
;

For last query '34.1234.' we want to print VERSION '34.1234' and
return DOT.
This is just an test example, actually we know workaround
for this case, but we need something simple and universal :)

Regards,    Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83


pgsql-hackers by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: dblink for Oracle - question ...
Next
From: Oleg Bartunov
Date:
Subject: Re: help needed with yacc/bison