parse

package
v0.0.0-...-494f9af Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	T2Comma   = 57371
	T3Comma   = 57372
	TAnd      = 57346
	TBreak    = 57347
	TDo       = 57348
	TElse     = 57349
	TElseIf   = 57350
	TEnd      = 57351
	TEqeq     = 57367
	TFalse    = 57352
	TFloorDiv = 57378
	TFor      = 57353
	TFunction = 57354
	TGte      = 57370
	TIdent    = 57373
	TIf       = 57355
	TIn       = 57356
	TLocal    = 57357
	TLshift   = 57377
	TLte      = 57369
	TNeq      = 57368
	TNil      = 57358
	TNot      = 57359
	TNumber   = 57374
	TOr       = 57360
	TRepeat   = 57362
	TReturn   = 57361
	TRshift   = 57376
	TString   = 57375
	TThen     = 57363
	TTrue     = 57364
	TUntil    = 57365
	TWhile    = 57366
	UNARY     = 57379
)
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.Stmt, 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 {
	Stmts         []ast.Stmt
	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