Permalink
Browse files

Toss some P6Regex code that's ported.

  • Loading branch information...
1 parent a1c54d8 commit 9e503bdaac8207ad2e4b36a8bc6d1aa2b05aee49 @jnthn jnthn committed Oct 7, 2012
Showing with 1 addition and 63 deletions.
  1. +0 −42 src/QRegex/P5Regex/Actions.nqp
  2. +1 −21 src/QRegex/P5Regex/Grammar.nqp
@@ -374,10 +374,6 @@ class QRegex::P5Regex::Actions is HLL::Actions {
make $qast;
}
- method metachar:sym<[ ]>($/) {
- make $<nibbler>.ast;
- }
-
method metachar:sym<'>($/) {
my $quote := $<quote_EXPR>.ast;
if QAST::SVal.ACCEPTS($quote) { $quote := $quote.value; }
@@ -506,38 +502,6 @@ class QRegex::P5Regex::Actions is HLL::Actions {
make QAST::Regex.new( $<charspec>.ast, :rxtype('literal'), :node($/) );
}
- method assertion:sym<?>($/) {
- my $qast;
- if $<assertion> {
- $qast := $<assertion>.ast;
- $qast.subtype('zerowidth');
- }
- else {
- $qast := QAST::Regex.new( :rxtype<anchor>, :subtype<pass>, :node($/) );
- }
- make $qast;
- }
-
- method assertion:sym<!>($/) {
- my $qast;
- if $<assertion> {
- $qast := $<assertion>.ast;
- $qast.negate( !$qast.negate );
- $qast.subtype('zerowidth');
- }
- else {
- $qast := QAST::Regex.new( :rxtype<anchor>, :subtype<fail>, :node($/) );
- }
- make $qast;
- }
-
- method assertion:sym<method>($/) {
- my $qast := $<assertion>.ast;
- $qast.subtype('method');
- $qast.name('');
- make $qast;
- }
-
method assertion:sym<name>($/) {
my $name := ~$<longname>;
my $qast;
@@ -580,12 +544,6 @@ class QRegex::P5Regex::Actions is HLL::Actions {
make $past;
}
- method mod_internal($/) {
- my $n := $<n>[0] gt '' ?? +$<n>[0] !! 1;
- %*RX{ ~$<mod_ident><sym> } := $n;
- make 0;
- }
-
method subrule_alias($ast, $name) {
if $ast.name gt '' { $ast.name( $name ~ '=' ~ $ast.name ); }
else { $ast.name($name); }
@@ -122,6 +122,7 @@ grammar QRegex::P5Regex::Grammar is HLL::Grammar {
token ws { [ \s+ | '#' \N* ]* }
+
# XXX Below here is straight from P6Regex and unreviewed.
token normspace { <?before \s | '#' > <.ws> }
@@ -140,14 +141,12 @@ grammar QRegex::P5Regex::Grammar is HLL::Grammar {
proto token metachar { <...> }
token metachar:sym<ws> { <.normspace> }
- token metachar:sym<[ ]> { '[' <nibbler> ']' }
token metachar:sym<'> { <?[']> <quote_EXPR: ':q'> }
token metachar:sym<"> { <?["]> <quote_EXPR: ':qq'> }
token metachar:sym<lwb> { $<sym>=['<<'|'«'] }
token metachar:sym<rwb> { $<sym>=['>>'|'»'] }
token metachar:sym<from> { '<(' }
token metachar:sym<to> { ')>' }
- token metachar:sym<mod> { <mod_internal> }
token metachar:sym<var> {
[
@@ -176,13 +175,6 @@ grammar QRegex::P5Regex::Grammar is HLL::Grammar {
proto token assertion { <...> }
- token assertion:sym<?> { '?' [ <?before '>' > | <assertion> ] }
- token assertion:sym<!> { '!' [ <?before '>' > | <assertion> ] }
-
- token assertion:sym<method> {
- '.' <assertion>
- }
-
token assertion:sym<name> {
<longname=.identifier>
[
@@ -193,16 +185,4 @@ grammar QRegex::P5Regex::Grammar is HLL::Grammar {
| <.normspace> <nibbler>
]?
}
-
- token mod_internal {
- [
- | ':' $<n>=('!' | \d+)**1 <mod_ident> »
- | ':' <mod_ident> [ '(' $<n>=[\d+] ')' ]?
- ]
- }
-
- proto token mod_ident { <...> }
- token mod_ident:sym<ignorecase> { $<sym>=[i] 'gnorecase'? }
- token mod_ident:sym<ratchet> { $<sym>=[r] 'atchet'? }
- token mod_ident:sym<sigspace> { $<sym>=[s] 'igspace'? }
}

0 comments on commit 9e503bd

Please sign in to comment.