token

package
v0.0.0-...-47fdfb9 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TOKEN_DEF uint8 = iota
	TOKEN_CLASS
	TOKEN_END
	TOKEN_IF
	TOKEN_ELSE
	TOKEN_ELSIF
	TOKEN_BEGIN
	TOKEN_DO
	TOKEN_CONTINUE
	TOKEN_FOR
	TOKEN_WHILE
	TOKEN_LAMBDA
	TOKEN_RETURN
	TOKEN_BREAK
	TOKEN_NEXT
	TOKEN_RESCUE
	TOKEN_TRUE
	TOKEN_FALSE
	TOKEN_NIL
	TOKEN_SUPER
	TOKEN_UNLESS
	TOKEN_REQUIRE
	TOKEN_REQUIRE_RELATIVE
	TOKEN_YIELD
	TOKEN_RAISE
	// /n
	TOKEN_NEWLINE
	// + - * /
	TOKEN_PLUS
	TOKEN_MINUS
	// MINUS immediately followed by token
	// we introduce this token mainly to distinguish
	// between "puts foo - bar" and "puts foo -bar"
	// we parse the former as "puts( (foo) - (bar) )"
	// latter as "puts(foo(-bar))"
	TOKEN_NEGATE_MINUS
	TOKEN_SLASH
	TOKEN_STAR
	// ( )
	TOKEN_LEFT_PAREN
	TOKEN_RIGHT_PAREN
	// { }
	TOKEN_LEFT_BRACE
	TOKEN_RIGHT_BRACE
	// .
	TOKEN_DOT
	// | ||
	TOKEN_BAR
	TOKEN_OR
	// & && &.
	TOKEN_AND
	TOKEN_LOGIC_AND
	TOKEN_OPTIONAL_CALL
	// < > = ! != <= >= ==
	TOKEN_LESS
	TOKEN_GREATER
	TOKEN_EQUAL
	TOKEN_BANG
	TOKEN_BANG_EQUAL
	TOKEN_EQUAL_EQUAL
	TOKEN_GREATER_EQUAL
	TOKEN_LESS_EQUAL
	// ?
	TOKEN_QUESTION_MARK
	// [ ]
	TOKEN_LEFT_BRACKET
	TOKEN_RIGHT_BRACKET
	// : :: :foo
	TOKEN_COLON
	TOKEN_DOUBLE_COLON
	TOKEN_SYMBOL
	// ,
	TOKEN_COMMA
	// =>
	TOKEN_ARROW
	// Literals
	TOKEN_STRING
	TOKEN_DOUBLE
	TOKEN_INT
	TOKEN_IDENTIFIER
	TOKEN_IDENTIFIER_GLOBAL
	TOKEN_IDENTIFIER_IVAR
	TOKEN_IDENTIFIER_CVAR
	TOKEN_STRING_LIST
	// Interpolation
	TOKEN_DOUBLE_QUOTE      // "
	TOKEN_INTERPO_EXP_START // #{

	TOKEN_EOF
)

Variables

View Source
var EOF = Token{Type: TOKEN_EOF}

Functions

func PrintToken

func PrintToken(token Token)

Types

type Token

type Token struct {
	Type  uint8
	Value interface{}
}

Jump to

Keyboard shortcuts

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