File tree 2 files changed +14
-4
lines changed
2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -49,22 +49,22 @@ public function __construct()
49
49
$ this ->identifierPattern = '-?(?: ' .$ this ->nmStartPattern .')(?: ' .$ this ->nmCharPattern .')* ' ;
50
50
$ this ->hashPattern = '#((?: ' .$ this ->nmCharPattern .')+) ' ;
51
51
$ 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 .')* ' ;
53
53
}
54
54
55
55
public function getNewLineEscapePattern (): string
56
56
{
57
- return '~^ ' .$ this ->newLineEscapePattern .'~ ' ;
57
+ return '~ ' .$ this ->newLineEscapePattern .'~ ' ;
58
58
}
59
59
60
60
public function getSimpleEscapePattern (): string
61
61
{
62
- return '~^ ' .$ this ->simpleEscapePattern .'~ ' ;
62
+ return '~ ' .$ this ->simpleEscapePattern .'~ ' ;
63
63
}
64
64
65
65
public function getUnicodeEscapePattern (): string
66
66
{
67
- return '~^ ' .$ this ->unicodeEscapePattern .'~i ' ;
67
+ return '~ ' .$ this ->unicodeEscapePattern .'~i ' ;
68
68
}
69
69
70
70
public function getIdentifierPattern (): string
Original file line number Diff line number Diff line change @@ -138,6 +138,16 @@ public function getParserTestData()
138
138
['div:not(div.foo) ' , ['Negation[Element[div]:not(Class[Element[div].foo])] ' ]],
139
139
['td ~ th ' , ['CombinedSelector[Element[td] ~ Element[th]] ' ]],
140
140
['.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 = \'\' \'\']] ' ]],
141
151
];
142
152
}
143
153
You can’t perform that action at this time.
0 commit comments