From e8ec86e6c2e65e5e528c975efd9c54380cd6dbcc Mon Sep 17 00:00:00 2001 From: Bronley Plumb Date: Mon, 23 Sep 2019 06:14:03 -0400 Subject: [PATCH 1/3] Syntax colorization fixes. --- syntaxes/brightscript.tmLanguage.json | 64 ++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 6 deletions(-) diff --git a/syntaxes/brightscript.tmLanguage.json b/syntaxes/brightscript.tmLanguage.json index 03ce2d8a..3fc149f5 100644 --- a/syntaxes/brightscript.tmLanguage.json +++ b/syntaxes/brightscript.tmLanguage.json @@ -8,12 +8,24 @@ "foldingStartMarker": "(?i)^\\s*(sub|if|f(or( each)?|unction)|while)\\s*([a-zA-Z_]\\w*)\\s*(\\(.*\\)\\s*)?$", "foldingStopMarker": "(?i)^\\s*(next|e(nd(if| (sub|if|function))|xit( while)?))\\s*$", "patterns": [ + { + "include": "#preprocessor_keywords" + }, { "include": "#region_comment" }, { "include": "#end_region_comment" }, + { + "include": "#global_constants" + }, + { + "include": "#keyword_logical_operator" + }, + { + "include": "#object_properties" + }, { "include": "#vscode_rale_tracker_entry_comment" }, @@ -38,6 +50,9 @@ { "include": "#end_function" }, + { + "include": "#function_call" + }, { "include": "#storage_types" }, @@ -68,14 +83,42 @@ { "include": "#string_literal" }, - { - "include": "#function_call" - }, { "include": "#variables_and_params" } ], "repository": { + "preprocessor_keywords": { + "patterns": [ + { + "match": "(?i:(#const))", + "name": "keyword.preprocessor.if.brs" + }, + { + "match": "(?i:(#if))", + "name": "keyword.preprocessor.if.brs" + }, + { + "match": "(?i:(#else\\s*if))", + "name": "keyword.preprocessor.if.brs" + }, + { + "match": "(?i:(#end\\s*if))", + "name": "keyword.preprocessor.endif.brs" + } + ] + }, + "object_properties": { + "match": "(?i:\\b([a-z_][a-z0-9_]*)\\.([a-z_][a-z0-9_]*))", + "captures": { + "1": { + "name": "entity.name.variable.local.brs" + }, + "2": { + "name": "variable.other.object.property.brs" + } + } + }, "identifiers_with_type_designators": { "name": "entity.name.variable.local.brs", "match": "(?i:\\b([a-z_][a-z0-9_]*)[\\$%!#])" @@ -112,6 +155,11 @@ "match": "(').*$\\n?", "name": "comment.line.apostrophe.brs" }, + "keyword_logical_operator": { + "comment": "Capture logical operators. ", + "match": "(?i:\\b(and|or|not)\\b)", + "name": "keyword.operator.logical.word" + }, "keyword_return": { "comment": "The return statements in functions", "captures": { @@ -175,7 +223,7 @@ }, "end_function": { "name": "keyword.declaration.function", - "match": "(?i)end\\s*(sub|function)" + "match": "(?i)[ \\t]*end\\s*(sub|function)" }, "inline_function_declaration": { "captures": { @@ -200,7 +248,7 @@ "name": "keyword.control.brs" } }, - "match": "(?i:[^\\.\\w\\\"](then|stop|run|end)(?!(\\s*:)|[\\d\\w_]))" + "match": "(?i:[^\\.\\w\\\"](then|stop|run|end|each|next)(?!(\\s*:)|[\\d\\w_]))" }, "program_statements": { "match": "(?i:\\b(if|else\\s*if|else|print|library|while|for\\s+each|for|end\\s*for|exit\\s+for|end\\s*while|exit\\s*while|end\\s*if|to|step|in|goto|rem|as)\\b)", @@ -232,8 +280,12 @@ } ] }, + "global_constants": { + "match": "(?i:\\b(line_num)\\b)", + "name": "variable.language" + }, "support_builtin_functions": { - "match": "(?i:\\b(GetLastRun(RuntimeError|CompileError)|Rnd|Box|Type)\\b)", + "match": "(?i:\\b(GetLastRun(RuntimeError|CompileError)|Rnd|Box|Type|objfun|pos|eval)\\b)", "name": "support.function.brs" }, "support_global_functions": { From 3b89940226e4d1e4fd27d41cbdad938a84f7242b Mon Sep 17 00:00:00 2001 From: Bronley Plumb Date: Mon, 23 Sep 2019 15:18:30 -0400 Subject: [PATCH 2/3] update changelog for 1.19.6 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63f1a2b3..a38a63e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.19.6] - 2019-09-23 +### Fixed + - bugs in language grammar (syntax highlighting) + + ## [1.19.5] - 2019-09-20 ### Fixed @@ -346,6 +351,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 +[1.19.6]: https://github.com/RokuCommunity/vscode-brightscript-language/compare/v1.19.5...v1.19.6 [1.19.5]: https://github.com/RokuCommunity/vscode-brightscript-language/compare/v1.19.4...v1.19.5 [1.19.4]: https://github.com/RokuCommunity/vscode-brightscript-language/compare/v1.19.3...v1.19.4 [1.19.3]: https://github.com/RokuCommunity/vscode-brightscript-language/compare/v1.19.2...v1.19.3 From b10be37b149b0f2ec446de3747f412394416f23a Mon Sep 17 00:00:00 2001 From: Bronley Plumb Date: Mon, 23 Sep 2019 15:22:46 -0400 Subject: [PATCH 3/3] 1.19.6 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2a3a25af..05de6d3f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "brightscript", - "version": "1.19.5", + "version": "1.19.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 08c0d87d..37a1c15c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "brightscript", "displayName": "BrightScript Language", - "version": "1.19.5", + "version": "1.19.6", "publisher": "celsoaf", "description": "Language support for Roku's BrightScript language.", "author": {