Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 065da50

Browse files
adopt "embedded-php" parser, with custom tree-sitter-php fork
1 parent d83d201 commit 065da50

6 files changed

Lines changed: 1224 additions & 1212 deletions

File tree

grammars/tree-sitter-html.cson

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,12 @@ fileTypes: [
2121
'profile'
2222
]
2323

24+
firstLineRegex: [
25+
'^\\s*<\\?([pP][hH][pP]|=|\\s|$)'
26+
]
27+
2428
scopes:
25-
'php > "?>"': 'punctuation.section.embedded.end.php'
29+
'php': [
30+
{match: '\\n', scopes: 'meta.embedded.block.php'}
31+
'meta.embedded.line.php'
32+
]

grammars/tree-sitter-php.cson

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
name: 'PHP'
22
scopeName: 'source.php'
33
type: 'tree-sitter'
4-
parser: 'tree-sitter-php'
5-
6-
firstLineRegex: [
7-
'^\\s*<\\?([pP][hH][pP]|=|\\s|$)'
8-
]
4+
parser: 'tree-sitter-php-abc'
95

106
injectionRegex: 'php|PHP'
117

lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ exports.activate = function() {
1111
// inject html into text.html.php
1212
atom.grammars.addInjectionPoint('text.html.php', {
1313
type: 'template',
14-
language (node) { return 'html' },
14+
language () { return 'html' },
1515
content (node) { return node.descendantsOfType('content') }
1616
})
1717

package-lock.json

Lines changed: 15 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
"url": "https://github.com/atom/language-php/issues"
1818
},
1919
"dependencies": {
20-
"tree-sitter-php": "^0.16.2",
21-
"tree-sitter-phpdoc": "0.0.3"
20+
"tree-sitter-embedded-php": "0.0.1",
21+
"tree-sitter-php-abc": "^0.17.0",
22+
"tree-sitter-phpdoc": "0.0.4"
2223
},
2324
"devDependencies": {
2425
"coffeelint": "^1.10.1",

0 commit comments

Comments
 (0)