Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
throw more X::Syntax::Missing errors.
Also fixes error reporting from constant declarators
  • Loading branch information
moritz committed Mar 3, 2012
1 parent 06cf161 commit 4bacfdc
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Perl6/Grammar.pm
Expand Up @@ -45,6 +45,9 @@ grammar Perl6::Grammar is HLL::Grammar {
method malformed($what) {
self.typed_panic('X::Syntax::Malformed', :$what);
}
method missing($what) {
self.typed_panic('X::Syntax::Missing', :$what);
}
method NYI($feature) {
self.typed_panic('X::Comp::NYI', :$feature)
}
Expand Down Expand Up @@ -555,13 +558,13 @@ grammar Perl6::Grammar is HLL::Grammar {
| <?[{]>
<.newpad>
<blockoid>
|| { $*W.throw($/, 'X::Syntax::Missing', what =>'block') }
|| <.missing: 'block'>
}

token lambda { '->' | '<->' }

token block($*IMPLICIT = 0) {
[ <?[{]> || { $*W.throw($/, 'X::Syntax::Missing', what =>'block') }]
[ <?[{]> || <.missing: 'block'>]
<.newpad>
<blockoid>
}
Expand Down Expand Up @@ -1808,7 +1811,7 @@ grammar Perl6::Grammar is HLL::Grammar {

[
|| <initializer>
|| <.sorry: "Missing initializer on constant declaration">
|| <.missing: "initializer on constant declaration">
]
}

Expand Down Expand Up @@ -2110,7 +2113,7 @@ grammar Perl6::Grammar is HLL::Grammar {
[
| '/' <p6regex=.LANG('Regex','nibbler')> <?[/]> <quote_EXPR: ':qq'> <.old_rx_mods>?
| '[' <p6regex=.LANG('Regex','nibbler')> ']'
<.ws> [ '=' || <.panic: "Missing assignment operator"> ]
<.ws> [ '=' || <.missing: "assignment operator"> ]
<.ws> <EXPR('i')>
]
}
Expand Down Expand Up @@ -2314,14 +2317,14 @@ grammar Perl6::Grammar is HLL::Grammar {
token infix_circumfix_meta_operator:sym<« »> {
$<opening>=[ '«' | '»' ]
{} <infixish>
$<closing>=[ '«' | '»' || <.panic("Missing « or »")> ]
$<closing>=[ '«' | '»' || <.missing("« or »")> ]
<O=.copyO('infixish')>
}

token infix_circumfix_meta_operator:sym«<< >>» {
$<opening>=[ '<<' | '>>' ]
{} <infixish>
$<closing>=[ '<<' | '>>' || <.panic("Missing << or >>")> ]
$<closing>=[ '<<' | '>>' || <.missing("<< or >>")> ]
<O=.copyO('infixish')>
}

Expand Down

0 comments on commit 4bacfdc

Please sign in to comment.