Skip to content

Commit e065e9a

Browse files
committed
fix logical NOT UnaryOp
1 parent e1997ce commit e065e9a

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

include/rift/parser.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace rift {
2626
*
2727
* arithmetic_expression : term (('+' | '-') term)*
2828
* term : factor (('*' | '/' | '%') factor)*
29-
* factor : ('+' | '-') factor
29+
* factor : ('+' | '-' | '!') factor
3030
* : power
3131
*
3232
* power : call ('^' factor)*

src/parser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ namespace rift {
159159

160160
Result<Node*> Parser::parseFactor() {
161161
switch (m_currentToken.type) {
162+
case TokenType::NOT:
162163
case TokenType::PLUS:
163164
case TokenType::MINUS: {
164165
auto type = m_currentToken.type;

test/main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ int main() {
9595
RIFT_TEST_CASE("{float('3.14')} {int('100')} {str(3.1415926)} {int('ABC')}", "3.14 100 3.14 NaN");
9696
RIFT_TEST_CASE("{precision(float('3.149268') * 1.5, 6)}", "4.723902");
9797
RIFT_TEST_CASE("{'*' * 5} {4 * '*'} {'*' * 3.0} {2.0 * '*'}", "***** **** *** **");
98+
RIFT_TEST_CASE("{!value} {!true} {!false} {!nullval}", "false false true true", { VALUE("value", true) });
9899
}
99100

100101
// Show the results

0 commit comments

Comments
 (0)