scanner

package
v0.0.0-...-35f0d61 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintTokens

func PrintTokens(tokens []*Token)

Types

type Token

type Token struct {
	Type    TokenType
	Lexeme  string
	Literal any
}

func Scan

func Scan(s string) ([]*Token, error)

func (*Token) Equal

func (t *Token) Equal(o *Token) bool

type TokenType

type TokenType int
const (
	// single character tokens
	NONE TokenType = iota
	COMMA
	LEFT_PAREN
	RIGHT_PAREN
	DOT
	MINUS
	PLUS
	STAR
	SLASH
	SEMICOLON

	// single or double character tokens
	BANG
	BANG_EQUAL
	EQUAL
	EQUAL_EQUAL
	GREATER
	GREATER_EQUAL
	LESS
	LESS_EQUAL

	// literals
	IDENTIFIER
	STRING
	NUMBER

	// data type
	DATATYPE_BOOLEAN
	DATATYPE_STRING
	DATATYPE_NUMBER

	// keywords
	SELECT
	INSERT
	INTO
	UPDATE
	DELETE

	CREATE
	TABLE

	FROM
	WHERE
	GROUP
	OFFSET
	ORDER
	LIMIT
	SET

	AND
	OR
	NOT

	VALUES
)

func (TokenType) String

func (i TokenType) String() string

Jump to

Keyboard shortcuts

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