summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbscan <10503608+bscan@users.noreply.github.com>2022-12-04 21:55:28 -0500
committerbscan <10503608+bscan@users.noreply.github.com>2022-12-04 21:55:28 -0500
commit61c7ca05c7daeb40578d37389b8e1fa94a2c5be6 (patch)
tree57a4295af1e1b04d9250921c923d9a8b2860c167
parentcde55a3b0853256b66763079221ae25ef602e561 (diff)
downloadPerlNavigator-61c7ca05c7daeb40578d37389b8e1fa94a2c5be6.zip
Adding Dios syntax highlighting
-rw-r--r--package.json7
-rw-r--r--syntaxes/dios.json69
-rw-r--r--syntaxes/perl-scopes.json9
3 files changed, 85 insertions, 0 deletions
diff --git a/package.json b/package.json
index 112b316..a6275f3 100644
--- a/package.json
+++ b/package.json
@@ -240,6 +240,13 @@
],
"scopeName": "source.perl.package.funcparams",
"path": "./syntaxes/funcparams.json"
+ },
+ {
+ "injectTo": [
+ "source.perl"
+ ],
+ "scopeName": "source.perl.package.dios",
+ "path": "./syntaxes/dios.json"
}
]
},
diff --git a/syntaxes/dios.json b/syntaxes/dios.json
new file mode 100644
index 0000000..14fea49
--- /dev/null
+++ b/syntaxes/dios.json
@@ -0,0 +1,69 @@
+{
+ "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
+ "information_for_contributors": [
+ "To modify the grammar, simply update the JSON run the extension. This file detects scope (e.g. is Moo active) and the individual files define the syntax of the scope"
+ ],
+ "name": "dios",
+ "scopeName": "source.perl.package.dios",
+ "injectionSelector": "L:meta.dios.perl -comment -string -text",
+ "patterns": [
+ {
+ "include": "#dios"
+ }
+ ],
+ "repository": {
+ "dios": {
+ "patterns": [
+ {
+ "match": "\\b(has|shared|lex)(?:\\s+(\\w+))?\\s+([$@%][!.]?[\\w]+)\\b(?:\\s+is\\s+(rw|ro|req))?",
+ "captures": {
+ "1": {
+ "name": "keyword.other.attribute.dios.perl"
+ },
+ "2": {
+ "name": "storage.type.dios"
+ },
+ "3": {
+ "name": "variable.other.readwrite.dios.perl"
+ },
+ "4": {
+ "name": "storage.type.dios"
+ }
+ }
+ },
+ {
+ "match": "\\b(class)\\s+(\\w+)\\b(?:\\s+(is)\\s+(\\w+)\\b)?",
+ "captures": {
+ "1": {
+ "name": "keyword.control.dios"
+ },
+ "2": {
+ "name": "entity.name.type.class"
+ },
+ "3": {
+ "name": "storage.modifier.dios.perl"
+ },
+ "4": {
+ "name": "entity.name.type.class"
+ }
+ }
+ },
+ {
+ "match": "\\b((?:multi\\s+)?(?:method|submethod|func))\\s+([\\w]+)\\b",
+ "captures": {
+ "1": {
+ "name": "storage.type.sub.perl"
+ },
+ "2": {
+ "name": "entity.name.function.perl"
+ }
+ }
+ },
+ {
+ "match": "\\b(accessor|builder|clearer|coerce|default|does|is|isa|predicate|required|trigger)\\s*(?==>)",
+ "name": "constant.language.has.key.dios.perl"
+ }
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/syntaxes/perl-scopes.json b/syntaxes/perl-scopes.json
index 4ba1cbc..e673f5d 100644
--- a/syntaxes/perl-scopes.json
+++ b/syntaxes/perl-scopes.json
@@ -99,6 +99,15 @@
"include": "#source"
}
]
+ },
+ {
+ "name": "meta.dios.perl",
+ "begin": "(?<=use)\\s+(?:Dios)(?=[\\s;])",
+ "patterns": [
+ {
+ "include": "#source"
+ }
+ ]
}
]
}