gml

package
v0.0.0-...-4c43aeb Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Example
package main

import (
	"bramp.net/antlr4/gml"

	"fmt"
	"github.com/antlr/antlr4/runtime/Go/antlr"
)

type exampleListener struct {
	*gml.BasegmlListener
}

func (l *exampleListener) EnterEveryRule(ctx antlr.ParserRuleContext) {
	fmt.Println(ctx.GetText())
}
func main() {
	// Setup the input
	is := antlr.NewInputStream("...some text to parse...")

	// Create the Lexer
	lexer := gml.NewgmlLexer(is)
	stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel)

	// Create the Parser
	p := gml.NewgmlParser(stream)
	p.BuildParseTrees = true
	p.AddErrorListener(antlr.NewDiagnosticErrorListener(true))

	// Finally walk the tree
	tree := p.Graph()
	antlr.ParseTreeWalkerDefault.Walk(&exampleListener{}, tree)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewgmlLexer

func NewgmlLexer(input antlr.CharStream) *gmlLexer

func NewgmlParser

func NewgmlParser(input antlr.TokenStream) *gmlParser

Types

type BasegmlListener

type BasegmlListener struct{}

BasegmlListener is a complete listener for a parse tree produced by gmlParser.

func (*BasegmlListener) EnterEveryRule

func (s *BasegmlListener) EnterEveryRule(ctx antlr.ParserRuleContext)

EnterEveryRule is called when any rule is entered.

func (*BasegmlListener) EnterGraph

func (s *BasegmlListener) EnterGraph(ctx *GraphContext)

EnterGraph is called when production graph is entered.

func (*BasegmlListener) EnterInteger

func (s *BasegmlListener) EnterInteger(ctx *IntegerContext)

EnterInteger is called when production integer is entered.

func (*BasegmlListener) EnterKey

func (s *BasegmlListener) EnterKey(ctx *KeyContext)

EnterKey is called when production key is entered.

func (*BasegmlListener) EnterKv

func (s *BasegmlListener) EnterKv(ctx *KvContext)

EnterKv is called when production kv is entered.

func (*BasegmlListener) EnterList

func (s *BasegmlListener) EnterList(ctx *ListContext)

EnterList is called when production list is entered.

func (*BasegmlListener) EnterRealnum

func (s *BasegmlListener) EnterRealnum(ctx *RealnumContext)

EnterRealnum is called when production realnum is entered.

func (*BasegmlListener) EnterStr

func (s *BasegmlListener) EnterStr(ctx *StrContext)

EnterStr is called when production str is entered.

func (*BasegmlListener) EnterStringliteral

func (s *BasegmlListener) EnterStringliteral(ctx *StringliteralContext)

EnterStringliteral is called when production stringliteral is entered.

func (*BasegmlListener) EnterValue

func (s *BasegmlListener) EnterValue(ctx *ValueContext)

EnterValue is called when production value is entered.

func (*BasegmlListener) ExitEveryRule

func (s *BasegmlListener) ExitEveryRule(ctx antlr.ParserRuleContext)

ExitEveryRule is called when any rule is exited.

func (*BasegmlListener) ExitGraph

func (s *BasegmlListener) ExitGraph(ctx *GraphContext)

ExitGraph is called when production graph is exited.

func (*BasegmlListener) ExitInteger

func (s *BasegmlListener) ExitInteger(ctx *IntegerContext)

ExitInteger is called when production integer is exited.

func (*BasegmlListener) ExitKey

func (s *BasegmlListener) ExitKey(ctx *KeyContext)

ExitKey is called when production key is exited.

func (*BasegmlListener) ExitKv

func (s *BasegmlListener) ExitKv(ctx *KvContext)

ExitKv is called when production kv is exited.

func (*BasegmlListener) ExitList

func (s *BasegmlListener) ExitList(ctx *ListContext)

ExitList is called when production list is exited.

func (*BasegmlListener) ExitRealnum

func (s *BasegmlListener) ExitRealnum(ctx *RealnumContext)

ExitRealnum is called when production realnum is exited.

func (*BasegmlListener) ExitStr

func (s *BasegmlListener) ExitStr(ctx *StrContext)

ExitStr is called when production str is exited.

func (*BasegmlListener) ExitStringliteral

func (s *BasegmlListener) ExitStringliteral(ctx *StringliteralContext)

ExitStringliteral is called when production stringliteral is exited.

func (*BasegmlListener) ExitValue

func (s *BasegmlListener) ExitValue(ctx *ValueContext)

ExitValue is called when production value is exited.

func (*BasegmlListener) VisitErrorNode

func (s *BasegmlListener) VisitErrorNode(node antlr.ErrorNode)

VisitErrorNode is called when an error node is visited.

func (*BasegmlListener) VisitTerminal

func (s *BasegmlListener) VisitTerminal(node antlr.TerminalNode)

VisitTerminal is called when a terminal node is visited.

type GraphContext

type GraphContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyGraphContext

func NewEmptyGraphContext() *GraphContext

func NewGraphContext

func NewGraphContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *GraphContext

func (*GraphContext) AllKv

func (s *GraphContext) AllKv() []IKvContext

func (*GraphContext) EnterRule

func (s *GraphContext) EnterRule(listener antlr.ParseTreeListener)

func (*GraphContext) ExitRule

func (s *GraphContext) ExitRule(listener antlr.ParseTreeListener)

func (*GraphContext) GetParser

func (s *GraphContext) GetParser() antlr.Parser

func (*GraphContext) GetRuleContext

func (s *GraphContext) GetRuleContext() antlr.RuleContext

func (*GraphContext) IsGraphContext

func (*GraphContext) IsGraphContext()

func (*GraphContext) Kv

func (s *GraphContext) Kv(i int) IKvContext

func (*GraphContext) ToStringTree

func (s *GraphContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type IGraphContext

type IGraphContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsGraphContext differentiates from other interfaces.
	IsGraphContext()
}

IGraphContext is an interface to support dynamic dispatch.

type IIntegerContext

type IIntegerContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsIntegerContext differentiates from other interfaces.
	IsIntegerContext()
}

IIntegerContext is an interface to support dynamic dispatch.

type IKeyContext

type IKeyContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsKeyContext differentiates from other interfaces.
	IsKeyContext()
}

IKeyContext is an interface to support dynamic dispatch.

type IKvContext

type IKvContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsKvContext differentiates from other interfaces.
	IsKvContext()
}

IKvContext is an interface to support dynamic dispatch.

type IListContext

type IListContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsListContext differentiates from other interfaces.
	IsListContext()
}

IListContext is an interface to support dynamic dispatch.

type IRealnumContext

type IRealnumContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsRealnumContext differentiates from other interfaces.
	IsRealnumContext()
}

IRealnumContext is an interface to support dynamic dispatch.

type IStrContext

type IStrContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsStrContext differentiates from other interfaces.
	IsStrContext()
}

IStrContext is an interface to support dynamic dispatch.

type IStringliteralContext

type IStringliteralContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsStringliteralContext differentiates from other interfaces.
	IsStringliteralContext()
}

IStringliteralContext is an interface to support dynamic dispatch.

type IValueContext

type IValueContext interface {
	antlr.ParserRuleContext

	// GetParser returns the parser.
	GetParser() antlr.Parser

	// IsValueContext differentiates from other interfaces.
	IsValueContext()
}

IValueContext is an interface to support dynamic dispatch.

type IntegerContext

type IntegerContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyIntegerContext

func NewEmptyIntegerContext() *IntegerContext

func NewIntegerContext

func NewIntegerContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *IntegerContext

func (*IntegerContext) AllDIGIT

func (s *IntegerContext) AllDIGIT() []antlr.TerminalNode

func (*IntegerContext) DIGIT

func (s *IntegerContext) DIGIT(i int) antlr.TerminalNode

func (*IntegerContext) EnterRule

func (s *IntegerContext) EnterRule(listener antlr.ParseTreeListener)

func (*IntegerContext) ExitRule

func (s *IntegerContext) ExitRule(listener antlr.ParseTreeListener)

func (*IntegerContext) GetParser

func (s *IntegerContext) GetParser() antlr.Parser

func (*IntegerContext) GetRuleContext

func (s *IntegerContext) GetRuleContext() antlr.RuleContext

func (*IntegerContext) IsIntegerContext

func (*IntegerContext) IsIntegerContext()

func (*IntegerContext) SIGN

func (s *IntegerContext) SIGN() antlr.TerminalNode

func (*IntegerContext) ToStringTree

func (s *IntegerContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type KeyContext

type KeyContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyKeyContext

func NewEmptyKeyContext() *KeyContext

func NewKeyContext

func NewKeyContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *KeyContext

func (*KeyContext) EnterRule

func (s *KeyContext) EnterRule(listener antlr.ParseTreeListener)

func (*KeyContext) ExitRule

func (s *KeyContext) ExitRule(listener antlr.ParseTreeListener)

func (*KeyContext) GetParser

func (s *KeyContext) GetParser() antlr.Parser

func (*KeyContext) GetRuleContext

func (s *KeyContext) GetRuleContext() antlr.RuleContext

func (*KeyContext) IsKeyContext

func (*KeyContext) IsKeyContext()

func (*KeyContext) ToStringTree

func (s *KeyContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

func (*KeyContext) VALUE

func (s *KeyContext) VALUE() antlr.TerminalNode

type KvContext

type KvContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyKvContext

func NewEmptyKvContext() *KvContext

func NewKvContext

func NewKvContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *KvContext

func (*KvContext) EnterRule

func (s *KvContext) EnterRule(listener antlr.ParseTreeListener)

func (*KvContext) ExitRule

func (s *KvContext) ExitRule(listener antlr.ParseTreeListener)

func (*KvContext) GetParser

func (s *KvContext) GetParser() antlr.Parser

func (*KvContext) GetRuleContext

func (s *KvContext) GetRuleContext() antlr.RuleContext

func (*KvContext) IsKvContext

func (*KvContext) IsKvContext()

func (*KvContext) Key

func (s *KvContext) Key() IKeyContext

func (*KvContext) ToStringTree

func (s *KvContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

func (*KvContext) Value

func (s *KvContext) Value() IValueContext

type ListContext

type ListContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyListContext

func NewEmptyListContext() *ListContext

func NewListContext

func NewListContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ListContext

func (*ListContext) AllKv

func (s *ListContext) AllKv() []IKvContext

func (*ListContext) EnterRule

func (s *ListContext) EnterRule(listener antlr.ParseTreeListener)

func (*ListContext) ExitRule

func (s *ListContext) ExitRule(listener antlr.ParseTreeListener)

func (*ListContext) GetParser

func (s *ListContext) GetParser() antlr.Parser

func (*ListContext) GetRuleContext

func (s *ListContext) GetRuleContext() antlr.RuleContext

func (*ListContext) IsListContext

func (*ListContext) IsListContext()

func (*ListContext) Kv

func (s *ListContext) Kv(i int) IKvContext

func (*ListContext) ToStringTree

func (s *ListContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type RealnumContext

type RealnumContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyRealnumContext

func NewEmptyRealnumContext() *RealnumContext

func NewRealnumContext

func NewRealnumContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RealnumContext

func (*RealnumContext) EnterRule

func (s *RealnumContext) EnterRule(listener antlr.ParseTreeListener)

func (*RealnumContext) ExitRule

func (s *RealnumContext) ExitRule(listener antlr.ParseTreeListener)

func (*RealnumContext) GetParser

func (s *RealnumContext) GetParser() antlr.Parser

func (*RealnumContext) GetRuleContext

func (s *RealnumContext) GetRuleContext() antlr.RuleContext

func (*RealnumContext) IsRealnumContext

func (*RealnumContext) IsRealnumContext()

func (*RealnumContext) REAL

func (s *RealnumContext) REAL() antlr.TerminalNode

func (*RealnumContext) ToStringTree

func (s *RealnumContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type StrContext

type StrContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyStrContext

func NewEmptyStrContext() *StrContext

func NewStrContext

func NewStrContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *StrContext

func (*StrContext) EnterRule

func (s *StrContext) EnterRule(listener antlr.ParseTreeListener)

func (*StrContext) ExitRule

func (s *StrContext) ExitRule(listener antlr.ParseTreeListener)

func (*StrContext) GetParser

func (s *StrContext) GetParser() antlr.Parser

func (*StrContext) GetRuleContext

func (s *StrContext) GetRuleContext() antlr.RuleContext

func (*StrContext) IsStrContext

func (*StrContext) IsStrContext()

func (*StrContext) ToStringTree

func (s *StrContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

func (*StrContext) VALUE

func (s *StrContext) VALUE() antlr.TerminalNode

type StringliteralContext

type StringliteralContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyStringliteralContext

func NewEmptyStringliteralContext() *StringliteralContext

func NewStringliteralContext

func NewStringliteralContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *StringliteralContext

func (*StringliteralContext) EnterRule

func (s *StringliteralContext) EnterRule(listener antlr.ParseTreeListener)

func (*StringliteralContext) ExitRule

func (s *StringliteralContext) ExitRule(listener antlr.ParseTreeListener)

func (*StringliteralContext) GetParser

func (s *StringliteralContext) GetParser() antlr.Parser

func (*StringliteralContext) GetRuleContext

func (s *StringliteralContext) GetRuleContext() antlr.RuleContext

func (*StringliteralContext) IsStringliteralContext

func (*StringliteralContext) IsStringliteralContext()

func (*StringliteralContext) STRINGLITERAL

func (s *StringliteralContext) STRINGLITERAL() antlr.TerminalNode

func (*StringliteralContext) ToStringTree

func (s *StringliteralContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

type ValueContext

type ValueContext struct {
	*antlr.BaseParserRuleContext
	// contains filtered or unexported fields
}

func NewEmptyValueContext

func NewEmptyValueContext() *ValueContext

func NewValueContext

func NewValueContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ValueContext

func (*ValueContext) EnterRule

func (s *ValueContext) EnterRule(listener antlr.ParseTreeListener)

func (*ValueContext) ExitRule

func (s *ValueContext) ExitRule(listener antlr.ParseTreeListener)

func (*ValueContext) GetParser

func (s *ValueContext) GetParser() antlr.Parser

func (*ValueContext) GetRuleContext

func (s *ValueContext) GetRuleContext() antlr.RuleContext

func (*ValueContext) Integer

func (s *ValueContext) Integer() IIntegerContext

func (*ValueContext) IsValueContext

func (*ValueContext) IsValueContext()

func (*ValueContext) List

func (s *ValueContext) List() IListContext

func (*ValueContext) Realnum

func (s *ValueContext) Realnum() IRealnumContext

func (*ValueContext) Str

func (s *ValueContext) Str() IStrContext

func (*ValueContext) Stringliteral

func (s *ValueContext) Stringliteral() IStringliteralContext

func (*ValueContext) ToStringTree

func (s *ValueContext) ToStringTree(ruleNames []string, recog antlr.Recognizer) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL