token

package
Version: v0.0.0-...-89480e5 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2018 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,
	"select":      Select,
	"switch":      Switch,
	"case":        Case,
	"default":     Default,
	"defer":       Defer,
	"fallthrough": Fallthrough,
	"const":       Const,
	"var":         Var,
	"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       // {
	LeftBraceTable  // {|
	RightParen      // )
	RightBracket    // ]
	RightBrace      // }
	RightBraceTable // |}
	Comma           // ,
	Period          // .
	Semicolon       // ;
	Colon           // :
	Pipe            // |

	Package
	Import

	Func
	Return
	Defer

	Select
	Switch
	Case
	Default
	Fallthrough

	Const
	Var

	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

Source Files

Jump to

Keyboard shortcuts

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