Version: v0.6.10 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2021 License: BSD-3-Clause Imports: 2 Imported by: 0



Package listener adds semantic error handling to a standard antlr.DiagnosticListener and conforms to the go error handling infrastructure



This section is empty.


This section is empty.


This section is empty.


type Diagnostic

type Diagnostic struct {
	Type    string
	Path    string
	Line    int
	Column  int
	Message string

Diagnostic represents a locatable error in an FSE spec

func (Diagnostic) String

func (d Diagnostic) String() string

type Listener

type Listener struct {
	Path string
	Diagnostics []Diagnostic

Listener records and logs syntax errors produced by the antlr4 parser

func New

func New(path string) *Listener

New creates a new Listener

func (*Listener) Error

func (el *Listener) Error() string

Error makes Listener itself an error

func (*Listener) ErrorCount

func (el *Listener) ErrorCount() int

ErrorCount counts the number of Diagnostic messages

func (*Listener) SemErr

func (el *Listener) SemErr(
	offendingToken antlr.Token,
	msg string,

SemErr logs a semantic error

func (*Listener) SemanticError

func (el *Listener) SemanticError(
	line, column int,
	msg string,

SemanticError logs a semantic error

func (*Listener) SyntaxError

func (el *Listener) SyntaxError(
	recognizer antlr.Recognizer,
	offendingSymbol interface{},
	line, column int,
	msg string,
	e antlr.RecognitionException,

SyntaxError implements an interface method of antlr.DiagnosticListener

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL