@@ -4131,8 +4131,8 @@ describe("Tree-sitter PHP grammar", () => {
41314131 ] )
41324132 } )
41334133
4134- fit ( 'scopes double quoted strings' , ( ) => {
4135- editor . setPhpText ( '"just a string"' )
4134+ it ( 'scopes double quoted strings' , ( ) => {
4135+ editor . setPhpText ( '"just a string"; ' )
41364136
41374137 expect ( editor ) . toHaveScopesAtPosition ( [ 1 , 0 ] , '"' , [ "source.php" , "string.quoted.double.php" ,
41384138 // FIXME following scopes differ from TM
@@ -4145,9 +4145,31 @@ describe("Tree-sitter PHP grammar", () => {
41454145 ] )
41464146 } )
41474147
4148+ it ( 'handles strings containing php tags (regression)' , ( ) => {
4149+ // this regression was in the embedded-php parser, not this grammar
4150+
4151+ editor . setPhpText ( '"just a string ?>" . $foo;' )
4152+
4153+ expect ( editor ) . toHaveScopesAtPosition ( [ 1 , 0 ] , '"' , [ "source.php" , "string.quoted.double.php" ,
4154+ // FIXME following scopes differ from TM
4155+ // "punctuation.definition.string.begin.php"
4156+ ] )
4157+ expect ( editor ) . toHaveScopesAtPosition ( [ 1 , 1 ] , 'just' , [ "source.php" , "string.quoted.double.php" ] )
4158+ expect ( editor ) . toHaveScopesAtPosition ( [ 1 , 15 ] , '?>' , [ "source.php" , "string.quoted.double.php" ,
4159+ // FIXME following scopes differ from TM
4160+ // "punctuation.definition.string.end.php"
4161+ ] )
4162+ expect ( editor ) . toHaveScopesAtPosition ( [ 1 , 17 ] , '"' , [ "source.php" , "string.quoted.double.php" ,
4163+ // FIXME following scopes differ from TM
4164+ // "punctuation.definition.string.end.php"
4165+ ] )
4166+ expect ( editor ) . toHaveScopesAtPosition ( [ 1 , 19 ] , '.' , [ "source.php" , "keyword.operator.string.php" ] )
4167+ expect ( editor ) . toHaveScopesAtPosition ( [ 1 , 21 ] , '$' , [ 'source.php' , 'variable.other.php' , 'punctuation.definition.variable.php' ] )
4168+ } )
4169+
41484170 describe ( 'string escape sequences' , ( ) => {
41494171 it ( 'tokenizes escaped octal sequences' , ( ) => {
4150- editor . setContent ( '"test \\007 test";' )
4172+ editor . setPhpText ( '"test \\007 test";' )
41514173
41524174 expect ( editor ) . toHaveScopesAtPosition ( [ 1 , 0 ] , '"' , [ 'source.php' , 'string.quoted.double.php' ,
41534175 // FIXME following scopes differ from TM
0 commit comments