Skip to content

Commit

Permalink
typed exception for infix in term position
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed May 29, 2012
1 parent 92a95c7 commit e2d8762
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Perl6/Grammar.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2334,7 +2334,8 @@ grammar Perl6::Grammar is HLL::Grammar {
]
|| <!{ $*QSIGIL }> <postfixish>*
]
|| <!{ $*QSIGIL }> <?before <infixish> { $/.CURSOR.panic("Preceding context expects a term, but found infix " ~ ~$<infixish> ~ " instead"); } >
|| <!{ $*QSIGIL }> <?before <infixish> {
$/.CURSOR.typed_panic('X::Syntax::InfixInTermPosition', infix => ~$<infixish>); } >
|| <!>
]
}
Expand Down
7 changes: 7 additions & 0 deletions src/core/Exception.pm
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,13 @@ my class X::Syntax::Extension::Category does X::Syntax {
}
}

my class X::Syntax::InfixInTermPosition does X::Syntax {
has $.infix;
method message() {
"Preceding context expects a term, but found infix $.infix instead";
}
}

my class X::Attribute::Package does X::Comp {
has $.package-type;
method message() { "A $.package-type cannot have attributes" }
Expand Down

0 comments on commit e2d8762

Please sign in to comment.