uparse

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: GPL-3.0 Imports: 7 Imported by: 1

README

uparse

Licencse

GNU

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseToken

type BaseToken struct {
	Token
	// contains filtered or unexported fields
}

func (*BaseToken) Description

func (t *BaseToken) Description() any

func (*BaseToken) IsLiteral

func (t *BaseToken) IsLiteral() bool

func (*BaseToken) IsOperator

func (t *BaseToken) IsOperator() bool

func (*BaseToken) IsOperatorOf

func (t *BaseToken) IsOperatorOf(name string) bool

func (*BaseToken) IsSeperator

func (t *BaseToken) IsSeperator() bool

func (*BaseToken) IsString

func (t *BaseToken) IsString() bool

func (*BaseToken) Line

func (t *BaseToken) Line() int

func (*BaseToken) Position

func (t *BaseToken) Position() int

func (*BaseToken) String

func (t *BaseToken) String() string

func (*BaseToken) Type

func (t *BaseToken) Type() string

func (*BaseToken) Value

func (t *BaseToken) Value() string

type CommentDescription

type CommentDescription struct {
	StartSequence string
	StopSequence  string
	StopOperator  string
	LineComment   bool
}

type CommentToken

type CommentToken struct {
	*BaseToken
	// contains filtered or unexported fields
}

func (*CommentToken) Description

func (t *CommentToken) Description() any

func (*CommentToken) String

func (t *CommentToken) String() string

func (*CommentToken) Type

func (t *CommentToken) Type() string

type Lexer

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

func NewLexer

func NewLexer() *Lexer

func (*Lexer) Lex

func (lex *Lexer) Lex(value string) (tokens TokenList, err error)

func (*Lexer) SetCommentDefinitions

func (lex *Lexer) SetCommentDefinitions(descriptions []*CommentDescription)

func (*Lexer) SetEscapeChar

func (lex *Lexer) SetEscapeChar(char rune)

func (*Lexer) SetOperators

func (lex *Lexer) SetOperators(descriptions []*OperatorDescription)

func (*Lexer) SetSeperators

func (lex *Lexer) SetSeperators(seperators string)

func (*Lexer) SetStringDefinitions

func (lex *Lexer) SetStringDefinitions(descriptions []*StringDescription)

type LexerInput

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

func NewLexerInput

func NewLexerInput(lexer *Lexer, value string) *LexerInput

func (*LexerInput) Begin

func (in *LexerInput) Begin() *LexerInput

func (*LexerInput) BeginSelect

func (in *LexerInput) BeginSelect()

func (*LexerInput) CharPosition

func (in *LexerInput) CharPosition() (position int)

func (*LexerInput) Current

func (in *LexerInput) Current() rune

func (*LexerInput) CurrentString

func (in *LexerInput) CurrentString() string

func (*LexerInput) Cursor

func (in *LexerInput) Cursor() int

func (*LexerInput) EOF

func (in *LexerInput) EOF() bool

func (*LexerInput) End

func (in *LexerInput) End()

func (*LexerInput) EndSelect

func (in *LexerInput) EndSelect() []rune

func (*LexerInput) Error

func (in *LexerInput) Error(msg string) error

func (*LexerInput) ErrorExpected

func (in *LexerInput) ErrorExpected(expected string) error

func (*LexerInput) ExpectedChars

func (in *LexerInput) ExpectedChars(count int) (value string)

ExpectedChars returns up to “count“ chars if the buffer has more runes in it then requested, it appends ... to the return value

func (*LexerInput) IsLastLine

func (in *LexerInput) IsLastLine() bool

func (*LexerInput) Line

func (in *LexerInput) Line() int

func (*LexerInput) Next

func (in *LexerInput) Next() bool

func (*LexerInput) Peek

func (in *LexerInput) Peek() rune

func (*LexerInput) Seek

func (in *LexerInput) Seek(position int, whence int) bool

func (*LexerInput) Skip

func (in *LexerInput) Skip(count int) bool

func (*LexerInput) SkipToEndOf

func (in *LexerInput) SkipToEndOf(sequence string) bool

func (*LexerInput) SkipToStartOf

func (in *LexerInput) SkipToStartOf(sequence string) bool

func (*LexerInput) StartsWith

func (in *LexerInput) StartsWith(value string) bool

type LiteralToken

type LiteralToken struct {
	*BaseToken
}

func (*LiteralToken) Description

func (t *LiteralToken) Description() any

func (*LiteralToken) IsLiteral

func (t *LiteralToken) IsLiteral() bool

func (*LiteralToken) String

func (t *LiteralToken) String() string

func (*LiteralToken) Type

func (t *LiteralToken) Type() string

type OperatorDescription

type OperatorDescription struct {
	Name          string
	StartSequence string
}

type OperatorToken

type OperatorToken struct {
	*BaseToken
	// contains filtered or unexported fields
}

func (*OperatorToken) Description

func (t *OperatorToken) Description() any

func (OperatorToken) IsOperatorOf

func (t OperatorToken) IsOperatorOf(name string) bool

func (*OperatorToken) String

func (t *OperatorToken) String() string

func (*OperatorToken) Type

func (t *OperatorToken) Type() string

type SeperatorToken

type SeperatorToken struct {
	*BaseToken
}

func (*SeperatorToken) Description

func (t *SeperatorToken) Description() any

func (*SeperatorToken) String

func (t *SeperatorToken) String() string

func (*SeperatorToken) Type

func (t *SeperatorToken) Type() string

type StringDescription

type StringDescription struct {
	StartSequence string
	StopSequence  string
	AllowNewline  bool
}

type StringToken

type StringToken struct {
	*BaseToken
	// contains filtered or unexported fields
}

func (*StringToken) Description

func (t *StringToken) Description() any

func (*StringToken) String

func (t *StringToken) String() string

func (*StringToken) Type

func (t *StringToken) Type() string

type Token

type Token interface {
	Line() int
	Position() int
	Value() string
	Type() string
	Description() any
}

type TokenList

type TokenList []Token

func (TokenList) FilterTypes

func (l TokenList) FilterTypes(types ...string) (out TokenList)

func (TokenList) String

func (l TokenList) String() string

func (TokenList) StrippedString

func (l TokenList) StrippedString(whitespace string) string

Jump to

Keyboard shortcuts

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