summaryrefslogtreecommitdiff
path: root/syntaxes
diff options
context:
space:
mode:
authorbscan <10503608+bscan@users.noreply.github.com>2023-01-04 23:51:32 -0500
committerbscan <10503608+bscan@users.noreply.github.com>2023-01-04 23:51:32 -0500
commit34bce782b192ee9596bb4256edf6623733ba56a0 (patch)
tree82e3e0c5f5ebcd9563bbf0c0805e1605b91b924c /syntaxes
parent7bc374f64ab837a712607368f68645940abb7971 (diff)
downloadPerlNavigator-34bce782b192ee9596bb4256edf6623733ba56a0.zip
Syntax higlighting: feature bundles, defer, state, isa
Diffstat (limited to 'syntaxes')
-rw-r--r--syntaxes/defer.json21
-rw-r--r--syntaxes/isa.json21
-rw-r--r--syntaxes/perl-scopes.json63
-rw-r--r--syntaxes/state.json21
-rw-r--r--syntaxes/v510.json11
-rw-r--r--syntaxes/v536.json14
6 files changed, 146 insertions, 5 deletions
diff --git a/syntaxes/defer.json b/syntaxes/defer.json
new file mode 100644
index 0000000..13e4970
--- /dev/null
+++ b/syntaxes/defer.json
@@ -0,0 +1,21 @@
+{
+ "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
+ "name": "defer",
+ "scopeName": "source.perl.package.defer",
+ "injectionSelector": "L:meta.defer.perl -comment -string -text",
+ "patterns": [
+ {
+ "include": "#defer"
+ }
+ ],
+ "repository": {
+ "defer": {
+ "patterns": [
+ {
+ "match": "\\b(defer)\\s*(?=\\{)",
+ "name": "keyword.control.defer"
+ }
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/syntaxes/isa.json b/syntaxes/isa.json
new file mode 100644
index 0000000..2353a4a
--- /dev/null
+++ b/syntaxes/isa.json
@@ -0,0 +1,21 @@
+{
+ "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
+ "name": "isa",
+ "scopeName": "source.perl.package.isa",
+ "injectionSelector": "L:meta.isa.perl -comment -string -text",
+ "patterns": [
+ {
+ "include": "#isa"
+ }
+ ],
+ "repository": {
+ "isa": {
+ "patterns": [
+ {
+ "match": "\\b(isa)(?!\\s*=>)",
+ "name": "constant.language.isa"
+ }
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/syntaxes/perl-scopes.json b/syntaxes/perl-scopes.json
index 55dae0f..fca3034 100644
--- a/syntaxes/perl-scopes.json
+++ b/syntaxes/perl-scopes.json
@@ -34,8 +34,20 @@
]
},
{
- "name": "meta.objectpad.perl",
- "begin": "(?<=use)\\s+(?:Object::Pad)(?=[\\s;])",
+ "comment": "This matches feature bundle 5.10 to 5.35",
+ "name": "meta.v510.perl",
+ "begin": "(?<=use)\\s+(?=(?:v?5\\.0?(?:[1-2][0-9]|3[0-5])(?:\\.\\d+)?|feature\\s+[\"']:5\\.(?:[1-2][0-9]|3[0-5])[\"'])[\\s;])",
+ "end": "(\\b)(?=^\\s*package\\s)",
+ "patterns": [
+ {
+ "include": "#source"
+ }
+ ]
+ },
+ {
+ "comment": "This matches from 5.36 and up",
+ "name": "meta.v536.perl",
+ "begin": "(?<=use)\\s+(?=(?:v?5\\.0?(?:3[6-9]|4[0-9])(?:\\.\\d+)?|feature\\s+[\"']:5\\.(?:3[6-9]|4[0-9])[\"'])[\\s;])",
"end": "(\\b)(?=^\\s*package\\s|no\\s+\\1[\\s;])",
"patterns": [
{
@@ -44,6 +56,17 @@
]
},
{
+ "comment": "TODO: Currently, these regexes do not allow for multiple features in 'feature qw(class try)' since the first one consumes it.",
+ "name": "meta.objectpad.perl",
+ "begin": "(?<=use)\\s+(?=(?:Object::Pad|feature\\s.*class.*|experimental\\s.*class.*|Feature::Compat::Class)[\\s;])",
+ "end": "(\\b)(?=^\\s*package\\s)",
+ "patterns": [
+ {
+ "include": "#source"
+ }
+ ]
+ },
+ {
"name": "meta.dataclass.perl",
"begin": "(?<=use)\\s+(?:Data::Class)(?=[\\s;])",
"patterns": [
@@ -83,7 +106,7 @@
},
{
"name": "meta.async.perl",
- "begin": "(?<=use)\\s+(?:\\w+::AsyncAwait|Mojo::Base.*-async_await.*)(?=[\\s;])",
+ "begin": "(?<=use)\\s+(?=(?:\\w+::AsyncAwait|Mojo::Base.*-async_await.*)[\\s;])",
"end": "(\\b)(?=^\\s*package\\s|no\\s+\\1[\\s;])",
"patterns": [
{
@@ -93,8 +116,38 @@
},
{
"name": "meta.trycatch.perl",
- "begin": "(?<=use)\\s+(?:Syntax::Keyword::Try|Feature::Compat::Try|Syntax::Feature::Try|Try::Tiny|TryCatch|Try|feature\\s+'try')(?=[\\s;])",
- "end": "(\\b)(?=^\\s*package\\s|no\\s+\\1[\\s;])",
+ "begin": "(?<=use)\\s+(?=(?:Syntax::Keyword::Try|Feature::Compat::Try|Syntax::Feature::Try|Try::Tiny|TryCatch|Try|feature\\s.*try.*|experimental\\s.*try.*)[\\s;])",
+ "end": "(\\b)(?=^\\s*package\\s)",
+ "patterns": [
+ {
+ "include": "#source"
+ }
+ ]
+ },
+ {
+ "name": "meta.defer.perl",
+ "begin": "(?<=use)\\s+(?=(?:feature\\s.*\\bdefer\\b.*|Syntax::Keyword::Defer)[\\s;])",
+ "end": "(\\b)(?=^\\s*package\\s)",
+ "patterns": [
+ {
+ "include": "#source"
+ }
+ ]
+ },
+ {
+ "name": "meta.isa.perl",
+ "begin": "(?<=use)\\s+(?=(?:feature\\s.*\\bisa\\b.*)[\\s;])",
+ "end": "(\\b)(?=^\\s*package\\s)",
+ "patterns": [
+ {
+ "include": "#source"
+ }
+ ]
+ },
+ {
+ "name": "meta.state.perl",
+ "begin": "(?<=use)\\s+(?=(?:feature\\s.*\\bstate\\b.*)[\\s;])",
+ "end": "(\\b)(?=^\\s*package\\s)",
"patterns": [
{
"include": "#source"
diff --git a/syntaxes/state.json b/syntaxes/state.json
new file mode 100644
index 0000000..f3c7c43
--- /dev/null
+++ b/syntaxes/state.json
@@ -0,0 +1,21 @@
+{
+ "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
+ "name": "state",
+ "scopeName": "source.perl.package.state",
+ "injectionSelector": "L:meta.state.perl -comment -string -text",
+ "patterns": [
+ {
+ "include": "#state"
+ }
+ ],
+ "repository": {
+ "state": {
+ "patterns": [
+ {
+ "match": "\\b(state)\\b",
+ "name": "storage.type.sub.state"
+ }
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/syntaxes/v510.json b/syntaxes/v510.json
new file mode 100644
index 0000000..16235bc
--- /dev/null
+++ b/syntaxes/v510.json
@@ -0,0 +1,11 @@
+{
+ "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
+ "name": "v510",
+ "scopeName": "source.perl.package.v510",
+ "injectionSelector": "L:meta.v510.perl -comment -string -text",
+ "patterns": [
+ {
+ "include": "source.perl.package.state#state"
+ }
+ ]
+} \ No newline at end of file
diff --git a/syntaxes/v536.json b/syntaxes/v536.json
new file mode 100644
index 0000000..b864457
--- /dev/null
+++ b/syntaxes/v536.json
@@ -0,0 +1,14 @@
+{
+ "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
+ "name": "v536",
+ "scopeName": "source.perl.package.v536",
+ "injectionSelector": "L:meta.v536.perl -comment -string -text",
+ "patterns": [
+ {
+ "include": "source.perl.package.state#state"
+ },
+ {
+ "include": "source.perl.package.isa#isa"
+ }
+ ]
+} \ No newline at end of file