Documentation ¶
Index ¶
- func NewTreeTokenSource(tree Tree, tttype TreeTokenTypes) antlr.TokenStream
- func NewTreeTokenSourceFromStart(tree Tree, tttype TreeTokenTypes, start INode) antlr.TokenStream
- func NewTree_MutableINodes(name string, root INode) (Tree, INode)
- type Builder
- type CallbackFunc
- type Down
- type Eof
- type INode
- type INodeIterator
- type Iterator
- type PreOrderTreeIterator
- type Tree
- type TreeNode
- type TreeToken
- func (tt *TreeToken) GetChannel() int
- func (tt *TreeToken) GetColumn() int
- func (tt *TreeToken) GetInputStream() antlr.CharStream
- func (tt *TreeToken) GetLine() int
- func (tt *TreeToken) GetSource() *antlr.TokenSourceCharStreamPair
- func (tt *TreeToken) GetStart() int
- func (tt *TreeToken) GetStop() int
- func (tt *TreeToken) GetText() string
- func (tt *TreeToken) GetTokenIndex() int
- func (tt *TreeToken) GetTokenSource() antlr.TokenSource
- func (t *TreeToken) GetTokenType() int
- func (tt *TreeToken) SetText(s string)
- func (tt *TreeToken) SetTokenIndex(v int)
- type TreeTokenSource
- func (tts *TreeTokenSource) Consume()
- func (tts *TreeTokenSource) Get(index int) antlr.Token
- func (tts *TreeTokenSource) GetAllText() string
- func (tts *TreeTokenSource) GetSourceName() string
- func (tts *TreeTokenSource) GetTextFromInterval(*antlr.Interval) string
- func (tts *TreeTokenSource) GetTextFromRuleContext(antlr.RuleContext) string
- func (tts *TreeTokenSource) GetTextFromTokens(antlr.Token, antlr.Token) string
- func (tts *TreeTokenSource) GetTokenSource() antlr.TokenSource
- func (tts *TreeTokenSource) Index() int
- func (tts *TreeTokenSource) LA(i int) int
- func (tts *TreeTokenSource) LT(k int) (ret antlr.Token)
- func (tts *TreeTokenSource) Mark() int
- func (tts *TreeTokenSource) Release(marker int)
- func (tts *TreeTokenSource) Seek(index int)
- func (tts *TreeTokenSource) SetTokenSource(antlr.TokenSource)
- func (tts *TreeTokenSource) Size() int
- type TreeTokenTypes
- type Up
- type WalkableBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTreeTokenSource ¶
func NewTreeTokenSource(tree Tree, tttype TreeTokenTypes) antlr.TokenStream
func NewTreeTokenSourceFromStart ¶
func NewTreeTokenSourceFromStart(tree Tree, tttype TreeTokenTypes, start INode) antlr.TokenStream
Types ¶
type Builder ¶
type Builder interface { Add(n INode) Builder Down() Builder Up() Builder Build() Tree Current() INode }
Fluent API for building a tree
func BuildTree_MutableNodes ¶
type CallbackFunc ¶
type INode ¶
type INode interface { }
INode, an interface{} type store in the tree. Tider then writing interface{} everywhere
type INodeIterator ¶
type INodeIterator struct {
// contains filtered or unexported fields
}
func (*INodeIterator) HasNext ¶
func (iter *INodeIterator) HasNext() bool
func (*INodeIterator) Next ¶
func (iter *INodeIterator) Next() INode
func (*INodeIterator) String ¶
func (iter *INodeIterator) String() string
type PreOrderTreeIterator ¶
type PreOrderTreeIterator struct {
// contains filtered or unexported fields
}
func NewPreOrderTreeIterator ¶
func NewPreOrderTreeIterator(tree Tree, node INode) *PreOrderTreeIterator
Constructs a preorder enumeration with the tree to traverse, and the starting node */
func (*PreOrderTreeIterator) HasNext ¶
func (iter *PreOrderTreeIterator) HasNext() bool
INMIND It would be handy to get traversal information UP DOWN etc
func (*PreOrderTreeIterator) Next ¶
func (iter *PreOrderTreeIterator) Next() INode
type Tree ¶
type Tree interface { Name() string // Returns the root Inode of the tree Root() INode // Adds a child to the provided parent. // Returns true, nil if added successfully, // false, current parent if // the Inode already exists in the tree Add(parent INode, child INode) (success bool, otherParent INode) // Get the parent of the provided Inode Parent(child INode) (parent INode) // Depth first walk of the tree calling the provided function for each Inode visited Walk(CallbackFunc) // Children of parent Children(parent INode) []INode Size() int PathAsPosition(node INode) []int CommonAncestor(a, b INode) INode // Contains Contains(INode) bool TreeString() string DebugTreeString() string SExpr(start INode) string }
type TreeToken ¶
type TreeToken struct { TType int Start int // optional return -1 if not implemented. Stop int // optional return -1 if not implemented. TokenIndex int }
func (*TreeToken) GetChannel ¶
func (*TreeToken) GetInputStream ¶
func (tt *TreeToken) GetInputStream() antlr.CharStream
func (*TreeToken) GetSource ¶
func (tt *TreeToken) GetSource() *antlr.TokenSourceCharStreamPair
func (*TreeToken) GetTokenIndex ¶
func (*TreeToken) GetTokenSource ¶
func (tt *TreeToken) GetTokenSource() antlr.TokenSource
func (*TreeToken) GetTokenType ¶
func (*TreeToken) SetTokenIndex ¶
type TreeTokenSource ¶
type TreeTokenSource struct {
// contains filtered or unexported fields
}
func (*TreeTokenSource) Consume ¶
func (tts *TreeTokenSource) Consume()
func (*TreeTokenSource) GetAllText ¶
func (tts *TreeTokenSource) GetAllText() string
func (*TreeTokenSource) GetSourceName ¶
func (tts *TreeTokenSource) GetSourceName() string
func (*TreeTokenSource) GetTextFromInterval ¶
func (tts *TreeTokenSource) GetTextFromInterval(*antlr.Interval) string
func (*TreeTokenSource) GetTextFromRuleContext ¶
func (tts *TreeTokenSource) GetTextFromRuleContext(antlr.RuleContext) string
func (*TreeTokenSource) GetTextFromTokens ¶
func (*TreeTokenSource) GetTokenSource ¶
func (tts *TreeTokenSource) GetTokenSource() antlr.TokenSource
func (*TreeTokenSource) Index ¶
func (tts *TreeTokenSource) Index() int
func (*TreeTokenSource) LA ¶
func (tts *TreeTokenSource) LA(i int) int
func (*TreeTokenSource) Release ¶
func (tts *TreeTokenSource) Release(marker int)
func (*TreeTokenSource) Seek ¶
func (tts *TreeTokenSource) Seek(index int)
func (*TreeTokenSource) SetTokenSource ¶
func (tts *TreeTokenSource) SetTokenSource(antlr.TokenSource)
func (*TreeTokenSource) Size ¶
func (tts *TreeTokenSource) Size() int
type TreeTokenTypes ¶
type WalkableBuilder ¶
type WalkableBuilder interface { Add(n antlr.Token) WalkableBuilder AddNode(n antlr.Token, stop antlr.Token, ttype int, val interface{}) WalkableBuilder Down() WalkableBuilder Up() WalkableBuilder Build() Tree Current() antlr.Token }
func NewWalkableBuild ¶
func NewWalkableBuild(name string, root antlr.Token) WalkableBuilder
Click to show internal directories.
Click to hide internal directories.