parser

package
v0.0.0-...-c7f8db1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Modified upon: yuin/gopher-lua

Index

Constants

View Source
const ASSIGN = 57396
View Source
const EOF = 0xffffffff
View Source
const FUNC = 57397
View Source
const TAddEq = 57384
View Source
const TAnd = 57374
View Source
const TBitAndEq = 57390
View Source
const TBitLshEq = 57393
View Source
const TBitOrEq = 57391
View Source
const TBitRshEq = 57394
View Source
const TBitURshEq = 57395
View Source
const TBitXorEq = 57392
View Source
const TBreak = 57351
View Source
const TContinue = 57352
View Source
const TDivEq = 57387
View Source
const TDo = 57346
View Source
const TDotDotDot = 57369
View Source
const TElse = 57353
View Source
const TElseIf = 57348
View Source
const TEnd = 57350
View Source
const TEqeq = 57375
View Source
const TFor = 57354
View Source
const TFunc = 57356
View Source
const TGoto = 57364
View Source
const TGte = 57378
View Source
const TIDiv = 57382
View Source
const TIDivEq = 57388
View Source
const TIdent = 57379
View Source
const TIf = 57357
View Source
const TIn = 57365
View Source
const TInv = 57383
View Source
const TIs = 57372
View Source
const TLBracket = 57371
View Source
const TLParen = 57370
View Source
const TLabel = 57363
View Source
const TLocal = 57347
View Source
const TLsh = 57366
View Source
const TLte = 57377
View Source
const TModEq = 57389
View Source
const TMulEq = 57386
View Source
const TNeq = 57376
View Source
const TNot = 57362
View Source
const TNumber = 57380
View Source
const TOr = 57373
View Source
const TRepeat = 57360
View Source
const TReturn = 57358
View Source
const TReturnVoid = 57359
View Source
const TRsh = 57367
View Source
const TString = 57381
View Source
const TSubEq = 57385
View Source
const TThen = 57349
View Source
const TURsh = 57368
View Source
const TUntil = 57361
View Source
const TWhile = 57355
View Source
const UNARY = 57398

Variables

View Source
var (
	Sa   = &Symbol{Name: bas.Str("a!")}
	SNil = &Symbol{Name: bas.Str("nil")}
)

Functions

This section is empty.

Types

type Address

type Address uint16

func (Address) Dump

func (s Address) Dump(w io.Writer)

type And

type And struct {
	A, B Node
}

func (And) Dump

func (p And) Dump(w io.Writer)

type Assign

type Assign Declare

func (*Assign) Dump

func (p *Assign) Dump(w io.Writer)

func (*Assign) GetLine

func (b *Assign) GetLine() (string, int)

type Binary

type Binary struct {
	A, B Node
	Op   byte
	Line uint32
}

func (*Binary) Dump

func (b *Binary) Dump(w io.Writer)

func (*Binary) GetLine

func (b *Binary) GetLine() (string, int)

type BreakContinue

type BreakContinue struct {
	Break bool
	Line  uint32
}

func (*BreakContinue) Dump

func (p *BreakContinue) Dump(w io.Writer)

func (*BreakContinue) GetLine

func (p *BreakContinue) GetLine() (string, int)

type Call

type Call struct {
	Op     byte
	Callee Node
	Args   ExprList
	Vararg bool
	Line   uint32
}

func (*Call) Dump

func (p *Call) Dump(w io.Writer)

func (*Call) GetLine

func (b *Call) GetLine() (string, int)

type DeclList

type DeclList []Node

func (DeclList) Dump

func (p DeclList) Dump(w io.Writer)

type Declare

type Declare struct {
	Name  *Symbol
	Value Node
	Line  uint32
}

func (*Declare) Dump

func (p *Declare) Dump(w io.Writer)

func (*Declare) GetLine

func (b *Declare) GetLine() (string, int)

type Error

type Error struct {
	Pos     Position
	Message string
	Token   string
}

func (*Error) Error

func (e *Error) Error() string

type ExprAssignList

type ExprAssignList [][2]Node

func (ExprAssignList) Dump

func (p ExprAssignList) Dump(w io.Writer)

func (*ExprAssignList) ExpandAsExprList

func (p *ExprAssignList) ExpandAsExprList() (tmp ExprList)

type ExprList

type ExprList []Node

func (ExprList) Dump

func (p ExprList) Dump(w io.Writer)

type Function

type Function struct {
	Name       string
	Args       IdentList
	Body       Node
	Vararg     bool
	VargExpand IdentList
	Line       uint32
}

func (*Function) Dump

func (p *Function) Dump(w io.Writer)

func (*Function) GetLine

func (b *Function) GetLine() (string, int)

type GetLine

type GetLine interface {
	Node
	GetLine() (string, int)
}

type GotoLabel

type GotoLabel struct {
	Label string
	Goto  bool
	Line  uint32
}

func (*GotoLabel) Dump

func (p *GotoLabel) Dump(w io.Writer)

func (*GotoLabel) GetLine

func (p *GotoLabel) GetLine() (string, int)

type IdentList

type IdentList []Node

func (IdentList) Dump

func (p IdentList) Dump(w io.Writer)

type IdentVarargExpandList

type IdentVarargExpandList struct {
	IdentList
	Expand IdentList
}

type IdentVarargList

type IdentVarargList struct {
	IdentList
}

type If

type If struct {
	Cond        Node
	True, False Node
}

func (*If) Dump

func (p *If) Dump(w io.Writer)

type Lexer

type Lexer struct {
	Stmts Node
	Token Token
	// contains filtered or unexported fields
}

func (*Lexer) Error

func (lx *Lexer) Error(message string)

func (*Lexer) Float

func (lex *Lexer) Float(v float64) Primitive

func (*Lexer) Int

func (lex *Lexer) Int(v int64) Primitive

func (*Lexer) IntBool

func (lex *Lexer) IntBool(b bool) (n Node)

func (*Lexer) Lex

func (lx *Lexer) Lex(lval *yySymType) int

func (*Lexer) Num

func (lex *Lexer) Num(v string) Primitive

func (*Lexer) Str

func (lex *Lexer) Str(s string) Primitive

func (*Lexer) TokenError

func (lx *Lexer) TokenError(tok Token, message string)

type LoadConst

type LoadConst struct {
	Table bas.Map
	Funcs bas.Map
}

func (*LoadConst) Dump

func (p *LoadConst) Dump(w io.Writer)

type Loop

type Loop struct {
	Continue Node
	Body     Node
}

func (*Loop) Dump

func (p *Loop) Dump(w io.Writer)

type Node

type Node interface {
	Dump(io.Writer)
}

func Parse

func Parse(text, name string) (chunk Node, err error)

type Or

type Or And

func (Or) Dump

func (p Or) Dump(w io.Writer)

type Position

type Position struct {
	Source string
	Line   uint32
	Column uint32
}

func (*Position) String

func (pos *Position) String() string

type Primitive

type Primitive bas.Value

func (Primitive) Dump

func (p Primitive) Dump(w io.Writer)

func (Primitive) Value

func (p Primitive) Value() bas.Value

type Prog

type Prog struct {
	DoBlock bool
	Stats   []Node
}

func (*Prog) Append

func (p *Prog) Append(stat Node) *Prog

func (*Prog) Dump

func (p *Prog) Dump(w io.Writer)

func (*Prog) String

func (p *Prog) String() string

type Release

type Release []*Symbol

func (Release) Dump

func (p Release) Dump(w io.Writer)

type Scanner

type Scanner struct {
	Pos Position
	// contains filtered or unexported fields
}

func NewScanner

func NewScanner(text string, source string) *Scanner

func (*Scanner) Error

func (sc *Scanner) Error(tok string, msg string) *Error

func (*Scanner) Next

func (sc *Scanner) Next() uint32

func (*Scanner) Peek

func (sc *Scanner) Peek() uint32

func (*Scanner) Scan

func (sc *Scanner) Scan(lexer *Lexer) (Token, error)

func (*Scanner) TokenError

func (sc *Scanner) TokenError(tok Token, msg string) *Error

type Symbol

type Symbol struct {
	Name bas.Value
	Line uint32
}

func Sym

func Sym(tok Token) *Symbol

func (*Symbol) Dump

func (s *Symbol) Dump(w io.Writer)

func (*Symbol) GetLine

func (s *Symbol) GetLine() (string, int)

type Tenary

type Tenary struct {
	Op      byte
	A, B, C Node
	Line    uint32
}

func (*Tenary) Dump

func (p *Tenary) Dump(w io.Writer)

func (*Tenary) GetLine

func (b *Tenary) GetLine() (string, int)

type Token

type Token struct {
	Type uint32
	Str  string
	Pos  Position
}

func (*Token) Line

func (t *Token) Line() uint32

func (*Token) String

func (t *Token) String() string

type Unary

type Unary struct {
	Op   byte
	A    Node
	Line uint32
}

func (*Unary) Dump

func (b *Unary) Dump(w io.Writer)

func (*Unary) GetLine

func (b *Unary) GetLine() (string, int)

Jump to

Keyboard shortcuts

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