演算順位を修正
This commit is contained in:
@@ -44,6 +44,9 @@ FOR I=0 TO 100
|
|||||||
ENDIF
|
ENDIF
|
||||||
ENDIF
|
ENDIF
|
||||||
NEXT
|
NEXT
|
||||||
|
?1 AND 1 OR 1 AND 0
|
||||||
|
?(1 OR 2 XOR 3)
|
||||||
|
?(1 OR 2 XOR 3 OR 4)
|
||||||
?@HELLOWORLD
|
?@HELLOWORLD
|
||||||
GOSUB @A
|
GOSUB @A
|
||||||
END
|
END
|
||||||
|
|||||||
@@ -278,10 +278,13 @@ class Parser
|
|||||||
this.code = input;
|
this.code = input;
|
||||||
lex = new Lexical(input);
|
lex = new Lexical(input);
|
||||||
}
|
}
|
||||||
|
const int opMax = 11;
|
||||||
int getOPRank(TokenType type)
|
int getOPRank(TokenType type)
|
||||||
{
|
{
|
||||||
switch(type)
|
switch(type)
|
||||||
{
|
{
|
||||||
|
version(none)
|
||||||
|
{
|
||||||
case TokenType.LogicalAnd:
|
case TokenType.LogicalAnd:
|
||||||
case TokenType.LogicalOr:
|
case TokenType.LogicalOr:
|
||||||
return 8;//&&,||
|
return 8;//&&,||
|
||||||
@@ -289,6 +292,17 @@ class Parser
|
|||||||
case TokenType.Or:
|
case TokenType.Or:
|
||||||
case TokenType.Xor:
|
case TokenType.Xor:
|
||||||
return 7;//AND,OR,XOR
|
return 7;//AND,OR,XOR
|
||||||
|
}
|
||||||
|
case TokenType.LogicalAnd:
|
||||||
|
return 10;//&&,||
|
||||||
|
case TokenType.LogicalOr:
|
||||||
|
return 11;//&&,||
|
||||||
|
case TokenType.And:
|
||||||
|
return 7;//AND,OR,XOR
|
||||||
|
case TokenType.Or:
|
||||||
|
return 9-1;//AND,OR,XOR
|
||||||
|
case TokenType.Xor:
|
||||||
|
return 9;//AND,OR,XOR
|
||||||
case TokenType.Equal:
|
case TokenType.Equal:
|
||||||
case TokenType.NotEqual:
|
case TokenType.NotEqual:
|
||||||
case TokenType.Less:
|
case TokenType.Less:
|
||||||
@@ -684,7 +698,7 @@ class Parser
|
|||||||
Expression expression()
|
Expression expression()
|
||||||
{
|
{
|
||||||
Expression node = null;
|
Expression node = null;
|
||||||
return term(8, node);
|
return term(opMax, node);
|
||||||
}
|
}
|
||||||
Expression term(int order, Expression node)
|
Expression term(int order, Expression node)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user