ErrorListener class

LG parser error listener.

Constructors

ErrorListener(string, number)

Creates a new instance of the ErrorListener class.

Methods

syntaxError<T>(Recognizer<T, any>, any, number, number, string, RecognitionException | undefined)

Notifies any interested parties upon a syntax error.

Constructor Details

ErrorListener(string, number)

Creates a new instance of the ErrorListener class.

new ErrorListener(errorSource: string, lineOffset?: number)

Parameters

errorSource

string

String value that represents the source of the error.

lineOffset

number

Offset of the line where the error occurred.

Method Details

syntaxError<T>(Recognizer<T, any>, any, number, number, string, RecognitionException | undefined)

Notifies any interested parties upon a syntax error.

function syntaxError<T>(recognizer: Recognizer<T, any>, offendingSymbol: any, line: number, charPositionInLine: number, msg: string, e: RecognitionException | undefined)

Parameters

recognizer

Recognizer<T, any>

What parser got the error. From this object, you can access the context as well as the input stream.

offendingSymbol

any

Offending token in the input token stream, unless recognizer is a lexer (then it's null).

line

number

Line number in the input where the error occurred.

charPositionInLine

number

Character position within the line where the error occurred.

msg

string

Message to emit.

e

RecognitionException | undefined

Exception.