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

Commit

Permalink
Allow spaces in character class compositions.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Oct 13, 2009
1 parent 3de5a4f commit f00fd0d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Regex/P6Regex/Grammar.pm
Expand Up @@ -2,6 +2,8 @@ grammar Regex::P6Regex::Grammar is PCT::Grammar;

token ws { [ \s+ | '#' \N*\n ]* }

token normspace { <?before \s | '#' > <.ws> }

token TOP {
<nibbler>
[ <.ws> $ || <.panic: "Syntax error"> ]
Expand Down Expand Up @@ -118,14 +120,16 @@ grammar Regex::P6Regex::Grammar is PCT::Grammar;

token cclass_elem {
$<sign>=['+'|'-'|<?>]
<.normspace>?
[
| '[' $<charspec>=(
| '-' <.obs: "hyphen in enumerated character class;..">
| [ \\ (.) | (<-[\]\\]>) ] [ '..' (.) ]?
| \s* '-' <.obs: "hyphen in enumerated character class;..">
| \s* [ \\ (.) | (<-[\]\\]>) ] [ \s* '..' \s* (.) ]?
)*
']'
\s* ']'
| $<name>=[\w+]
]
<.normspace>?
{*}
}

0 comments on commit f00fd0d

Please sign in to comment.