You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
is the name of the lexical analyser function, and is a token that is to be treated as the end of file.
I had created a token named 'eof' under %token and set to eof. This seemed to work, but when I finished the rest of the grammar to a compiling state, it would immediately fail at the first token. This is because eof was taken as a variable pattern that matched everything, so everything was considered an end of file. The documentation could stand to be louder that this is a Haskell pattern matching the token type, and not the name of a token.
So the second thing will be used In pattern matching position so it needs to be a constructor or pattern synonym (I’m assuming a pattern synonym is possible?)
https://www.haskell.org/happy/doc/html/sec-monads.html#sec-lexers states that
I had created a token named 'eof' under %token and set to
eof
. This seemed to work, but when I finished the rest of the grammar to a compiling state, it would immediately fail at the first token. This is becauseeof
was taken as a variable pattern that matched everything, so everything was considered an end of file. The documentation could stand to be louder that this is a Haskell pattern matching the token type, and not the name of a token.Cc: @cartazio
The text was updated successfully, but these errors were encountered: