@@ 145-163 (lines=19) @@ | ||
142 | * @throws \InvalidArgumentException |
|
143 | * @throws \LogicException |
|
144 | */ |
|
145 | private function extractSectionName() |
|
146 | { |
|
147 | start: |
|
148 | $char = $this->stream->currentAscii(); |
|
149 | ||
150 | if ($char->isLetter() || $char->isDigit() || $char->is(AsciiChar::UNDERSCORE)) { |
|
151 | $this->currentSection['name'] .= $this->stream->current(); |
|
152 | $this->stream->next(); |
|
153 | goto start; |
|
154 | } elseif ($char->isWhiteSpace() || $char->is(AsciiChar::COLON)) { |
|
155 | if (empty($this->currentSection['name'])) { |
|
156 | throw new SyntaxErrorException($this->stream); |
|
157 | } |
|
158 | ||
159 | return; |
|
160 | } else { |
|
161 | throw new SyntaxErrorException($this->stream); |
|
162 | } |
|
163 | } |
|
164 | ||
165 | /** |
|
166 | * @internal |
|
@@ 196-214 (lines=19) @@ | ||
193 | * @throws \InvalidArgumentException |
|
194 | * @throws \LogicException |
|
195 | */ |
|
196 | private function extractInheritanceName() |
|
197 | { |
|
198 | start: |
|
199 | $char = $this->stream->currentAscii(); |
|
200 | ||
201 | if ($char->isLetter() || $char->isDigit() || $char->is(AsciiChar::UNDERSCORE)) { |
|
202 | $this->currentSection['inheritance'] .= $this->stream->current(); |
|
203 | $this->stream->next(); |
|
204 | goto start; |
|
205 | } elseif ($char->isWhiteSpace()) { |
|
206 | if (empty($this->currentSection['inheritance'])) { |
|
207 | throw new SyntaxErrorException($this->stream); |
|
208 | } |
|
209 | ||
210 | return; |
|
211 | } else { |
|
212 | throw new SyntaxErrorException($this->stream); |
|
213 | } |
|
214 | } |
|
215 | ||
216 | /** |
|
217 | * @internal |