summaryrefslogtreecommitdiff
path: root/syntaxes
diff options
context:
space:
mode:
authorbscan <10503608+bscan@users.noreply.github.com>2022-12-28 21:41:07 -0500
committerbscan <10503608+bscan@users.noreply.github.com>2022-12-28 21:41:07 -0500
commit0ea8d3a33149c0b42a9a6a801d52d0dc6fde685d (patch)
tree76a2f063caaab221f7edcbefdb5dd20d5af3c48a /syntaxes
parentc0f9ccc5aecb37eab5ad8f177e0df09273bf9b1f (diff)
downloadPerlNavigator-0ea8d3a33149c0b42a9a6a801d52d0dc6fde685d.zip
Syntax highlighting for try/catch
Diffstat (limited to 'syntaxes')
-rw-r--r--syntaxes/perl-scopes.json10
-rw-r--r--syntaxes/trycatch.json32
2 files changed, 42 insertions, 0 deletions
diff --git a/syntaxes/perl-scopes.json b/syntaxes/perl-scopes.json
index e673f5d..55dae0f 100644
--- a/syntaxes/perl-scopes.json
+++ b/syntaxes/perl-scopes.json
@@ -92,6 +92,16 @@
]
},
{
+ "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;])",
+ "patterns": [
+ {
+ "include": "#source"
+ }
+ ]
+ },
+ {
"name": "meta.funcparams.perl",
"begin": "(?<=use)\\s+(?:Function::Parameters)(?=[\\s;])",
"patterns": [
diff --git a/syntaxes/trycatch.json b/syntaxes/trycatch.json
new file mode 100644
index 0000000..8beacbf
--- /dev/null
+++ b/syntaxes/trycatch.json
@@ -0,0 +1,32 @@
+{
+ "$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": "trycatch",
+ "scopeName": "source.perl.package.trycatch",
+ "injectionSelector": "L:meta.trycatch.perl -comment -string -text",
+ "patterns": [
+ {
+ "include": "#trycatch"
+ }
+ ],
+ "repository": {
+ "trycatch": {
+ "patterns": [
+ {
+ "match": "\\b(try)\\b",
+ "name": "keyword.control.trycatch.try"
+ },
+ {
+ "match": "\\b(catch)\\b",
+ "name": "keyword.control.trycatch.catch"
+ },
+ {
+ "match": "\\b(finally)\\b",
+ "name": "keyword.control.trycatch.finally"
+ }
+ ]
+ }
+ }
+} \ No newline at end of file