token

package
v0.0.0-...-26c87ff Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2017 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package token provides the base lexical tokens for parsing files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

type Token int

Token is the token representation for the GryphOn uration files

const (
	// Special tokens
	ILLEGAL Token = iota
	EOF           // EOF
	COMMENT       // #

	IDENT // Slave1
	INT   // 200
	FLOAT // 123.45

	// Operators and delimiters
	ADD // +
	SUB // -
	MUL // *
	QUO // /
	REM // %

	AND // &
	OR  // |

	DAND   // &&
	DOR    // ||
	ASSIGN // =
	NOT    // !

	EQL // ==
	LSS // <
	GTR // >
	NEQ // !=
	LEQ // <=
	GEQ // >=

	LPAREN   // (
	LBRACK   // [
	LBRACE   // {
	COMMA    // ,
	PERIOD   // .
	ELLIPSIS // ...

	RPAREN    // )
	RBRACK    // ]
	RBRACE    // }
	SEMICOLON // ;
	COLON     // :

	ITERATOR // $

	OUTPUT // Output registers
	INPUT  // Input registers

)

func (Token) IsComparisonOperator

func (tok Token) IsComparisonOperator() bool

IsComparisonOperator returns true for tokens corresponding to comparison operators; it returns false otherwise.

func (Token) IsKeyword

func (tok Token) IsKeyword() bool

IsKeyword returns true for tokens corresponding to keywords; it returns false otherwise.

func (Token) IsLiteral

func (tok Token) IsLiteral() bool

IsLiteral returns true for tokens corresponding to identifiers and basic type literals; it returns false otherwise.

func (Token) IsOperator

func (tok Token) IsOperator() bool

IsOperator returns true for tokens corresponding to operators and delimiters; it returns false otherwise.

func (Token) Precedence

func (tok Token) Precedence() int

Precedence indicates the priority of the defined operators

func (Token) String

func (tok Token) String() string

Jump to

Keyboard shortcuts

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