Skip to content

Commit

Permalink
ignore multple unary op cases, like !!!true, or ---1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xffxff committed Sep 19, 2023
1 parent 66bec85 commit cef9a8a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 12 deletions.
2 changes: 2 additions & 0 deletions lox_tests/boolean.bytecode
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ Chunk {
False,
True,
Not,
False,
Not,
],
}
32 changes: 32 additions & 0 deletions lox_tests/boolean.execute
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,35 @@ stack: [
),
]

execute: False
stack: [
Boolean(
true,
),
Boolean(
false,
),
Boolean(
false,
),
Boolean(
false,
),
]

execute: Not
stack: [
Boolean(
true,
),
Boolean(
false,
),
Boolean(
false,
),
Boolean(
true,
),
]

2 changes: 1 addition & 1 deletion lox_tests/boolean.lox
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
true
false
!true
!!!true
!false
14 changes: 3 additions & 11 deletions lox_tests/boolean.syntax
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@ UnaryOp {
op: Bang,
expr: BooleanLiteral(true),
}
Diagnostic {
severity: Error,
span: @17..@18,
message: "extra tokens after expression",
labels: [
Label {
span: @17..@18,
message: "here",
},
],
children: [],
UnaryOp {
op: Bang,
expr: BooleanLiteral(false),
}

0 comments on commit cef9a8a

Please sign in to comment.