lexer

package
v0.0.2-0...-91d2dc1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lexer

type Lexer struct {
	// contains filtered or unexported fields
}

Lexer - It's create tokens for source that it's passed as string . IMPORTANT!! no create and lexer , use the function NewLexer

func NewLexer

func NewLexer(source string) Lexer

NewLexer create a lexer with string passed as parameter

func (*Lexer) NextToken

func (l *Lexer) NextToken() *Token

NextToken - Next token

type Token

type Token struct {
	TokenType TokenType
	Literal   string
}

Token - Represent a minimun unit of sol programing language

func (Token) ToString

func (t Token) ToString() string

ToString - to string

type TokenType

type TokenType string

TokenType type of token

const (
	ALL            TokenType = "ALL"
	AS             TokenType = "AS"
	BASE           TokenType = "BASE"
	BEFORE         TokenType = "BEFORE"
	BODY           TokenType = "BODY"
	COMMA          TokenType = "COMMA"
	COLON          TokenType = "COLON"
	DELETE         TokenType = "DELETE"
	DOT            TokenType = "DOT"
	EOF            TokenType = "EOF"
	ERRORSHANDLERS TokenType = "ERRORSHANDLERS"
	FROM           TokenType = "FROM"
	GET            TokenType = "GET"
	HANDLER        TokenType = "HANDLER"
	HEAD           TokenType = "HEAD"
	HEADERS        TokenType = "HEADERS"
	IDENT          TokenType = "IDENT"
	IMPORT         TokenType = "IMPORT"
	ILLEGAL        TokenType = "ILLEGAL"
	LBRACE         TokenType = "LBRACE"
	LPAREN         TokenType = "LPAREN"
	OPTIONS        TokenType = "OPTIONS"
	PARAMS         TokenType = "PARAMS"
	PATCH          TokenType = "PATCH"
	POST           TokenType = "POST"
	PUT            TokenType = "PUT"
	QUOTES         TokenType = "QUOTES"
	RBRACE         TokenType = "RBRACE"
	RPAREN         TokenType = "RPAREN"
	SERVICE        TokenType = "SERVICE"
	SERVICEOPTIONS TokenType = "SERVICEOPTIONS"
	SEMICOLON      TokenType = "SEMICOLON"
)

Enum for type of tokens

Jump to

Keyboard shortcuts

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