Added: AS1/2 - underline errors in the code (also in edit mode)

This commit is contained in:
Jindra Petřík
2025-05-28 17:51:05 +02:00
parent d3dd8224d4
commit 479b61a7f1
10 changed files with 721 additions and 380 deletions
@@ -27,6 +27,11 @@ public abstract class ParseException extends Exception {
* Line number where the exception occurred.
*/
public long line;
/**
* Position in the code where the exception occured. -1 where unknown
*/
public long position = -1;
/**
* Text of the exception.
@@ -43,5 +48,19 @@ public abstract class ParseException extends Exception {
super("ParseException:" + text + " on line " + line);
this.line = line;
this.text = text;
this.position = -1;
}
/**
* Constructs a new parse exception.
*
* @param text Text of the exception
* @param line Line number where the exception occurred
*/
public ParseException(String text, long line, long position) {
super("ParseException:" + text + " on line " + line);
this.line = line;
this.text = text;
this.position = position;
}
}
@@ -33,4 +33,14 @@ public class ActionParseException extends ParseException {
public ActionParseException(String text, long line) {
super(text, line);
}
/**
* Constructs a new parse exception.
* @param text Text of the exception
* @param line Line number where the exception occurred
* @param position Position where the exception occured
*/
public ActionParseException(String text, long line, long position) {
super(text, line, position);
}
}
@@ -1914,7 +1914,7 @@ public final class ActionScriptLexer {
}
case 253: break;
case 74:
{ throw new ActionParseException("Illegal escape sequence \"" + yytext() + "\"", yyline + 1);
{ throw new ActionParseException("Illegal escape sequence \"" + yytext() + "\"", yyline + 1, yychar());
}
case 254: break;
case 75:
@@ -0,0 +1,46 @@
/*
* Copyright (C) 2010-2025 JPEXS, All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.parser.script.variables;
import com.jpexs.decompiler.flash.ParseException;
/**
* Exception for action parsing errors
*
* @author JPEXS
*/
public class ActionVariableParseException extends ParseException {
/**
* Constructs a new parse exception.
* @param text Text of the exception
* @param line Line number where the exception occurred
*/
public ActionVariableParseException(String text, long line) {
super(text, line);
}
/**
* Constructs a new parse exception.
* @param text Text of the exception
* @param line Line number where the exception occurred
* @param position Position where the exception occured
*/
public ActionVariableParseException(String text, long line, long position) {
super(text, line, position);
}
}