Fixed: AS3 direct editation - NaN can be used as identifier

This commit is contained in:
Jindra Petřík
2025-05-31 13:17:23 +02:00
parent 7588307dd0
commit 236c3b9e6a
6 changed files with 998 additions and 1007 deletions

View File

@@ -50,6 +50,7 @@ All notable changes to this project will be documented in this file.
- [#2461] SVG export - incorrect clipping / missing shapes
- AS1/2 direct editation - Position in the code should stay same after clicking Edit button
- AS3 direct editation - Allow internal keyword on script traits (e.g. classes)
- AS3 direct editation - NaN can be used as identifier
## [23.0.1] - 2025-05-16
### Fixed

View File

@@ -297,7 +297,7 @@ RegExp = \/([^\r\n/]|\\\/)+\/[a-z]*
"true" { return new ParsedSymbol(yychar(), SymbolGroup.KEYWORD, SymbolType.TRUE, yytext()); }
"undefined" { return new ParsedSymbol(yychar(), SymbolGroup.GLOBALCONST, SymbolType.UNDEFINED, yytext()); }
"Infinity" { return new ParsedSymbol(yychar(), SymbolGroup.GLOBALCONST, SymbolType.INFINITY, yytext()); }
"NaN" { return new ParsedSymbol(yychar(), SymbolGroup.GLOBALCONST, SymbolType.NAN, yytext()); }
/* "NaN" { return new ParsedSymbol(yychar(), SymbolGroup.GLOBALCONST, SymbolType.NAN, yytext()); } */
"final" { return new ParsedSymbol(yychar(), SymbolGroup.IDENTIFIER, SymbolType.FINAL, yytext()); }
"native" { return new ParsedSymbol(yychar(), SymbolGroup.IDENTIFIER, SymbolType.NATIVE, yytext()); }

View File

@@ -2587,10 +2587,10 @@ public class ActionScript3Parser {
ret = function(allOpenedNamespaces, new ArrayList<>(), pkg, false, false, needsActivation, importedClasses, thisType, openedNamespaces, fname, false, variables, abc);
allowMemberOrCall = true;
break;
case NAN:
/*case NAN:
ret = new NanAVM2Item(null, null);
break;
break;*/
case INFINITY:
ret = new DoubleValueAVM2Item(null, null, Double.POSITIVE_INFINITY);

View File

@@ -1872,9 +1872,9 @@ public class ActionScript3SimpleParser implements SimpleParser {
ret = true;
allowMemberOrCall = true;
break;
case NAN:
/*case NAN:
ret = true;
break;
break;*/
case INFINITY:
ret = true;
break;

View File

@@ -503,10 +503,9 @@ public enum SymbolType {
* Other: undefined
*/
UNDEFINED(GraphTargetItem.PRECEDENCE_PRIMARY, false),
/**
* Other: NaN
*/
NAN(GraphTargetItem.PRECEDENCE_PRIMARY, false),
//NAN(GraphTargetItem.PRECEDENCE_PRIMARY, false),
/**
* Keyword: final
*/