Skip to content

Commit ab1df4b

Browse files
committedDec 28, 2022
Merge branch '6.1' into 6.2
* 6.1: [Console] Correctly overwrite progressbars with different line count per step [DependencyInjection] Fix deduplicating service instances in circular graphs [Form] Make `ButtonType` handle `form_attr` option [PhpUnitBridge] Use verbose deprecation output for quiet types only when it reaches the threshold [CssSelector] Fix escape patterns
2 parents 91c342f + a90ee25 commit ab1df4b

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed
 

‎Parser/Tokenizer/TokenizerPatterns.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,22 @@ public function __construct()
4949
$this->identifierPattern = '-?(?:'.$this->nmStartPattern.')(?:'.$this->nmCharPattern.')*';
5050
$this->hashPattern = '#((?:'.$this->nmCharPattern.')+)';
5151
$this->numberPattern = '[+-]?(?:[0-9]*\.[0-9]+|[0-9]+)';
52-
$this->quotedStringPattern = '([^\n\r\f%s]|'.$this->stringEscapePattern.')*';
52+
$this->quotedStringPattern = '([^\n\r\f\\\\%s]|'.$this->stringEscapePattern.')*';
5353
}
5454

5555
public function getNewLineEscapePattern(): string
5656
{
57-
return '~^'.$this->newLineEscapePattern.'~';
57+
return '~'.$this->newLineEscapePattern.'~';
5858
}
5959

6060
public function getSimpleEscapePattern(): string
6161
{
62-
return '~^'.$this->simpleEscapePattern.'~';
62+
return '~'.$this->simpleEscapePattern.'~';
6363
}
6464

6565
public function getUnicodeEscapePattern(): string
6666
{
67-
return '~^'.$this->unicodeEscapePattern.'~i';
67+
return '~'.$this->unicodeEscapePattern.'~i';
6868
}
6969

7070
public function getIdentifierPattern(): string

‎Tests/Parser/ParserTest.php

+10
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,16 @@ public function getParserTestData()
138138
['div:not(div.foo)', ['Negation[Element[div]:not(Class[Element[div].foo])]']],
139139
['td ~ th', ['CombinedSelector[Element[td] ~ Element[th]]']],
140140
['.foo[data-bar][data-baz=0]', ["Attribute[Attribute[Class[Element[*].foo][data-bar]][data-baz = '0']]"]],
141+
['div#foo\.bar', ['Hash[Element[div]#foo.bar]']],
142+
['div.w-1\/3', ['Class[Element[div].w-1/3]']],
143+
['#test\:colon', ['Hash[Element[*]#test:colon]']],
144+
[".a\xc1b", ["Class[Element[*].a\xc1b]"]],
145+
// unicode escape: \22 == "
146+
['*[aval="\'\22\'"]', ['Attribute[Element[*][aval = \'\'"\'\']]']],
147+
['*[aval="\'\22 2\'"]', ['Attribute[Element[*][aval = \'\'"2\'\']]']],
148+
// unicode escape: \20 == (space)
149+
['*[aval="\'\20 \'"]', ['Attribute[Element[*][aval = \'\' \'\']]']],
150+
["*[aval=\"'\\20\r\n '\"]", ['Attribute[Element[*][aval = \'\' \'\']]']],
141151
];
142152
}
143153

0 commit comments

Comments
 (0)
Please sign in to comment.