lexer

package
v0.0.0-...-6aa2a36 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Hash                     = "#"
	LineEnd                  = "\n"
	CodeDelimiter            = "`"
	FencedCodeBlockDelimiter = "```"
	OpenSquareBracket        = "["
	CloseSquareBracket       = "]"
	OpenParen                = "("
	CloseParen               = ")"
	OpenCurlyBrace           = "{"
	CloseCurlyBrace          = "}"
	Comma                    = ","
	UnorderedListPrefix      = "-"
	Whitespace               = " \t"
	SymbolStart              = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
	SymbolTail               = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
	NumberStart              = "0123456789"
	StringStart              = "\""
	PlusPlus                 = "++"
	MinusMinus               = "--"
	Not                      = "!"
	Plus                     = "+"
	Minus                    = "-"
	Star                     = "*"
	Slash                    = "/"
	Percent                  = "%"
	Gte                      = ">="
	Gt                       = ">"
	Lte                      = "<="
	Lt                       = "<"
	Eq                       = "="
	EqEq                     = "=="
	Neq                      = "!="
	TrueLiteral              = "true"
	FalseLiteral             = "false"
	NullLiteral              = "null"
	GotoLiteral              = "goto"
	Dot                      = "."
	Semicolon                = ";"
	And                      = "&&"
	Or                       = "||"
	Operators                = "!+-*/><=&|{}().,;%"
	IfLiteral                = "if"
	ElseLiteral              = "else"
	WhileLiteral             = "while"
	Comment                  = "//"
	BoolType                 = "bool"
	NumberType               = "number"
	StringType               = "string"
	NullType                 = "null"
	ExternKeyword            = "extern"
)
View Source
const (
	ErrorBadHeader         = "Header must only be of the form '# HeaderName\\n"
	ErrorBadLink           = "Link must only be of the form '[symbol] (text)\\n"
	ErrorBadCode           = "Unrecognized code element"
	ErrorBadNumber         = "Numbers must be in format -?0|([1-9][0-9]*(e[+-]?[0-9])?)"
	ErrorBadOperator       = "Not a valid operator"
	ErrorBadString         = "Not a valid string"
	ErrorBadEscape         = "The only valid escapes are \\\\, \\/, \\b, \\f, \\n, \\r, \\t, \\uxxxx"
	ErrorBadFrontMatterEnd = "Fromtmatter must end in mewline"
	ErrorBadFrontmatter    = "Unrecognized token in frontmatter"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Lexer

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

func New

func New(input string) *Lexer

func (*Lexer) Lex

func (l *Lexer) Lex() []lexeme.Item

type State

type State func(*Lexer) State

func LexCloseCodeFence

func LexCloseCodeFence(l *Lexer) State

func LexCloseInlineCode

func LexCloseInlineCode(l *Lexer) State

func LexCode

func LexCode(l *Lexer) State

func LexComment

func LexComment(l *Lexer) State

func LexFrontMatter

func LexFrontMatter(l *Lexer) State

func LexHeader

func LexHeader(l *Lexer) State

func LexLine

func LexLine(l *Lexer) State

func LexLineEndInCode

func LexLineEndInCode(l *Lexer) State
func LexLink(l *Lexer) State

func LexNumber

func LexNumber(l *Lexer) State

func LexOpenCodeFence

func LexOpenCodeFence(l *Lexer) State

func LexOpenInlineCode

func LexOpenInlineCode(l *Lexer) State

func LexOperator

func LexOperator(l *Lexer) State

func LexString

func LexString(l *Lexer) State

func LexSymbol

func LexSymbol(l *Lexer) State

func LexUnorderedListItem

func LexUnorderedListItem(l *Lexer) State

Jump to

Keyboard shortcuts

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