These are chat archives for pest-parser/pest

29th
Dec 2017
James Harton
@jamesotron
Dec 29 2017 06:26
you might need to make the rule atomic and specify exactly where the whitespace is allowed, something like:
host = @{ ^”Host” ~ space? ~ (!newline ~ pattern)+ }
Vincent Prouillet
@Keats
Dec 29 2017 17:22
has anyone got an idea how I can make the filter rule work in the basic_expr while conserving precedence climbing in https://github.com/Keats/tera/blob/v0.11/src/parser/tera.pest#L72-L76 ?
I can remove comparison_val and change basic_expr = { ("(" ~ basic_expr ~ ")" | basic_val) ~ filter* ~ (basic_op ~ basic_expr)* } which looks like it would be the right thing but I don't know how would I parse that
The goal being to have {{ a | length - 1}} working as it currently wouldn't work since filters are after the math op in the grammar
Vincent Prouillet
@Keats
Dec 29 2017 17:29
but also {{ (1 + 3) | round * 10 }} etc
James Harton
@jamesotron
Dec 29 2017 19:14
@Keats I had trouble with infix operations too. What worked for me in Huia was to use repetition instead of recursion the way you’re trying to - https://gitlab.com/huia-lang/huia-compiler/blob/master/huia-parser/src/grammar.pest#L20
James Harton
@jamesotron
Dec 29 2017 19:20
NVM. I just reread it and what you’re doing is right.
Can you tell us more about what is and isn’t working?