dsl

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

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

Go to latest
Published: Apr 13, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pretty

func Pretty(pretty bool) func(*PRD) error

func Size

func Size(size int) func(*PRD) error

func SyntaxErrorf

func SyntaxErrorf(c *ParseContext, node *node32, f string, args ...any) error

Types

type Definition

type Definition struct {
	DefType string
	ID      string
	Options OptionList
	Body    []any
}

type Expression

type Expression struct {
	Op      string
	Operand []any
}

type OptionList

type OptionList map[string]any

type PRD

type PRD struct {
	Buffer string

	Pretty bool
	// contains filtered or unexported fields
}

func (*PRD) AST

func (t *PRD) AST() *node32

func (*PRD) Add

func (t *PRD) Add(rule pegRule, begin, end, index uint32)

func (*PRD) Init

func (p *PRD) Init(options ...func(*PRD) error) error

func (*PRD) Parse

func (p *PRD) Parse(rule ...int) error

func (*PRD) PrettyPrintSyntaxTree

func (t *PRD) PrettyPrintSyntaxTree(buffer string)

func (*PRD) Print

func (t *PRD) Print()

func (*PRD) PrintSyntaxTree

func (p *PRD) PrintSyntaxTree()

func (*PRD) Reset

func (p *PRD) Reset()

func (*PRD) SprintSyntaxTree

func (p *PRD) SprintSyntaxTree() string

func (*PRD) Tokens

func (t *PRD) Tokens() []token32

func (*PRD) Trim

func (t *PRD) Trim(length uint32)

func (*PRD) WriteSyntaxTree

func (p *PRD) WriteSyntaxTree(w io.Writer)

type ParseContext

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

func MakeParseContext

func MakeParseContext(script string) (*ParseContext, error)

func (*ParseContext) PrintTree

func (c *ParseContext) PrintTree()

func (*ParseContext) Run

func (c *ParseContext) Run() ([]*Definition, error)

type SyntaxError

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

func (*SyntaxError) Cause

func (s *SyntaxError) Cause() error

func (*SyntaxError) Error

func (s *SyntaxError) Error() string

func (*SyntaxError) Unwrap

func (s *SyntaxError) Unwrap() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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