parse

package
v1.4.12 Latest Latest
Warning

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

Go to latest
Published: May 11, 2024 License: MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	T2Colon   = 57378
	T2Comma   = 57376
	T3Comma   = 57377
	TAnd      = 57346
	TBreak    = 57347
	TCompound = 57382
	TContinue = 57348
	TDo       = 57349
	TElse     = 57350
	TElseIf   = 57351
	TEnd      = 57352
	TEqeq     = 57369
	TFalse    = 57353
	TFloorDiv = 57373
	TFor      = 57354
	TFunction = 57355
	TGoto     = 57368
	TGte      = 57372
	TIdent    = 57379
	TIf       = 57356
	TIn       = 57357
	TLocal    = 57358
	TLshift   = 57375
	TLte      = 57371
	TNeq      = 57370
	TNil      = 57359
	TNot      = 57360
	TNumber   = 57380
	TOr       = 57361
	TRepeat   = 57363
	TReturn   = 57362
	TRshift   = 57374
	TString   = 57381
	TThen     = 57364
	TTrue     = 57365
	TUntil    = 57366
	TWhile    = 57367
	UNARY     = 57383
)
View Source
const EOF = -1

Variables

This section is empty.

Functions

func Dump

func Dump(chunk []ast.Stmt) string

func Parse

func Parse(reader io.Reader, name string) (chunk ast.Chunk, err error)

func TokenName

func TokenName(c int) string

Types

type Error

type Error struct {
	Pos     ast.Position
	Message string
	Token   string
}

func (*Error) Error

func (e *Error) Error() string

type Lexer

type Lexer struct {
	Chunk         ast.Chunk
	PNewLine      bool
	Token         ast.Token
	PrevTokenType int
	// contains filtered or unexported fields
}

func (*Lexer) Error

func (lx *Lexer) Error(message string)

func (*Lexer) Lex

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

func (*Lexer) TokenError

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

type Scanner

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

func NewScanner

func NewScanner(reader io.Reader, source string) *Scanner

func (*Scanner) Error

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

func (*Scanner) Newline

func (sc *Scanner) Newline(ch int)

func (*Scanner) Next

func (sc *Scanner) Next() int

func (*Scanner) Peek

func (sc *Scanner) Peek() int

func (*Scanner) Scan

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

func (*Scanner) TokenError

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

Jump to

Keyboard shortcuts

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