From 73fd0aa37764a668bbe2dab354eb64acf75e0b60 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Sun, 23 Nov 2025 23:03:42 +0100 Subject: [PATCH] Berry syntax highlighter for multiline f-strings (#24155) --- .../skiars.berry-1.1.0/syntaxes/berry.json | 153 -------------- .../skiars.berry-1.1.0/syntaxes/bytecode.json | 58 ------ .../.vsixmanifest | 9 - .../CHANGELOG.md | 2 + .../README.md | 0 .../berry-configuration.json | 0 .../berry-icon.png | Bin .../package.json | 18 +- .../skiars.berry-1.2.0/syntaxes/berry.json | 195 ++++++++++++++++++ 9 files changed, 199 insertions(+), 236 deletions(-) delete mode 100755 lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/syntaxes/berry.json delete mode 100755 lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/syntaxes/bytecode.json rename lib/libesp32/berry/tools/plugins/vscode/{skiars.berry-1.1.0 => skiars.berry-1.2.0}/.vsixmanifest (95%) mode change 100755 => 100644 rename lib/libesp32/berry/tools/plugins/vscode/{skiars.berry-1.1.0 => skiars.berry-1.2.0}/CHANGELOG.md (83%) mode change 100755 => 100644 rename lib/libesp32/berry/tools/plugins/vscode/{skiars.berry-1.1.0 => skiars.berry-1.2.0}/README.md (100%) mode change 100755 => 100644 rename lib/libesp32/berry/tools/plugins/vscode/{skiars.berry-1.1.0 => skiars.berry-1.2.0}/berry-configuration.json (100%) mode change 100755 => 100644 rename lib/libesp32/berry/tools/plugins/vscode/{skiars.berry-1.1.0 => skiars.berry-1.2.0}/berry-icon.png (100%) rename lib/libesp32/berry/tools/plugins/vscode/{skiars.berry-1.1.0 => skiars.berry-1.2.0}/package.json (63%) mode change 100755 => 100644 create mode 100644 lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/syntaxes/berry.json diff --git a/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/syntaxes/berry.json b/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/syntaxes/berry.json deleted file mode 100755 index 4087fb10c..000000000 --- a/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/syntaxes/berry.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", - "name": "Berry", - "patterns": [ - { - "include": "#controls" - }, - { - "include": "#strings" - }, - { - "include": "#comment-block" - }, - { - "include": "#comments" - }, - { - "include": "#keywords" - }, - { - "include": "#function" - }, - { - "include": "#member" - }, - { - "include": "#identifier" - }, - { - "include": "#number" - }, - { - "include": "#operator" - } - ], - "repository": { - "controls": { - "patterns": [{ - "name": "keyword.control.berry", - "match": "\\b(if|elif|else|for|while|do|end|break|continue|return|try|except|raise)\\b" - }] - }, - "strings": { - "patterns": [ - { - "name": "string.quoted.double.berry", - "begin": "(\"|')", - "end": "\\1", - "patterns": [ - { - "name": "constant.character.escape.berry", - "match": "(\\\\x[\\h]{2})|(\\\\[0-7]{3})|(\\\\\\\\)|(\\\\\")|(\\\\')|(\\\\a)|(\\\\b)|(\\\\f)|(\\\\n)|(\\\\r)|(\\\\t)|(\\\\v)" - } - ] - }, - { - "name": "string.quoted.other.berry", - "begin": "f(\"|')", - "end": "\\1", - "patterns": [ - { - "name": "constant.character.escape.berry", - "match": "(\\\\x[\\h]{2})|(\\\\[0-7]{3})|(\\\\\\\\)|(\\\\\")|(\\\\')|(\\\\a)|(\\\\b)|(\\\\f)|(\\\\n)|(\\\\r)|(\\\\t)|(\\\\v)" - }, - { - "name": "string.quoted.other.berry", - "match": "\\{\\{[^\\}]*\\}\\}" - }, - { - "name": "keyword.other.unit.berry", - "begin": "\\{", - "end": "\\}", - "patterns": [ - { - "include": "#keywords" - }, - { - "include": "#numbers" - }, - { - "include": "#identifier" - }, - { - "include": "#operator" - }, - { - "include": "#member" - }, - { - "include": "#function" - } - ] - } - - ] - } - ] - }, - "comment-block": { - "name": "comment.berry", - "begin": "\\#\\-", - "end": "\\-#", - "patterns": [{}] - }, - "comments": { - "name": "comment.line.berry", - "begin": "\\#", - "end": "\\n", - "patterns": [{}] - }, - "keywords": { - "patterns": [{ - "name": "keyword.berry", - "match": "\\b(var|static|def|class|true|false|nil|self|super|import|as|_class)\\b" - }] - }, - "identifier": { - "patterns": [{ - "name": "identifier.berry", - "match": "\\b[_A-Za-z]\\w+\\b" - }] - }, - "number": { - "patterns": [{ - "name": "constant.numeric.berry", - "match": "0x[a-fA-F0-9]+|\\d+|(\\d+\\.?|\\.\\d)\\d*([eE][+-]?\\d+)?" - }] - }, - "operator": { - "patterns": [{ - "name": "keyword.operator.berry", - "match": "\\(|\\)|\\[|\\]|\\.|-|\\!|~|\\*|/|%|\\+|&|\\^|\\||<|>|=|:" - }] - }, - "member": { - "patterns": [{ - "match": "\\.([a-zA-Z_][a-zA-Z0-9_]*)", - "captures": { - "0": { - "name": "entity.other.attribute-name.berry" - } - } - }] - }, - "function": { - "patterns": [{ - "name": "entity.name.function.berry", - "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*(?=\\s*\\())" - }] - } - }, - "scopeName": "source.berry" -} \ No newline at end of file diff --git a/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/syntaxes/bytecode.json b/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/syntaxes/bytecode.json deleted file mode 100755 index 4bd10a843..000000000 --- a/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/syntaxes/bytecode.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", - "name": "Berry", - "patterns": [ - { - "include": "#comments" - }, - { - "include": "#keywords" - }, - { - "include": "#number" - }, - { - "include": "#operator" - }, - { - "include": "#entity" - } - ], - "repository": { - "comments": { - "name": "comment.line.berry.bytecode", - "begin": "\\--", - "end": "\\n", - "patterns": [{}] - }, - "keywords": { - "patterns": [{ - "name": "keyword.berry.bytecode", - "match": "or" - }] - }, - "number": { - "patterns": [{ - "name": "constant.numeric.berry.bytecode", - "match": "\\b((0x)?[0-9]+)\\b" - }] - }, - "operator": { - "patterns": [ - { - "name": "keyword.operator.berry.bytecode", - "match": "\\(|\\)|:|\\[|\\]|\\||->" - } - ] - }, - "entity": { - "patterns": [ - { - "name": "entity.name.function.berry", - "match": "^\\s*\\w+(?=\\s*(:|->))" - } - ] - } - }, - "scopeName": "source.berry.bytecode" -} \ No newline at end of file diff --git a/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/.vsixmanifest b/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/.vsixmanifest old mode 100755 new mode 100644 similarity index 95% rename from lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/.vsixmanifest rename to lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/.vsixmanifest index e14b7eabc..eae06a3df --- a/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/.vsixmanifest +++ b/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/.vsixmanifest @@ -11,17 +11,8 @@ - - - - - - - - - diff --git a/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/CHANGELOG.md b/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/CHANGELOG.md old mode 100755 new mode 100644 similarity index 83% rename from lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/CHANGELOG.md rename to lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/CHANGELOG.md index 2867fd3ab..fac734c3d --- a/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/CHANGELOG.md +++ b/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/CHANGELOG.md @@ -6,3 +6,5 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how ## [Unreleased] - Initial release - add support for f-strings, `_class` and indent on `do` +- add support for multiline f-strings +- remove bytecode \ No newline at end of file diff --git a/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/README.md b/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/README.md old mode 100755 new mode 100644 similarity index 100% rename from lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/README.md rename to lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/README.md diff --git a/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/berry-configuration.json b/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/berry-configuration.json old mode 100755 new mode 100644 similarity index 100% rename from lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/berry-configuration.json rename to lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/berry-configuration.json diff --git a/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/berry-icon.png b/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/berry-icon.png similarity index 100% rename from lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/berry-icon.png rename to lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/berry-icon.png diff --git a/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/package.json b/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/package.json old mode 100755 new mode 100644 similarity index 63% rename from lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/package.json rename to lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/package.json index 6837eb54e..85885b404 --- a/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.1.0/package.json +++ b/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/package.json @@ -2,7 +2,8 @@ "name": "berry", "displayName": "Berry Script Language", "description": "A small embedded script language.", - "version": "1.1.0", + "version": "1.2.0", + "icon": "berry-icon.png", "publisher": "skiars", "engines": { "vscode": "^1.15.1" @@ -22,16 +23,6 @@ ".be" ], "configuration": "./berry-configuration.json" - }, - { - "id": "berry-bytecode", - "aliases": [ - "Berry Bytecode", - "berry bytecode" - ], - "extensions": [ - "berry.bytecode" - ] } ], "grammars": [ @@ -39,11 +30,6 @@ "language": "berry", "scopeName": "source.berry", "path": "./syntaxes/berry.json" - }, - { - "language": "berry-bytecode", - "scopeName": "source.berry.bytecode", - "path": "./syntaxes/bytecode.json" } ] }, diff --git a/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/syntaxes/berry.json b/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/syntaxes/berry.json new file mode 100644 index 000000000..41b834deb --- /dev/null +++ b/lib/libesp32/berry/tools/plugins/vscode/skiars.berry-1.2.0/syntaxes/berry.json @@ -0,0 +1,195 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "Berry", + "patterns": [ + { + "include": "#controls" + }, + { + "include": "#strings" + }, + { + "include": "#comment-block" + }, + { + "include": "#comments" + }, + { + "include": "#keywords" + }, + { + "include": "#function" + }, + { + "include": "#member" + }, + { + "include": "#identifier" + }, + { + "include": "#number" + }, + { + "include": "#operator" + } + ], + "repository": { + "controls": { + "patterns": [{ + "name": "keyword.control.berry", + "match": "\\b(if|elif|else|for|while|do|end|break|continue|return|try|except|raise)\\b" + }] + }, + "strings": { + "patterns": [ + { + "begin": "f(?=[\"'])", + "while": "\\G|^[ \\t]*(?=[\"'])", + "patterns": [{ + "name": "string.quoted.other.berry", + "begin": "\"", + "end": "\"", + "patterns": [ + { + "name": "constant.character.escape.berry", + "match": "(\\\\x[\\h]{2})|(\\\\[0-7]{3})|(\\\\\\\\)|(\\\\\")|(\\\\')|(\\\\a)|(\\\\b)|(\\\\f)|(\\\\n)|(\\\\r)|(\\\\t)|(\\\\v)" + }, + { + "name": "string.quoted.other.berry", + "match": "\\{\\{[^\\}]*\\}\\}" + }, + { + "name": "keyword.other.unit.berry", + "begin": "\\{", + "end": "\\}", + "patterns": [ + { + "include": "#keywords" + }, + { + "include": "#numbers" + }, + { + "include": "#identifier" + }, + { + "include": "#operator" + }, + { + "include": "#member" + }, + { + "include": "#function" + } + ] + } + ] + }, + { + "name": "string.quoted.other.berry", + "begin": "'", + "end": "'", + "patterns": [ + { + "name": "constant.character.escape.berry", + "match": "(\\\\x[\\h]{2})|(\\\\[0-7]{3})|(\\\\\\\\)|(\\\\\")|(\\\\')|(\\\\a)|(\\\\b)|(\\\\f)|(\\\\n)|(\\\\r)|(\\\\t)|(\\\\v)" + }, + { + "name": "string.quoted.other.berry", + "match": "\\{\\{[^\\}]*\\}\\}" + }, + { + "name": "keyword.other.unit.berry", + "begin": "\\{", + "end": "\\}", + "patterns": [ + { + "include": "#keywords" + }, + { + "include": "#numbers" + }, + { + "include": "#identifier" + }, + { + "include": "#operator" + }, + { + "include": "#member" + }, + { + "include": "#function" + } + ] + } + ] + } + ] + }, + { + "name": "string.quoted.double.berry", + "begin": "(\"|')", + "end": "\\1", + "patterns": [{ + "name": "constant.character.escape.berry", + "match": "(\\\\x[\\h]{2})|(\\\\[0-7]{3})|(\\\\\\\\)|(\\\\\")|(\\\\')|(\\\\a)|(\\\\b)|(\\\\f)|(\\\\n)|(\\\\r)|(\\\\t)|(\\\\v)" + }] + } + ] + }, + "comment-block": { + "name": "comment.berry", + "begin": "\\#\\-", + "end": "\\-#", + "patterns": [{}] + }, + "comments": { + "name": "comment.line.berry", + "begin": "\\#", + "end": "\\n", + "patterns": [{}] + }, + "keywords": { + "patterns": [{ + "name": "keyword.berry", + "match": "\\b(var|static|def|class|true|false|nil|self|super|import|as|_class)\\b" + }] + }, + "identifier": { + "patterns": [{ + "name": "identifier.berry", + "match": "\\b[_A-Za-z]\\w+\\b" + }] + }, + "number": { + "patterns": [{ + "name": "constant.numeric.berry", + "match": "0x[a-fA-F0-9]+|\\d+|(\\d+\\.?|\\.\\d)\\d*([eE][+-]?\\d+)?" + }] + }, + "operator": { + "patterns": [{ + "name": "keyword.operator.berry", + "match": "\\(|\\)|\\[|\\]|\\.|-|\\!|~|\\*|/|%|\\+|&|\\^|\\||<|>|=|:" + }] + }, + "member": { + "patterns": [{ + "match": "\\.([a-zA-Z_][a-zA-Z0-9_]*)", + "captures": { + "0": { + "name": "entity.other.attribute-name.berry" + } + } + }] + }, + "function": { + "patterns": [{ + "name": "entity.name.function.berry", + "match": "\\b([a-zA-Z_][a-zA-Z0-9_]*(?=\\s*\\())" + }] + } + }, + "scopeName": "source.berry" +} \ No newline at end of file