grammar g { rule TOP { <bang> | <at> } rule bang { 'bang' '!' [<-[!]>*] '!' } } g.^add_method('at', rx { 'at' [\s*] '@' [<-[@]>*] '@' } ); # ... then do the above for each of the sigils g.^compose; say g.parse('bang !some text!'); say g.parse('at @some text@');
In reply to Re^3: Perl6: Dynamic Grammars
by bduggan
in thread Perl6: Dynamic Grammars
by OneTrueDabe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |