token

package
v0.0.0-...-ca5e2ec Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ID

func ID(token Token) bool

ID ...

func UnreservedWord

func UnreservedWord(token Token) bool

UnreservedWord ...

Types

type Token

type Token int

Token is the set of lexical tokens in JavaScript (ECMA5).

const (
	Illegal Token
	Eof
	Comment

	String
	Number

	Plus      // +
	Minus     // -
	Multiply  // *
	Exponent  // **
	Slash     // /
	Remainder // %

	And                // &
	Or                 // |
	ExclusiveOr        // ^
	ShiftLeft          // <<
	ShiftRight         // >>
	UnsignedShiftRight // >>>

	AddAssign       // +=
	SubtractAssign  // -=
	MultiplyAssign  // *=
	ExponentAssign  // **=
	QuotientAssign  // /=
	RemainderAssign // %=

	AndAssign                // &=
	OrAssign                 // |=
	ExclusiveOrAssign        // ^=
	ShiftLeftAssign          // <<=
	ShiftRightAssign         // >>=
	UnsignedShiftRightAssign // >>>=

	LogicalAnd // &&
	LogicalOr  // ||
	Coalesce   // ??
	Increment  // ++
	Decrement  // --

	Equal       // ==
	StrictEqual // ===
	Less        // <
	Greater     // >
	Assign      // =
	Not         // !

	BitwiseNot // ~

	NotEqual       // !=
	StrictNotEqual // !==
	LessOrEqual    // <=
	GreaterOrEqual // >=

	LeftParenthesis // (
	LeftBracket     // [
	LeftBrace       // {
	Comma           // ,
	Period          // .

	RightParenthesis // )
	RightBracket     // ]
	RightBrace       // }
	Semicolon        // ;
	Colon            // :
	QuestionMark     // ?
	QuestionDot      // ?.
	Arrow            // =>
	Ellipsis         // ...
	Backtick         // `

	PrivateIdentifier

	Identifier
	Keyword
	Boolean
	Null

	If
	In
	Of
	Do

	Var
	For
	New
	Try

	This
	Else
	Case
	Void
	With

	Const
	While
	Break
	Catch
	Throw
	Class
	Super

	Return
	Typeof
	Delete
	Switch

	Default
	Finally
	Extends

	Function
	Continue
	Debugger

	InstanceOf

	EscapedReservedWord

	Let
	Static
	Async
	Await
	Yield
)

func LiteralKeyword

func LiteralKeyword(literal string) (Token, bool)

LiteralKeyword returns the keyword token if literal is a keyword, a Keyword token. If the literal is a future keyword (const, let, class, super, ...), or 0 if the literal is not a keyword.

func (Token) Precedence

func (t Token) Precedence(in bool) int

Precedence ...

func (Token) String

func (t Token) String() string

String returns the string corresponding to the token.

Jump to

Keyboard shortcuts

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