diff --git a/src/Perl6/Grammar.nqp b/src/Perl6/Grammar.nqp index 97af44c08ea..4afbcae7c63 100644 --- a/src/Perl6/Grammar.nqp +++ b/src/Perl6/Grammar.nqp @@ -387,6 +387,11 @@ role STD { } self } + + token RESTRICTED { + [ [ $ || <.malformed($*RESTRICTED)> ] ]? + + } } grammar Perl6::Grammar is HLL::Grammar does STD { @@ -1995,12 +2000,12 @@ grammar Perl6::Grammar is HLL::Grammar does STD { | | $=[\d+] [ <.typed_panic: "X::Syntax::Variable::Numeric">]? | [ <.typed_panic('X::Syntax::Variable::Match')>]? - | > + | > | $=['$'] $=[<[/_!¢]>] | {} # try last, to allow sublanguages to redefine sigils (like & in regex) ] [ && $ eq '.' }> - [ <.unsp> | '\\' | ] + [ <.unsp> | '\\' | ] ]? { $*LEFTSIGIL := nqp::substr(self.orig(), self.from, 1) unless $*LEFTSIGIL } } @@ -2950,7 +2955,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD { | ['*'|'<...>'|'<*>'] $={1} | ?? %*LANG !! %*LANG, '{', '}'))> ] - '}' + '}' { $*CURPAD := $*W.pop_lexpad() } ] || <.malformed('regex')> } @@ -4729,7 +4734,7 @@ grammar Perl6::QGrammar is HLL::Grammar does STD { } role c1 { - token escape:sym<{ }> { :my $*ESCAPEBLOCK := 1; } + token escape:sym<{ }> { :my $*ESCAPEBLOCK := 1; } } role c0 { @@ -4740,6 +4745,7 @@ grammar Perl6::QGrammar is HLL::Grammar does STD { token escape:sym<$> { :my $*QSIGIL := '$'; + [ { :my $*QSIGIL := '@'; + + + } token escape:sym { + } token escape:sym<#> { @@ -5073,6 +5083,7 @@ grammar Perl6::RegexGrammar is QRegex::P6Regex::Grammar does STD does CursorPack token metachar:sym<:my> { ':' + <.LANG('MAIN', 'eat_terminator')> } @@ -5118,26 +5129,32 @@ grammar Perl6::RegexGrammar is QRegex::P6Regex::Grammar does STD does CursorPack } token assertion:sym { + + [ | ')> [ | ':' | '(' ')' ]? | ')> + ] } token assertion:sym<~~> { + [ ]> | $=[\d+] | ] } token codeblock { :my $*ESCAPEBLOCK := 1; + } token arglist { :my $*IN_REGEX_ASSERTION := 1; + } diff --git a/src/core/Cursor.pm b/src/core/Cursor.pm index af9247ed96a..b7f9661a42e 100644 --- a/src/core/Cursor.pm +++ b/src/core/Cursor.pm @@ -359,6 +359,7 @@ sub MAKE_REGEX($arg, :$i, :$m, :$context) { $arg.regex } else { + my $*RESTRICTED = 'regex interpolation'; my $rx := $i && $m ?? EVAL("anon regex \{ :i :m $arg\}", :$context) !! $i ?? EVAL("anon regex \{ :i $arg\}", :$context) !! $m ?? EVAL("anon regex \{ :m $arg\}", :$context) !!