parser

package
v0.0.0-...-5d81d55 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NamedBlockDefault = iota
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Assignment

type Assignment struct {
	SourcePosition
	Op         string
	X          string
	Expression string
}

type Attribute

type Attribute struct {
	SourcePosition
	Name      string
	Value     string
	IsRaw     bool
	IsFlag    bool
	Condition string
	Elements  *node.KeyValueArrayLit
}

type Block

type Block struct {
	SourcePosition
	Children []Node
}

func (*Block) CanInline

func (b *Block) CanInline() bool

type Case

type Case struct {
	SourcePosition
	Expr    string
	Content *Block
}

type Code

type Code struct {
	SourcePosition
	Expressions         []string
	TrimRigth, TrimLeft bool
}

type Comment

type Comment struct {
	SourcePosition
	Value  string
	Block  *Block
	Silent bool
}

type Comp

type Comp struct {
	SourcePosition
	Block    *Block
	Name     string
	Params   *node.FuncParams
	ID       string
	Exported bool
	Slots    []*Slot
	Comps    []*Comp
}

type CompCall

type CompCall struct {
	SourcePosition
	Name     string
	Args     node.CallArgs
	SlotPass []*SlotPass
	InitCode *Code
}

type Condition

type Condition struct {
	SourcePosition
	Block      *Block
	Expression string
	// contains filtered or unexported fields
}

type Default

type Default struct {
	SourcePosition
	Content *Block
}

type Doctype

type Doctype struct {
	SourcePosition
	Value string
}

func (*Doctype) String

func (d *Doctype) String() string

type Export

type Export struct {
	SourcePosition
	Name  string
	Value string
}

type For

type For struct {
	SourcePosition
	Args       string
	Expression string
	Block      *Block
	Else       *Block
}

type Func

type Func struct {
	SourcePosition
	Block    *Block
	Name     string
	Params   *node.FuncParams
	Exported bool
}

type If

type If struct {
	SourcePosition
	Positives []*Condition
	Negative  *Block
	// contains filtered or unexported fields
}

type Kind

type Kind int8

func (Kind) String

func (k Kind) String() string

type NamedBlock

type NamedBlock struct {
	Block
	Name string
}

type Node

type Node interface {
	Pos() SourcePosition
}

type ParseError

type ParseError struct {
	Filename    string
	Line        int
	Column      int
	TokenLength int
	Err         error
}

func (*ParseError) Error

func (p *ParseError) Error() string

func (*ParseError) Unrap

func (p *ParseError) Unrap() error

type Parser

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

func FileParser

func FileParser(filename string) (*Parser, error)

func New

func New(rdr io.Reader) *Parser

func (*Parser) Parse

func (p *Parser) Parse() (root *Root, err error)

func (*Parser) SetFilename

func (p *Parser) SetFilename(filename string) *Parser

type Root

type Root struct {
	Block
	Comps []*Comp
}

type Slot

type Slot struct {
	SourcePosition
	Name  string
	ID    string
	Scope *node.FuncParams
	Block *Block
	Wrap  *Wrap
}

type SlotPass

type SlotPass struct {
	SourcePosition
	FuncType *node.FuncType
	Name     node.Expr
	Block    *Block
}

type SourcePosition

type SourcePosition struct {
	RawPos      int
	LineNum     int
	ColNum      int
	TokenLength int
	Filename    string
}

func (*SourcePosition) Pos

func (s *SourcePosition) Pos() SourcePosition

func (SourcePosition) String

func (s SourcePosition) String() string

type Switch

type Switch struct {
	SourcePosition
	Expr    string
	Cases   []*Case
	Default *Default
}

type Tag

type Tag struct {
	SourcePosition
	Block          *Block
	Name           string
	IsInterpolated bool
	Attributes     []Attribute
}

func (*Tag) IsRawText

func (t *Tag) IsRawText() bool

func (*Tag) IsSelfClosing

func (t *Tag) IsSelfClosing() bool

type Text

type Text struct {
	SourcePosition
	Stmts node.Stmts
}

type Wrap

type Wrap struct {
	SourcePosition
	Block *Block
}

Jump to

Keyboard shortcuts

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