libgraviton / rql-parser

PHP RQL parser
31 stars 15 forks source link

Fix value in unexpected token error message #23

Closed jimcottrell closed 1 year ago

jimcottrell commented 1 year ago

A simple fix for an incorrect variable reference that results in an error message like

Unexpected token "value" (T_STRING) (expected "41" (T_OPERATOR))

where the token type constant is displayed rather than the expected value(s). For testing, nothing in the standard grammar can trigger this error, so it can't currently be added to ParserTest, and is probably why it slipped through the cracks. I'm happy to write a test on TokenStream that mocks a situation to test this issue, or add something to ParserTest's parser chain that could trigger this, but I wasn't sure what your preference would be.

narcoticfresh commented 1 year ago

@jimcottrell thanks!