propcalc

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

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

type exampleListener struct {
	*propcalc.BasepropcalcListener
}

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

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

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

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewpropcalcLexer

func NewpropcalcLexer(input antlr.CharStream) *propcalcLexer

func NewpropcalcParser

func NewpropcalcParser(input antlr.TokenStream) *propcalcParser

Types

type AtomContext

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

func NewAtomContext

func NewAtomContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AtomContext

func NewEmptyAtomContext

func NewEmptyAtomContext() *AtomContext

func (*AtomContext) Atom

func (s *AtomContext) Atom() IAtomContext

func (*AtomContext) EnterRule

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

func (*AtomContext) ExitRule

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

func (*AtomContext) Expression

func (s *AtomContext) Expression() IExpressionContext

func (*AtomContext) GetParser

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

func (*AtomContext) GetRuleContext

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

func (*AtomContext) IsAtomContext

func (*AtomContext) IsAtomContext()

func (*AtomContext) LPAREN

func (s *AtomContext) LPAREN() antlr.TerminalNode

func (*AtomContext) NOT

func (s *AtomContext) NOT() antlr.TerminalNode

func (*AtomContext) RPAREN

func (s *AtomContext) RPAREN() antlr.TerminalNode

func (*AtomContext) ToStringTree

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

func (*AtomContext) Variable

func (s *AtomContext) Variable() IVariableContext

type AtomsContext

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

func NewAtomsContext

func NewAtomsContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *AtomsContext

func NewEmptyAtomsContext

func NewEmptyAtomsContext() *AtomsContext

func (*AtomsContext) AllAtom

func (s *AtomsContext) AllAtom() []IAtomContext

func (*AtomsContext) Atom

func (s *AtomsContext) Atom(i int) IAtomContext

func (*AtomsContext) EnterRule

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

func (*AtomsContext) ExitRule

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

func (*AtomsContext) GetParser

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

func (*AtomsContext) GetRuleContext

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

func (*AtomsContext) IsAtomsContext

func (*AtomsContext) IsAtomsContext()

func (*AtomsContext) ToStringTree

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

type BasepropcalcListener

type BasepropcalcListener struct{}

BasepropcalcListener is a complete listener for a parse tree produced by propcalcParser.

func (*BasepropcalcListener) EnterAtom

func (s *BasepropcalcListener) EnterAtom(ctx *AtomContext)

EnterAtom is called when production atom is entered.

func (*BasepropcalcListener) EnterAtoms

func (s *BasepropcalcListener) EnterAtoms(ctx *AtomsContext)

EnterAtoms is called when production atoms is entered.

func (*BasepropcalcListener) EnterEquiv

func (s *BasepropcalcListener) EnterEquiv(ctx *EquivContext)

EnterEquiv is called when production equiv is entered.

func (*BasepropcalcListener) EnterEveryRule

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

EnterEveryRule is called when any rule is entered.

func (*BasepropcalcListener) EnterExpression

func (s *BasepropcalcListener) EnterExpression(ctx *ExpressionContext)

EnterExpression is called when production expression is entered.

func (*BasepropcalcListener) EnterImplies

func (s *BasepropcalcListener) EnterImplies(ctx *ImpliesContext)

EnterImplies is called when production implies is entered.

func (*BasepropcalcListener) EnterProposition

func (s *BasepropcalcListener) EnterProposition(ctx *PropositionContext)

EnterProposition is called when production proposition is entered.

func (*BasepropcalcListener) EnterRelExpression

func (s *BasepropcalcListener) EnterRelExpression(ctx *RelExpressionContext)

EnterRelExpression is called when production relExpression is entered.

func (*BasepropcalcListener) EnterVariable

func (s *BasepropcalcListener) EnterVariable(ctx *VariableContext)

EnterVariable is called when production variable is entered.

func (*BasepropcalcListener) ExitAtom

func (s *BasepropcalcListener) ExitAtom(ctx *AtomContext)

ExitAtom is called when production atom is exited.

func (*BasepropcalcListener) ExitAtoms

func (s *BasepropcalcListener) ExitAtoms(ctx *AtomsContext)

ExitAtoms is called when production atoms is exited.

func (*BasepropcalcListener) ExitEquiv

func (s *BasepropcalcListener) ExitEquiv(ctx *EquivContext)

ExitEquiv is called when production equiv is exited.

func (*BasepropcalcListener) ExitEveryRule

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

ExitEveryRule is called when any rule is exited.

func (*BasepropcalcListener) ExitExpression

func (s *BasepropcalcListener) ExitExpression(ctx *ExpressionContext)

ExitExpression is called when production expression is exited.

func (*BasepropcalcListener) ExitImplies

func (s *BasepropcalcListener) ExitImplies(ctx *ImpliesContext)

ExitImplies is called when production implies is exited.

func (*BasepropcalcListener) ExitProposition

func (s *BasepropcalcListener) ExitProposition(ctx *PropositionContext)

ExitProposition is called when production proposition is exited.

func (*BasepropcalcListener) ExitRelExpression

func (s *BasepropcalcListener) ExitRelExpression(ctx *RelExpressionContext)

ExitRelExpression is called when production relExpression is exited.

func (*BasepropcalcListener) ExitVariable

func (s *BasepropcalcListener) ExitVariable(ctx *VariableContext)

ExitVariable is called when production variable is exited.

func (*BasepropcalcListener) VisitErrorNode

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

VisitErrorNode is called when an error node is visited.

func (*BasepropcalcListener) VisitTerminal

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

VisitTerminal is called when a terminal node is visited.

type EquivContext

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

func NewEmptyEquivContext

func NewEmptyEquivContext() *EquivContext

func NewEquivContext

func NewEquivContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *EquivContext

func (*EquivContext) AllAtom

func (s *EquivContext) AllAtom() []IAtomContext

func (*EquivContext) Atom

func (s *EquivContext) Atom(i int) IAtomContext

func (*EquivContext) EQUIV

func (s *EquivContext) EQUIV() antlr.TerminalNode

func (*EquivContext) EnterRule

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

func (*EquivContext) ExitRule

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

func (*EquivContext) GetParser

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

func (*EquivContext) GetRuleContext

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

func (*EquivContext) IsEquivContext

func (*EquivContext) IsEquivContext()

func (*EquivContext) ToStringTree

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

type ExpressionContext

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

func NewEmptyExpressionContext

func NewEmptyExpressionContext() *ExpressionContext

func NewExpressionContext

func NewExpressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ExpressionContext

func (*ExpressionContext) AND

func (*ExpressionContext) AllAND

func (s *ExpressionContext) AllAND() []antlr.TerminalNode

func (*ExpressionContext) AllOR

func (s *ExpressionContext) AllOR() []antlr.TerminalNode

func (*ExpressionContext) AllRelExpression

func (s *ExpressionContext) AllRelExpression() []IRelExpressionContext

func (*ExpressionContext) EnterRule

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

func (*ExpressionContext) ExitRule

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

func (*ExpressionContext) GetParser

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

func (*ExpressionContext) GetRuleContext

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

func (*ExpressionContext) IsExpressionContext

func (*ExpressionContext) IsExpressionContext()

func (*ExpressionContext) OR

func (*ExpressionContext) RelExpression

func (s *ExpressionContext) RelExpression(i int) IRelExpressionContext

func (*ExpressionContext) ToStringTree

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

type IAtomContext

type IAtomContext interface {
	antlr.ParserRuleContext

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

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

IAtomContext is an interface to support dynamic dispatch.

type IAtomsContext

type IAtomsContext interface {
	antlr.ParserRuleContext

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

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

IAtomsContext is an interface to support dynamic dispatch.

type IEquivContext

type IEquivContext interface {
	antlr.ParserRuleContext

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

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

IEquivContext is an interface to support dynamic dispatch.

type IExpressionContext

type IExpressionContext interface {
	antlr.ParserRuleContext

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

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

IExpressionContext is an interface to support dynamic dispatch.

type IImpliesContext

type IImpliesContext interface {
	antlr.ParserRuleContext

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

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

IImpliesContext is an interface to support dynamic dispatch.

type IPropositionContext

type IPropositionContext interface {
	antlr.ParserRuleContext

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

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

IPropositionContext is an interface to support dynamic dispatch.

type IRelExpressionContext

type IRelExpressionContext interface {
	antlr.ParserRuleContext

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

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

IRelExpressionContext is an interface to support dynamic dispatch.

type IVariableContext

type IVariableContext interface {
	antlr.ParserRuleContext

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

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

IVariableContext is an interface to support dynamic dispatch.

type ImpliesContext

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

func NewEmptyImpliesContext

func NewEmptyImpliesContext() *ImpliesContext

func NewImpliesContext

func NewImpliesContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *ImpliesContext

func (*ImpliesContext) AllAtom

func (s *ImpliesContext) AllAtom() []IAtomContext

func (*ImpliesContext) Atom

func (s *ImpliesContext) Atom(i int) IAtomContext

func (*ImpliesContext) EnterRule

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

func (*ImpliesContext) ExitRule

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

func (*ImpliesContext) GetParser

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

func (*ImpliesContext) GetRuleContext

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

func (*ImpliesContext) IMPLIES

func (s *ImpliesContext) IMPLIES() antlr.TerminalNode

func (*ImpliesContext) IsImpliesContext

func (*ImpliesContext) IsImpliesContext()

func (*ImpliesContext) ToStringTree

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

type PropositionContext

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

func NewEmptyPropositionContext

func NewEmptyPropositionContext() *PropositionContext

func NewPropositionContext

func NewPropositionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *PropositionContext

func (*PropositionContext) AllExpression

func (s *PropositionContext) AllExpression() []IExpressionContext

func (*PropositionContext) EnterRule

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

func (*PropositionContext) ExitRule

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

func (*PropositionContext) Expression

func (s *PropositionContext) Expression(i int) IExpressionContext

func (*PropositionContext) GetParser

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

func (*PropositionContext) GetRuleContext

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

func (*PropositionContext) IsPropositionContext

func (*PropositionContext) IsPropositionContext()

func (*PropositionContext) THEREFORE

func (s *PropositionContext) THEREFORE() antlr.TerminalNode

func (*PropositionContext) ToStringTree

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

type RelExpressionContext

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

func NewEmptyRelExpressionContext

func NewEmptyRelExpressionContext() *RelExpressionContext

func NewRelExpressionContext

func NewRelExpressionContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *RelExpressionContext

func (*RelExpressionContext) Atom

func (*RelExpressionContext) EnterRule

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

func (*RelExpressionContext) Equiv

func (*RelExpressionContext) ExitRule

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

func (*RelExpressionContext) GetParser

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

func (*RelExpressionContext) GetRuleContext

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

func (*RelExpressionContext) Implies

func (*RelExpressionContext) IsRelExpressionContext

func (*RelExpressionContext) IsRelExpressionContext()

func (*RelExpressionContext) ToStringTree

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

type VariableContext

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

func NewEmptyVariableContext

func NewEmptyVariableContext() *VariableContext

func NewVariableContext

func NewVariableContext(parser antlr.Parser, parent antlr.ParserRuleContext, invokingState int) *VariableContext

func (*VariableContext) AllLETTER

func (s *VariableContext) AllLETTER() []antlr.TerminalNode

func (*VariableContext) EnterRule

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

func (*VariableContext) ExitRule

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

func (*VariableContext) GetParser

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

func (*VariableContext) GetRuleContext

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

func (*VariableContext) IsVariableContext

func (*VariableContext) IsVariableContext()

func (*VariableContext) LETTER

func (s *VariableContext) LETTER(i int) antlr.TerminalNode

func (*VariableContext) ToStringTree

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