@@ 116-125 (lines=10) @@ | ||
113 | $this->stream = $stream; |
|
114 | $node = $this->parseExpression(); |
|
115 | ||
116 | if (!$stream->isEOF()) { |
|
117 | throw new SyntaxError( |
|
118 | sprintf( |
|
119 | 'Unexpected token "%s" of value "%s"', |
|
120 | $stream->current->type, |
|
121 | $stream->current->value |
|
122 | ), |
|
123 | $stream->current->cursor |
|
124 | ); |
|
125 | } |
|
126 | ||
127 | return $node; |
|
128 | } |
|
@@ 403-407 (lines=5) @@ | ||
400 | $this->stream->next(); |
|
401 | } elseif ($this->stream->current->test(Token::PUNCTUATION_TYPE, '(')) { |
|
402 | $key = $this->parseExpression(); |
|
403 | } else { |
|
404 | $current = $this->stream->current; |
|
405 | ||
406 | throw new SyntaxError(sprintf('A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s"', $current->type, $current->value), $current->cursor); |
|
407 | } |
|
408 | ||
409 | $this->stream->expect(Token::PUNCTUATION_TYPE, ':', 'A hash key must be followed by a colon (:)'); |
|
410 | $value = $this->parseExpression(); |