token

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type Token

type Token int

Token represents a lexical token in a JSONPath expression.

const (
	ILLEGAL Token = iota
	STRING
	INTEGER
	FLOAT
	STRING_LITERAL
	TRUE
	FALSE
	NULL
	ROOT
	CURRENT
	WILDCARD
	PROPERTY_NAME
	RECURSIVE
	CHILD
	ARRAY_SLICE
	FILTER
	PAREN_LEFT
	PAREN_RIGHT
	BRACKET_LEFT
	BRACKET_RIGHT
	COMMA
	TILDE
	AND
	OR
	NOT
	EQ
	NE
	GT
	GE
	LT
	LE
	MATCHES
	FUNCTION
)

The list of tokens.

func (Token) String

func (tok Token) String() string

String returns the string representation of the token.

type TokenInfo

type TokenInfo struct {
	Token   Token
	Line    int
	Column  int
	Literal string
	Len     int
}

TokenInfo represents a token and its associated information.

type Tokenizer

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

Tokenizer represents a JSONPath tokenizer.

func NewTokenizer

func NewTokenizer(input string, opts ...config.Option) *Tokenizer

NewTokenizer creates a new JSONPath tokenizer for the given input string.

func (Tokenizer) ErrorString

func (t Tokenizer) ErrorString(target *TokenInfo, msg string) string

When there's an error in the tokenizer, this helps represent it.

func (Tokenizer) ErrorTokenString

func (t Tokenizer) ErrorTokenString(target *TokenInfo, msg string) string

When there's an error

func (*Tokenizer) Tokenize

func (t *Tokenizer) Tokenize() Tokens

Tokenize tokenizes the input string and returns a slice of TokenInfo.

type Tokens

type Tokens []TokenInfo

Tokens represents the list of tokens

func (Tokens) IsSimple

func (tok Tokens) IsSimple() bool

Jump to

Keyboard shortcuts

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