some cleanup

This commit is contained in:
gluax 2022-03-16 15:04:49 -07:00
parent 790c282e8b
commit 34e1b39805
32 changed files with 122 additions and 186 deletions

Binary file not shown.

View File

@ -41,6 +41,7 @@ fn eat_identifier(input: &mut Peekable<impl Iterator<Item = char>>) -> Option<St
}
impl Token {
// Eats the parts of the unicode character after \u.
fn eat_unicode_char(input: &mut Peekable<impl Iterator<Item = char>>) -> Result<(usize, Char)> {
let mut unicode = String::new();
// Account for the chars '\' and 'u'.
@ -85,6 +86,7 @@ impl Token {
}
}
// Eats the parts of the hex character after \x.
fn eat_hex_char(input: &mut Peekable<impl Iterator<Item = char>>) -> Result<(usize, Char)> {
let mut hex = String::new();
// Account for the chars '\' and 'x'.
@ -173,23 +175,6 @@ impl Token {
Ok((int.len(), Token::Int(int)))
}
/// Returns the number of bytes in an utf-8 encoding that starts with this byte.
fn _utf8_byte_count(byte: u8) -> usize {
let mut mask = 0x80;
let mut result = 0;
while byte & mask > 0 {
result += 1;
mask >>= 1;
}
if result == 0 {
1
} else if result > 4 {
4
} else {
result
}
}
///
/// Returns a tuple: [(token length, token)] if the next token can be eaten, otherwise returns [`None`].
/// The next token can be eaten if the bytes at the front of the given `input_tendril` string can be scanned into a token.
@ -234,8 +219,8 @@ impl Token {
if input.next_if_eq(&'\'').is_some() {
input.next();
return Ok((len + 2, Token::CharLit(character)));
} else if let Some(c) = input.next() {
return Err(ParserError::lexer_string_not_closed(c).into());
} else if input.next().is_some() {
return Err(ParserError::lexer_char_not_closed(character).into());
} else {
return Err(ParserError::lexer_empty_input_tendril().into());
}

BIN
covered.yml Normal file

Binary file not shown.

BIN
default.profraw Normal file

Binary file not shown.

BIN
leo/errors/covered.yml Normal file

Binary file not shown.

View File

@ -136,14 +136,6 @@ create_errors!(
help: None,
}
/// For when the parser encountered an illegal `const self` argument.
@formatted
illegal_self_const {
args: (),
msg: "cannot have const self",
help: None,
}
/// For when the parser encountered a deprecated `mut` argument in a function.
@formatted
mut_function_input {
@ -232,14 +224,6 @@ create_errors!(
help: None,
}
/// When an integer is started with a leading zero.
@backtraced
lexer_eat_integer_leading_zero {
args: (input: impl Display),
msg: format!("Tried to eat integer but found a leading zero on `{}`.", input),
help: None,
}
/// When an integer is started with a leading zero.
@backtraced
lexer_expected_valid_escaped_char {
@ -296,30 +280,6 @@ create_errors!(
help: None,
}
/// When a escaped character was given more than one char to escape.
@backtraced
lexer_escaped_char_incorrect_length {
args: (input: impl Display),
msg: format!("Could not lex the following escaped char due to being given more than one char: `{}`.", input),
help: None,
}
/// When a escape was given but no following character
@backtraced
lexer_unclosed_escaped_char {
args: (),
msg: "There was no escaped character following the escape char symbol `\\`.",
help: None,
}
/// When a escaped hex was given more than two chars to escape.
@backtraced
lexer_escaped_hex_incorrect_length {
args: (input: impl Display),
msg: format!("Could not lex the following escaped hex due to being given more than two chars: `{}`.", input),
help: None,
}
/// When a valid hex character was expected.
@backtraced
lexer_expected_valid_hex_char {
@ -336,7 +296,7 @@ create_errors!(
help: None,
}
/// When a escaped unicode char was given but it had an incorrect length.
/// When a escaped unicode char was given but it had an incorrect length. 38
@backtraced
lexer_invalid_escaped_unicode_length {
args: (input: impl Display),
@ -375,14 +335,6 @@ create_errors!(
help: None,
}
/// When a escaped unicode char has an emoji in it.
@backtraced
lexer_emoji_inside_escaped_unicode_char {
args: (input: impl Display),
msg: format!("There was an emoji found in the escaped unicode character: `{}`.", input),
help: None,
}
/// For when a user puts parens around a single defined variable.
@formatted
invalid_parens_around_single_variable {
@ -406,5 +358,4 @@ create_errors!(
msg: format!("Found the char `{}`, but expected `{}`", found, expected),
help: None,
}
);

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370022]: Member functions must come after member variables.\n --> test:7:5\n |\n 7 | foo: u8,\n | ^^^\nError [EPAR0370021]: Member functions must come after member consts.\n --> test:9:18\n |\n 9 | static const BAR: u8 = 0u8;\n | ^^^^^^^^^^^^^\nError [EPAR0370020]: Member variables must come after member consts.\n --> test:15:18\n |\n 15 | static const BAR: u8 = 0u8;\n | ^^^^^^^^^^^^^"
- "Error [EPAR0370021]: Member functions must come after member variables.\n --> test:7:5\n |\n 7 | foo: u8,\n | ^^^\nError [EPAR0370020]: Member functions must come after member consts.\n --> test:9:18\n |\n 9 | static const BAR: u8 = 0u8;\n | ^^^^^^^^^^^^^\nError [EPAR0370019]: Member variables must come after member consts.\n --> test:15:18\n |\n 15 | static const BAR: u8 = 0u8;\n | ^^^^^^^^^^^^^"

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370019]: `mut self` is no longer accepted. Use `&self` if you would like to pass in a mutable reference to `self`\n --> test:4:16\n |\n 4 | function x(mut self) {\n | ^^^^^^^^"
- "Error [EPAR0370018]: `mut self` is no longer accepted. Use `&self` if you would like to pass in a mutable reference to `self`\n --> test:4:16\n |\n 4 | function x(mut self) {\n | ^^^^^^^^"

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370041]: A function received a self argument as not the first argument."
- "Error [EPAR0370036]: A function received a self argument as not the first argument."

View File

@ -4,5 +4,5 @@ expectation: Fail
outputs:
- "Error [EPAR0370010]: illegal spread in array initializer\n --> test:1:1\n |\n 1 | [...0u8; 1]\n | ^^^^^^^"
- "Error [EPAR0370010]: illegal spread in array initializer\n --> test:1:1\n |\n 1 | [...0; 1]\n | ^^^^^"
- "Error [EPAR0370023]: Array dimensions specified as a tuple cannot be empty.\n --> test:1:5\n |\n 1 | [0; ()]\n | ^^"
- "Error [EPAR0370045]: do not put parens around single dimension array size\n --> test:1:5\n |\n 1 | [0; (1)]\n | ^^^"
- "Error [EPAR0370022]: Array dimensions specified as a tuple cannot be empty.\n --> test:1:5\n |\n 1 | [0; ()]\n | ^^"
- "Error [EPAR0370039]: do not put parens around single dimension array size\n --> test:1:5\n |\n 1 | [0; (1)]\n | ^^^"

View File

@ -2,47 +2,47 @@
namespace: Token
expectation: Fail
outputs:
- "Error [EPAR0370024]: Expected more characters to lex but found none."
- "Error [EPAR0370032]: Could not lex the following content: `\\`."
- "Error [EPAR0370024]: Expected more characters to lex but found none."
- "Error [EPAR0370032]: Could not lex the following content: `\\n`."
- "Error [EPAR0370024]: Expected more characters to lex but found none."
- "Error [EPAR0370024]: Expected more characters to lex but found none."
- "Error [EPAR0370036]: Expected a valid hex character but found `'`."
- "Error [EPAR0370036]: Expected a valid hex character but found `'`."
- "Error [EPAR0370036]: Expected a valid hex character but found `9A`."
- "Error [EPAR0370036]: Expected a valid hex character but found `7g`."
- "Error [EPAR0370036]: Expected a valid hex character but found `80`."
- "Error [EPAR0370036]: Expected a valid hex character but found `c1`."
- "Error [EPAR0370036]: Expected a valid hex character but found `c2`."
- "Error [EPAR0370036]: Expected a valid hex character but found `DF`."
- "Error [EPAR0370036]: Expected a valid hex character but found `C0`."
- "Error [EPAR0370036]: Expected a valid hex character but found `e0`."
- "Error [EPAR0370036]: Expected a valid hex character but found `9f`."
- "Error [EPAR0370027]: Expected a closed string but found `'b'`."
- "Error [EPAR0370026]: Expected a valid escape character but found `a`."
- "Error [EPAR0370026]: Expected a valid escape character but found `z`."
- "Error [EPAR0370026]: Expected a valid escape character but found `A`."
- "Error [EPAR0370026]: Expected a valid escape character but found `Z`."
- "Error [EPAR0370026]: Expected a valid escape character but found `1`."
- "Error [EPAR0370026]: Expected a valid escape character but found `9`."
- "Error [EPAR0370026]: Expected a valid escape character but found `*`."
- "Error [EPAR0370036]: Expected a valid hex character but found `'`."
- "Error [EPAR0370042]: There was no opening `{` after starting an escaped unicode `'`."
- "Error [EPAR0370027]: Expected a closed string but found `'\\\\'`."
- "Error [EPAR0370042]: There was no opening `{` after starting an escaped unicode `z`."
- "Error [EPAR0370042]: There was no opening `{` after starting an escaped unicode `1`."
- "Error [EPAR0370042]: There was no opening `{` after starting an escaped unicode `}`."
- "Error [EPAR0370027]: Expected a closed string but found `'\\\\'`."
- "Error [EPAR0370042]: There was no opening `{` after starting an escaped unicode `1`."
- "Error [EPAR0370027]: Expected a closed string but found `'1'`."
- "Error [EPAR0370042]: There was no opening `{` after starting an escaped unicode `6`."
- "Error [EPAR0370037]: There was no closing `}` after a escaped unicode `af🦀'`."
- "Error [EPAR0370037]: There was no closing `}` after a escaped unicode `2764z'`."
- "Error [EPAR0370036]: Expected a valid hex character but found `276g`."
- "Error [EPAR0370042]: There was no opening `{` after starting an escaped unicode `9`."
- "Error [EPAR0370042]: There was no opening `{` after starting an escaped unicode `0`."
- "Error [EPAR0370042]: There was no opening `{` after starting an escaped unicode `0`."
- "Error [EPAR0370039]: The escaped unicode char `110000` is greater than 0x10FFFF."
- "Error [EPAR0370027]: Expected a closed string but found `'\\\\'`."
- "Error [EPAR0370027]: Expected a closed string but found `'😂'`."
- "Error [EPAR0370023]: Expected more characters to lex but found none."
- "Error [EPAR0370030]: Could not lex the following content: `\\`."
- "Error [EPAR0370023]: Expected more characters to lex but found none."
- "Error [EPAR0370030]: Could not lex the following content: `\\n`."
- "Error [EPAR0370023]: Expected more characters to lex but found none."
- "Error [EPAR0370023]: Expected more characters to lex but found none."
- "Error [EPAR0370031]: Expected a valid hex character but found `'`."
- "Error [EPAR0370031]: Expected a valid hex character but found `'`."
- "Error [EPAR0370031]: Expected a valid hex character but found `9A`."
- "Error [EPAR0370031]: Expected a valid hex character but found `7g`."
- "Error [EPAR0370031]: Expected a valid hex character but found `80`."
- "Error [EPAR0370031]: Expected a valid hex character but found `c1`."
- "Error [EPAR0370031]: Expected a valid hex character but found `c2`."
- "Error [EPAR0370031]: Expected a valid hex character but found `DF`."
- "Error [EPAR0370031]: Expected a valid hex character but found `C0`."
- "Error [EPAR0370031]: Expected a valid hex character but found `e0`."
- "Error [EPAR0370031]: Expected a valid hex character but found `9f`."
- "Error [EPAR0370026]: Expected a closed char but found `a`."
- "Error [EPAR0370024]: Expected a valid escape character but found `a`."
- "Error [EPAR0370024]: Expected a valid escape character but found `z`."
- "Error [EPAR0370024]: Expected a valid escape character but found `A`."
- "Error [EPAR0370024]: Expected a valid escape character but found `Z`."
- "Error [EPAR0370024]: Expected a valid escape character but found `1`."
- "Error [EPAR0370024]: Expected a valid escape character but found `9`."
- "Error [EPAR0370024]: Expected a valid escape character but found `*`."
- "Error [EPAR0370031]: Expected a valid hex character but found `'`."
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `'`."
- "Error [EPAR0370026]: Expected a closed char but found `\t`."
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `z`."
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `1`."
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `}`."
- "Error [EPAR0370026]: Expected a closed char but found `🦀`."
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `1`."
- "Error [EPAR0370026]: Expected a closed char but found `🦀`."
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `6`."
- "Error [EPAR0370032]: There was no closing `}` after a escaped unicode `af🦀'`."
- "Error [EPAR0370032]: There was no closing `}` after a escaped unicode `2764z'`."
- "Error [EPAR0370031]: Expected a valid hex character but found `276g`."
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `9`."
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `0`."
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `0`."
- "Error [EPAR0370034]: The escaped unicode char `110000` is greater than 0x10FFFF."
- "Error [EPAR0370026]: Expected a closed char but found `򻮻`."
- "Error [EPAR0370026]: Expected a closed char but found `😭`."

View File

@ -2,14 +2,14 @@
namespace: ParseExpression
expectation: Fail
outputs:
- "Error [EPAR0370030]: Empty block comment."
- "Error [EPAR0370031]: Block comment does not close with content: `/* test`."
- "Error [EPAR0370028]: Empty block comment."
- "Error [EPAR0370029]: Block comment does not close with content: `/* test`."
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '/'\n --> test:1:1\n |\n 1 | / /\n | ^"
- "Error [EPAR0370031]: Block comment does not close with content: `/*/`."
- "Error [EPAR0370029]: Block comment does not close with content: `/*/`."
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '*'\n --> test:1:1\n |\n 1 | */\n | ^"
- "Error [EPAR0370032]: Could not lex the following content: `🦀**/`."
- "Error [EPAR0370032]: Could not lex the following content: `🦀*/`."
- "Error [EPAR0370031]: Block comment does not close with content: `/*🦀/`."
- "Error [EPAR0370031]: Block comment does not close with content: `/**🦀`."
- "Error [EPAR0370031]: Block comment does not close with content: `/*🦀`."
- "Error [EPAR0370031]: Block comment does not close with content: `/*/*`."
- "Error [EPAR0370030]: Could not lex the following content: `🦀**/`."
- "Error [EPAR0370030]: Could not lex the following content: `🦀*/`."
- "Error [EPAR0370029]: Block comment does not close with content: `/*🦀/`."
- "Error [EPAR0370029]: Block comment does not close with content: `/**🦀`."
- "Error [EPAR0370029]: Block comment does not close with content: `/*🦀`."
- "Error [EPAR0370029]: Block comment does not close with content: `/*/*`."

View File

@ -2,6 +2,6 @@
namespace: Token
expectation: Fail
outputs:
- "Error [EPAR0370040]: A hex number `0x..` was provided but hex is not allowed."
- "Error [EPAR0370040]: A hex number `0x..` was provided but hex is not allowed."
- "Error [EPAR0370040]: A hex number `0x..` was provided but hex is not allowed."
- "Error [EPAR0370035]: A hex number `0x..` was provided but hex is not allowed."
- "Error [EPAR0370035]: A hex number `0x..` was provided but hex is not allowed."
- "Error [EPAR0370035]: A hex number `0x..` was provided but hex is not allowed."

View File

@ -2,15 +2,15 @@
namespace: Token
expectation: Fail
outputs:
- "Error [EPAR0370027]: Expected a closed string but found `[Scalar('H'), Scalar('e'), Scalar('l'), Scalar('l'), Scalar('o'), Scalar(' '), Scalar('w'), Scalar('o'), Scalar('r'), Scalar('l'), Scalar('d'), Scalar('!')]`."
- "Error [EPAR0370027]: Expected a closed string but found `[Scalar('\"')]`."
- "Error [EPAR0370024]: Expected more characters to lex but found none."
- "Error [EPAR0370026]: Expected a valid escape character but found `l`."
- "Error [EPAR0370042]: There was no opening `{` after starting an escaped unicode `a`."
- "Error [EPAR0370042]: There was no opening `{` after starting an escaped unicode `\"`."
- "Error [EPAR0370036]: Expected a valid hex character but found `FF`."
- "Error [EPAR0370024]: Expected more characters to lex but found none."
- "Error [EPAR0370042]: There was no opening `{` after starting an escaped unicode `}`."
- "Error [EPAR0370042]: There was no opening `{` after starting an escaped unicode `6`."
- "Error [EPAR0370037]: There was no closing `}` after a escaped unicode `af🦀\"`."
- "Error [EPAR0370032]: Could not lex the following content: `⭇😍;`."
- "Error [EPAR0370025]: Expected a closed string but found `[Scalar('H'), Scalar('e'), Scalar('l'), Scalar('l'), Scalar('o'), Scalar(' '), Scalar('w'), Scalar('o'), Scalar('r'), Scalar('l'), Scalar('d'), Scalar('!')]`."
- "Error [EPAR0370025]: Expected a closed string but found `[Scalar('\"')]`."
- "Error [EPAR0370023]: Expected more characters to lex but found none."
- "Error [EPAR0370024]: Expected a valid escape character but found `l`."
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `a`."
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `\"`."
- "Error [EPAR0370031]: Expected a valid hex character but found `FF`."
- "Error [EPAR0370023]: Expected more characters to lex but found none."
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `}`."
- "Error [EPAR0370037]: There was no opening `{` after starting an escaped unicode `6`."
- "Error [EPAR0370032]: There was no closing `}` after a escaped unicode `af🦀\"`."
- "Error [EPAR0370030]: Could not lex the following content: `⭇😍;`."

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370009]: unexpected string: expected 'ident', got '?'\n --> test:3:6\n |\n 3 | @foo(?, bar, ?)\n | ^\nError [EPAR0370009]: unexpected string: expected 'ident', got '?'\n --> test:3:14\n |\n 3 | @foo(?, bar, ?)\n | ^\nError [EPAR0370009]: unexpected string: expected 'ident', got '123'\n --> test:8:6\n |\n 8 | @bar(123) // ints not vali\n | ^^^\nError [EPAR0370017]: \"@context(...)\" is deprecated. Did you mean @test annotation?\n --> test:14:2\n |\n 14 | @context // recovery witness\n | ^^^^^^^"
- "Error [EPAR0370009]: unexpected string: expected 'ident', got '?'\n --> test:3:6\n |\n 3 | @foo(?, bar, ?)\n | ^\nError [EPAR0370009]: unexpected string: expected 'ident', got '?'\n --> test:3:14\n |\n 3 | @foo(?, bar, ?)\n | ^\nError [EPAR0370009]: unexpected string: expected 'ident', got '123'\n --> test:8:6\n |\n 8 | @bar(123) // ints not vali\n | ^^^\nError [EPAR0370016]: \"@context(...)\" is deprecated. Did you mean @test annotation?\n --> test:14:2\n |\n 14 | @context // recovery witness\n | ^^^^^^^"

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370017]: \"@context(...)\" is deprecated. Did you mean @test annotation?\n --> test:3:2\n |\n 3 | @context\n | ^^^^^^^\nError [EPAR0370017]: \"@context(...)\" is deprecated. Did you mean @test annotation?\n --> test:8:2\n |\n 8 | @context // recovery witness\n | ^^^^^^^"
- "Error [EPAR0370016]: \"@context(...)\" is deprecated. Did you mean @test annotation?\n --> test:3:2\n |\n 3 | @context\n | ^^^^^^^\nError [EPAR0370016]: \"@context(...)\" is deprecated. Did you mean @test annotation?\n --> test:8:2\n |\n 8 | @context // recovery witness\n | ^^^^^^^"

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370032]: Could not lex the following content: `\\`."
- "Error [EPAR0370030]: Could not lex the following content: `\\`."

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370032]: Could not lex the following content: `\\`."
- "Error [EPAR0370030]: Could not lex the following content: `\\`."

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370032]: Could not lex the following content: `$`."
- "Error [EPAR0370030]: Could not lex the following content: `$`."

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370032]: Could not lex the following content: `\\1u8`."
- "Error [EPAR0370030]: Could not lex the following content: `\\1u8`."

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370040]: A hex number `0x..` was provided but hex is not allowed."
- "Error [EPAR0370035]: A hex number `0x..` was provided but hex is not allowed."

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370024]: Expected more characters to lex but found none."
- "Error [EPAR0370023]: Expected more characters to lex but found none."

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370027]: Expected a closed string but found `[]`."
- "Error [EPAR0370025]: Expected a closed string but found `[]`."

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370024]: Expected more characters to lex but found none."
- "Error [EPAR0370023]: Expected more characters to lex but found none."

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370032]: Could not lex the following content: `~`."
- "Error [EPAR0370030]: Could not lex the following content: `~`."

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370024]: Expected more characters to lex but found none."
- "Error [EPAR0370023]: Expected more characters to lex but found none."

View File

@ -15,4 +15,4 @@ outputs:
- "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x {x: y, y: z} = y;\n | ^^^^^^^^^^^^^^"
- "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x() = y;\n | ^^^"
- "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x.y() = y;\n | ^^^^^"
- "Error [EPAR0370032]: Could not lex the following content: `🦀 = y;`."
- "Error [EPAR0370030]: Could not lex the following content: `🦀 = y;`."

View File

@ -2,30 +2,30 @@
namespace: ParseStatement
expectation: Fail
outputs:
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = expr;\n | ^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = ();\n | ^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = x+y;\n | ^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = (x,y);\n | ^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = x();\n | ^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = expr;\n | ^^^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = ();\n | ^^^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = x+y;\n | ^^^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = (x,y);\n | ^^^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = x();\n | ^^^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = expr;\n | ^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = ();\n | ^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = x+y;\n | ^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = (x,y);\n | ^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = x();\n | ^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = expr;\n | ^^^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = ();\n | ^^^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = x+y;\n | ^^^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = (x,y);\n | ^^^^^^^^^"
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = x();\n | ^^^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = expr;\n | ^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = ();\n | ^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = x+y;\n | ^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = (x,y);\n | ^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x = x();\n | ^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = expr;\n | ^^^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = ();\n | ^^^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = x+y;\n | ^^^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = (x,y);\n | ^^^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x = x();\n | ^^^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = expr;\n | ^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = ();\n | ^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = x+y;\n | ^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = (x,y);\n | ^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | let mut x: u32 = x();\n | ^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = expr;\n | ^^^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = ();\n | ^^^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = x+y;\n | ^^^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = (x,y);\n | ^^^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:1:1\n |\n 1 | const mut x: u32 = x();\n | ^^^^^^^^^"
- "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:10\n |\n 1 | let (x,y,,) = ();\n | ^"
- "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:6\n |\n 1 | let (,x,y) = ();\n | ^"
- "Error [EPAR0370009]: unexpected string: expected 'ident', got ','\n --> test:1:8\n |\n 1 | let (x,,y) = ();\n | ^"
- "Error [EPAR0370009]: unexpected string: expected 'int', got ','\n --> test:1:16\n |\n 1 | let x: [u8; (2,,)] = [[0,0], [0,0]];\n | ^\nError [EPAR0370045]: do not put parens around single dimension array size\n --> test:1:13\n |\n 1 | let x: [u8; (2,,)] = [[0,0], [0,0]];\n | ^^^^^"
- "Error [EPAR0370009]: unexpected string: expected 'int', got ','\n --> test:1:16\n |\n 1 | let x: [u8; (2,,)] = [[0,0], [0,0]];\n | ^\nError [EPAR0370039]: do not put parens around single dimension array size\n --> test:1:13\n |\n 1 | let x: [u8; (2,,)] = [[0,0], [0,0]];\n | ^^^^^"
- "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got 'const'\n --> test:1:8\n |\n 1 | let x: const = expr;\n | ^^^^^"
- "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got 'let'\n --> test:1:10\n |\n 1 | const x: let = expr;\n | ^^^"
- "Error [EPAR0370005]: expected 'i8', 'i16', 'i32', 'i64', 'i128', 'u8', 'u16', 'u32', 'u64', 'u128', 'field', 'group', 'address', 'bool', 'char' -- got 'mut'\n --> test:1:8\n |\n 1 | let x: mut = expr;\n | ^^^"
@ -43,6 +43,6 @@ outputs:
- "Error [EPAR0370003]: unexpected EOF\n --> test:1:11\n |\n 1 | let x: [u8;\n | ^"
- "Error [EPAR0370005]: expected ] -- got 'u8'\n --> test:1:14\n |\n 1 | let x: [u8; 1u8] = [1,\n | ^^"
- "Error [EPAR0370009]: unexpected string: expected 'expression', got ']'\n --> test:1:15\n |\n 1 | let dbg: u8 = ];\n | ^"
- "Error [EPAR0370032]: Could not lex the following content: `🦀: u8 = 0;`."
- "Error [EPAR0370044]: do not put parens around single variable names\n --> test:1:6\n |\n 1 | let (x) = ...;\n | ^\nError [EPAR0370009]: unexpected string: expected 'expression', got '...'\n --> test:1:11\n |\n 1 | let (x) = ...;\n | ^^^"
- "Error [EPAR0370044]: do not put parens around single variable names\n --> test:1:6\n |\n 1 | let (x,) = ...;\n | ^\nError [EPAR0370009]: unexpected string: expected 'expression', got '...'\n --> test:1:12\n |\n 1 | let (x,) = ...;\n | ^^^"
- "Error [EPAR0370030]: Could not lex the following content: `🦀: u8 = 0;`."
- "Error [EPAR0370038]: do not put parens around single variable names\n --> test:1:6\n |\n 1 | let (x) = ...;\n | ^\nError [EPAR0370009]: unexpected string: expected 'expression', got '...'\n --> test:1:11\n |\n 1 | let (x) = ...;\n | ^^^"
- "Error [EPAR0370038]: do not put parens around single variable names\n --> test:1:6\n |\n 1 | let (x,) = ...;\n | ^\nError [EPAR0370009]: unexpected string: expected 'expression', got '...'\n --> test:1:12\n |\n 1 | let (x,) = ...;\n | ^^^"

View File

@ -4,7 +4,7 @@ expectation: Fail
outputs:
- "Error [EPAR0370009]: unexpected string: expected 'expression', got ']'\n --> test:1:2\n |\n 1 | (];\n | ^"
- "Error [EPAR0370009]: unexpected string: expected 'expression', got ')'\n --> test:1:2\n |\n 1 | [);\n | ^"
- "Error [EPAR0370032]: Could not lex the following content: `\\y;`."
- "Error [EPAR0370046]: Found the char `;`, but expected `|`"
- "Error [EPAR0370030]: Could not lex the following content: `\\y;`."
- "Error [EPAR0370040]: Found the char `;`, but expected `|`"
- "Error [EPAR0370009]: unexpected string: expected 'expression', got '}'\n --> test:1:3\n |\n 1 | x[};\n | ^"
- "Error [EPAR0370005]: expected ) -- got ']'\n --> test:1:6\n |\n 1 | (x, y];\n | ^"

View File

@ -2,6 +2,6 @@
namespace: ParseStatement
expectation: Fail
outputs:
- "Error [EPAR0370040]: A hex number `0x..` was provided but hex is not allowed."
- "Error [EPAR0370040]: A hex number `0x..` was provided but hex is not allowed."
- "Error [EPAR0370040]: A hex number `0x..` was provided but hex is not allowed."
- "Error [EPAR0370035]: A hex number `0x..` was provided but hex is not allowed."
- "Error [EPAR0370035]: A hex number `0x..` was provided but hex is not allowed."
- "Error [EPAR0370035]: A hex number `0x..` was provided but hex is not allowed."

View File

@ -2,4 +2,4 @@
namespace: Parse
expectation: Fail
outputs:
- "Error [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:4:5\n |\n 4 | let mut x = 0;\n | ^^^^^^^\nError [EPAR0370015]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:5:5\n |\n 5 | let mut y = 0; // recovery witness\n | ^^^^^^^"
- "Error [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:4:5\n |\n 4 | let mut x = 0;\n | ^^^^^^^\nError [EPAR0370014]: let mut = ... is deprecated. `let` keyword implies mutabality by default.\n --> test:5:5\n |\n 5 | let mut y = 0; // recovery witness\n | ^^^^^^^"

View File

@ -49,7 +49,7 @@ fn run_with_args(opt: Opt) -> Result<(), Box<dyn Error>> {
// Variable that stores all the tests.
let mut tests = Vec::new();
let mut test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
test_dir.push("../tests/");
test_dir.push("../");
let mut expectation_dir = test_dir.clone();
expectation_dir.push("expectations");