token

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EOF  = NewBaseToken(-1)
	EOL  = "\\n"
	NULL = ""
)

Functions

This section is empty.

Types

type BaseToken

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

func NewBaseToken

func NewBaseToken(line int) *BaseToken

func (*BaseToken) GetLineNumber

func (t *BaseToken) GetLineNumber() int

func (*BaseToken) GetNumber

func (t *BaseToken) GetNumber() (interface{}, error)

func (*BaseToken) GetText

func (t *BaseToken) GetText() (string, error)

func (*BaseToken) IsIdentifier

func (t *BaseToken) IsIdentifier() bool

func (*BaseToken) IsNumber

func (t *BaseToken) IsNumber() bool

func (*BaseToken) IsString

func (t *BaseToken) IsString() bool

func (*BaseToken) String

func (t *BaseToken) String() string

type CommentToken

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

func NewCommentToken

func NewCommentToken(line int, comment string) *CommentToken

func (*CommentToken) GetLineNumber

func (t *CommentToken) GetLineNumber() int

func (*CommentToken) GetNumber

func (t *CommentToken) GetNumber() (interface{}, error)

func (*CommentToken) GetText

func (t *CommentToken) GetText() (string, error)

func (*CommentToken) IsIdentifier

func (t *CommentToken) IsIdentifier() bool

func (*CommentToken) IsNumber

func (t *CommentToken) IsNumber() bool

func (*CommentToken) IsString

func (t *CommentToken) IsString() bool

func (*CommentToken) String

func (t *CommentToken) String() string

type FloatToken

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

func NewFloatToken

func NewFloatToken(line int, v float64) *FloatToken

func (*FloatToken) GetLineNumber

func (f *FloatToken) GetLineNumber() int

func (*FloatToken) GetNumber

func (f *FloatToken) GetNumber() (interface{}, error)

func (*FloatToken) GetText

func (f *FloatToken) GetText() (string, error)

func (*FloatToken) IsIdentifier

func (f *FloatToken) IsIdentifier() bool

func (*FloatToken) IsNumber

func (f *FloatToken) IsNumber() bool

func (*FloatToken) IsString

func (f *FloatToken) IsString() bool

func (*FloatToken) String

func (f *FloatToken) String() string

type IdentifierToken

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

func NewIdentifierToken

func NewIdentifierToken(line int, t string) *IdentifierToken

func (*IdentifierToken) GetLineNumber

func (t *IdentifierToken) GetLineNumber() int

func (*IdentifierToken) GetNumber

func (t *IdentifierToken) GetNumber() (interface{}, error)

func (*IdentifierToken) GetText

func (t *IdentifierToken) GetText() (string, error)

func (*IdentifierToken) IsIdentifier

func (t *IdentifierToken) IsIdentifier() bool

func (*IdentifierToken) IsNumber

func (t *IdentifierToken) IsNumber() bool

func (*IdentifierToken) IsString

func (t *IdentifierToken) IsString() bool

func (*IdentifierToken) String

func (t *IdentifierToken) String() string

type NumberToken

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

func NewNumberToken

func NewNumberToken(line int, v int) *NumberToken

func (*NumberToken) GetLineNumber

func (t *NumberToken) GetLineNumber() int

func (*NumberToken) GetNumber

func (t *NumberToken) GetNumber() (interface{}, error)

func (*NumberToken) GetText

func (t *NumberToken) GetText() (string, error)

func (*NumberToken) IsIdentifier

func (t *NumberToken) IsIdentifier() bool

func (*NumberToken) IsNumber

func (t *NumberToken) IsNumber() bool

func (*NumberToken) IsString

func (t *NumberToken) IsString() bool

func (*NumberToken) String

func (t *NumberToken) String() string

type StringToken

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

func NewStringToken

func NewStringToken(line int, s string) *StringToken

func (*StringToken) GetLineNumber

func (t *StringToken) GetLineNumber() int

func (*StringToken) GetNumber

func (t *StringToken) GetNumber() (interface{}, error)

func (*StringToken) GetText

func (t *StringToken) GetText() (string, error)

func (*StringToken) IsIdentifier

func (t *StringToken) IsIdentifier() bool

func (*StringToken) IsNumber

func (t *StringToken) IsNumber() bool

func (*StringToken) IsString

func (t *StringToken) IsString() bool

func (*StringToken) String

func (t *StringToken) String() string

type Token

type Token interface {
	IsIdentifier() bool
	IsNumber() bool
	IsString() bool

	GetLineNumber() int
	GetNumber() (interface{}, error)
	GetText() (string, error)

	String() string
}

Jump to

Keyboard shortcuts

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