parser

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2021 License: MIT Imports: 7 Imported by: 50

Documentation

Overview

Package parser implements parser for anko.

Index

Constants

View Source
const (
	// EOF is short for End of file.
	EOF = -1
	// EOL is short for End of line.
	EOL = '\n'
)
View Source
const ANDAND = 57364
View Source
const ANDEQ = 57378
View Source
const ARRAY = 57349
View Source
const BREAK = 57380
View Source
const CASE = 57387
View Source
const CATCH = 57372
View Source
const CHAN = 57390
View Source
const CLOSE = 57398
View Source
const CONTINUE = 57381
View Source
const DEFAULT = 57388
View Source
const DELETE = 57397
View Source
const DIVEQ = 57377
View Source
const ELSE = 57356
View Source
const EQEQ = 57359
View Source
const EQOPCHAN = 57394
View Source
const FALSE = 57367
View Source
const FINALLY = 57373
View Source
const FOR = 57357
View Source
const FUNC = 57351
View Source
const GE = 57361
View Source
const GO = 57389
View Source
const IDENT = 57346
View Source
const IF = 57355
View Source
const IMPORT = 57400
View Source
const IN = 57358
View Source
const LE = 57362
View Source
const LEN = 57396
View Source
const MAKE = 57392
View Source
const MAP = 57399
View Source
const MINUSEQ = 57375
View Source
const MINUSMINUS = 57383
View Source
const MODULE = 57370
View Source
const MULEQ = 57376
View Source
const NEQ = 57360
View Source
const NEW = 57365
View Source
const NIL = 57368
View Source
const NILCOALESCE = 57369
View Source
const NUMBER = 57347
View Source
const OPCHAN = 57393
View Source
const OREQ = 57379
View Source
const OROR = 57363
View Source
const PLUSEQ = 57374
View Source
const PLUSPLUS = 57382
View Source
const RETURN = 57352
View Source
const SHIFTLEFT = 57384
View Source
const SHIFTRIGHT = 57385
View Source
const STRING = 57348
View Source
const STRUCT = 57391
View Source
const SWITCH = 57386
View Source
const THROW = 57354
View Source
const TRUE = 57366
View Source
const TRY = 57371
View Source
const TYPE = 57395
View Source
const UNARY = 57401
View Source
const VAR = 57353
View Source
const VARARG = 57350

Variables

This section is empty.

Functions

func EnableDebug added in v0.1.5

func EnableDebug(level int)

EnableDebug enabled debug from the parser

func EnableErrorVerbose

func EnableErrorVerbose()

EnableErrorVerbose enabled verbose errors from the parser

func Parse

func Parse(s *Scanner) (ast.Stmt, error)

Parse provides way to parse the code using Scanner.

func ParseSrc

func ParseSrc(src string) (ast.Stmt, error)

ParseSrc provides way to parse the code from source.

Types

type Error

type Error struct {
	Message  string
	Pos      ast.Position
	Filename string
	Fatal    bool
}

Error is a parse error.

func (*Error) Error

func (e *Error) Error() string

Error returns the parse error message.

type Lexer

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

Lexer provides interface to parse codes.

func (*Lexer) Error

func (l *Lexer) Error(msg string)

Error sets parse error.

func (*Lexer) Lex

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

Lex scans the token and literals.

type Scanner

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

Scanner stores informations for lexer.

func (*Scanner) Init

func (s *Scanner) Init(src string)

Init resets code to scan.

func (*Scanner) Scan

func (s *Scanner) Scan() (tok int, lit string, pos ast.Position, err error)

Scan analyses token, and decide identify or literals.

Jump to

Keyboard shortcuts

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