mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-13 09:57:51 +08:00
parse: More godoc.
This commit is contained in:
parent
15dd028dcb
commit
16f5c8c149
|
@ -24,6 +24,8 @@ func (n *node) n() *node {
|
|||
return n
|
||||
}
|
||||
|
||||
// Parent returns the parent node. If the node is the root of the syntax tree,
|
||||
// the parent is nil.
|
||||
func (n *node) Parent() Node {
|
||||
return n.parent
|
||||
}
|
||||
|
@ -37,15 +39,17 @@ func (n *node) End() int {
|
|||
}
|
||||
|
||||
// Range returns the range within the original (full) source text that parses
|
||||
// into the node.
|
||||
// to the node.
|
||||
func (n *node) Range() diag.Ranging {
|
||||
return diag.Ranging{n.begin, n.end}
|
||||
}
|
||||
|
||||
// SourceText returns the part of the source text that parses to the node.
|
||||
func (n *node) SourceText() string {
|
||||
return n.sourceText
|
||||
}
|
||||
|
||||
// Children returns all children of the node in the parse tree.
|
||||
func (n *node) Children() []Node {
|
||||
return n.children
|
||||
}
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
// Package parse implements the elvish parser.
|
||||
//
|
||||
// The parser builds a hybrid of AST (abstract syntax tree) and parse tree
|
||||
// (a.k.a. concrete syntax tree). The AST part only includes parts that are
|
||||
// semantically important, and is embodied in the fields of each *Node type. The
|
||||
// parse tree part corresponds to all the text in the original source text, and
|
||||
// is embodied in the children of each *Node type.
|
||||
package parse
|
||||
|
||||
//go:generate ./boilerplate.py
|
||||
|
|
Loading…
Reference in New Issue
Block a user