-
In brainfuck, every character that is not I've tried this but this sadly does not work: const VALID_TOKENS: &str = "[]<>+-.,";
let invalid_chars = filter(|c| !VALID_TOKENS.contains(*c)).repeated();
choice((
just('<').to(DiamondLeft),
just('>').to(DiamondRight),
just('.').to(Dot),
just(',').to(Comma),
just('+').to(Plus),
just('-').to(Minus),
just('[').to(SquareBracketLeft),
just(']').to(SquareBracketRight),
))
.padded()
.map_with_span(|t, s| (t, s))
.repeated()
.padded_by(invalid_chars)
.then_ignore(end()) |
Beta Was this translation helpful? Give feedback.
Answered by
mainrs
Dec 4, 2022
Replies: 1 comment
-
I just saw the problem: it's the parser application order. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
mainrs
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
I just saw the problem: it's the parser application order.
padded_by
has to be called beforerepeated
.