diff options
-rw-r--r-- | package.json | 7 | ||||
-rw-r--r-- | syntaxes/perl-scopes.json | 10 | ||||
-rw-r--r-- | syntaxes/trycatch.json | 32 |
3 files changed, 49 insertions, 0 deletions
diff --git a/package.json b/package.json index ad9b6ee..4fc5d86 100644 --- a/package.json +++ b/package.json @@ -245,6 +245,13 @@ "injectTo": [ "source.perl" ], + "scopeName": "source.perl.package.trycatch", + "path": "./syntaxes/trycatch.json" + }, + { + "injectTo": [ + "source.perl" + ], "scopeName": "source.perl.package.dios", "path": "./syntaxes/dios.json" } 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 |