This is an automated email from the ASF dual-hosted git repository. joshtynjala pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
commit 03c6df8b8e5e9e9612d81219bd3ebba7117e6209 Author: Josh Tynjala <[email protected]> AuthorDate: Tue Apr 23 10:40:09 2024 -0700 CSSDocument: parser, lexer, and tree walker can add ICompilerProblem instead of just CSSParserProblem This will allow problems to be detected that Antlr can't do on its own --- .../src/main/antlr3/org/apache/royale/compiler/internal/css/CSS.g | 6 ++++-- .../main/antlr3/org/apache/royale/compiler/internal/css/CSSTree.g | 3 ++- .../java/org/apache/royale/compiler/internal/css/CSSDocument.java | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/compiler/src/main/antlr3/org/apache/royale/compiler/internal/css/CSS.g b/compiler/src/main/antlr3/org/apache/royale/compiler/internal/css/CSS.g index 2c118bb30..28bdf8887 100644 --- a/compiler/src/main/antlr3/org/apache/royale/compiler/internal/css/CSS.g +++ b/compiler/src/main/antlr3/org/apache/royale/compiler/internal/css/CSS.g @@ -62,6 +62,7 @@ package org.apache.royale.compiler.internal.css; import java.util.Map; import java.util.HashMap; import org.apache.royale.compiler.problems.CSSParserProblem; +import org.apache.royale.compiler.problems.ICompilerProblem; } @lexer::header @@ -69,6 +70,7 @@ import org.apache.royale.compiler.problems.CSSParserProblem; package org.apache.royale.compiler.internal.css; import org.apache.royale.compiler.problems.CSSParserProblem; +import org.apache.royale.compiler.problems.ICompilerProblem; } @lexer::members @@ -77,7 +79,7 @@ import org.apache.royale.compiler.problems.CSSParserProblem; /** * Lexer problems. */ -protected List<CSSParserProblem> problems = new ArrayList<CSSParserProblem>(); +protected List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>(); /** * Collect lexer problems. @@ -95,7 +97,7 @@ public void displayRecognitionError(String[] tokenNames, RecognitionException e) /** * Parser problems. */ -protected List<CSSParserProblem> problems = new ArrayList<CSSParserProblem>(); +protected List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>(); /** * Collect parser problems. diff --git a/compiler/src/main/antlr3/org/apache/royale/compiler/internal/css/CSSTree.g b/compiler/src/main/antlr3/org/apache/royale/compiler/internal/css/CSSTree.g index ad9e63f6c..cbb545d49 100644 --- a/compiler/src/main/antlr3/org/apache/royale/compiler/internal/css/CSSTree.g +++ b/compiler/src/main/antlr3/org/apache/royale/compiler/internal/css/CSSTree.g @@ -57,6 +57,7 @@ import java.util.Map; import java.util.HashMap; import org.apache.royale.compiler.css.*; import org.apache.royale.compiler.problems.CSSParserProblem; +import org.apache.royale.compiler.problems.ICompilerProblem; } @@ -76,7 +77,7 @@ private final TokenStream tokenStream = getTreeNodeStream().getTokenStream(); /** * Tree walker problems. */ -protected List<CSSParserProblem> problems = new ArrayList<CSSParserProblem>(); +protected List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>(); /** * Used for building up attribute selector strings until we implement a data diff --git a/compiler/src/main/java/org/apache/royale/compiler/internal/css/CSSDocument.java b/compiler/src/main/java/org/apache/royale/compiler/internal/css/CSSDocument.java index 91e467027..8e9c7c925 100644 --- a/compiler/src/main/java/org/apache/royale/compiler/internal/css/CSSDocument.java +++ b/compiler/src/main/java/org/apache/royale/compiler/internal/css/CSSDocument.java @@ -244,7 +244,7 @@ public class CSSDocument extends CSSNodeBase implements ICSSDocument return namespacesLookup.get(DEFAULT_NAMESPACE_SHORT_NAME); } - private static boolean hasErrors(Collection<CSSParserProblem> problems) { + private static boolean hasErrors(Collection<ICompilerProblem> problems) { CompilerProblemCategorizer categorizer = new CompilerProblemCategorizer(null); for (ICompilerProblem problem : problems) { CompilerProblemSeverity severity = categorizer.getProblemSeverity(problem);
