lexer

package
v0.0.0-...-40ef3ae Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TOKEN_EOF         = iota           // end-of-file
	TOKEN_VARARG                       // ...
	TOKEN_SEP_SEMI                     // ;
	TOKEN_SEP_COMMA                    // ,
	TOKEN_SEP_DOT                      // .
	TOKEN_SEP_COLON                    // :
	TOKEN_SEP_LABEL                    // ::
	TOKEN_SEP_LPAREN                   // (
	TOKEN_SEP_RPAREN                   // )
	TOKEN_SEP_LBRACK                   // [
	TOKEN_SEP_RBRACK                   // ]
	TOKEN_SEP_LCURLY                   // {
	TOKEN_SEP_RCURLY                   // }
	TOKEN_OP_ASSIGN                    // =
	TOKEN_OP_MINUS                     // - (sub or unm)
	TOKEN_OP_WAVE                      // ~ (bnot or bxor)
	TOKEN_OP_ADD                       // +
	TOKEN_OP_MUL                       // *
	TOKEN_OP_DIV                       // /
	TOKEN_OP_IDIV                      // //
	TOKEN_OP_POW                       // ^
	TOKEN_OP_MOD                       // %
	TOKEN_OP_BAND                      // &
	TOKEN_OP_BOR                       // |
	TOKEN_OP_SHR                       // >>
	TOKEN_OP_SHL                       // <<
	TOKEN_OP_CONCAT                    // ..
	TOKEN_OP_LT                        // <
	TOKEN_OP_LE                        // <=
	TOKEN_OP_GT                        // >
	TOKEN_OP_GE                        // >=
	TOKEN_OP_EQ                        // ==
	TOKEN_OP_NE                        // ~=
	TOKEN_OP_LEN                       // #
	TOKEN_OP_AND                       // and
	TOKEN_OP_OR                        // or
	TOKEN_OP_NOT                       // not
	TOKEN_KW_BREAK                     // break
	TOKEN_KW_DO                        // do
	TOKEN_KW_ELSE                      // else
	TOKEN_KW_ELSEIF                    // elseif
	TOKEN_KW_END                       // end
	TOKEN_KW_FALSE                     // false
	TOKEN_KW_FOR                       // for
	TOKEN_KW_FUNCTION                  // function
	TOKEN_KW_GOTO                      // goto
	TOKEN_KW_IF                        // if
	TOKEN_KW_IN                        // in
	TOKEN_KW_LOCAL                     // local
	TOKEN_KW_NIL                       // nil
	TOKEN_KW_REPEAT                    // repeat
	TOKEN_KW_RETURN                    // return
	TOKEN_KW_THEN                      // then
	TOKEN_KW_TRUE                      // true
	TOKEN_KW_UNTIL                     // until
	TOKEN_KW_WHILE                     // while
	TOKEN_IDENTIFIER                   // identifier
	TOKEN_NUMBER                       // number literal
	TOKEN_STRING                       // string literal
	TOKEN_OP_UNM      = TOKEN_OP_MINUS // unary minus
	TOKEN_OP_SUB      = TOKEN_OP_MINUS
	TOKEN_OP_BNOT     = TOKEN_OP_WAVE
	TOKEN_OP_BXOR     = TOKEN_OP_WAVE
)

token kind

Variables

This section is empty.

Functions

This section is empty.

Types

type Lexer

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

func NewLexer

func NewLexer(chunk, chunkName string) *Lexer

func (*Lexer) Line

func (self *Lexer) Line() int

func (*Lexer) LookAhead

func (self *Lexer) LookAhead() int

func (*Lexer) NextIdentifier

func (self *Lexer) NextIdentifier() (line int, token string)

func (*Lexer) NextToken

func (self *Lexer) NextToken() (line, kind int, token string)

func (*Lexer) NextTokenOfKind

func (self *Lexer) NextTokenOfKind(kind int) (line int, token string)

Jump to

Keyboard shortcuts

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