Documentation ¶
Overview ¶
Package ast parses and formats sys files.
Index ¶
- func Format(desc *Description) []byte
- func FormatWriter(w io.Writer, desc *Description)
- func LoggingHandler(pos Pos, msg string)
- func Walk(desc *Description, cb func(n Node))
- func WalkNode(n0 Node, cb func(n Node))
- type Call
- type Comment
- type Define
- type Description
- type ErrorHandler
- type ErrorMatcher
- type Field
- type Ident
- type Incdir
- type Include
- type Int
- type IntFlags
- type NewLine
- type Node
- type Pos
- type Resource
- type StrFlags
- type String
- type Struct
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Format ¶
func Format(desc *Description) []byte
func FormatWriter ¶
func FormatWriter(w io.Writer, desc *Description)
func LoggingHandler ¶
func Walk ¶
func Walk(desc *Description, cb func(n Node))
Walk calls callback cb for every node in AST.
Types ¶
type Description ¶
type Description struct {
Nodes []Node
}
Description contains top-level nodes of a parsed sys description.
func Clone ¶
func Clone(desc *Description) *Description
func Parse ¶
func Parse(data []byte, filename string, errorHandler ErrorHandler) *Description
Parse parses sys description into AST and returns top-level nodes. If any errors are encountered, returns nil.
func ParseGlob ¶
func ParseGlob(glob string, errorHandler ErrorHandler) *Description
type ErrorHandler ¶
type ErrorMatcher ¶
type ErrorMatcher struct { Data []byte // contains filtered or unexported fields }
func NewErrorMatcher ¶
func NewErrorMatcher(t *testing.T, file string) *ErrorMatcher
func (*ErrorMatcher) Check ¶
func (em *ErrorMatcher) Check(t *testing.T)
func (*ErrorMatcher) Count ¶
func (em *ErrorMatcher) Count() int
func (*ErrorMatcher) DumpErrors ¶
func (em *ErrorMatcher) DumpErrors(t *testing.T)
func (*ErrorMatcher) ErrorHandler ¶
func (em *ErrorMatcher) ErrorHandler(pos Pos, msg string)
type Field ¶
type Int ¶
type Pos ¶
type Pos struct { File string Off int // byte offset, starting at 0 Line int // line number, starting at 1 Col int // column number, starting at 1 (byte count) }
Pos represents source info for AST nodes.
type Struct ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.