token

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OneOfTypes

func OneOfTypes(tok *Token, types ...Type) bool

Types

type Emitter

type Emitter interface {
	Emit(token *Token)
}

type EmitterFunc

type EmitterFunc func(token *Token)

func (EmitterFunc) Emit

func (fn EmitterFunc) Emit(token *Token)

type EmitterIterator

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

func NewEmitterIterator

func NewEmitterIterator() *EmitterIterator

func (*EmitterIterator) Emit

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

func (*EmitterIterator) NextToken

func (e *EmitterIterator) NextToken() *Token

type Iterator

type Iterator interface {
	NextToken() *Token
}

type Token

type Token struct {
	Filename string
	Literal  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
	Http                                 // http
	Rpc                                  // rpc
	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
	File                                 // file
	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                               // =
	Colon                                // :
	Comma                                // ,
	Extend                               // ...
	OpenCurly                            // {
	CloseCurly                           // }
	OpenParen                            // (
	CloseParen                           // )
	OpenAngle                            // <
	CloseAngle                           // >
	RightComment                         // #
	TopComment                           // #
	CustomError                          // error
)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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