lexer

package
v0.0.0-...-3c3801e Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KeywordToString = map[Token]string{
	TTrue:  "true",
	TFalse: "false",
	TNull:  "null",
}

Functions

func IsWhitespace

func IsWhitespace(codePoint rune) bool

Types

type Lexer

type Lexer struct {
	Token Token

	Number float64
	String string
	// contains filtered or unexported fields
}

func NewLexer

func NewLexer(s string) Lexer

func (*Lexer) Next

func (l *Lexer) Next()

func (*Lexer) SyntaxError

func (l *Lexer) SyntaxError(msg string)

type LexerPanic

type LexerPanic struct {
	Msg string
	Loc Loc
}

type Loc

type Loc struct {
	// This is the 0-based index of this location from the start of the file, in bytes
	Start int32
}

type Token

type Token uint
const (
	TEndOfFile Token = iota

	// Structural tokens
	TLeftSquareBracket  // [
	TLeftCurlyBracket   // {
	TRightSquareBracket // ]
	TRightCurlyBracket  // }
	TColon              // ;
	TComma              // ,

	// Literal tokens
	TTrue  // true
	TFalse // false
	TNull  // null
	TNumber
	TString
)

Jump to

Keyboard shortcuts

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