These are chat archives for pest-parser/pest

21st
Nov 2016
Taryn
@Phrohdoh
Nov 21 2016 04:18
How come my kw_percent is expected here? It is optional in my stmt_top_legacy rule. https://gist.github.com/Phrohdoh/2428773a8fe047baff3505c527eea592
Ugh I am an idiot. I only partially did the refactor! (I left the ! when I should have removed it)
While I am here... is there any advantage/disadvantage to defining tok_paren_open = { ["("] } and using tok_paren_open in my rules instead of a literal ["("]?
Taryn
@Phrohdoh
Nov 21 2016 04:26
Hm one 'advantage' I see is that with it being a token I get that in the vec of tokens (in queue).
Dragoș Tiselice
@dragostis
Nov 21 2016 07:13
There's also the fact that it appears in expected, so it helps with reporting errors. Also, if you have a repetition of tokens, you'll need some token to let you know when to stop.
Taryn
@Phrohdoh
Nov 21 2016 16:13
So I am providing kw_where (which is [i"WHERE"]) but pest says it is expecting a kw_where: https://gist.github.com/Phrohdoh/2428773a8fe047baff3505c527eea592
Dragoș Tiselice
@dragostis
Nov 21 2016 16:19
The problem here is the fact that term_id accept the "WHERE" as well. Whenever you have a repetition in a non-atomic rule, it tries to match whitespace between them.
Taryn
@Phrohdoh
Nov 21 2016 16:20
Okay, so my term_id needs to be atomic because whitespace isn't valid there, thanks.
That fixed it, thank you!
Dragoș Tiselice
@dragostis
Nov 21 2016 16:22
No prob. :) One good way of debugging the grammar is to try and make the input string shorter to see what would get accepted.
Taryn
@Phrohdoh
Nov 21 2016 16:22
Does that also mean my lit_integer needs to be atomic? 5 5 isn't a single literal
Dragoș Tiselice
@dragostis
Nov 21 2016 16:22
Yes. That too.