Hi,

I am pretty sure bison cannot simply ignore tokens. However, I don't know 
what's the usual flex/bison pattern to solve this issue.

I am implementing a parser for a language that terminates statements with 
a newline, however, the newline doesn't always terminate statements... 
only after a statement.

-----
x = x + 1
y = x + 2

-----

This should parse ok, since each statement is terminated by a new line. 
If I tell lexer to lex '\n' as a EOS (end of statement) then something 
like this won't parse:

-----
def myfunc {
    x = x + 1
    y = x + 2
}
-----


The reason for this is that it gets the tokens '{', '\n', 'x' (whitespace 
ignored) and says : "hey, I am not expecting a EOS there". Now, I could 
fill my parser with EOS between every two tokens, however, that's crazy 
and there must be a better way.

Any suggestions?

Cheers,
-- 
PMatos


_______________________________________________
[email protected] https://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to