diff --git a/src/imp/parser.rs b/src/imp/parser.rs index 79d5871be..c757a5142 100644 --- a/src/imp/parser.rs +++ b/src/imp/parser.rs @@ -577,7 +577,7 @@ impl<'a> PyParser<'a> { if nxt_indent != *indent { return self .expected_indent(*indent, nxt_indent) - .or(self.expected_spanned("else or elif", self.index..self.index + 1)); + .or(self.expected_spanned("'else' or 'elif'", self.index..self.index + 1)); } let mut elifs = Vec::new(); while self.try_parse_keyword("elif") { @@ -592,7 +592,7 @@ impl<'a> PyParser<'a> { if nxt_indent != *indent { return self .expected_indent(*indent, nxt_indent) - .or(self.expected_spanned("else or elif", self.index..self.index + 1)); + .or(self.expected_spanned("'else' or 'elif'", self.index..self.index + 1)); } elifs.push((cond, then)); } @@ -634,7 +634,7 @@ impl<'a> PyParser<'a> { self.consume_new_line()?; indent.enter_level(); - self.consume_indent_exactly(*indent).or(self.expected_spanned("case", self.index..self.index + 1))?; + self.consume_indent_exactly(*indent).or(self.expected_spanned("'case'", self.index..self.index + 1))?; let (case, mut nxt_indent) = self.parse_match_case(indent)?; let mut arms = vec![case]; while nxt_indent == *indent { @@ -734,7 +734,7 @@ impl<'a> PyParser<'a> { if nxt_indent != *indent { return self .expected_indent(*indent, nxt_indent) - .or(self.expected_spanned("case", self.index..self.index + 1)); + .or(self.expected_spanned("'case'", self.index..self.index + 1)); } let (case, stmt, nxt_indent_) = self.parse_switch_case(indent)?; nxt_indent = nxt_indent_; @@ -799,7 +799,7 @@ impl<'a> PyParser<'a> { self.consume_new_line()?; indent.enter_level(); - self.consume_indent_exactly(*indent).or(self.expected_spanned("case", self.index..self.index + 1))?; + self.consume_indent_exactly(*indent).or(self.expected_spanned("'case'", self.index..self.index + 1))?; let (case, mut nxt_indent) = self.parse_match_case(indent)?; let mut arms = vec![case]; while nxt_indent == *indent { @@ -830,7 +830,7 @@ impl<'a> PyParser<'a> { self.consume_new_line()?; indent.enter_level(); - self.consume_indent_exactly(*indent).or(self.expected_spanned("when", self.index..self.index + 1))?; + self.consume_indent_exactly(*indent).or(self.expected_spanned("'when'", self.index..self.index + 1))?; self.parse_keyword("when")?; let cond = self.parse_expr(true, false)?; self.skip_trivia_inline()?; @@ -845,7 +845,7 @@ impl<'a> PyParser<'a> { if nxt_indent != *indent { return self .expected_indent(*indent, nxt_indent) - .or(self.expected_spanned("else", self.index..self.index + 1)); + .or(self.expected_spanned("'else'", self.index..self.index + 1)); } self.parse_keyword("else")?; self.skip_trivia_inline()?; diff --git a/tests/snapshots/compile_file__elif_no_else.bend.snap b/tests/snapshots/compile_file__elif_no_else.bend.snap index 4d243bf36..b812d1cb3 100644 --- a/tests/snapshots/compile_file__elif_no_else.bend.snap +++ b/tests/snapshots/compile_file__elif_no_else.bend.snap @@ -4,6 +4,6 @@ input_file: tests/golden_tests/compile_file/elif_no_else.bend --- Errors: In tests/golden_tests/compile_file/elif_no_else.bend : -- expected: else or elif +- expected: 'else' or 'elif' - detected: end of input  6 |   diff --git a/tests/snapshots/parse_file__bend_missing_else.bend.snap b/tests/snapshots/parse_file__bend_missing_else.bend.snap index 02a51b3a2..e00a8c9fd 100644 --- a/tests/snapshots/parse_file__bend_missing_else.bend.snap +++ b/tests/snapshots/parse_file__bend_missing_else.bend.snap @@ -4,6 +4,6 @@ input_file: tests/golden_tests/parse_file/bend_missing_else.bend --- Errors: In tests/golden_tests/parse_file/bend_missing_else.bend : -- expected: else +- expected: 'else' - detected:  14 | def main(): diff --git a/tests/snapshots/parse_file__fold_missing_case.bend.snap b/tests/snapshots/parse_file__fold_missing_case.bend.snap index 6722c5bba..81926ecc5 100644 --- a/tests/snapshots/parse_file__fold_missing_case.bend.snap +++ b/tests/snapshots/parse_file__fold_missing_case.bend.snap @@ -4,6 +4,6 @@ input_file: tests/golden_tests/parse_file/fold_missing_case.bend --- Errors: In tests/golden_tests/parse_file/fold_missing_case.bend : -- expected: case +- expected: 'case' - detected: end of input  4 |   diff --git a/tests/snapshots/parse_file__if_missing_else.bend.snap b/tests/snapshots/parse_file__if_missing_else.bend.snap index f812d550a..8756e211d 100644 --- a/tests/snapshots/parse_file__if_missing_else.bend.snap +++ b/tests/snapshots/parse_file__if_missing_else.bend.snap @@ -4,6 +4,6 @@ input_file: tests/golden_tests/parse_file/if_missing_else.bend --- Errors: In tests/golden_tests/parse_file/if_missing_else.bend : -- expected: else or elif +- expected: 'else' or 'elif' - detected: end of input  5 |   diff --git a/tests/snapshots/parse_file__match_missing_case.bend.snap b/tests/snapshots/parse_file__match_missing_case.bend.snap index ed631ebed..5c7ad9e29 100644 --- a/tests/snapshots/parse_file__match_missing_case.bend.snap +++ b/tests/snapshots/parse_file__match_missing_case.bend.snap @@ -4,6 +4,6 @@ input_file: tests/golden_tests/parse_file/match_missing_case.bend --- Errors: In tests/golden_tests/parse_file/match_missing_case.bend : -- expected: case +- expected: 'case' - detected: end of input  4 |