Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultFloatType() *types.FloatType
- func DefaultIntType() *types.IntType
- func IsResType(token string) (code int, ok bool)
- type Checkpoint
- type Lexer
- func (l *Lexer) GetPos() int
- func (l *Lexer) GobackTo(c Checkpoint)
- func (l *Lexer) Peek() (ch rune, end bool)
- func (l *Lexer) PeekToken() (code int, token string, eos bool)
- func (l *Lexer) PrintCurrent()
- func (l *Lexer) Scan() (code int, token string, eos bool)
- func (l *Lexer) ScanType(code int) (token string, err error)
- func (l *Lexer) SetCheckpoint() Checkpoint
- func (l *Lexer) SetInput(s string)
Constants ¶
View Source
const ( TYPE_INT = iota TYPE_PLUS // "+" TYPE_SUB // "-" TYPE_MUL // "*" TYPE_DIV // "/" TYPE_LP // "(" TYPE_RP // ")" TYPE_ASSIGN // "=" TYPE_RES_VAR // "var" TYPE_RES_INT // "int" TYPE_NL // "\n" TYPE_VAR // "([a-z]|[A-Z])([a-z]|[A-Z]|[0-9])*" TYPE_FLOAT // 小数,x.y这种 TYPE_RES_FLOAT // "float" TYPE_RES_FUNC // "func" TYPE_LB // "{" TYPE_RB // "}" TYPE_COMMA // "," TYPE_RES_RET // "return" TYPE_RES_VOID // "void" TYPE_RES_TRUE // "true" TYPE_RES_FALSE // "false" TYPE_AND // "&&" TYPE_OR // "||" TYPE_EQ // "==" TYPE_RES_BOOL // "bool" TYPE_LG // ">" TYPE_SM // "<" TYPE_LEQ // ">=" TYPE_SEQ // "<=" TYPE_NOT // "!" TYPE_NEQ // "!=" TYPE_RES_IF // "if" TYPE_RES_EL // "else" TYPE_DEAS // ":=" TYPE_RES_FOR // "for" TYPE_SEMI // ";" TYPE_RES_BR // "break" TYPE_RES_CO // "continue" TYPE_RES_TYPE // "type" TYPE_RES_STRUCT // "struct" TYPE_COLON // ":" TYPE_LSB // "[" TYPE_RSB // "]" TYPE_ESP // "&" TYPE_RES_INT32 // "int32" TYPE_RES_FLOAT32 // "float32" TYPE_RES_INT64 // "int64" TYPE_RES_FLOAT64 // "float64" TYPE_RES_BYTE // "byte" TYPE_DOT // "." TYPE_RES_THIS // "this" TYPE_RES_INTERFACE // "interface" TYPE_RES_NIL // "nil" TYPE_RES_PKG // "pkg" TYPE_STR // a quoted string TYPE_RES_STR // "string" TYPE_RES_IMPORT // "import" TYPE_RES_OP // "op" TYPE_PS // "%" TYPE_SHL // "<<" 逻辑左移 TYPE_SHR // "<<" 算术右移 TYPE_BIT_OR // "|" TYPE_BIT_XOR // "^" TYPE_RES_YIELD // "yield" TYPE_RES_ASYNC // "async" TYPE_RES_AWAIT // "await" )
Variables ¶
View Source
var ( ErrEOS = fmt.Errorf("eos error") ErrTYPE = fmt.Errorf("the next token doesn't match the expected type") )
Functions ¶
func DefaultFloatType ¶
func DefaultIntType ¶
Types ¶
type Checkpoint ¶
type Checkpoint struct {
// contains filtered or unexported fields
}
type Lexer ¶
type Lexer struct {
// contains filtered or unexported fields
}
func (*Lexer) GobackTo ¶
func (l *Lexer) GobackTo(c Checkpoint)
func (*Lexer) PrintCurrent ¶
func (l *Lexer) PrintCurrent()
func (*Lexer) SetCheckpoint ¶
func (l *Lexer) SetCheckpoint() Checkpoint
Click to show internal directories.
Click to hide internal directories.