diff --git a/src/parser.rs b/src/parser.rs index 2ffb3c0..6dbd6e1 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -378,6 +378,9 @@ where while self.peek() != Some(TOKEN_SEMICOLON) { self.parse_val(); + if self.errors.last().map_or(false, |x| *x == ParseError::UnexpectedEOF) { + break; + } } self.expect(TOKEN_SEMICOLON); diff --git a/test_data/parser/inherit/2.expect b/test_data/parser/inherit/2.expect new file mode 100644 index 0000000..3970428 --- /dev/null +++ b/test_data/parser/inherit/2.expect @@ -0,0 +1,13 @@ +error: unexpected end of file +error: unexpected end of file, wanted any of [TOKEN_SEMICOLON] +error: unexpected end of file +error: unexpected end of file +NODE_ROOT 0..13 { + NODE_LET_IN 0..13 { + TOKEN_LET("let") 0..3 + TOKEN_WHITESPACE("\n ") 3..6 + NODE_INHERIT 6..13 { + TOKEN_INHERIT("inherit") 6..13 + } + } +} diff --git a/test_data/parser/inherit/2.nix b/test_data/parser/inherit/2.nix new file mode 100644 index 0000000..bacd6b8 --- /dev/null +++ b/test_data/parser/inherit/2.nix @@ -0,0 +1,2 @@ +let + inherit