Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Clean up a few regex parsing definitions in P6Regex.
P6Grammar is now able to completely parse its own grammars.
    ./p6grammar --target=parse src/Regex/P6Grammar/Grammar.pm
    ./p6grammar --target=parse src/Regex/P6Regex/Grammar.pm
  • Loading branch information
pmichaud committed Oct 15, 2009
1 parent 75fd363 commit 3b052a5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Regex/P6Regex/Grammar.pm
Expand Up @@ -14,11 +14,11 @@ grammar Regex::P6Regex::Grammar is PCT::Grammar;
{*}
}

rule arglist { <arg> ** \, {*} }
rule arglist { <arg> ** ',' {*} }

token TOP {
<nibbler>
[ $ || <.panic: "Syntax error"> ]
[ $ || <.panic: 'Confused'> ]
{*}
}

Expand All @@ -27,7 +27,7 @@ grammar Regex::P6Regex::Grammar is PCT::Grammar;
['||'|'|'|'&&'|'&']?
<termish>
[ ['||'|'|']
[ <termish> || <.panic: "Null pattern not allowed"> ]
[ <termish> || <.panic: 'Null pattern not allowed'> ]
]*
{*}
}
Expand All @@ -43,7 +43,7 @@ grammar Regex::P6Regex::Grammar is PCT::Grammar;
}

token atom {
:dba('regex atom')
# :dba('regex atom')
[
| \w [ \w+! <?before \w> ]?
| <metachar>
Expand Down Expand Up @@ -85,7 +85,7 @@ grammar Regex::P6Regex::Grammar is PCT::Grammar;
token metachar:sym<mod> { <mod_internal> {*} }
token metachar:sym<assert> {
'<' <assertion>
[ '>' || <.panic: "regex assertion not terminated by angle bracket"> ]
[ '>' || <.panic: 'regex assertion not terminated by angle bracket'> ]
{*}
}

Expand Down Expand Up @@ -141,7 +141,7 @@ grammar Regex::P6Regex::Grammar is PCT::Grammar;
<.normspace>?
[
| '[' $<charspec>=(
| \s* '-' <.obs: "hyphen in enumerated character class;..">
| \s* '-' <.obs: 'hyphen in enumerated character class;..'>
| \s* [ \\ (.) | (<-[\]\\]>) ] [ \s* '..' \s* (.) ]?
)*
\s* ']'
Expand Down

0 comments on commit 3b052a5

Please sign in to comment.