How would it be possible to look ahead more than one token? #2
-
The However, there does not seem to be a way to look ahead more than one token? My use case is parsing JMESPath expressions.
The following token sequence is ambiguous
When parsing this expression, I have a parselet for the prefixed token Maybe I’m using TDOP wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I wonder if you could disambiguate at the tokenization level in this particular case. In other words, what if you tried treating
If just two tokens are sufficient to disambiguate then you could just go with:
This way, you could easily do your lookaheads at the character level during tokenization rather than needing to do it during parsing. |
Beta Was this translation helpful? Give feedback.
I wonder if you could disambiguate at the tokenization level in this particular case. In other words, what if you tried treating
"[" "*" "]"
as a single token along? As in:If just two tokens are sufficient to disambiguate then you could just go with:
This way, you could easily do your lookaheads at the character level during tokenization rather than needing to do it during parsing.