Fixed: #2466 AS1/2/3 Highlighter freezing - expression missing operand,

+ also fixed saving
This commit is contained in:
Jindra Petřík
2025-06-08 14:20:52 +02:00
parent 279801a54f
commit f4e3d99aea
5 changed files with 114 additions and 107 deletions
@@ -184,7 +184,7 @@ import java.util.Map;
public class ActionScript2Parser {
private static final GraphTargetDialect DIALECT = ActionGraphTargetDialect.INSTANCE;
/**
* Builtin classes that can be casted to
*/
@@ -1531,8 +1531,9 @@ public class ActionScript2Parser {
rhs = expressionPrimary(allowRemainder, inFunction, inMethod, inTellTarget, allowRemainder, variables, functions, true, hasEval);
if (rhs == null) {
lexer.pushback(op);
break;
throw new ActionParseException("Missing operand", lexer.yyline());
//lexer.pushback(op);
//break;
}
lookahead = peekLex();
@@ -36,7 +36,6 @@ import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -1145,13 +1144,17 @@ public class ActionScript2SimpleParser implements SimpleParser {
rhs = expressionPrimary(errors, inFunction, inMethod, inTellTarget, allowRemainder, variables, true, hasEval);
if (rhs == false) {
lexer.pushback(op);
break;
errors.add(new SimpleParseException("Missing operand", lexer.yyline(), op.position));
return false;
}
lookahead = peekLex();
while ((isBinaryOperator(lookahead) && getSymbPrecedence(lookahead) < /* > on wiki */ getSymbPrecedence(op))
|| (lookahead.type.isRightAssociative() && getSymbPrecedence(lookahead) == getSymbPrecedence(op))) {
rhs = expression1(errors, rhs, getSymbPrecedence(lookahead), inFunction, inMethod, inTellTarget, allowRemainder, variables, hasEval);
if (!rhs) {
break;
}
lookahead = peekLex();
}