Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
more typed exceptions
  • Loading branch information
moritz committed Jan 30, 2012
1 parent d63e72d commit 0683298
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/Perl6/Grammar.pm
Expand Up @@ -266,7 +266,7 @@ grammar Perl6::Grammar is HLL::Grammar {
[
<pod_content> *
^^ $<spaces> '=end' \h+ $<type> <pod_newline>
|| <.panic: '=begin without matching =end'>
|| <.typed_panic: 'X::Syntax::Pod::BeginWithoutEnd'>
]
}

Expand All @@ -280,7 +280,7 @@ grammar Perl6::Grammar is HLL::Grammar {
[
$<pod_content> = [ .*? ]
^^ $<spaces> '=end' \h+ $<type> <pod_newline>
|| <.panic: '=begin without matching =end'>
|| <.typed_panic: 'X::Syntax::Pod::BeginWithoutEnd'>
]
}

Expand All @@ -290,7 +290,7 @@ grammar Perl6::Grammar is HLL::Grammar {
[
<table_row>*
^^ \h* '=end' \h+ 'table' <pod_newline>
|| <.panic: '=begin without matching =end'>
|| <.typed_panic: 'X::Syntax::Pod::BeginWithoutEnd'>
]
}

Expand Down Expand Up @@ -475,7 +475,7 @@ grammar Perl6::Grammar is HLL::Grammar {

<.install_doc_phaser>

[ $ || <.panic: 'Confused'> ]
[ $ || <.typed_panic: 'X::Syntax::Confused'> ]

{
$*POD_PAST := $*W.add_constant(
Expand Down Expand Up @@ -1094,7 +1094,7 @@ grammar Perl6::Grammar is HLL::Grammar {
| <sigil> <?[<[]> [ <?{ $*IN_DECL }> <.typed_panic('X::Syntax::Variable::Match')>]? <postcircumfix>
| $<sigil>=['$'] $<desigilname>=[<[/_!]>]
| <sigil> <?{ $*IN_DECL }>
| <!{ $*QSIGIL }> <.panic("Non-declarative sigil is missing its name")>
| <!{ $*QSIGIL }> <.typed_panic: 'X::Syntax::SigilWithoutName'>
]
]
[ <?{ $<twigil> && $<twigil>[0] eq '.' }>
Expand Down
15 changes: 14 additions & 1 deletion src/core/Exceptions.pm
Expand Up @@ -24,6 +24,7 @@ my role X::Comp is X::Base {
}

my role X::Syntax does X::Comp { }
my role X::Pod { }

my class X::NYI is X::Base {
has $.feature;
Expand Down Expand Up @@ -204,8 +205,20 @@ my class X::Syntax::Comment::Embedded does X::Syntax {
method message() { "Opening bracket required for #` comment" }
}

my class X::Syntax::Pod::BeginWithoutIdentifier does X::Syntax {
my class X::Syntax::Pod::BeginWithoutIdentifier does X::Syntax does X::Pod {
method message() {
'=begin must be followed by an identifier; (did you mean "=begin pod"?)'
}
}

my class X::Syntax::Pod::BeginWithoutEnd does X::Syntax does X::Pod {
method message() { '=begin without matching =end' }
}

my class X::Syntax::Confused does X::Syntax {
method message() { 'Confused' }
}

my class X::Syntax::SigilWithoutName does X::Syntax {
method message() { 'Non-declarative sigil is missing its name' }
}

0 comments on commit 0683298

Please sign in to comment.