parser

package
v0.0.0-...-d323686 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CharacterToken = "character"
	ParameterToken = "parameter"
	EOFToken       = "eof"
)

Variables

This section is empty.

Functions

func SyntaxCheck

func SyntaxCheck(define string, actual []*Token) (bool, error)

Types

type Lexer

type Lexer struct {
	Text        []rune
	Pos         int
	CurrentChar rune
	LineNo      int
	Column      int
}

func NewLexer

func NewLexer(text []rune) *Lexer

func (*Lexer) Advance

func (l *Lexer) Advance()

func (*Lexer) Character

func (l *Lexer) Character() (*Token, error)

func (*Lexer) GetNextToken

func (l *Lexer) GetNextToken() (*Token, error)

func (*Lexer) Peek

func (l *Lexer) Peek() rune

func (*Lexer) SkipWhitespace

func (l *Lexer) SkipWhitespace()

func (*Lexer) String

func (l *Lexer) String() (*Token, error)

type Syntax

type Syntax struct {
	Text        []rune
	Pos         int
	CurrentChar rune
	LineNo      int
	Column      int
}

func NewSyntax

func NewSyntax(text []rune) *Syntax

func (*Syntax) Advance

func (l *Syntax) Advance()

func (*Syntax) Character

func (l *Syntax) Character() (*Token, error)

func (*Syntax) GetNextToken

func (l *Syntax) GetNextToken() (*Token, error)

func (*Syntax) Parameter

func (l *Syntax) Parameter() (*Token, error)

func (*Syntax) Peek

func (l *Syntax) Peek() rune

func (*Syntax) SkipWhitespace

func (l *Syntax) SkipWhitespace()

type Token

type Token struct {
	Type   string
	Value  Value
	LineNo int
	Column int
}

func ParseString

func ParseString(in string) ([]*Token, error)

type Value

type Value struct {
	Source interface{}
}

func Variable

func Variable(i interface{}) Value

func (Value) Bool

func (v Value) Bool() (bool, bool)

func (Value) Int64

func (v Value) Int64() (int64, bool)

func (Value) String

func (v Value) String() (string, bool)

Jump to

Keyboard shortcuts

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