Xeverous / filter_spirit

Advanced item filter generator for Path of Exile that uses it's own DSL and online item price APIs
GNU General Public License v3.0
36 stars 7 forks source link

parser treats identifiers as keywords when their content starts with a keyword #13

Closed Xeverous closed 5 years ago

Xeverous commented 5 years ago

Example code:

Corrupted falsee

The code is parsed as boolean_condition::corrupted, bool(false), e instead of boolean_condition::corrupted, identifier(falsee).

Identifiers can not be searched before keywords, because otherwise no keyword would ever match (any keyword satisfies identifier grammar). Since keywords are searched before identifiers, if first characters much a keyword it is treated as a keyword, leaving some garbage for further processing (here: e) which causes very unclear syntax errors. Looks like some look-ahead needs to be performed to ensure there are no unconsumed letters left.

Xeverous commented 5 years ago

Fixed in 98eb66ba7e13e3c3643db80acac15cdc39b55266