Fix bug when minus op which goes after right parenthesis detected as part of number

This commit is contained in:
ChronosX88 2021-06-08 18:37:03 +03:00
parent 29fd0e58eb
commit c8ff935d97
Signed by: ChronosXYZ
GPG Key ID: 085A69A82C8C511A

View File

@ -51,18 +51,22 @@ public class Main {
}
case '+': {
token = new Token(TokenType.Operator, OperatorType.Add);
isLastCharOperator = true;
break;
}
case '-': {
token = new Token(TokenType.Operator, OperatorType.Sub);
isLastCharOperator = true;
break;
}
case '*': {
token = new Token(TokenType.Operator, OperatorType.Mul);
isLastCharOperator = true;
break;
}
case '/': {
token = new Token(TokenType.Operator, OperatorType.Div);
isLastCharOperator = true;
break;
}
case ')': {
@ -70,7 +74,6 @@ public class Main {
break;
}
}
isLastCharOperator = true;
}
tokens.add(token);
}