parser

package
v0.0.0-...-1a6570b Latest Latest
Warning

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

Go to latest
Published: May 29, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

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

func NewAnalyzer

func NewAnalyzer(t *Tokenizer, f string) *Analyzer

func (*Analyzer) Analyze

func (a *Analyzer) Analyze() (Node, error)

func (*Analyzer) Errorf

func (a *Analyzer) Errorf(row, col int, format string, v ...interface{}) error

type ClassNode

type ClassNode struct {
	Qualifier *Symbol
	// contains filtered or unexported fields
}

func NewClassNode

func NewClassNode(parent Node) *ClassNode

func (ClassNode) Name

func (n ClassNode) Name() string

func (ClassNode) Symbol

func (n ClassNode) Symbol() *Symbol

type EnumNode

type EnumNode struct {
	Flags     bool
	Qualifier *Symbol
	// contains filtered or unexported fields
}

func NewEnumNode

func NewEnumNode(parent Node) *EnumNode

func (EnumNode) Name

func (n EnumNode) Name() string

func (EnumNode) Symbol

func (n EnumNode) Symbol() *Symbol

type Node

type Node interface {
	Name() string
	NamePath() []string
	Parent() Node
	SetParent(Node)
	Path() []Node
	Ancestors() []Node
	Children() []Node
	AddChild(Node)
	AdoptChildren(Node)
	ClearChildren()
	Symbols() []*Symbol
	CreateSymbol(string, Node) *Symbol
	AddSymbol(*Symbol)
	FindSymbol(string, bool) *Symbol
	FindNestedSymbol([]string) *Symbol
	ImportSymbols(Node)
	ClearSymbols()
}

func NewNode

func NewNode(parent Node) Node

type OpCode

type OpCode int
const (
	OpWhitespace OpCode = iota
	OpTerminator
	OpString
	OpComment
	OpIdentifier
	OpNamespace
	OpPreprocess
	OpOperator
	OpInvalid
)

func (OpCode) String

func (op OpCode) String() string

type PropertyNode

type PropertyNode struct {
	Flags          string
	FlagsOpt       *Symbol
	Type           *Symbol
	Default        []*Symbol
	Obsolete       bool
	ObsoleteReason string
	// contains filtered or unexported fields
}

func NewPropertyNode

func NewPropertyNode(parent Node) *PropertyNode

func (*PropertyNode) AddDefault

func (n *PropertyNode) AddDefault(s *Symbol)

func (PropertyNode) Name

func (n PropertyNode) Name() string

func (PropertyNode) Symbol

func (n PropertyNode) Symbol() *Symbol

type Symbol

type Symbol struct {
	Value string
	Scope Node
	Node  Node
}

type Token

type Token struct {
	Op    OpCode
	Name  string
	Value []byte
	Raw   []byte
	Row   int
	Col   int
	Error error
}

func (*Token) Equal

func (t *Token) Equal(other *Token) bool

func (*Token) ValueEqual

func (t *Token) ValueEqual(val []byte) bool

func (*Token) ValueEqualString

func (t *Token) ValueEqualString(val string) bool

func (*Token) ValueString

func (t *Token) ValueString() string

type TokenQueue

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

func NewTokenQueue

func NewTokenQueue() *TokenQueue

func (*TokenQueue) Dequeue

func (q *TokenQueue) Dequeue() *Token

func (*TokenQueue) Len

func (q *TokenQueue) Len() int

func (*TokenQueue) Peek

func (q *TokenQueue) Peek() *Token

type Tokenizer

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

func NewTokenizer

func NewTokenizer(data []byte) *Tokenizer

func (*Tokenizer) Tokenize

func (t *Tokenizer) Tokenize() (*TokenQueue, error)

Jump to

Keyboard shortcuts

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