I'm new to flex and bison and I'm trying to parse a file with flex and bison but there is an issue with one of the recursions that maybe someone can help me with, it looks a little like this:
details : empty | details detail ;
detail:
TOKEN
string
string
nestedDetails
integer ;
whereby:
nestedDetails : empty
|
string
integer
integerPairs ;
and:
integerPairs : integer integer | integerPairs integer integer ;
My problem is this:
when parsing the file, bison goes through "nestedDetails" and never reaches the final integer call (presumably, when he finds the final integer he is looking for another integer because he thinks it is the first of a pair defined in "nestedDetails") and thus leaves me with a syntax error because the next thing he finds is not relevant for him.
Is there any clever way of letting bison know that he has actually reached the final integer, and he can move on to the next section? Preferably without having to define new tokens in flex, that has already let to some unpleasant surprises.
thank you in advance.