token

package
v3.7.3+incompatible Latest Latest
Warning

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

Go to latest
Published: May 3, 2018 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ILLEGAL = "ILLEGAL"
	EOF     = "EOF"

	// Identifiers + literals
	IDENT  = "IDENT"  // add, foobar, x, y, ...
	INT    = "INT"    // 1343456
	FLOAT  = "FLOAT"  // 12.34
	STRING = "STRING" // "foobar"
	HTML   = "HTML"   // <p>adf</p>
	DOT    = "DOT"    // .23

	// Operators
	ASSIGN   = "="
	PLUS     = "+"
	MINUS    = "-"
	BANG     = "!"
	ASTERISK = "*"
	SLASH    = "/"
	PERCENT  = "%"

	LT   = "<"
	LTEQ = "<="
	GT   = ">"
	GTEQ = ">="

	EQ      = "=="
	NOT_EQ  = "!="
	AND     = "&&"
	OR      = "||"
	MATCHES = "~="

	S_START = "<%"
	C_START = "<%#"
	E_START = "<%="
	E_END   = "%>"

	COMMA     = ","
	SEMICOLON = ";"
	COLON     = ":"

	LPAREN   = "("
	RPAREN   = ")"
	LBRACE   = "{"
	RBRACE   = "}"
	LBRACKET = "["
	RBRACKET = "]"

	// Keywords
	FUNCTION = "FUNCTION"
	LET      = "LET"
	TRUE     = "TRUE"
	FALSE    = "FALSE"
	IF       = "IF"
	ELSE     = "ELSE"
	RETURN   = "RETURN"
	FOR      = "FOR"
	IN       = "IN"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

type Token struct {
	Type       Type
	Literal    string
	LineNumber int
}

Token of a section of input source.

type Type

type Type string

Type represents each type of token.

func LookupIdent

func LookupIdent(ident string) Type

LookupIdent an ident and return a keyword type, or a plain ident

Jump to

Keyboard shortcuts

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