token

package
v0.0.0-...-b83a777 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2017 License: BSD-2-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package token defines data structures representing Neugram tokens.

Index

Constants

This section is empty.

Variables

View Source
var Keywords = map[string]Token{
	"package":     Package,
	"import":      Import,
	"func":        Func,
	"return":      Return,
	"switch":      Switch,
	"case":        Case,
	"default":     Default,
	"fallthrough": Fallthrough,
	"const":       Const,
	"if":          If,
	"else":        Else,
	"for":         For,
	"range":       Range,
	"continue":    Continue,
	"break":       Break,
	"goto":        Goto,
	"go":          Go,
	"chan":        Chan,
	"map":         Map,
	"struct":      Struct,
	"methodik":    Methodik,
	"interface":   Interface,
	"type":        Type,
}

Functions

This section is empty.

Types

type Token

type Token int

Token is a neugram lexical token.

const (
	Unknown Token = iota
	Comment

	Ident     // E.g. funcName
	Int       // E.g. 1001 TODO: rename to Integer?
	Float     // E.g. 10.01
	Imaginary // E.g. 10.01i
	String    // E.g. "a string"
	Rune      // E.g. '\u1f4a9'

	Add          // +
	Sub          // -
	Mul          // *
	Div          // /
	Rem          // %
	Pow          // ^
	Ref          // &
	LogicalAnd   // &&
	LogicalOr    // ||
	Equal        // ==
	Less         // <
	Greater      // >
	Assign       // =
	Not          // !
	NotEqual     // !=
	LessEqual    // <=
	GreaterEqual // >=
	Shell        // $$
	ShellWord    // [^\s|&;<>()]+
	ShellPipe    // |
	ShellNewline // \n
	GreaterAnd   // >&
	AndGreater   // &>
	TwoGreater   // >>
	ChanOp       // <-
	Ellipsis     // ...

	Inc       // ++
	Dec       // --
	AddAssign // +=
	SubAssign // -=
	MulAssign // *=
	DivAssign // /=
	RemAssign // %=
	PowAssign // ^=
	Define    // :=

	LeftParen    // (
	LeftBracket  // [
	LeftBrace    // {
	RightParen   // )
	RightBracket // ]
	RightBrace   // }
	Comma        // ,
	Period       // .
	Semicolon    // ;
	Colon        // :
	Pipe         // |

	Package
	Import

	Func
	Return

	Switch
	Case
	Default
	Fallthrough

	Const

	If
	Else

	For
	Range
	Continue
	Break
	Goto

	Go

	Chan
	Map
	Struct
	Methodik
	Interface
	Type
)

func Keyword

func Keyword(n string) Token

func (Token) Precedence

func (t Token) Precedence() int

func (Token) String

func (t Token) String() string

Jump to

Keyboard shortcuts

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