gitoken

package
v0.0.0-...-bf9f4d5 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package gitoken (Glif Interpreter TOKEN) defines the list of recognized tokens

Index

Constants

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

	// Identifiers and litterals
	IDENT  = "IDENT" //
	INT    = "INT"   // 0123456789
	STRING = "STRING"

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

	LT = "<"
	GT = ">"

	EQ    = "=="
	NOTEQ = "!="

	TO = "->"

	// Delimiters
	COMMA     = ","
	SEMICOLON = ";"
	LPAREN    = "("
	RPAREN    = ")"
	LBRACE    = "{"
	RBRACE    = "}"
	LBRAKET   = "["
	RBRAKET   = "]"
	COLON     = ":"

	// Keywords
	FUNCTION = "FUNCTION"
	LET      = "LET"
	SET      = "SET"
	TRUE     = "TRUE"
	FALSE    = "FALSE"
	IF       = "IF"
	ELSE     = "ELSE"
	RETURN   = "RETURN"
	REPOPATH = "REPOPATH"
	TICKETS  = "TICKETS"
)

Definition of the various constant for the tokens to be returned by the lexer

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

type Token struct {
	Type    TokenType
	Literal string
}

Token is a series of character forming a word (literal)

type TokenType

type TokenType string

TokenType is a simple string to store the type of the token object

func LookupIdent

func LookupIdent(ident string) TokenType

LookupIdent returns the TokenType of the keyword if the ident string is a keyword. Otherwise it returns the contant IDEN

Jump to

Keyboard shortcuts

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