Documentation ¶
Index ¶
Constants ¶
const COMBINED = grammarType("COMBINED")
const LEXER = grammarType("LEXER")
const PARSER = grammarType("PARSER")
Variables ¶
This section is empty.
Functions ¶
func PrintAllTokens ¶
PrintAllTokens consumes all the tokens from the lexer and prints them to stdout.
Types ¶
type CaseChangingStream ¶
type CaseChangingStream struct { antlr.CharStream // contains filtered or unexported fields }
CaseChangingStream wraps an existing CharStream, but upper cases, or lower cases the input before it is tokenized.
It would be useful if this was part of the core antlr library, but it was rejected in https://github.com/antlr/antlr4/pull/2046 as users can trivial strings.ToUpper(...) the input, or write their own version of this stream.
func NewCaseChangingStream ¶
func NewCaseChangingStream(in antlr.CharStream, upper bool) *CaseChangingStream
func (*CaseChangingStream) LA ¶
func (is *CaseChangingStream) LA(offset int) int
type Grammar ¶
type Grammar struct { Name string // name of this grammar Filename string Type grammarType // one of PARSER, LEXER or COMBINED }
Grammar represents a Antlr G4 grammar file.
func (*Grammar) DependentFilenames ¶
func (*Grammar) GeneratedFilenames ¶
GeneratedFilenames returns the list of generated files.
type Project ¶
type Project struct { FileName string // Filename of the pom.xml. LongName string // Name of the grammar defined in the pom.xml Includes []string // List of included g4 files Grammars []*Grammar // Parsed grammars // Test related info EntryPoint string Examples []string CaseInsensitiveType string FoundAntlr4MavenPlugin bool // Did we find the Antlr Maven plugin? }
Project represents one of language grammars defined by a pom.xml file and a set of g4 files.
func (*Project) AddGrammar ¶
func (*Project) GeneratedFilenames ¶
GeneratedFilenames returns the list of generated files.
func (*Project) ListenerName ¶
ListenerName returns the name of the of the generated Listener. See https://github.com/antlr/antlr4/blob/master/tool/src/org/antlr/v4/codegen/target/GoTarget.java#L168
func (*Project) ParserName ¶
ParserName returns the name of the generated Parser.
type TestingErrorListener ¶
type TestingErrorListener struct { *antlr.DefaultErrorListener // contains filtered or unexported fields }
TestingErrorListener is a antlr.ErrorListener which fails a given test if a SyntaxError is found. The other Report errors are ignored.
func NewTestingErrorListener ¶
func NewTestingErrorListener(t *testing.T, name string) *TestingErrorListener
func (*TestingErrorListener) SyntaxError ¶
func (l *TestingErrorListener) SyntaxError(recognizer antlr.Recognizer, offendingSymbol interface{}, line, column int, msg string, e antlr.RecognitionException)