Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
catch use of braces on escapes
  • Loading branch information
TimToady committed Apr 13, 2015
1 parent cc3e654 commit 8b639ba
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/Perl6/Grammar.nqp
Expand Up @@ -210,6 +210,8 @@ role STD {
}
$lang_cursor.nibbler();
}

token obsbrace { <.obs('curlies around escape argument','square brackets')> }

method panic(*@args) {
self.typed_panic('X::Comp::AdHoc', payload => nqp::join('', @args))
Expand Down Expand Up @@ -4699,11 +4701,12 @@ grammar Perl6::QGrammar is HLL::Grammar does STD {
token backslash:sym<c> { <sym> <charspec> }
token backslash:sym<e> { <sym> }
token backslash:sym<f> { <sym> }
token backslash:sym<N> { <?before 'N{'<[A..Z]>> <.obs('\N{CHARNAME}','\c[CHARNAME]')> }
token backslash:sym<n> { <sym> }
token backslash:sym<o> { :dba('octal character') <sym> [ <octint> | '[' ~ ']' <octints> ] }
token backslash:sym<o> { :dba('octal character') <sym> [ <octint> | '[' ~ ']' <octints> | '{' <.obsbrace> ] }
token backslash:sym<r> { <sym> }
token backslash:sym<t> { <sym> }
token backslash:sym<x> { :dba('hex character') <sym> [ <hexint> | '[' ~ ']' <hexints> ] }
token backslash:sym<x> { :dba('hex character') <sym> [ <hexint> | '[' ~ ']' <hexints> | '{' <.obsbrace> ] }
token backslash:sym<0> { <sym> }
}

Expand Down Expand Up @@ -4944,14 +4947,15 @@ grammar Perl6::QGrammar is HLL::Grammar does STD {
token backslash:sym<e> { :i <sym> }
token backslash:sym<f> { :i <sym> }
token backslash:sym<h> { :i <sym> { $*CCSTATE := '' } }
token backslash:sym<N> { <?before 'N{'<[A..Z]>> <.obs('\N{CHARNAME}','\c[CHARNAME]')> }
token backslash:sym<n> { :i <sym> }
token backslash:sym<o> { :i :dba('octal character') <sym> [ <octint> | '[' ~ ']' <octints> ] }
token backslash:sym<o> { :i :dba('octal character') <sym> [ <octint> | '[' ~ ']' <octints> | '{' <.obsbrace> ] }
token backslash:sym<r> { :i <sym> }
token backslash:sym<s> { :i <sym> { $*CCSTATE := '' } }
token backslash:sym<t> { :i <sym> }
token backslash:sym<v> { :i <sym> { $*CCSTATE := '' } }
token backslash:sym<w> { :i <sym> { $*CCSTATE := '' } }
token backslash:sym<x> { :i :dba('hex character') <sym> [ <hexint> | '[' ~ ']' <hexints> ] }
token backslash:sym<x> { :i :dba('hex character') <sym> [ <hexint> | '[' ~ ']' <hexints> | '{' <.obsbrace> ] }
token backslash:sym<0> { <sym> }

# keep random backslashes like qq does
Expand Down Expand Up @@ -5078,6 +5082,8 @@ grammar Perl6::RegexGrammar is QRegex::P6Regex::Grammar does STD does CursorPack
token metachar:sym<'> { <?[']> <quote=.LANG('MAIN','quote')> <.SIGOK> }

token metachar:sym<"> { <?["]> <quote=.LANG('MAIN','quote')> <.SIGOK> }

token metachar:sym<{}> { \\<[xo]>'{' <.obsbrace> }

token assertion:sym<{ }> {
<?[{]> <codeblock>
Expand Down

0 comments on commit 8b639ba

Please sign in to comment.