Merge pull request #28198 from ProvableHQ/fix/parser-error-data

Fix expected list in parser error.
This commit is contained in:
evan-schott 2024-07-08 11:41:36 -07:00 committed by GitHub
commit edb3c8ea16
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 9 additions and 6 deletions

View File

@ -137,7 +137,7 @@ impl<N: Network> ParserContext<'_, N> {
Token::At | Token::Async | Token::Function | Token::Transition | Token::Inline => {
let (id, function) = self.parse_function()?;
// Partition into transitions and functions so that don't have to sort later.
// Partition into transitions and functions so that we don't have to sort later.
if function.variant.is_transition() {
transitions.push((id, function));
} else {
@ -147,13 +147,16 @@ impl<N: Network> ParserContext<'_, N> {
Token::RightCurly => break,
_ => {
return Err(Self::unexpected_item(&self.token, &[
Token::Const,
Token::Struct,
Token::Record,
Token::Mapping,
Token::At,
Token::Async,
Token::Function,
Token::Transition,
Token::Inline,
Token::RightCurly,
])
.into());
}

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370005]: expected 'struct', 'record', 'mapping', '@', 'function', 'transition', 'inline' -- found 'finalize'\n --> test:6:7\n |\n 6 | } finalize {\n | ^^^^^^^^"
- "Error [EPAR0370005]: expected 'const', 'struct', 'record', 'mapping', '@', 'async', 'function', 'transition', 'inline', '}' -- found 'finalize'\n --> test:6:7\n |\n 6 | } finalize {\n | ^^^^^^^^"

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370005]: expected 'struct', 'record', 'mapping', '@', 'function', 'transition', 'inline' -- found '1'\n --> test:4:5\n |\n 4 | 1 main() {}}\n | ^"
- "Error [EPAR0370005]: expected 'const', 'struct', 'record', 'mapping', '@', 'async', 'function', 'transition', 'inline', '}' -- found '1'\n --> test:4:5\n |\n 4 | 1 main() {}}\n | ^"

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370005]: expected 'struct', 'record', 'mapping', '@', 'function', 'transition', 'inline' -- found 'test'\n --> test:4:5\n |\n 4 | test main() {}}\n | ^^^^"
- "Error [EPAR0370005]: expected 'const', 'struct', 'record', 'mapping', '@', 'async', 'function', 'transition', 'inline', '}' -- found 'test'\n --> test:4:5\n |\n 4 | test main() {}}\n | ^^^^"

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370005]: expected 'struct', 'record', 'mapping', '@', 'function', 'transition', 'inline' -- found 'circuit'\n --> test:5:5\n |\n 5 | circuit Foo {\n | ^^^^^^^"
- "Error [EPAR0370005]: expected 'const', 'struct', 'record', 'mapping', '@', 'async', 'function', 'transition', 'inline', '}' -- found 'circuit'\n --> test:5:5\n |\n 5 | circuit Foo {\n | ^^^^^^^"

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370005]: expected 'struct', 'record', 'mapping', '@', 'function', 'transition', 'inline' -- found 'mappin'\n --> test:4:5\n |\n 4 | mappin balances: address => u128;\n | ^^^^^^"
- "Error [EPAR0370005]: expected 'const', 'struct', 'record', 'mapping', '@', 'async', 'function', 'transition', 'inline', '}' -- found 'mappin'\n --> test:4:5\n |\n 4 | mappin balances: address => u128;\n | ^^^^^^"