parser

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package parser implements LL(1) recursive descent parsing for XML format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser implements LL(1) recursive descent parsing for XML. It maintains a single token lookahead for predictive parsing.

func NewParser

func NewParser(input string) *Parser

NewParser creates a new XML parser for the given input string. For parsing from io.Reader, use NewParserFromStream instead.

func NewParserFromStream

func NewParserFromStream(stream shapetokenizer.Stream) *Parser

NewParserFromStream creates a new XML parser using a pre-configured stream. This allows parsing from io.Reader using tokenizer.NewStreamFromReader.

func (*Parser) Parse

func (p *Parser) Parse() (ast.SchemaNode, error)

Parse parses the input and returns an AST representing the XML document.

Grammar:

Document = [ XMLDecl ] Element

Returns ast.SchemaNode - the root of the AST. For XML data, this will be an ObjectNode representing the root element.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL