Fixed AS - direct editation - long integer values

This commit is contained in:
Jindra Petřík
2021-11-29 11:57:56 +01:00
parent 5cd2b9d6c0
commit 0ef76b8860
5 changed files with 35 additions and 10 deletions

View File

@@ -358,13 +358,20 @@ Preprocessor = \u00A7\u00A7 {Identifier}
/* numeric literals */
{DecIntegerLiteral} { return new ParsedSymbol(SymbolGroup.INTEGER, SymbolType.INTEGER, Long.parseLong((yytext()))); }
{DecIntegerLiteral} {
try{
return new ParsedSymbol(SymbolGroup.INTEGER, SymbolType.INTEGER, Long.parseLong(yytext()));
} catch(NumberFormatException nfe){
//its too long for a Long var
return new ParsedSymbol(SymbolGroup.DOUBLE, SymbolType.DOUBLE, Double.parseDouble(yytext()));
}
}
{HexIntegerLiteral} { return new ParsedSymbol(SymbolGroup.INTEGER, SymbolType.INTEGER, Long.parseLong(yytext().substring(2), 16)); }
{OctIntegerLiteral} { return new ParsedSymbol(SymbolGroup.INTEGER, SymbolType.INTEGER, Long.parseLong(yytext(), 8)); }
{DoubleLiteral} { return new ParsedSymbol(SymbolGroup.DOUBLE, SymbolType.DOUBLE, Double.parseDouble((yytext()))); }
{DoubleLiteral} { return new ParsedSymbol(SymbolGroup.DOUBLE, SymbolType.DOUBLE, Double.parseDouble(yytext())); }
/* comments */
{Comment} { yyline += count(yytext(),"\n"); }