token

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Emitter

type Emitter interface {
	EmitToken(token *Token)
}

type EmitterFunc

type EmitterFunc func(token *Token)

func (EmitterFunc) EmitToken

func (f EmitterFunc) EmitToken(token *Token)

type EmitterIterator

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

func NewEmitterIterator

func NewEmitterIterator() *EmitterIterator

func (*EmitterIterator) EmitToken

func (e *EmitterIterator) EmitToken(token *Token)

func (*EmitterIterator) NextToken

func (e *EmitterIterator) NextToken() *Token

type Iterator

type Iterator interface {
	NextToken() *Token
}

type Token

type Token struct {
	Filename string
	Value    string
	Type     Type
	Start    int
	End      int
}

type Type

type Type int
const (
	Error                    Type = -1   // Error token type which indicates error
	EOF                      Type = iota // EOF token type which indicates end of input
	Identifier                           // identifier
	Const                                // const
	Enum                                 // enum
	Model                                // model
	Service                              // service
	Byte                                 // byte
	Bool                                 // bool
	Int8                                 // int8
	Int16                                // int16
	Int32                                // int32
	Int64                                // int64
	Uint8                                // uint8
	Uint16                               // uint16
	Uint32                               // uint32
	Uint64                               // uint64
	Float32                              // float32
	Float64                              // float64
	Timestamp                            // timestamp
	String                               // string
	Map                                  // map
	Array                                // array []
	Any                                  // any
	Stream                               // stream
	ConstDuration                        // 1ns, 1us, 1ms, 1s, 1m, 1h
	ConstBytes                           // 1b, 1kb, 1mb, 1gb, 1tb, 1pb, 1eb
	ConstFloat                           // 1.0
	ConstInt                             // 1
	ConstStringSingleQuote               // 'string'
	ConstStringDoubleQuote               // "string"
	ConstStringBacktickQoute             // `string`
	ConstBool                            // true, false
	ConstNull                            // null
	Return                               // =>
	Assign                               // =
	Optional                             // ?
	Colon                                // :
	Comma                                // ,
	Extend                               // ...
	OpenCurly                            // {
	CloseCurly                           // }
	OpenParen                            // (
	CloseParen                           // )
	OpenAngle                            // <
	CloseAngle                           // >
	Comment                              // # comment
	CustomError                          // error
)

func (Type) String

func (tt Type) String() string

Jump to

Keyboard shortcuts

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