On 2020-05-21 David Santiago <deman...@gmail.com> wrote: > Can someone explain me why my grammar isn't working? Unfortunately i > can't figure it out :-(
Mixing ``rule``, ``token``, and ``regex`` apparently at random doesn't make for a good grammar… The text at https://docs.raku.org/language/grammar_tutorial#The_technical_overview is a bit confusing. This https://docs.raku.org/language/regexes#Sigspace is more precise: a ``rule`` inserts a ``<.ws>`` wherever there's whitespace in the source code, so your:: rule header-value { <graph>+ } is equivalent to:: token header-value { <graph>+ <.ws> } which, as you saw in the trace, eats up the newline. Short version: the only ``rule``s should be ``TOP``, ``request-line``, and ``headers``, the others are all ``token``s Extending the grammar to recognise more than one header is left as an exercise. -- Dakkar - <Mobilis in mobile> GPG public key fingerprint = A071 E618 DD2C 5901 9574 6FE2 40EA 9883 7519 3F88 key id = 0x75193F88