fix parsing comments not prefixed by a space
This commit is contained in:
parent
6b8857c974
commit
35b223aaa4
@ -127,7 +127,7 @@ class Inline
|
|||||||
}
|
}
|
||||||
|
|
||||||
// some comments are allowed at the end
|
// some comments are allowed at the end
|
||||||
if (preg_replace('/\s+#.*$/A', '', substr($value, $i))) {
|
if (preg_replace('/\s*#.*$/A', '', substr($value, $i))) {
|
||||||
throw new ParseException(sprintf('Unexpected characters near "%s".', substr($value, $i)), self::$parsedLineNumber + 1, $value, self::$parsedFilename);
|
throw new ParseException(sprintf('Unexpected characters near "%s".', substr($value, $i)), self::$parsedLineNumber + 1, $value, self::$parsedFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -860,4 +860,14 @@ class InlineTest extends TestCase
|
|||||||
{
|
{
|
||||||
self::assertSame('-0123456789', Inline::parse('-0123456789'));
|
self::assertSame('-0123456789', Inline::parse('-0123456789'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testParseCommentNotPrefixedBySpaces()
|
||||||
|
{
|
||||||
|
self::assertSame('foo', Inline::parse('"foo"#comment'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testParseUnquotedStringContainingHashTagNotPrefixedBySpace()
|
||||||
|
{
|
||||||
|
self::assertSame('foo#nocomment', Inline::parse('foo#nocomment'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user