| @@ 132-159 (lines=28) @@ | ||
| 129 | $this->emit(Token::T_STRING, $string, $location); |
|
| 130 | } |
|
| 131 | ||
| 132 | private function integerPart() |
|
| 133 | { |
|
| 134 | $number = $this->scanner->next(); |
|
| 135 | $location = $this->getLocation(); |
|
| 136 | if ($number === '-') { |
|
| 137 | if ($this->scanner->eof()) { |
|
| 138 | throw $this->getError('Expected a digit but instead reached end'); |
|
| 139 | } |
|
| 140 | $next = $this->scanner->peek(); |
|
| 141 | if (ctype_digit($next) === false) { |
|
| 142 | throw $this->getError("Expected a digit but instead found \"{$next}\""); |
|
| 143 | } |
|
| 144 | } |
|
| 145 | ||
| 146 | $next = $this->scanner->peek(); |
|
| 147 | if ($next === '0') { |
|
| 148 | $number .= $this->scanner->next(); |
|
| 149 | return array($number, $location); |
|
| 150 | } |
|
| 151 | ||
| 152 | $next = $this->scanner->peek(); |
|
| 153 | while ($this->scanner->eof() === false && ctype_digit($next)) { |
|
| 154 | $number .= $this->scanner->next(); |
|
| 155 | $next = $this->scanner->peek(); |
|
| 156 | } |
|
| 157 | ||
| 158 | return array($number, $location); |
|
| 159 | } |
|
| 160 | ||
| 161 | private function fractionalPart() |
|
| 162 | { |
|
| @@ 103-130 (lines=28) @@ | ||
| 100 | $this->emit(Token::T_STRING, $string, $location); |
|
| 101 | } |
|
| 102 | ||
| 103 | private function integerPart() |
|
| 104 | { |
|
| 105 | $number = $this->scanner->next(); |
|
| 106 | $location = $this->getLocation(); |
|
| 107 | if ($number === '-') { |
|
| 108 | if ($this->scanner->eof()) { |
|
| 109 | throw $this->getError('Expected a digit but instead reached end'); |
|
| 110 | } |
|
| 111 | $next = $this->scanner->peek(); |
|
| 112 | if (ctype_digit($next) === false) { |
|
| 113 | throw $this->getError("Expected a digit but instead found \"{$next}\""); |
|
| 114 | } |
|
| 115 | } |
|
| 116 | ||
| 117 | $next = $this->scanner->peek(); |
|
| 118 | if ($next === '0') { |
|
| 119 | $number .= $this->scanner->next(); |
|
| 120 | return array($number, $location); |
|
| 121 | } |
|
| 122 | ||
| 123 | $next = $this->scanner->peek(); |
|
| 124 | while ($this->scanner->eof() === false && ctype_digit($next)) { |
|
| 125 | $number .= $this->scanner->next(); |
|
| 126 | $next = $this->scanner->peek(); |
|
| 127 | } |
|
| 128 | ||
| 129 | return array($number, $location); |
|
| 130 | } |
|
| 131 | ||
| 132 | private function fractionalPart() |
|
| 133 | { |
|