13:06
discord-raku-bot left
13:56
discord-raku-bot joined
|
|||
Hydrazer | ah i needed to use token on calc-op instead of rule | 18:07 | |
im trying to use grammars but im not really understanding why using .*? in place of <random> works here ```pl | 18:54 | ||
grammar Calc { | |||
token TOP {^^ [<random> <calc-op> <random>] * $$} | |||
proto token calc-op {*} | |||
token calc-op:sym<sub> { | |||
<num> <minus> <num> | |||
} | |||
token num {<whitespace> \d+ <whitespace>} | |||
token minus {<whitespace> "-" <whitespace>} | |||
token whitespace {\s*} | |||
token random {.*?} | |||
} | |||
Calc.parse("a3 - 3e a;3;42;34;;3-24"); | |||
``` | 18:55 | ||
「3 - 3」 | |||
num => 「3 」 | |||
whitespace => 「」 | |||
whitespace => 「 」 | |||
... | |||
``` vs | |||
``` | |||
Nil | |||
``` | |||
CIAvash | Hydrazer: I guess `ratcheting` is involved, changing `TOP` and `random` from `token` to `regex` works. | 20:01 | |
20:27
melika joined
21:32
melika left
|
|||
Hydrazer | ok cool | 23:44 |