File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments