| Methods |
public
|
__construct(string $text)
|
#
|
public
|
with(callable $callback): mixed
Try a parse action; on failure (null return or exception), reset position.
Try a parse action; on failure (null return or exception), reset position.
|
#
|
public
|
finished(): bool
|
#
|
public
|
remaining(): string
|
#
|
public
|
errorContext(): string
|
#
|
public
|
expression(string $pattern, bool $caseSensitive = true, int $group = 0): string
Match regex at current position, advance cursor, return match.
Match regex at current position, advance cursor, return match.
Throws
|
#
|
public
|
maybeExpression(string $pattern, bool $caseSensitive = true, int $group = 0): ?string
|
#
|
public
|
char(string $char = ''): string
Match a single character (or any character if $char is empty).
Match a single character (or any character if $char is empty).
Throws
|
#
|
public
|
maybeChar(string $char): ?string
|
#
|
public
|
peekChar(string $char): bool
Check if the next non-whitespace character matches, without consuming it.
Check if the next non-whitespace character matches, without consuming it.
|
#
|
public
|
literal(string ...$keywords): string
Match one of the given literal keywords at the current position.
Match one of the given literal keywords at the current position.
Throws
|
#
|
public
|
maybeLiteral(string ...$keywords): ?string
|
#
|
public
|
whitespace(): string
|
#
|
public
|
maybeWhitespace(): ?string
|
#
|
public
|
identifier(): string
|
#
|
public
|
qualifiedIdentifier(): string
|
#
|
public
|
boolean(): string
|
#
|
public
|
guid(): string
|
#
|
public
|
dateTimeOffset(): string
|
#
|
public
|
date(): string
|
#
|
public
|
timeOfDay(): string
|
#
|
public
|
duration(): string
|
#
|
public
|
number(): int|float|null
Match a number (integer or float). Returns int|float|null on no match.
Match a number (integer or float). Returns int|float|null on no match.
|
#
|
public
|
quotedString(string $quote = "'"): string
Match a single-quoted string with '' escape handling.
Match a single-quoted string with '' escape handling.
|
#
|
public
|
operator(string $symbol): ?string
Match an operator: \s{symbol}\s (case-insensitive).
Match an operator: \s{symbol}\s (case-insensitive).
|
#
|
public
|
unaryOperator(string $symbol): ?string
Match a unary operator: {symbol}\s (case-insensitive).
Match a unary operator: {symbol}\s (case-insensitive).
|
#
|
public
|
func(string $symbol): ?string
Match a function call: {symbol}( (case-insensitive). Backtracks the '('.
Match a function call: {symbol}( (case-insensitive). Backtracks the '('.
|
#
|
public
|
matchingParenthesis(): string
Match balanced parentheses, return inner content.
Match balanced parentheses, return inner content.
|
#
|
public
|
maybeMatchingParenthesis(): ?string
|
#
|
| Constants |
public
|
IDENTIFIER = '([A-Za-z_\p{L}\p{Nl}][A-Za-z_0-9\p{L}\p{Nl}\p{Nd}\p{Mn}\p{Mc}\p{Pc}\p{Cf}]{0,127})'
|
#
|
public
|
QUALIFIED_IDENTIFIER = '(?:' . self::IDENTIFIER . '\.?)*' . self::IDENTIFIER
|
#
|
public
|
DURATION = '(-?)P(?=\d|T\d)(\d+Y)?(\d+M)?(\d+[DW])?(T(\d+H)?(\d+M)?((\d+(\.\d+)?)S)?)?'
|
#
|
public
|
DATETIME_OFFSET = '[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])'
|
#
|
public
|
DATE = '[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])'
|
#
|
public
|
GUID = '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}'
|
#
|
public
|
TIME_OF_DAY = '([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?'
|
#
|
public
|
DIGIT = '\d'
|
#
|
public
|
LAMBDA_VARIABLE = self::IDENTIFIER . '\:'
|
#
|