@@ -1167,17 +1167,17 @@ private function lexUnquotedString(int &$cursor): string
11671167 return substr ($ this ->currentLine , $ offset , $ cursor - $ offset );
11681168 }
11691169
1170- private function lexInlineMapping (int &$ cursor = 0 ): string
1170+ private function lexInlineMapping (int &$ cursor = 0 , bool $ consumeUntilEol = true ): string
11711171 {
1172- return $ this ->lexInlineStructure ($ cursor , '} ' );
1172+ return $ this ->lexInlineStructure ($ cursor , '} ' , $ consumeUntilEol );
11731173 }
11741174
1175- private function lexInlineSequence (int &$ cursor = 0 ): string
1175+ private function lexInlineSequence (int &$ cursor = 0 , bool $ consumeUntilEol = true ): string
11761176 {
1177- return $ this ->lexInlineStructure ($ cursor , '] ' );
1177+ return $ this ->lexInlineStructure ($ cursor , '] ' , $ consumeUntilEol );
11781178 }
11791179
1180- private function lexInlineStructure (int &$ cursor , string $ closingTag ): string
1180+ private function lexInlineStructure (int &$ cursor , string $ closingTag, bool $ consumeUntilEol = true ): string
11811181 {
11821182 $ value = $ this ->currentLine [$ cursor ];
11831183 ++$ cursor ;
@@ -1197,15 +1197,19 @@ private function lexInlineStructure(int &$cursor, string $closingTag): string
11971197 ++$ cursor ;
11981198 break ;
11991199 case '{ ' :
1200- $ value .= $ this ->lexInlineMapping ($ cursor );
1200+ $ value .= $ this ->lexInlineMapping ($ cursor, false );
12011201 break ;
12021202 case '[ ' :
1203- $ value .= $ this ->lexInlineSequence ($ cursor );
1203+ $ value .= $ this ->lexInlineSequence ($ cursor, false );
12041204 break ;
12051205 case $ closingTag :
12061206 $ value .= $ this ->currentLine [$ cursor ];
12071207 ++$ cursor ;
12081208
1209+ if ($ consumeUntilEol && isset ($ this ->currentLine [$ cursor ]) && (strspn ($ this ->currentLine , ' ' , $ cursor ) + $ cursor ) < strlen ($ this ->currentLine )) {
1210+ throw new ParseException (sprintf ('Unexpected token "%s". ' , trim (substr ($ this ->currentLine , $ cursor ))));
1211+ }
1212+
12091213 return $ value ;
12101214 case '# ' :
12111215 break 2 ;
0 commit comments