Documentation
¶
Index ¶
- Variables
- func GetPositions(opts ...ParseOption) map[*ir.Node]*token.Pos
- func Parse(d []byte, opts ...ParseOption) (*ir.Node, error)
- func ParseMulti(d []byte, opts ...ParseOption) ([]*ir.Node, error)
- func ParseNodeFromSource(source *token.TokenSource, opts ...ParseOption) (*ir.Node, error)
- type ParseOption
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GetPositions ¶ added in v0.0.6
func GetPositions(opts ...ParseOption) map[*ir.Node]*token.Pos
GetPositions extracts the positions map from the provided options. This allows consumers (like FromTony methods) to access position information.
func ParseMulti ¶ added in v0.0.6
func ParseMulti(d []byte, opts ...ParseOption) ([]*ir.Node, error)
ParseMulti parses multiple Tony documents separated by '---' from a single byte slice. It preserves global positions for all documents.
func ParseNodeFromSource ¶ added in v0.0.12
func ParseNodeFromSource(source *token.TokenSource, opts ...ParseOption) (*ir.Node, error)
ParseNodeFromSource parses the next complete ir.Node from a TokenSource. It reads tokens until it finds a complete bracketed structure or simple value, then parses and returns it. Returns io.EOF when the source is exhausted.
This is a simplified replacement for NodeParser.ParseNext() that handles the core incremental parsing use case.
Types ¶
type ParseOption ¶
type ParseOption func(*parseOpts)
func NoBrackets ¶
func NoBrackets() ParseOption
func ParseComments ¶
func ParseComments(v bool) ParseOption
func ParseFormat ¶
func ParseFormat(f format.Format) ParseOption
func ParseJSON ¶
func ParseJSON() ParseOption
func ParsePositions ¶
func ParsePositions(m map[*ir.Node]*token.Pos) ParseOption
func ParseTony ¶
func ParseTony() ParseOption
func ParseYAML ¶
func ParseYAML() ParseOption
Click to show internal directories.
Click to hide internal directories.