Create a gist now

Instantly share code, notes, and snippets.

@smls /grammar-test.pl6 Secret
Created Aug 20, 2016

What would you like to do?
grammar G {
rule TOP { ^ <definition>* $ }
token definition {
'block' \s* '{' \s* [<line>+% "\n"] \s* '}' \s*
}
token line {
\h* 'line'+ % [\h* "&" \h*]
}
}
my $text = q<
block {
line
line & line
line
}
>;
say G.parse($text);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment