save progress

This commit is contained in:
0rphon 2022-02-14 17:25:57 -08:00
parent 0e82808c7d
commit 0d6c258068
15 changed files with 3432 additions and 1 deletions

12
cover.bat Normal file
View File

@ -0,0 +1,12 @@
set CLEAR_LEO_TEST_EXPECTATIONS=
cargo clean
cd parser
set RUSTFLAGS=-Cinstrument-coverage
cargo +nightly build
set LLVM_PROFILE_FILE=../target/out/leo_coverage-%%p-%%m.profraw
cargo +nightly test -- test::parser_tests --exact --nocapture
grcov ../target/out -s . --binary-path ../target/debug/ -t html --branch --ignore-not-existing -o ../target/debug/coverage/
cd ..
del default.profraw
set RUSTFLAGS=
set LLVM_PROFILE_FILE=

View File

@ -53,7 +53,7 @@ impl ParserContext<'_> {
Token::U32 => IntegerType::U32,
Token::U64 => IntegerType::U64,
Token::U128 => IntegerType::U128,
_ => return None,
_ => return None, // todo 0rphon: unreachable
})
}

3
test.bat Normal file
View File

@ -0,0 +1,3 @@
set CLEAR_LEO_TEST_EXPECTATIONS=1
cargo test --package leo-parser --lib -- test::parser_tests --exact --nocapture
set CLEAR_LEO_TEST_EXPECTATIONS=

View File

@ -122,3 +122,24 @@ outputs:
col_stop: 4
path: ""
content: "-!x"
- Value:
Implicit:
- "-5"
- span:
line_start: 1
line_stop: 1
col_start: 1
col_stop: 3
path: ""
content: "-5"
- Value:
Integer:
- I8
- "-5"
- span:
line_start: 1
line_stop: 1
col_start: 1
col_stop: 5
path: ""
content: "-5i8"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
---
namespace: ParseStatement
expectation: Fail
outputs:
- "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x::y = y;\n | ^^^^"
- "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | 5 = y;\n | ^"
- "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x + x = 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;\n | ^^"
- "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | a? x : x = y;\n | ^^^^^^^^"
- "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | x as u32 = y;\n | ^^^^^^^^"
- "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | [x, x, x] = y;\n | ^^^^^^^^^"
- "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | [x; 3] = y;\n | ^^^^^^"
- "Error [EPAR0370011]: invalid assignment target\n --> test:1:1\n |\n 1 | (x, x, x) = y;\n | ^^^^^^^^^"
- "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 | ^^^^^"

View File

@ -0,0 +1,6 @@
---
namespace: ParseStatement
expectation: Fail
outputs:
- "Error [EPAR0370009]: unexpected string: expected 'formatted string', got '1'\n --> test:1:13\n |\n 1 | console.log(1);\n | ^"
- "Error [EPAR0370007]: unexpected identifier: expected 'assert', 'error', 'log' -- got 'test'\n --> test:1:9\n |\n 1 | console.test();\n | ^^^^"

View File

@ -1616,3 +1616,132 @@ outputs:
col_stop: 37
path: ""
content: "let x: [[u8; 2]; 2] = [[0,0], [0,0]];"
- Definition:
declaration_type: Let
variable_names:
- mutable: true
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x: [u8; (2, 2)] = [[0,0], [0,0]];\\\"}\"}"
span:
line_start: 1
line_stop: 1
col_start: 5
col_stop: 6
path: ""
content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];"
type_:
Array:
- IntegerType: U8
- - value: "2"
- value: "2"
value:
ArrayInline:
elements:
- Expression:
ArrayInline:
elements:
- Expression:
Value:
Implicit:
- "0"
- span:
line_start: 1
line_stop: 1
col_start: 25
col_stop: 26
path: ""
content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];"
- Expression:
Value:
Implicit:
- "0"
- span:
line_start: 1
line_stop: 1
col_start: 27
col_stop: 28
path: ""
content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];"
span:
line_start: 1
line_stop: 1
col_start: 24
col_stop: 29
path: ""
content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];"
- Expression:
ArrayInline:
elements:
- Expression:
Value:
Implicit:
- "0"
- span:
line_start: 1
line_stop: 1
col_start: 32
col_stop: 33
path: ""
content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];"
- Expression:
Value:
Implicit:
- "0"
- span:
line_start: 1
line_stop: 1
col_start: 34
col_stop: 35
path: ""
content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];"
span:
line_start: 1
line_stop: 1
col_start: 31
col_stop: 36
path: ""
content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];"
span:
line_start: 1
line_stop: 1
col_start: 23
col_stop: 37
path: ""
content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];"
span:
line_start: 1
line_stop: 1
col_start: 1
col_stop: 37
path: ""
content: "let x: [u8; (2, 2)] = [[0,0], [0,0]];"
- Definition:
declaration_type: Let
variable_names:
- mutable: true
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":5,\\\"col_stop\\\":6,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"let x: address = aleo15u4r0gzjtqzepkgurgn7p3u5kkhs9p74rx6aun3uh2s5std6759svgmg53;\\\"}\"}"
span:
line_start: 1
line_stop: 1
col_start: 5
col_stop: 6
path: ""
content: "let x: address = aleo15u4r0gzjtqzepkgurgn7p3u5kkhs9p74rx6aun3uh2s5std6759svgmg53;"
type_: Address
value:
Value:
Address:
- aleo15u4r0gzjtqzepkgurgn7p3u5kkhs9p74rx6aun3uh2s5std6759svgmg53
- span:
line_start: 1
line_stop: 1
col_start: 18
col_stop: 81
path: ""
content: "let x: address = aleo15u4r0gzjtqzepkgurgn7p3u5kkhs9p74rx6aun3uh2s5std6759svgmg53;"
span:
line_start: 1
line_stop: 1
col_start: 1
col_stop: 81
path: ""
content: "let x: address = aleo15u4r0gzjtqzepkgurgn7p3u5kkhs9p74rx6aun3uh2s5std6759svgmg53;"

View File

@ -25,3 +25,4 @@ outputs:
- "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 | ^"

View File

@ -9,3 +9,6 @@ expectation: Pass
-x()
--x
-!x
-5
-5i8

View File

@ -29,3 +29,162 @@ x[2..] = y;
x[..] = y;
x.0[0][..] = y;
x.y = y;
x.0.y[0].1.y[..][0][1..5][0..3] = y;
x += expr;
x += ();
x += x+y;
x += x();
x[0] += y;
x[0u32] += y;
x.0 += y;
x[1..2][0] += y;
x[..2][0] += y;
x[2..][0] += y;
x[..][0] += y;
x.0[0][..][0] += y;
x.y += y;
x.0.y[0].1.y[..][0][1..5][0..3][0] += y;
x -= expr;
x -= ();
x -= x+y;
x -= x();
x[0] -= y;
x[0u32] -= y;
x.0 -= y;
x[1..2][0] -= y;
x[..2][0] -= y;
x[2..][0] -= y;
x[..][0] -= y;
x.0[0][..][0] -= y;
x.y -= y;
x.0.y[0].1.y[..][0][1..5][0..3][0] -= y;
x *= expr;
x *= ();
x *= x+y;
x *= x();
x[0] *= y;
x[0u32] *= y;
x.0 *= y;
x[1..2][0] *= y;
x[..2][0] *= y;
x[2..][0] *= y;
x[..][0] *= y;
x.0[0][..][0] *= y;
x.y *= y;
x.0.y[0].1.y[..][0][1..5][0..3][0] *= y;
x /= expr;
x /= ();
x /= x+y;
x /= x();
x[0] /= y;
x[0u32] /= y;
x.0 /= y;
x[1..2][0] /= y;
x[..2][0] /= y;
x[2..][0] /= y;
x[..][0] /= y;
x.0[0][..][0] /= y;
x.y /= y;
x.0.y[0].1.y[..][0][1..5][0..3][0] /= y;
x **= expr;
x **= ();
x **= x+y;
x **= x();
x[0] *= y;
x[0u32] *= y;
x.0 **= y;
x[1..2][0] **= y;
x[..2][0] **= y;
x[2..][0] **= y;
x[..][0] **= y;
x.0[0][..][0] **= y;
x.y **= y;
x.0.y[0].1.y[..][0][1..5][0..3][0] **= y;

View File

@ -0,0 +1,30 @@
/*
namespace: ParseStatement
expectation: Fail
*/
x::y = y;
5 = y;
x + x = y;
-x = y;
!x = y;
a? x : x = y;
x as u32 = y;
[x, x, x] = y;
[x; 3] = y;
(x, x, x) = y;
x {x: y, y: z} = y;
x() = y;
x.y() = y;

View File

@ -0,0 +1,8 @@
/*
namespace: ParseStatement
expectation: Fail
*/
console.log(1);
console.test();

View File

@ -103,3 +103,8 @@ let (x,) = ();
let x: [char; _] = "Hello, World!";
let x: [[u8; 2]; 2] = [[0,0], [0,0]];
let x: [u8; (2, 2)] = [[0,0], [0,0]];
let x: address = aleo15u4r0gzjtqzepkgurgn7p3u5kkhs9p74rx6aun3uh2s5std6759svgmg53;

View File

@ -52,3 +52,5 @@ let (x,y,,) = ();
let (,x,y) = ();
let (x,,y) = ();
let x: [u8; (2,,)] = [[0,0], [0,0]];