Fix bugs, add propper tests
This commit is contained in:
908
old_tests/parser/expressions.exp
Normal file
908
old_tests/parser/expressions.exp
Normal file
@@ -0,0 +1,908 @@
|
||||
Program {
|
||||
ast: Block(
|
||||
[
|
||||
Statement(
|
||||
LocBox {
|
||||
inner: Let {
|
||||
name: Ident(
|
||||
"a",
|
||||
),
|
||||
typ: None,
|
||||
val: Some(
|
||||
LocBox {
|
||||
inner: BinOp {
|
||||
typ: EqEq,
|
||||
left: LocBox {
|
||||
inner: BinOp {
|
||||
typ: Star,
|
||||
left: LocBox {
|
||||
inner: Literal(
|
||||
Number(
|
||||
Number {
|
||||
val: 1,
|
||||
base: 10,
|
||||
signed: false,
|
||||
},
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 1,
|
||||
col: 10,
|
||||
},
|
||||
},
|
||||
right: LocBox {
|
||||
inner: Literal(
|
||||
Number(
|
||||
Number {
|
||||
val: 3,
|
||||
base: 10,
|
||||
signed: false,
|
||||
},
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 1,
|
||||
col: 14,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 1,
|
||||
col: 12,
|
||||
},
|
||||
},
|
||||
right: LocBox {
|
||||
inner: Literal(
|
||||
Number(
|
||||
Number {
|
||||
val: 4,
|
||||
base: 10,
|
||||
signed: false,
|
||||
},
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 1,
|
||||
col: 18,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 1,
|
||||
col: 16,
|
||||
},
|
||||
},
|
||||
),
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 1,
|
||||
col: 4,
|
||||
},
|
||||
},
|
||||
),
|
||||
Statement(
|
||||
LocBox {
|
||||
inner: Let {
|
||||
name: Ident(
|
||||
"b",
|
||||
),
|
||||
typ: None,
|
||||
val: Some(
|
||||
LocBox {
|
||||
inner: BinOp {
|
||||
typ: EqEq,
|
||||
left: LocBox {
|
||||
inner: BinOp {
|
||||
typ: Div,
|
||||
left: LocBox {
|
||||
inner: Literal(
|
||||
Number(
|
||||
Number {
|
||||
val: 3,
|
||||
base: 10,
|
||||
signed: false,
|
||||
},
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 2,
|
||||
col: 10,
|
||||
},
|
||||
},
|
||||
right: LocBox {
|
||||
inner: Literal(
|
||||
Number(
|
||||
Number {
|
||||
val: 4,
|
||||
base: 10,
|
||||
signed: false,
|
||||
},
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 2,
|
||||
col: 12,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 2,
|
||||
col: 11,
|
||||
},
|
||||
},
|
||||
right: LocBox {
|
||||
inner: UnOp {
|
||||
typ: Star,
|
||||
right: LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"a",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 2,
|
||||
col: 17,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 2,
|
||||
col: 16,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 2,
|
||||
col: 14,
|
||||
},
|
||||
},
|
||||
),
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 2,
|
||||
col: 4,
|
||||
},
|
||||
},
|
||||
),
|
||||
Statement(
|
||||
LocBox {
|
||||
inner: Let {
|
||||
name: Ident(
|
||||
"c",
|
||||
),
|
||||
typ: None,
|
||||
val: Some(
|
||||
LocBox {
|
||||
inner: BinOp {
|
||||
typ: Div,
|
||||
left: LocBox {
|
||||
inner: Group(
|
||||
LocBox {
|
||||
inner: PtrFieldAccess {
|
||||
left: Some(
|
||||
LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"a",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 3,
|
||||
col: 11,
|
||||
},
|
||||
},
|
||||
),
|
||||
right: LocBox {
|
||||
inner: FieldAccess {
|
||||
left: Some(
|
||||
LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"b",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 3,
|
||||
col: 13,
|
||||
},
|
||||
},
|
||||
),
|
||||
right: LocBox {
|
||||
inner: PtrFieldAccess {
|
||||
left: Some(
|
||||
LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"c",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 3,
|
||||
col: 15,
|
||||
},
|
||||
},
|
||||
),
|
||||
right: LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"d",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 3,
|
||||
col: 17,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 3,
|
||||
col: 16,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 3,
|
||||
col: 14,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 3,
|
||||
col: 12,
|
||||
},
|
||||
},
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 3,
|
||||
col: 10,
|
||||
},
|
||||
},
|
||||
right: LocBox {
|
||||
inner: Literal(
|
||||
Number(
|
||||
Number {
|
||||
val: 2,
|
||||
base: 10,
|
||||
signed: false,
|
||||
},
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 3,
|
||||
col: 22,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 3,
|
||||
col: 20,
|
||||
},
|
||||
},
|
||||
),
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 3,
|
||||
col: 4,
|
||||
},
|
||||
},
|
||||
),
|
||||
Statement(
|
||||
LocBox {
|
||||
inner: Let {
|
||||
name: Ident(
|
||||
"d",
|
||||
),
|
||||
typ: None,
|
||||
val: Some(
|
||||
LocBox {
|
||||
inner: BinOp {
|
||||
typ: Div,
|
||||
left: LocBox {
|
||||
inner: Literal(
|
||||
Number(
|
||||
Number {
|
||||
val: 2,
|
||||
base: 10,
|
||||
signed: false,
|
||||
},
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 4,
|
||||
col: 10,
|
||||
},
|
||||
},
|
||||
right: LocBox {
|
||||
inner: PtrFieldAccess {
|
||||
left: Some(
|
||||
LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"a",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 4,
|
||||
col: 14,
|
||||
},
|
||||
},
|
||||
),
|
||||
right: LocBox {
|
||||
inner: FieldAccess {
|
||||
left: Some(
|
||||
LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"b",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 4,
|
||||
col: 16,
|
||||
},
|
||||
},
|
||||
),
|
||||
right: LocBox {
|
||||
inner: PtrFieldAccess {
|
||||
left: Some(
|
||||
LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"c",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 4,
|
||||
col: 18,
|
||||
},
|
||||
},
|
||||
),
|
||||
right: LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"d",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 4,
|
||||
col: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 4,
|
||||
col: 19,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 4,
|
||||
col: 17,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 4,
|
||||
col: 15,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 4,
|
||||
col: 12,
|
||||
},
|
||||
},
|
||||
),
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 4,
|
||||
col: 4,
|
||||
},
|
||||
},
|
||||
),
|
||||
Statement(
|
||||
LocBox {
|
||||
inner: Let {
|
||||
name: Ident(
|
||||
"e",
|
||||
),
|
||||
typ: None,
|
||||
val: Some(
|
||||
LocBox {
|
||||
inner: BinOp {
|
||||
typ: Div,
|
||||
left: LocBox {
|
||||
inner: PtrFieldAccess {
|
||||
left: Some(
|
||||
LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"a",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 5,
|
||||
col: 10,
|
||||
},
|
||||
},
|
||||
),
|
||||
right: LocBox {
|
||||
inner: FieldAccess {
|
||||
left: Some(
|
||||
LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"b",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 5,
|
||||
col: 12,
|
||||
},
|
||||
},
|
||||
),
|
||||
right: LocBox {
|
||||
inner: PtrFieldAccess {
|
||||
left: Some(
|
||||
LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"c",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 5,
|
||||
col: 14,
|
||||
},
|
||||
},
|
||||
),
|
||||
right: LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"d",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 5,
|
||||
col: 16,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 5,
|
||||
col: 15,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 5,
|
||||
col: 13,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 5,
|
||||
col: 11,
|
||||
},
|
||||
},
|
||||
right: LocBox {
|
||||
inner: Literal(
|
||||
Number(
|
||||
Number {
|
||||
val: 2,
|
||||
base: 10,
|
||||
signed: false,
|
||||
},
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 5,
|
||||
col: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 5,
|
||||
col: 18,
|
||||
},
|
||||
},
|
||||
),
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 5,
|
||||
col: 4,
|
||||
},
|
||||
},
|
||||
),
|
||||
Statement(
|
||||
LocBox {
|
||||
inner: Let {
|
||||
name: Ident(
|
||||
"f",
|
||||
),
|
||||
typ: None,
|
||||
val: Some(
|
||||
LocBox {
|
||||
inner: BinOp {
|
||||
typ: Div,
|
||||
left: LocBox {
|
||||
inner: FieldAccess {
|
||||
left: Some(
|
||||
LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"a",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 6,
|
||||
col: 10,
|
||||
},
|
||||
},
|
||||
),
|
||||
right: LocBox {
|
||||
inner: FieldAccess {
|
||||
left: Some(
|
||||
LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"b",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 6,
|
||||
col: 12,
|
||||
},
|
||||
},
|
||||
),
|
||||
right: LocBox {
|
||||
inner: FieldAccess {
|
||||
left: Some(
|
||||
LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"c",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 6,
|
||||
col: 14,
|
||||
},
|
||||
},
|
||||
),
|
||||
right: LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"d",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 6,
|
||||
col: 16,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 6,
|
||||
col: 15,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 6,
|
||||
col: 13,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 6,
|
||||
col: 11,
|
||||
},
|
||||
},
|
||||
right: LocBox {
|
||||
inner: Literal(
|
||||
Number(
|
||||
Number {
|
||||
val: 2,
|
||||
base: 10,
|
||||
signed: false,
|
||||
},
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 6,
|
||||
col: 20,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 6,
|
||||
col: 18,
|
||||
},
|
||||
},
|
||||
),
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 6,
|
||||
col: 4,
|
||||
},
|
||||
},
|
||||
),
|
||||
Statement(
|
||||
LocBox {
|
||||
inner: Let {
|
||||
name: Ident(
|
||||
"g",
|
||||
),
|
||||
typ: None,
|
||||
val: Some(
|
||||
LocBox {
|
||||
inner: BinOp {
|
||||
typ: Star,
|
||||
left: LocBox {
|
||||
inner: ArrayIndex {
|
||||
name: LocBox {
|
||||
inner: FieldAccess {
|
||||
left: Some(
|
||||
LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"a",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 7,
|
||||
col: 10,
|
||||
},
|
||||
},
|
||||
),
|
||||
right: LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"b",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 7,
|
||||
col: 12,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 7,
|
||||
col: 11,
|
||||
},
|
||||
},
|
||||
index: LocBox {
|
||||
inner: UnOp {
|
||||
typ: Star,
|
||||
right: LocBox {
|
||||
inner: FieldAccess {
|
||||
left: Some(
|
||||
LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"a",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 7,
|
||||
col: 15,
|
||||
},
|
||||
},
|
||||
),
|
||||
right: LocBox {
|
||||
inner: Path(
|
||||
Path(
|
||||
[
|
||||
Ident(
|
||||
"c",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 7,
|
||||
col: 17,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 7,
|
||||
col: 16,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 7,
|
||||
col: 14,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 7,
|
||||
col: 13,
|
||||
},
|
||||
},
|
||||
right: LocBox {
|
||||
inner: Literal(
|
||||
Number(
|
||||
Number {
|
||||
val: 5,
|
||||
base: 10,
|
||||
signed: false,
|
||||
},
|
||||
),
|
||||
),
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 7,
|
||||
col: 22,
|
||||
},
|
||||
},
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 7,
|
||||
col: 20,
|
||||
},
|
||||
},
|
||||
),
|
||||
},
|
||||
loc: Loc {
|
||||
file: "parser/expressions.mcl",
|
||||
line: 7,
|
||||
col: 4,
|
||||
},
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
structs: {},
|
||||
enums: {},
|
||||
types: {},
|
||||
functions: {},
|
||||
member_functions: {},
|
||||
}
|
||||
Reference in New Issue
Block a user