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

Commit

Permalink
Make final rules of alias sequences explicitly non-capturing.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmichaud committed Nov 13, 2009
1 parent 4199a71 commit 7aa09d7
Show file tree
Hide file tree
Showing 6 changed files with 3,774 additions and 3,768 deletions.
8 changes: 4 additions & 4 deletions src/HLL/Grammar.pm
Expand Up @@ -19,11 +19,11 @@ grammar HLL::Grammar;

token term:sym<circumfix> { <circumfix> }

token infixish { $<OPER>=$<infix>=<infix> }
token prefixish { $<OPER>=$<prefix>=<prefix> <.ws> }
token infixish { $<OPER>=$<infix>=<.infix> }
token prefixish { $<OPER>=$<prefix>=<.prefix> <.ws> }
token postfixish {
| $<OPER>=$<postfix>=<postfix>
| $<OPER>=$<postcircumfix>=<postcircumfix>
| $<OPER>=$<postfix>=<.postfix>
| $<OPER>=$<postcircumfix>=<.postcircumfix>
}

# token quote_EXPR is in src/cheats/hll-grammar.pir
Expand Down
26 changes: 13 additions & 13 deletions src/NQP/Grammar.pm
Expand Up @@ -137,7 +137,7 @@ token statement_control:sym<if> {
<sym> :s
<xblock>
[ 'elsif'\s <xblock> ]*
[ 'else'\s $<else>=<pblock> ]?
[ 'else'\s $<else>=<.pblock> ]?
}

token statement_control:sym<unless> {
Expand Down Expand Up @@ -185,8 +185,8 @@ token blorst {

proto token statement_mod_cond { <...> }

token statement_mod_cond:sym<if> { <sym> :s $<mod_expr>=<EXPR> }
token statement_mod_cond:sym<unless> { <sym> :s $<mod_expr>=<EXPR> }
token statement_mod_cond:sym<if> { <sym> :s $<mod_expr>=<.EXPR> }
token statement_mod_cond:sym<unless> { <sym> :s $<mod_expr>=<.EXPR> }

## Terms

Expand All @@ -208,7 +208,7 @@ token colonpair {
}

token variable {
| <sigil> <twigil>? $<desigilname>=<ident>
| <sigil> <twigil>? $<desigilname>=<.ident>
| <sigil> <?[<[]> <postcircumfix>
| $<sigil>=['$'] $<desigilname>=[<[/_!]>]
}
Expand All @@ -223,7 +223,7 @@ token package_declarator:sym<class> { $<sym>=[class|grammar] <package_def> }

rule package_def {
<name>
[ 'is' $<parent>=<name> ]?
[ 'is' $<parent>=<.name> ]?
[
|| ';' <comp_unit>
|| <?[{]> <block>
Expand Down Expand Up @@ -275,7 +275,7 @@ token parameter {

token param_var {
<sigil> <twigil>?
[ $<name>=<ident> | $<name>=[<[/!]>] ]
[ $<name>=<.ident> | $<name>=[<[/!]>] ]
}

token named_param {
Expand All @@ -294,15 +294,15 @@ rule regex_declarator {
<.newpad>
[ '(' <signature> ')' ]?
{*} #= open
'{'$<p6regex>=<LANG('Regex','nibbler')>'}'<?ENDSTMT>
'{'$<p6regex>=<.LANG('Regex','nibbler')>'}'<?ENDSTMT>
]
}

token dotty {
'.' <identifier>
[
| <?[(]> <args>
| ':' \s $<args>=<arglist>
| ':' \s $<args>=<.arglist>
]?
}

Expand Down Expand Up @@ -384,11 +384,11 @@ INIT {


token nulltermish {
| $<OPER>=$<term>=<termish>
| $<OPER>=$<term>=<.termish>
| <?>
}

token infixish { <!infixstopper> $<OPER>=$<infix>=<infix> }
token infixish { <!infixstopper> $<OPER>=$<infix>=<.infix> }
token infixstopper { <?lambda> }

token postcircumfix:sym<[ ]> {
Expand Down Expand Up @@ -476,7 +476,7 @@ token infix:sym<,> { <sym> <O('%comma, :pasttype<list>')> }

grammar NQP::Regex is Regex::P6Regex::Grammar {
token metachar:sym<:my> {
':' <?before 'my'> $<statement>=<LANG('MAIN', 'statement')> <.ws> ';'
':' <?before 'my'> $<statement>=<.LANG('MAIN', 'statement')> <.ws> ';'
}

token metachar:sym<{ }> {
Expand All @@ -493,13 +493,13 @@ grammar NQP::Regex is Regex::P6Regex::Grammar {
| <?before '>'>
| '=' <assertion>
| ':' <arglist>
| '(' $<arglist>=<LANG('MAIN','arglist')> ')'
| '(' $<arglist>=<.LANG('MAIN','arglist')> ')'
| <.normspace> <nibbler>
]?
}


token codeblock {
$<block>=<LANG('MAIN','pblock')>
$<block>=<.LANG('MAIN','pblock')>
}
}
6 changes: 3 additions & 3 deletions src/Regex/P6Regex/Grammar.pm
Expand Up @@ -35,7 +35,7 @@ grammar Regex::P6Regex::Grammar is HLL::Grammar;
}

token termish {
$<noun>=<quantified_atom>+
$<noun>=<.quantified_atom>+
}

token quantified_atom {
Expand Down Expand Up @@ -84,8 +84,8 @@ grammar Regex::P6Regex::Grammar is HLL::Grammar;
## we cheat here, really should be regex_infix:sym<~>
token metachar:sym<~> {
<sym>
<.ws> $<GOAL>=<quantified_atom>
<.ws> $<EXPR>=<quantified_atom>
<.ws> $<GOAL>=<.quantified_atom>
<.ws> $<EXPR>=<.quantified_atom>
}

token metachar:sym<{*}> {
Expand Down

0 comments on commit 7aa09d7

Please sign in to comment.