Package dev.frostlake.parser
Class SyntaxErrorListener
java.lang.Object
org.antlr.v4.runtime.BaseErrorListener
dev.frostlake.parser.SyntaxErrorListener
- All Implemented Interfaces:
org.antlr.v4.runtime.ANTLRErrorListener
public class SyntaxErrorListener
extends org.antlr.v4.runtime.BaseErrorListener
Custom ANTLR error listener that collects syntax errors and throws them in live Snowflake's
wording (live-verified): every error renders on its own line under the one compilation-error
prefix — a parser error as
syntax error line L at position P unexpected 'TOK'. (token
text verbatim, '<EOF>' at end of input), a lexer error (an unterminated literal or
quoted identifier — the lexer consumed to end of input) as
parse error line L at position P near '<EOF>'. positioned at the END of the input.
The raw ANTLR diagnostics ("mismatched input ... expecting ...") stay available through
SqlSyntaxException.getSyntaxErrors() and the logs.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanWhether the FIRST error was a block's statement ending without its semicolon: the engine read that statement whole, so no construct it does not know can explain the fault, and a CREATE may refuse the body as the account does.booleanvoidMark this listener as watching a whole STATEMENT, which enables the leading-token rule.voidsyntaxError(org.antlr.v4.runtime.Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, org.antlr.v4.runtime.RecognitionException e) voidMethods inherited from class org.antlr.v4.runtime.BaseErrorListener
reportAmbiguity, reportAttemptingFullContext, reportContextSensitivity
-
Constructor Details
-
SyntaxErrorListener
-
SyntaxErrorListener
-
-
Method Details
-
syntaxError
public void syntaxError(org.antlr.v4.runtime.Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, org.antlr.v4.runtime.RecognitionException e) - Specified by:
syntaxErrorin interfaceorg.antlr.v4.runtime.ANTLRErrorListener- Overrides:
syntaxErrorin classorg.antlr.v4.runtime.BaseErrorListener
-
firstErrorIsMissingTerminator
public boolean firstErrorIsMissingTerminator()Whether the FIRST error was a block's statement ending without its semicolon: the engine read that statement whole, so no construct it does not know can explain the fault, and a CREATE may refuse the body as the account does. -
hasErrors
public boolean hasErrors() -
getErrors
-
statementParse
public void statementParse()Mark this listener as watching a whole STATEMENT, which enables the leading-token rule. -
throwIfErrors
public void throwIfErrors()
-