Constants

T_DOT

T_DOT = 'dot'

T_STAR

T_STAR = 'star'

T_COMMA

T_COMMA = 'comma'

T_COLON

T_COLON = 'colon'

T_CURRENT

T_CURRENT = 'current'

T_EXPREF

T_EXPREF = 'expref'

T_LPAREN

T_LPAREN = 'lparen'

T_RPAREN

T_RPAREN = 'rparen'

T_LBRACE

T_LBRACE = 'lbrace'

T_RBRACE

T_RBRACE = 'rbrace'

T_LBRACKET

T_LBRACKET = 'lbracket'

T_RBRACKET

T_RBRACKET = 'rbracket'

T_FLATTEN

T_FLATTEN = 'flatten'

T_IDENTIFIER

T_IDENTIFIER = 'identifier'

T_NUMBER

T_NUMBER = 'number'

T_QUOTED_IDENTIFIER

T_QUOTED_IDENTIFIER = 'quoted_identifier'

T_UNKNOWN

T_UNKNOWN = 'unknown'

T_PIPE

T_PIPE = 'pipe'

T_OR

T_OR = 'or'

T_AND

T_AND = 'and'

T_NOT

T_NOT = 'not'

T_FILTER

T_FILTER = 'filter'

T_LITERAL

T_LITERAL = 'literal'

T_EOF

T_EOF = 'eof'

T_COMPARATOR

T_COMPARATOR = 'comparator'

STATE_IDENTIFIER

STATE_IDENTIFIER = 0

STATE_NUMBER

STATE_NUMBER = 1

STATE_SINGLE_CHAR

STATE_SINGLE_CHAR = 2

STATE_WHITESPACE

STATE_WHITESPACE = 3

STATE_STRING_LITERAL

STATE_STRING_LITERAL = 4

STATE_QUOTED_STRING

STATE_QUOTED_STRING = 5

STATE_JSON_LITERAL

STATE_JSON_LITERAL = 6

STATE_LBRACKET

STATE_LBRACKET = 7

STATE_PIPE

STATE_PIPE = 8

STATE_LT

STATE_LT = 9

STATE_GT

STATE_GT = 10

STATE_EQ

STATE_EQ = 11

STATE_NOT

STATE_NOT = 12

STATE_AND

STATE_AND = 13

Properties

$transitionTable

$transitionTable : array

Type

array — We know what token we are consuming based on each char

$validIdentifier

$validIdentifier : array

Type

array — Valid identifier characters after first character

$numbers

$numbers : array

Type

array — Valid number characters after the first character

$simpleTokens

$simpleTokens : array

Type

array — Map of simple single character tokens

Methods

tokenize()

tokenize(string  $input) : array

Tokenize the JMESPath expression into an array of tokens hashes that contain a 'type', 'value', and 'key'.

Parameters

string $input

JMESPath input

Throws

\JmesPath\SyntaxErrorException

Returns

array —

matchOr()

matchOr(array  $chars, string  $current, string  $expected, string  $type, string  $orElse) : array

Returns a token based on whether or not the next token matches the expected value. If it does, a token of "$type" is returned. Otherwise, a token of "$orElse" type is returned.

Parameters

array $chars

Array of characters by reference.

string $current

The current character.

string $expected

Expected character.

string $type

Expected result type.

string $orElse

Otherwise return a token of this type.

Returns

array —

Returns a conditional token.

inside()

inside(array  $chars, string  $delim, string  $type) : array

Returns a token the is the result of consuming inside of delimiter characters. Escaped delimiters will be adjusted before returning a value. If the token is not closed, "unknown" is returned.

Parameters

array $chars

Array of characters by reference.

string $delim

The delimiter character.

string $type

Token type.

Returns

array —

Returns the consumed token.

parseJson()

parseJson(array  $token) : array

Parses a JSON token or sets the token type to "unknown" on error.

Parameters

array $token

Token that needs parsing.

Returns

array —

Returns a token with a parsed value.