Properly handle unary operators at beginning of statement.
This commit is contained in:
parent
7c6b444616
commit
231584824a
@ -8,6 +8,7 @@ Bug fixes
|
|||||||
---------
|
---------
|
||||||
|
|
||||||
* `0.0` now prints correctly (used to print `0e0`).
|
* `0.0` now prints correctly (used to print `0e0`).
|
||||||
|
* Unary operators are now properly recognized as an expression statement.
|
||||||
|
|
||||||
|
|
||||||
Version 1.1.1
|
Version 1.1.1
|
||||||
|
51
src/token.rs
51
src/token.rs
@ -805,55 +805,56 @@ impl Token {
|
|||||||
|
|
||||||
match self {
|
match self {
|
||||||
LexError(_) |
|
LexError(_) |
|
||||||
LeftBrace | // {+expr} - is unary
|
SemiColon | // ; - is unary
|
||||||
|
Comma | // ( ... , -expr ) - is unary
|
||||||
|
//Period |
|
||||||
|
LeftBrace | // { -expr } - is unary
|
||||||
// RightBrace | { expr } - expr not unary & is closing
|
// RightBrace | { expr } - expr not unary & is closing
|
||||||
LeftParen | // ( -expr ) - is unary
|
LeftParen | // ( -expr ) - is unary
|
||||||
// RightParen | (expr) - expr not unary & is closing
|
// RightParen | // ( expr ) - expr not unary & is closing
|
||||||
LeftBracket | // [ -expr ] - is unary
|
LeftBracket | // [ -expr ] - is unary
|
||||||
// RightBracket | [expr] - expr not unary & is closing
|
// RightBracket | // [ expr ] - expr not unary & is closing
|
||||||
Plus |
|
Plus |
|
||||||
|
PlusAssign |
|
||||||
UnaryPlus |
|
UnaryPlus |
|
||||||
Minus |
|
Minus |
|
||||||
|
MinusAssign |
|
||||||
UnaryMinus |
|
UnaryMinus |
|
||||||
Multiply |
|
Multiply |
|
||||||
|
MultiplyAssign |
|
||||||
Divide |
|
Divide |
|
||||||
Comma |
|
DivideAssign |
|
||||||
Period |
|
Modulo |
|
||||||
|
ModuloAssign |
|
||||||
|
PowerOf |
|
||||||
|
PowerOfAssign |
|
||||||
|
LeftShift |
|
||||||
|
LeftShiftAssign |
|
||||||
|
RightShift |
|
||||||
|
RightShiftAssign |
|
||||||
Equals |
|
Equals |
|
||||||
|
EqualsTo |
|
||||||
|
NotEqualsTo |
|
||||||
LessThan |
|
LessThan |
|
||||||
GreaterThan |
|
GreaterThan |
|
||||||
Bang |
|
Bang |
|
||||||
LessThanEqualsTo |
|
LessThanEqualsTo |
|
||||||
GreaterThanEqualsTo |
|
GreaterThanEqualsTo |
|
||||||
EqualsTo |
|
|
||||||
NotEqualsTo |
|
|
||||||
Pipe |
|
Pipe |
|
||||||
Or |
|
|
||||||
Ampersand |
|
Ampersand |
|
||||||
And |
|
|
||||||
If |
|
If |
|
||||||
Do |
|
//Do |
|
||||||
While |
|
While |
|
||||||
Until |
|
Until |
|
||||||
PlusAssign |
|
In |
|
||||||
MinusAssign |
|
And |
|
||||||
MultiplyAssign |
|
|
||||||
DivideAssign |
|
|
||||||
LeftShiftAssign |
|
|
||||||
RightShiftAssign |
|
|
||||||
PowerOf |
|
|
||||||
PowerOfAssign |
|
|
||||||
AndAssign |
|
AndAssign |
|
||||||
|
Or |
|
||||||
OrAssign |
|
OrAssign |
|
||||||
XOrAssign |
|
|
||||||
LeftShift |
|
|
||||||
RightShift |
|
|
||||||
XOr |
|
XOr |
|
||||||
Modulo |
|
XOrAssign |
|
||||||
ModuloAssign |
|
|
||||||
Return |
|
Return |
|
||||||
Throw |
|
Throw => true,
|
||||||
In => true,
|
|
||||||
|
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user