This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split PHP grammar into separate HTML and PHP portions
Fixes #182
- Loading branch information
Wliu
authored and
Wliu
committed
Oct 19, 2017
1 parent
28fb4f8
commit 01e7722
Showing
3 changed files
with
162 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# This grammar file is responsible for including the actual PHP grammar | ||
# by capturing <?php ?> tags | ||
'scopeName': 'text.html.php' | ||
'name': 'PHP' | ||
'fileTypes': [ | ||
'aw' | ||
'ctp' | ||
'inc' | ||
'install' | ||
'module' | ||
'php' | ||
'php_cs' | ||
'php3' | ||
'php4' | ||
'php5' | ||
'phpt' | ||
'phtml' | ||
'profile' | ||
] | ||
'firstLineMatch': '''(?x) | ||
# Hashbang | ||
^\\#!.*(?:\\s|\\/) | ||
php\\d? | ||
(?:$|\\s) | ||
| | ||
# Modeline | ||
(?i: | ||
# Emacs | ||
-\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*) | ||
php | ||
(?=[\\s;]|(?<![-*])-\\*-).*?-\\*- | ||
| | ||
# Vim | ||
(?:(?:\\s|^)vi(?:m[<=>]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s*set?\\s))(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:](?:filetype|ft|syntax)\\s*= | ||
(?:php|phtml) | ||
(?=\\s|:|$) | ||
) | ||
''' | ||
'foldingStartMarker': '(/\\*|\\{\\s*$|<<<HTML)' | ||
'foldingStopMarker': '(\\*/|^\\s*\\}|^HTML;)' | ||
'injections': | ||
'text.html.php - (meta.embedded | meta.tag), L:text.html.php meta.tag, L:source.js.embedded.html': | ||
'patterns': [ | ||
{ | ||
'include': '#php-tag' | ||
} | ||
] | ||
'patterns': [ | ||
{ | ||
'include': 'text.html.basic' | ||
} | ||
{ | ||
'include': '#php-tag' | ||
} | ||
] | ||
'repository': | ||
'php-tag': | ||
'patterns': [ | ||
{ | ||
'begin': '<\\?(?i:php|=)?(?![^?]*\\?>)' | ||
'beginCaptures': | ||
'0': | ||
'name': 'punctuation.section.embedded.begin.php' | ||
'end': '\\?>' | ||
'endCaptures': | ||
'0': | ||
'name': 'punctuation.section.embedded.end.php' | ||
'name': 'meta.embedded.block.php' | ||
'contentName': 'source.php' | ||
'patterns': [ | ||
{ | ||
'include': 'source.php' | ||
} | ||
] | ||
} | ||
{ | ||
'begin': '<\\?(?i:php|=)?' | ||
'beginCaptures': | ||
'0': | ||
'name': 'punctuation.section.embedded.begin.php' | ||
'end': '\\?>' | ||
'endCaptures': | ||
'0': | ||
'name': 'punctuation.section.embedded.end.php' | ||
'name': 'meta.embedded.line.php' | ||
'contentName': 'source.php' | ||
'patterns': [ | ||
{ | ||
'include': 'source.php' | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.