molecule

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/molecule"

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

type exampleListener struct {
	*molecule.BasemoleculeListener
}

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 := molecule.NewmoleculeLexer(is)
	stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel)

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

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

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewmoleculeLexer

func NewmoleculeLexer(input antlr.CharStream) *moleculeLexer

func NewmoleculeParser

func NewmoleculeParser(input antlr.TokenStream) *moleculeParser

Types

type BasemoleculeListener

type BasemoleculeListener struct{}

BasemoleculeListener is a complete listener for a parse tree produced by moleculeParser.

func (*BasemoleculeListener) EnterCount

func (s *BasemoleculeListener) EnterCount(ctx *CountContext)

EnterCount is called when production count is entered.

func (*BasemoleculeListener) EnterElement

func (s *BasemoleculeListener) EnterElement(ctx *ElementContext)

EnterElement is called when production element is entered.

func (*BasemoleculeListener) EnterEveryRule

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

EnterEveryRule is called when any rule is entered.

func (*BasemoleculeListener) EnterGroup

func (s *BasemoleculeListener) EnterGroup(ctx *GroupContext)

EnterGroup is called when production group is entered.

func (*BasemoleculeListener) EnterIon

func (s *BasemoleculeListener) EnterIon(ctx *IonContext)

EnterIon is called when production ion is entered.

func (*BasemoleculeListener) EnterMolecule

func (s *BasemoleculeListener) EnterMolecule(ctx *MoleculeContext)

EnterMolecule is called when production molecule is entered.

func (*BasemoleculeListener) EnterPart

func (s *BasemoleculeListener) EnterPart(ctx *PartContext)

EnterPart is called when production part is entered.

func (*BasemoleculeListener) EnterStructure

func (s *BasemoleculeListener) EnterStructure(ctx *StructureContext)

EnterStructure is called when production structure is entered.

func (*BasemoleculeListener) EnterSymbol

func (s *BasemoleculeListener) EnterSymbol(ctx *SymbolContext)

EnterSymbol is called when production symbol is entered.

func (*BasemoleculeListener) ExitCount

func (s *BasemoleculeListener) ExitCount(ctx *CountContext)

ExitCount is called when production count is exited.

func (*BasemoleculeListener) ExitElement

func (s *BasemoleculeListener) ExitElement(ctx *ElementContext)

ExitElement is called when production element is exited.

func (*BasemoleculeListener) ExitEveryRule

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

ExitEveryRule is called when any rule is exited.

func (*BasemoleculeListener) ExitGroup

func (s *BasemoleculeListener) ExitGroup(ctx *GroupContext)

ExitGroup is called when production group is exited.

func (*BasemoleculeListener) ExitIon

func (s *BasemoleculeListener) ExitIon(ctx *IonContext)

ExitIon is called when production ion is exited.

func (*BasemoleculeListener) ExitMolecule

func (s *BasemoleculeListener) ExitMolecule(ctx *MoleculeContext)

ExitMolecule is called when production molecule is exited.

func (*BasemoleculeListener) ExitPart

func (s *BasemoleculeListener) ExitPart(ctx *PartContext)

ExitPart is called when production part is exited.

func (*BasemoleculeListener) ExitStructure

func (s *BasemoleculeListener) ExitStructure(ctx *StructureContext)

ExitStructure is called when production structure is exited.

func (*BasemoleculeListener) ExitSymbol

func (s *BasemoleculeListener) ExitSymbol(ctx *SymbolContext)

ExitSymbol is called when production symbol is exited.

func (*BasemoleculeListener) VisitErrorNode

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

VisitErrorNode is called when an error node is visited.

func (*BasemoleculeListener) VisitTerminal

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

VisitTerminal is called when a terminal node is visited.

type CountContext

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

func NewCountContext

func NewCountContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *CountContext

func NewEmptyCountContext

func NewEmptyCountContext() *CountContext

func (*CountContext) EnterRule

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

func (*CountContext) ExitRule

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

func (*CountContext) GetParser

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

func (*CountContext) GetRuleContext

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

func (*CountContext) IsCountContext

func (*CountContext) IsCountContext()

func (*CountContext) NUMBER

func (s *CountContext) NUMBER() antlr.TerminalNode

func (*CountContext) ToStringTree

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

type ElementContext

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

func NewElementContext

func NewElementContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ElementContext

func NewEmptyElementContext

func NewEmptyElementContext() *ElementContext

func (*ElementContext) ELEMENT

func (s *ElementContext) ELEMENT() antlr.TerminalNode

func (*ElementContext) EnterRule

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

func (*ElementContext) ExitRule

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

func (*ElementContext) GetParser

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

func (*ElementContext) GetRuleContext

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

func (*ElementContext) IsElementContext

func (*ElementContext) IsElementContext()

func (*ElementContext) ToStringTree

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

type GroupContext

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

func NewEmptyGroupContext

func NewEmptyGroupContext() *GroupContext

func NewGroupContext

func NewGroupContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *GroupContext

func (*GroupContext) AllStructure

func (s *GroupContext) AllStructure() []IStructureContext

func (*GroupContext) EnterRule

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

func (*GroupContext) ExitRule

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

func (*GroupContext) GetParser

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

func (*GroupContext) GetRuleContext

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

func (*GroupContext) IsGroupContext

func (*GroupContext) IsGroupContext()

func (*GroupContext) Structure

func (s *GroupContext) Structure(i int) IStructureContext

func (*GroupContext) ToStringTree

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

type ICountContext

type ICountContext interface {
	antlr.ParserRuleContext

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

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

ICountContext is an interface to support dynamic dispatch.

type IElementContext

type IElementContext interface {
	antlr.ParserRuleContext

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

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

IElementContext is an interface to support dynamic dispatch.

type IGroupContext

type IGroupContext interface {
	antlr.ParserRuleContext

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

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

IGroupContext is an interface to support dynamic dispatch.

type IIonContext

type IIonContext interface {
	antlr.ParserRuleContext

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

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

IIonContext is an interface to support dynamic dispatch.

type IMoleculeContext

type IMoleculeContext interface {
	antlr.ParserRuleContext

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

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

IMoleculeContext is an interface to support dynamic dispatch.

type IPartContext

type IPartContext interface {
	antlr.ParserRuleContext

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

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

IPartContext is an interface to support dynamic dispatch.

type IStructureContext

type IStructureContext interface {
	antlr.ParserRuleContext

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

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

IStructureContext is an interface to support dynamic dispatch.

type ISymbolContext

type ISymbolContext interface {
	antlr.ParserRuleContext

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

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

ISymbolContext is an interface to support dynamic dispatch.

type IonContext

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

func NewEmptyIonContext

func NewEmptyIonContext() *IonContext

func NewIonContext

func NewIonContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *IonContext

func (*IonContext) AllStructure

func (s *IonContext) AllStructure() []IStructureContext

func (*IonContext) EnterRule

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

func (*IonContext) ExitRule

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

func (*IonContext) GetParser

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

func (*IonContext) GetRuleContext

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

func (*IonContext) IsIonContext

func (*IonContext) IsIonContext()

func (*IonContext) Structure

func (s *IonContext) Structure(i int) IStructureContext

func (*IonContext) ToStringTree

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

type MoleculeContext

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

func NewEmptyMoleculeContext

func NewEmptyMoleculeContext() *MoleculeContext

func NewMoleculeContext

func NewMoleculeContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *MoleculeContext

func (*MoleculeContext) AllPart

func (s *MoleculeContext) AllPart() []IPartContext

func (*MoleculeContext) EnterRule

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

func (*MoleculeContext) ExitRule

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

func (*MoleculeContext) GetParser

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

func (*MoleculeContext) GetRuleContext

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

func (*MoleculeContext) IsMoleculeContext

func (*MoleculeContext) IsMoleculeContext()

func (*MoleculeContext) Part

func (s *MoleculeContext) Part(i int) IPartContext

func (*MoleculeContext) ToStringTree

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

type PartContext

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

func NewEmptyPartContext

func NewEmptyPartContext() *PartContext

func NewPartContext

func NewPartContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PartContext

func (*PartContext) AllCount

func (s *PartContext) AllCount() []ICountContext

func (*PartContext) AllStructure

func (s *PartContext) AllStructure() []IStructureContext

func (*PartContext) Count

func (s *PartContext) Count(i int) ICountContext

func (*PartContext) EnterRule

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

func (*PartContext) ExitRule

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

func (*PartContext) GetParser

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

func (*PartContext) GetRuleContext

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

func (*PartContext) IsPartContext

func (*PartContext) IsPartContext()

func (*PartContext) Structure

func (s *PartContext) Structure(i int) IStructureContext

func (*PartContext) ToStringTree

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

type StructureContext

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

func NewEmptyStructureContext

func NewEmptyStructureContext() *StructureContext

func NewStructureContext

func NewStructureContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *StructureContext

func (*StructureContext) Count

func (s *StructureContext) Count() ICountContext

func (*StructureContext) EnterRule

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

func (*StructureContext) ExitRule

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

func (*StructureContext) GetParser

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

func (*StructureContext) GetRuleContext

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

func (*StructureContext) IsStructureContext

func (*StructureContext) IsStructureContext()

func (*StructureContext) Symbol

func (s *StructureContext) Symbol() ISymbolContext

func (*StructureContext) ToStringTree

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

type SymbolContext

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

func NewEmptySymbolContext

func NewEmptySymbolContext() *SymbolContext

func NewSymbolContext

func NewSymbolContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *SymbolContext

func (*SymbolContext) Element

func (s *SymbolContext) Element() IElementContext

func (*SymbolContext) EnterRule

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

func (*SymbolContext) ExitRule

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

func (*SymbolContext) GetParser

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

func (*SymbolContext) GetRuleContext

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

func (*SymbolContext) Group

func (s *SymbolContext) Group() IGroupContext

func (*SymbolContext) Ion

func (s *SymbolContext) Ion() IIonContext

func (*SymbolContext) IsSymbolContext

func (*SymbolContext) IsSymbolContext()

func (*SymbolContext) ToStringTree

func (s *SymbolContext) 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