public function testCanWorkWithElidedJsonLiterals() { $l = new Lexer(); $tokens = $l->tokenize('`foo`'); $this->assertEquals('foo', $tokens[0]['value']); $this->assertEquals('literal', $tokens[0]['type']); }
/** * Parses a JMESPath expression into an AST * * @param string $expression JMESPath expression to compile * * @return array Returns an array based AST * @throws SyntaxErrorException */ public function parse($expression) { $this->expression = $expression; $this->tokens = $this->lexer->tokenize($expression); $this->tpos = -1; $this->next(); $result = $this->expr(); if ($this->token['type'] === T::T_EOF) { return $result; } throw $this->syntax('Did not reach the end of the token stream'); }