aboutsummaryrefslogtreecommitdiffhomepage
path: root/ptx/src/ptx.lalrpop
diff options
context:
space:
mode:
Diffstat (limited to 'ptx/src/ptx.lalrpop')
-rw-r--r--ptx/src/ptx.lalrpop11
1 files changed, 9 insertions, 2 deletions
diff --git a/ptx/src/ptx.lalrpop b/ptx/src/ptx.lalrpop
index 181a727..f6fd9cd 100644
--- a/ptx/src/ptx.lalrpop
+++ b/ptx/src/ptx.lalrpop
@@ -526,8 +526,15 @@ Statement: Option<ast::Statement<ast::ParsedArgParams<'input>>> = {
<p:PredAt?> <i:Instruction> ";" => Some(ast::Statement::Instruction(p, i)),
PragmaStatement => None,
"{" <s:Statement*> "}" => Some(ast::Statement::Block(without_none(s))),
- ! ";" => {
- let (err, _) = (<>);
+ @L ! ";" @R => {
+ let (start, mut err, _, end) = (<>);
+ // TODO: report this error more generally, perhaps in user error?
+ err.error = match err.error {
+ ParseError::UnrecognizedToken { token: (_, token, _), expected } => {
+ ParseError::UnrecognizedToken { token: (start, token, end), expected }
+ }
+ e => e
+ };
errors.push(err.error);
None
}