From 98d937b89cc17971e6feced536a0e646eddb8f2a Mon Sep 17 00:00:00 2001 From: Nico Chatzi Date: Sat, 23 May 2020 13:09:16 +0200 Subject: [PATCH 01/11] Fix some typos --- docs/SOUL_Language.md | 4 ++-- docs/SOUL_Overview.md | 4 ++-- source/API/soul_patch/API/soul_patch_Library.h | 2 +- source/README.md | 2 +- source/modules/soul_core/diagnostics/soul_Errors.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/SOUL_Language.md b/docs/SOUL_Language.md index b98ef393..32914a3f 100644 --- a/docs/SOUL_Language.md +++ b/docs/SOUL_Language.md @@ -214,7 +214,7 @@ float getAnArrayElement (float[] a, int index) { return a.at (index); } To avoid confusion with fixed-size array indexes needing to use the `wrap` or `clamp` types, the `array[index]` syntax is not allowed on dynamic slices. Instead, you can use the following accessor methods: `array.at (index)` - this casts the index argument to an integer (rounding down if it's a floating point value), wraps it if it's out-of-range, and returns the element at that index. -`array.read (index)` - (essentially a synonum for `at`) +`array.read (index)` - (essentially a synonym for `at`) `array.readLinearInterpolated (index)` - returns the linearly-interpolated value at the fractional position (after wrapping it if it's out-of-bounds). This us only available for arrays of floating-point types. Other interpolators such as LaGrange, Catmull-Rom, etc, may be added in future releases. @@ -334,7 +334,7 @@ Where the runtime is providing an audio sample, you can add the annotation: external float[] audioFileData [[ resample: 48000 ]]; ``` -...which will tell the runtime to pre-process the audio file (or buffer) provided so that it is resampled to the given rate. The runtime will use a high-queality interpolator and there'll be no run-time overhead once the code is running. +...which will tell the runtime to pre-process the audio file (or buffer) provided so that it is resampled to the given rate. The runtime will use a high-quality interpolator and there'll be no run-time overhead once the code is running. You can also use the annotation 'sourceChannel' to pull out a specific channel from the file: diff --git a/docs/SOUL_Overview.md b/docs/SOUL_Overview.md index 3876120d..1f800f1b 100644 --- a/docs/SOUL_Overview.md +++ b/docs/SOUL_Overview.md @@ -56,7 +56,7 @@ We expect SOUL to be valuable to audio developers at all levels - from absolute ### Who is the target audience for the SOUL platform architecture? -At the high-end, SOUL will allow musicians to connect external accelarator devices to work on larger, more power-hungry sessions with much lower latency, while freeing up their laptop CPUs to handle the UI for their tools. +At the high-end, SOUL will allow musicians to connect external accelerator devices to work on larger, more power-hungry sessions with much lower latency, while freeing up their laptop CPUs to handle the UI for their tools. At a more general consumer level, SOUL can improve power and battery life for mobile devices that support it with dedicated hardware. And by providing a flexible platform for implementing audio codecs, it could be a more future-proof replacement for silicon which is dedicated to performing decompression of specific common codec formats. @@ -150,7 +150,7 @@ The main concepts involved in this API are **Performers** and **Venues**. - A *Performer* is an implementation of a JIT compiler which can be given a SOUL program and asked to synchronously render blocks of data. -- A *Venue* is an independant device (e.g. a machine accessed via a network, or a separate process or driver running on your local machine), which can be sent a SOUL program to run, and then controlled remotely and asynchronously. +- A *Venue* is an independent device (e.g. a machine accessed via a network, or a separate process or driver running on your local machine), which can be sent a SOUL program to run, and then controlled remotely and asynchronously. A developer can build a SOUL host which either compiles and runs SOUL synchronously inside its own process using a *performer*, or which dispatches the code to run remotely (and at low latency) in a suitable *venue*. Either way, using these APIs means that the programs are not limited to simple audio/MIDI i/o like the SOUL Patch format, and can have input and output channels containing any kind of data stream. diff --git a/source/API/soul_patch/API/soul_patch_Library.h b/source/API/soul_patch/API/soul_patch_Library.h index 5d8aa3f0..b3ba42d2 100644 --- a/source/API/soul_patch/API/soul_patch_Library.h +++ b/source/API/soul_patch/API/soul_patch_Library.h @@ -25,7 +25,7 @@ static constexpr int currentLibraryAPIVersion = 0x1005; /** Dynamically opens and connects to the shared library containing the patch loader. You should only create a single instance of this class. and use it in an RAII - style, making sure it lives longer than all the objects that orginate from it. + style, making sure it lives longer than all the objects that originate from it. */ struct SOULPatchLibrary { diff --git a/source/README.md b/source/README.md index 62cac1ac..b9c957c9 100644 --- a/source/README.md +++ b/source/README.md @@ -13,7 +13,7 @@ The low-level C++ source code for various compiler tasks is arranged as JUCE mod - `modules/soul_patch_loader` - this module implements a lot of the glue logic required to turn a `soul::Performer` into a set of COM classes which implement the SOUL Patch API - `API/soul_patch/API` - This contains the completely dependency-free C++ header-only COM base classes which define the SOUL Patch API -- `API/soul_patch/helper_classes` - A set of header-only C++ utlities providing various client-side helpers for dealing with the SOUL Patch API. This includes classes to load patches as a `juce::AudioPluginInstance` +- `API/soul_patch/helper_classes` - A set of header-only C++ utilities providing various client-side helpers for dealing with the SOUL Patch API. This includes classes to load patches as a `juce::AudioPluginInstance` ### Current Project Status diff --git a/source/modules/soul_core/diagnostics/soul_Errors.h b/source/modules/soul_core/diagnostics/soul_Errors.h index 0673bb50..6d97735d 100644 --- a/source/modules/soul_core/diagnostics/soul_Errors.h +++ b/source/modules/soul_core/diagnostics/soul_Errors.h @@ -179,7 +179,7 @@ namespace soul X(expectedUnqualifiedName, "This name cannot have a namespace qualifier") \ X(qualifierOnGeneric, "Generic function types must be a non-qualified identifier") \ X(tooManyParameters, "Too many function parameters") \ - X(tooManyInitialisers, "Initialiser list exceeeds max length limit") \ + X(tooManyInitialisers, "Initialiser list exceeds max length limit") \ X(cannotPassConstAsNonConstRef, "Cannot pass a const value as a non-const reference") \ X(assignmentInsideExpression, "Assignment is not allowed inside an expression") \ X(propertiesOutsideProcessor, "Processor properties are only valid inside a processor declaration") \ From 6b4263d5ffcae8457d1096c5ecf3ae441ca6539a Mon Sep 17 00:00:00 2001 From: Nico Chatzi Date: Sat, 23 May 2020 13:10:49 +0200 Subject: [PATCH 02/11] Add numeric literals and some types to SOUL syntax --- .../vs_code_extension/soul/syntaxes/soul.tmLanguage.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/editors/vs_code_extension/soul/syntaxes/soul.tmLanguage.json b/tools/editors/vs_code_extension/soul/syntaxes/soul.tmLanguage.json index 68f5c676..998b9c8d 100644 --- a/tools/editors/vs_code_extension/soul/syntaxes/soul.tmLanguage.json +++ b/tools/editors/vs_code_extension/soul/syntaxes/soul.tmLanguage.json @@ -9,7 +9,7 @@ }, { "name": "storage.type.soul", - "match": "\\b(const|void|int|int32|int64|float|float32|float64|fixed|bool|string|event|wrap|clamp|external)\\b" + "match": "\\b(const|void|int|int32|int64|float|float32|float64|fixed|bool|string|event|stream|value|wrap|clamp|external)\\b" }, { "name": "entity.name.type.soul", @@ -110,7 +110,7 @@ "name": "constant.language.soul" }, { - "match": "\\b((0(x|X)[0-9a-fA-F]([0-9a-fA-F']*[0-9a-fA-F])?)|(0(b|B)[01]([01']*[01])?)|(([0-9]([0-9']*[0-9])?\\.?[0-9]*([0-9']*[0-9])?)|(\\.[0-9]([0-9']*[0-9])?))((e|E)(\\+|-)?[0-9]([0-9']*[0-9])?)?)(F|f)?\\b", + "match": "\\b((0(x|X)[0-9a-fA-F]([0-9a-fA-F']*[0-9a-fA-F])?)|(0(b|B)[01]([01']*[01])?)|(([0-9]([0-9']*[0-9])?\\.?[0-9]*([0-9']*[0-9])?)|(\\.[0-9]([0-9']*[0-9])?))((e|E)(\\+|-)?[0-9]([0-9']*[0-9])?)?)((_)?f((32|64)?))?|([0-9]*([0-9']*[0-9])?((_)?(L|i(32|64))))\\b", "name": "constant.numeric.soul" }, { From 99dc134d4667217895385e806141a9ee5bfdb191 Mon Sep 17 00:00:00 2001 From: Nico Chatzi Date: Sat, 23 May 2020 13:11:34 +0200 Subject: [PATCH 03/11] Add HEART vscode syntax highlighting --- .../heart/.vscode/launch.json | 18 ++ .../heart/language-configuration.json | 28 +++ .../vs_code_extension/heart/package.json | 25 +++ .../heart/syntaxes/heart.tmLanguage.json | 163 ++++++++++++++++++ 4 files changed, 234 insertions(+) create mode 100644 tools/editors/vs_code_extension/heart/.vscode/launch.json create mode 100644 tools/editors/vs_code_extension/heart/language-configuration.json create mode 100644 tools/editors/vs_code_extension/heart/package.json create mode 100644 tools/editors/vs_code_extension/heart/syntaxes/heart.tmLanguage.json diff --git a/tools/editors/vs_code_extension/heart/.vscode/launch.json b/tools/editors/vs_code_extension/heart/.vscode/launch.json new file mode 100644 index 00000000..7bc18a44 --- /dev/null +++ b/tools/editors/vs_code_extension/heart/.vscode/launch.json @@ -0,0 +1,18 @@ +// A launch configuration that launches the extension inside a new window +// Use IntelliSense to learn about possible attributes. +// Hover to view descriptions of existing attributes. +// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Extension", + "type": "extensionHost", + "request": "launch", + "runtimeExecutable": "${execPath}", + "args": [ + "--extensionDevelopmentPath=${workspaceFolder}" + ] + } + ] +} \ No newline at end of file diff --git a/tools/editors/vs_code_extension/heart/language-configuration.json b/tools/editors/vs_code_extension/heart/language-configuration.json new file mode 100644 index 00000000..dbcefab4 --- /dev/null +++ b/tools/editors/vs_code_extension/heart/language-configuration.json @@ -0,0 +1,28 @@ +{ + "comments": { + // symbol used for single line comment. Remove this entry if your language does not support line comments + "lineComment": "#", + }, + // symbols used as brackets + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + // symbols that are auto closed when typing + "autoClosingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"] + ], + // symbols that that can be used to surround a selection + "surroundingPairs": [ + ["{", "}"], + ["[", "]"], + ["(", ")"], + ["\"", "\""], + ["'", "'"] + ] +} \ No newline at end of file diff --git a/tools/editors/vs_code_extension/heart/package.json b/tools/editors/vs_code_extension/heart/package.json new file mode 100644 index 00000000..dd7f5733 --- /dev/null +++ b/tools/editors/vs_code_extension/heart/package.json @@ -0,0 +1,25 @@ +{ + "name": "heart", + "displayName": "heart", + "description": "HEART language support", + "version": "0.0.1", + "engines": { + "vscode": "^1.32.0" + }, + "categories": [ + "Programming Languages" + ], + "contributes": { + "languages": [{ + "id": "heart", + "aliases": ["HEART", "heart"], + "extensions": [".heart",".hearttest"], + "configuration": "./language-configuration.json" + }], + "grammars": [{ + "language": "heart", + "scopeName": "source.heart", + "path": "./syntaxes/heart.tmLanguage.json" + }] + } +} \ No newline at end of file diff --git a/tools/editors/vs_code_extension/heart/syntaxes/heart.tmLanguage.json b/tools/editors/vs_code_extension/heart/syntaxes/heart.tmLanguage.json new file mode 100644 index 00000000..f4fcffa7 --- /dev/null +++ b/tools/editors/vs_code_extension/heart/syntaxes/heart.tmLanguage.json @@ -0,0 +1,163 @@ +{ + "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", + "name": "HEART", + "scopeName": "source.heart", + "patterns": [ + { + "name": "keyword.control.heart", + "match": "\\b(branch_if|branch|return)\\b" + }, + { + "name": "storage.type.heart", + "match": "\\b(const|void|int|int32|int64|float|float32|float64|fixed|bool|string|node|event|stream|value|wrap|clamp|external)\\b" + }, + { + "name": "entity.name.type.heart", + "match": "\\b(let|var|graph|processor|namespace|struct|function|enum|input|output|connection|import)\\b" + }, + { + "name": "entity.name.function.heart", + "match": "\\b(read|write|advance|cast|call|add|multiply|subtract|divide|modulo|bitwiseOr|bitwiseAnd|bitwiseXor|logicalOr|logicalAnd|equals|notEquals|lessThan|lessThanOrEqual|greaterThan|greaterThanOrEqual|leftShift|rightShift|rightShiftUnsigned|negate|logicalNot|bitwiseNot)\\b" + }, + { + "name": "entity.name.tag.heart", + "match": "\\b(none|latch|linear|sinc|fast|best)\\b" + }, + { + "name": "entity.name.section.heart", + "match": "([@*])\\w+" + }, + { + "name": "variable.other.heart", + "match": "([$*])\\w+" + }, + { + "name": "invalid.illegal.heart", + "match": "\\b(try|catch|throw|class|default|operator|switch|case)\\b" + }, + { + "name": "comment.line.number-sign.heart", + "begin": "#", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.cpp" + } + }, + "end": "(?=\\n)", + "patterns": [ + { + "match": "(\\\\)\\n" + } + ] + }, + { + "match": "->|<-", + "name": "keyword.other.heart" + }, + { + "match": "<<|>>", + "name": "keyword.other.heart" + }, + { + "match": "\\.|::", + "name": "punctuation.separator.heart" + }, + { + "match": ";", + "name": "punctuation.terminator.heart" + }, + { + "match": "=", + "name": "keyword.operator.assignment.heart" + }, + { + "match": "%|\\*|/|-|\\+", + "name": "keyword.operator.heart" + }, + { + "match": "\\b(true|false)\\b", + "name": "constant.language.heart" + }, + { + "match": "\\b((0(x|X)[0-9a-fA-F]([0-9a-fA-F']*[0-9a-fA-F])?)|(0(b|B)[01]([01']*[01])?)|(([0-9]([0-9']*[0-9])?\\.?[0-9]*([0-9']*[0-9])?)|(\\.[0-9]([0-9']*[0-9])?))((e|E)(\\+|-)?[0-9]([0-9']*[0-9])?)?)(f)?|([0-9]*([0-9']*[0-9])?(L))\\b", + "name": "constant.numeric.heart" + }, + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.section.parens.begin.bracket.round.heart" + } + }, + "end": "\\)|(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(? Date: Wed, 27 May 2020 09:37:53 +0200 Subject: [PATCH 04/11] Rich SOUL syntax highlighting --- .../soul/syntaxes/soul.tmLanguage.json | 91 +++++++++++++++++-- 1 file changed, 85 insertions(+), 6 deletions(-) diff --git a/tools/editors/vs_code_extension/soul/syntaxes/soul.tmLanguage.json b/tools/editors/vs_code_extension/soul/syntaxes/soul.tmLanguage.json index 998b9c8d..b5344eee 100644 --- a/tools/editors/vs_code_extension/soul/syntaxes/soul.tmLanguage.json +++ b/tools/editors/vs_code_extension/soul/syntaxes/soul.tmLanguage.json @@ -8,12 +8,20 @@ "match": "\\b(if|else|do|while|for|loop|break|continue|return)\\b" }, { - "name": "storage.type.soul", - "match": "\\b(const|void|int|int32|int64|float|float32|float64|fixed|bool|string|event|stream|value|wrap|clamp|external)\\b" + "name": "storage.type.core.soul", + "match": "\\b(void|int|int32|int64|float|float32|float64|bool|string|(wrap|clamp)(?=\\s*<))\\b" + }, + { + "name": "storage.class.soul", + "match": "\\b(event|stream|value)(?=[\\s+|\n|{])\\b" + }, + { + "name": "storage.modifier.core.soul", + "match": "\\b(const|fixed|external)\\b" }, { "name": "entity.name.type.soul", - "match": "\\b(let|var|graph|processor|namespace|struct|using|enum|input|output|connection|import)\\b" + "match": "\\b(let|var|input|output|connection|import)\\b" }, { "name": "invalid.illegal.soul", @@ -102,7 +110,7 @@ "name": "keyword.operator.assignment.soul" }, { - "match": "%|\\*|/|-|\\+", + "match": "%|\\*|/|-|\\+|\\?|\\:", "name": "keyword.operator.soul" }, { @@ -110,8 +118,79 @@ "name": "constant.language.soul" }, { - "match": "\\b((0(x|X)[0-9a-fA-F]([0-9a-fA-F']*[0-9a-fA-F])?)|(0(b|B)[01]([01']*[01])?)|(([0-9]([0-9']*[0-9])?\\.?[0-9]*([0-9']*[0-9])?)|(\\.[0-9]([0-9']*[0-9])?))((e|E)(\\+|-)?[0-9]([0-9']*[0-9])?)?)((_)?f((32|64)?))?|([0-9]*([0-9']*[0-9])?((_)?(L|i(32|64))))\\b", - "name": "constant.numeric.soul" + "match": "\\b(processor(?=[.]))\\b", + "name": "support.constant.core.soul" + }, + { + "match": "\\b[0-9]+[.]([0-9]+)?[_]?([f](32|64)?)?([e][+-]?[0-9]+)?[_]?([f](32|64)?)?\\b", + "name": "constant.numeric.float.soul" + }, + { + "match": "\\b[0-9]+(_)?(([i](32|64))|L)?\\b", + "name": "constant.numeric.integer.decimal.soul" + }, + { + "match": "\\b0x[a-fA-F0-9]+(_)?(([i](32|64))|L)?\\b", + "name": "constant.numeric.integer.hexadecimal.soul" + }, + { + "match": "\\b0o[0-7]+(_)?(([i](32|64))|L)?\\b", + "name": "constant.numeric.integer.octal.soul" + }, + { + "match": "\\b0b[01]+(_)?(([i](32|64))|L)?\\b", + "name": "constant.numeric.integer.binary.soul" + }, + { + "match": "\\b([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*\\(", + "captures": { + "1": { + "name": "entity.name.function.soul" + } + } + }, + { + "comment": "Module declaration", + "match": "\\b(graph|processor|namespace)\\s+([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\b", + "captures": { + "1": { + "name": "storage.type.soul" + }, + "2": { + "name": "entity.name.type.soul" + } + } + }, + { + "comment": "Type declaration", + "begin": "\\b(enum|struct)\\s+([a-zA-Z_][a-zA-Z0-9_]*)", + "end": "[\\{\\(]", + "beginCaptures": { + "1": { + "name": "storage.type.soul" + }, + "2": { + "name": "entity.name.type.soul" + } + }, + "patterns": [ + { + "match": "\\b(enum|struct)\\b", + "name": "keyword.other.type-decl.soul" + } + ] + }, + { + "comment": "Type alias", + "match": "\\b(using)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\b", + "captures": { + "1": { + "name": "storage.type.soul" + }, + "2": { + "name": "entity.name.type.soul" + } + } }, { "begin": "\\(", From 09eb2cfc3eb792e568cb324db923a3361515b799 Mon Sep 17 00:00:00 2001 From: Nico Chatzi Date: Wed, 27 May 2020 18:00:38 +0200 Subject: [PATCH 05/11] Enrich HEART syntax highlighting --- .../heart/syntaxes/heart.tmLanguage.json | 73 ++++++++++++++++--- 1 file changed, 64 insertions(+), 9 deletions(-) diff --git a/tools/editors/vs_code_extension/heart/syntaxes/heart.tmLanguage.json b/tools/editors/vs_code_extension/heart/syntaxes/heart.tmLanguage.json index f4fcffa7..fb614e5a 100644 --- a/tools/editors/vs_code_extension/heart/syntaxes/heart.tmLanguage.json +++ b/tools/editors/vs_code_extension/heart/syntaxes/heart.tmLanguage.json @@ -9,27 +9,35 @@ }, { "name": "storage.type.heart", - "match": "\\b(const|void|int|int32|int64|float|float32|float64|fixed|bool|string|node|event|stream|value|wrap|clamp|external)\\b" + "match": "\\b(void|int|int32|int64|float|float32|float64|bool|string|(wrap|clamp)(?=\\s*<))\\b" }, { - "name": "entity.name.type.heart", - "match": "\\b(let|var|graph|processor|namespace|struct|function|enum|input|output|connection|import)\\b" + "name": "storage.class.heart", + "match": "\\b(event|stream|value|node)(?=[\\s+|\n|{])\\b" }, { - "name": "entity.name.function.heart", - "match": "\\b(read|write|advance|cast|call|add|multiply|subtract|divide|modulo|bitwiseOr|bitwiseAnd|bitwiseXor|logicalOr|logicalAnd|equals|notEquals|lessThan|lessThanOrEqual|greaterThan|greaterThanOrEqual|leftShift|rightShift|rightShiftUnsigned|negate|logicalNot|bitwiseNot)\\b" + "name": "storage.modifier.core.heart", + "match": "\\b(const|fixed|external)\\b" + }, + { + "name": "entity.name.type.heart", + "match": "\\b(let|var|input|output|connection|import)\\b" }, { "name": "entity.name.tag.heart", "match": "\\b(none|latch|linear|sinc|fast|best)\\b" }, + { + "name": "entity.name.function.heart", + "match": "\\b(read|write|advance|cast|call)\\b" + }, { "name": "entity.name.section.heart", - "match": "([@*])\\w+" + "match": "[@]\\w+\\b" }, { "name": "variable.other.heart", - "match": "([$*])\\w+" + "match": "[$]\\w+\\b" }, { "name": "invalid.illegal.heart", @@ -79,8 +87,55 @@ "name": "constant.language.heart" }, { - "match": "\\b((0(x|X)[0-9a-fA-F]([0-9a-fA-F']*[0-9a-fA-F])?)|(0(b|B)[01]([01']*[01])?)|(([0-9]([0-9']*[0-9])?\\.?[0-9]*([0-9']*[0-9])?)|(\\.[0-9]([0-9']*[0-9])?))((e|E)(\\+|-)?[0-9]([0-9']*[0-9])?)?)(f)?|([0-9]*([0-9']*[0-9])?(L))\\b", - "name": "constant.numeric.heart" + "match": "\\b(processor(?=[.]))\\b", + "name": "support.constant.core.heart" + }, + { + "match": "\\b[0-9]+[.]([0-9]+)?[f]?([e][+-]?[0-9]+)?[f]?\\b", + "name": "constant.numeric.float.heart" + }, + { + "match": "\\b[0-9]+(L)?\\b", + "name": "constant.numeric.integer.decimal.heart" + }, + { + "match": "\\b0x[a-fA-F0-9]+(L)?\\b", + "name": "constant.numeric.integer.hexadecimal.heart" + }, + { + "match": "\\b0o[0-7]+(L)?\\b", + "name": "constant.numeric.integer.octal.heart" + }, + { + "match": "\\b0b[01]+(L)?\\b", + "name": "constant.numeric.integer.binary.heart" + }, + { + "match": "\\b([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*\\(", + "name": "entity.name.function.heart" + }, + { + "match": "\\b(function)\\s+([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*\\(", + "captures": { + "1": { + "name": "storage.type.soul" + }, + "2": { + "name": "entity.name.function.heart" + } + } + }, + { + "comment": "Module declaration", + "match": "\\b(graph|processor|namespace)\\s+([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_(::)]+)\\b", + "captures": { + "1": { + "name": "storage.type.heart" + }, + "2": { + "name": "entity.name.type.heart" + } + } }, { "begin": "\\(", From 83999ec79c1f0e3794aa3eb3e1c544a8b6c76168 Mon Sep 17 00:00:00 2001 From: Nico Chatzi Date: Wed, 27 May 2020 18:13:39 +0200 Subject: [PATCH 06/11] Reintroduce struct and enum to HEART syntax --- .../heart/syntaxes/heart.tmLanguage.json | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tools/editors/vs_code_extension/heart/syntaxes/heart.tmLanguage.json b/tools/editors/vs_code_extension/heart/syntaxes/heart.tmLanguage.json index fb614e5a..33ba74f7 100644 --- a/tools/editors/vs_code_extension/heart/syntaxes/heart.tmLanguage.json +++ b/tools/editors/vs_code_extension/heart/syntaxes/heart.tmLanguage.json @@ -118,7 +118,7 @@ "match": "\\b(function)\\s+([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*\\(", "captures": { "1": { - "name": "storage.type.soul" + "name": "storage.type.heart" }, "2": { "name": "entity.name.function.heart" @@ -137,6 +137,25 @@ } } }, + { + "comment": "Type declaration", + "begin": "\\b(enum|struct)\\s+([a-zA-Z_][a-zA-Z0-9_]*)", + "end": "[\\{\\(]", + "beginCaptures": { + "1": { + "name": "storage.type.heart" + }, + "2": { + "name": "entity.name.type.heart" + } + }, + "patterns": [ + { + "match": "\\b(enum|struct)\\b", + "name": "keyword.other.type-decl.heart" + } + ] + }, { "begin": "\\(", "beginCaptures": { From 6b84b7a5ba2401f61d180effbc2d437d66f1ba4a Mon Sep 17 00:00:00 2001 From: Nico Chatzi Date: Thu, 28 May 2020 18:23:00 +0200 Subject: [PATCH 07/11] Port highlighting to Atom --- tools/editors/atom/heart/grammars/heart.cson | 196 ++++++++++++++++ tools/editors/atom/heart/package.json | 11 + tools/editors/atom/soul/grammars/soul.cson | 224 +++++++++++++++++++ tools/editors/atom/soul/package.json | 11 + 4 files changed, 442 insertions(+) create mode 100644 tools/editors/atom/heart/grammars/heart.cson create mode 100644 tools/editors/atom/heart/package.json create mode 100644 tools/editors/atom/soul/grammars/soul.cson create mode 100644 tools/editors/atom/soul/package.json diff --git a/tools/editors/atom/heart/grammars/heart.cson b/tools/editors/atom/heart/grammars/heart.cson new file mode 100644 index 00000000..2f801133 --- /dev/null +++ b/tools/editors/atom/heart/grammars/heart.cson @@ -0,0 +1,196 @@ +scopeName: 'source.heart' +name: 'HEART' +fileTypes: ['heart'] +patterns: [ + { + name: 'keyword.control.heart' + match: '\\b(branch_if|branch|return)\\b' + } + { + name: 'storage.type.heart' + match: '\\b(void|int|int32|int64|float|float32|float64|bool|string|(wrap|clamp)(?=\\s*<))\\b' + } + { + name: 'storage.class.heart' + match: '''\\b(event|stream|value|node)(?=[\\s+|{])\\b''' + } + { + name: 'storage.modifier.core.heart' + match: '\\b(const|fixed|external)\\b' + } + { + name: 'entity.name.type.heart' + match: '\\b(let|var|input|output|connection|import)\\b' + } + { + name: 'entity.name.tag.heart' + match: '\\b(none|latch|linear|sinc|fast|best)\\b' + } + { + name: 'entity.name.function.heart' + match: '\\b(read|write|advance|cast|call)\\b' + } + { + name: 'entity.name.section.heart' + match: '[@]\\w+\\b' + } + { + name: 'variable.other.heart' + match: '[$]\\w+\\b' + } + { + name: 'invalid.illegal.heart' + match: '\\b(try|catch|throw|class|default|operator|switch|case)\\b' + } + { + name: 'comment.line.number-sign.heart' + begin: '#' + beginCaptures: + '0': + name: 'punctuation.definition.comment.cpp' + end: '(?=\\n)' + patterns: [ + { + match: '(\\\\)\\n' + } + ] + } + { + match: '->|<-' + name: 'keyword.other.heart' + } + { + match: '<<|>>' + name: 'keyword.other.heart' + } + { + match: '\\.|::' + name: 'punctuation.separator.heart' + } + { + match: ';' + name: 'punctuation.terminator.heart' + } + { + match: '=' + name: 'keyword.operator.assignment.heart' + } + { + match: '%|\\*|/|-|\\+' + name: 'keyword.operator.heart' + } + { + match: '\\b(true|false)\\b' + name: 'constant.language.heart' + } + { + match: '\\b(processor(?=[.]))\\b' + name: 'support.constant.core.heart' + } + { + match: '\\b[0-9]+[.]([0-9]+)?[f]?([e][+-]?[0-9]+)?[f]?\\b' + name: 'constant.numeric.float.heart' + } + { + match: '\\b[0-9]+(L)?\\b' + name: 'constant.numeric.integer.decimal.heart' + } + { + match: '\\b0x[a-fA-F0-9]+(L)?\\b' + name: 'constant.numeric.integer.hexadecimal.heart' + } + { + match: '\\b0o[0-7]+(L)?\\b' + name: 'constant.numeric.integer.octal.heart' + } + { + match: '\\b0b[01]+(L)?\\b' + name: 'constant.numeric.integer.binary.heart' + } + { + match: '\\b([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*\\(' + captures: + '1': + name: 'entity.name.function.heart' + } + { + match: '\\b(function)\\s+([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*\\(' + captures: + '1': + name: 'storage.type.heart' + '2': + name: 'entity.name.function.heart' + } + { + comment: 'Module declaration' + match: '\\b(graph|processor|namespace)\\s+([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_(::)]+)\\b' + captures: + '1': + name: 'storage.type.heart' + '2': + name: 'entity.name.type.heart' + } + { + comment: 'Type declaration' + begin: '\\b(enum|struct)\\s+([a-zA-Z_][a-zA-Z0-9_]*)' + end: '[\\{\\(]' + beginCaptures: + '1': + name: 'storage.type.heart' + '2': + name: 'entity.name.type.heart' + patterns: [ + { + match: '\\b(enum|struct)\\b' + name: 'keyword.other.type-decl.heart' + } + ] + } + { + begin: '\\(' + beginCaptures: + '0': + name: 'punctuation.section.parens.begin.bracket.round.heart' + end: '\\)|(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(?|<-' + name: 'keyword.other.soul' + } + { + match: '%=|\\+=|-=|\\*=' + name: 'keyword.operator.assignment.compound.soul' + } + { + match: '&=|\\^=|<<=|>>=|\\|=' + name: 'keyword.operator.assignment.compound.bitwise.soul' + } + { + match: '<<|>>' + name: 'keyword.other.soul' + } + { + match: '!=|<=|>=|==|<|>' + name: 'keyword.operator.comparison.soul' + } + { + match: '&&|!|\\|\\|' + name: 'keyword.operator.logical.soul' + } + { + match: '&|\\||\\^|~' + name: 'keyword.operator.soul' + } + { + match: '\\.|::' + name: 'punctuation.separator.soul' + } + { + match: ';' + name: 'punctuation.terminator.soul' + } + { + match: '=' + name: 'keyword.operator.assignment.soul' + } + { + match: '%|\\*|/|-|\\+|\\?|\\:' + name: 'keyword.operator.soul' + } + { + match: '\\b(true|false)\\b' + name: 'constant.language.soul' + } + { + match: '\\b(processor(?=[.]))\\b' + name: 'support.constant.core.soul' + } + { + match: '\\b[0-9]+[.]([0-9]+)?[_]?([f](32|64)?)?([e][+-]?[0-9]+)?[_]?([f](32|64)?)?\\b' + name: 'constant.numeric.float.soul' + } + { + match: '\\b[0-9]+(_)?(([i](32|64))|L)?\\b' + name: 'constant.numeric.integer.decimal.soul' + } + { + match: '\\b0x[a-fA-F0-9]+(_)?(([i](32|64))|L)?\\b' + name: 'constant.numeric.integer.hexadecimal.soul' + } + { + match: '\\b0o[0-7]+(_)?(([i](32|64))|L)?\\b' + name: 'constant.numeric.integer.octal.soul' + } + { + match: '\\b0b[01]+(_)?(([i](32|64))|L)?\\b' + name: 'constant.numeric.integer.binary.soul' + } + { + match: '\\b([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*\\(' + captures: + '1': + name: 'entity.name.function.soul' + } + { + comment: 'Module declaration' + match: '\\b(graph|processor|namespace)\\s+([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\b' + captures: + '1': + name: 'storage.type.soul' + '2': + name: 'entity.name.type.soul' + } + { + comment: 'Type declaration' + begin: '\\b(enum|struct)\\s+([a-zA-Z_][a-zA-Z0-9_]*)' + end: '[\\{\\(]' + beginCaptures: + '1': + name: 'storage.type.soul' + '2': + name: 'entity.name.type.soul' + patterns: [ + { + match: '\\b(enum|struct)\\b' + name: 'keyword.other.type-decl.soul' + } + ] + } + { + comment: 'Type alias' + match: '\\b(using)\\s+([a-zA-Z_][a-zA-Z0-9_]*)\\b' + captures: + '1': + name: 'storage.type.soul' + '2': + name: 'entity.name.type.soul' + } + { + begin: '\\(' + beginCaptures: + '0': + name: 'punctuation.section.parens.begin.bracket.round.soul' + end: '\\)|(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(? Date: Thu, 28 May 2020 18:29:48 +0200 Subject: [PATCH 08/11] Fix vscode HEART function call termination detection --- tools/editors/atom/soul/grammars/soul.cson | 12 ++++++------ .../heart/syntaxes/heart.tmLanguage.json | 6 +++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/editors/atom/soul/grammars/soul.cson b/tools/editors/atom/soul/grammars/soul.cson index fd21a24b..2195f1bf 100644 --- a/tools/editors/atom/soul/grammars/soul.cson +++ b/tools/editors/atom/soul/grammars/soul.cson @@ -3,28 +3,28 @@ name: 'SOUL' fileTypes: ['soul'] patterns: [ { - match: '\\b(if|else|do|while|for|loop|break|continue|return)\\b' name: 'keyword.control.soul' + match: '\\b(if|else|do|while|for|loop|break|continue|return)\\b' } { - match: '\\b(void|int|int32|int64|float|float32|float64|bool|string|(wrap|clamp)(?=\\s*<))\\b' name: 'storage.type.core.soul' + match: '\\b(void|int|int32|int64|float|float32|float64|bool|string|(wrap|clamp)(?=\\s*<))\\b' } { - match: '\\b(event|stream|value)(?=[\\s+|{])\\b' name: 'storage.class.soul' + match: '\\b(event|stream|value)(?=[\\s+|{])\\b' } { - match: '\\b(const|fixed|external)\\b' name: 'storage.modifier.core.soul' + match: '\\b(const|fixed|external)\\b' } { - match: '\\b(let|var|input|output|connection|import)\\b' name: 'entity.name.type.soul' + match: '\\b(let|var|input|output|connection|import)\\b' } { - match: '\\b(try|catch|throw|class|default|operator|switch|case)\\b' name: 'invalid.illegal.soul' + match: '\\b(try|catch|throw|class|default|operator|switch|case)\\b' } { name: 'comment.block.soul' diff --git a/tools/editors/vs_code_extension/heart/syntaxes/heart.tmLanguage.json b/tools/editors/vs_code_extension/heart/syntaxes/heart.tmLanguage.json index 33ba74f7..6724e660 100644 --- a/tools/editors/vs_code_extension/heart/syntaxes/heart.tmLanguage.json +++ b/tools/editors/vs_code_extension/heart/syntaxes/heart.tmLanguage.json @@ -112,7 +112,11 @@ }, { "match": "\\b([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*\\(", - "name": "entity.name.function.heart" + "captures": { + "1": { + "name": "entity.name.function.heart" + } + } }, { "match": "\\b(function)\\s+([A-Za-z][A-Za-z0-9_]*|_[A-Za-z0-9_]+)\\s*\\(", From bd5a64ea2cf69ccb868c4ea34a08e81942cec26f Mon Sep 17 00:00:00 2001 From: Nico Chatzi Date: Thu, 28 May 2020 19:53:58 +0200 Subject: [PATCH 09/11] Remove punctuation.section.parens in Atom which was breaking some function highlighting --- tools/editors/atom/heart/grammars/heart.cson | 15 --------------- tools/editors/atom/soul/grammars/soul.cson | 15 --------------- 2 files changed, 30 deletions(-) diff --git a/tools/editors/atom/heart/grammars/heart.cson b/tools/editors/atom/heart/grammars/heart.cson index 2f801133..809a59ca 100644 --- a/tools/editors/atom/heart/grammars/heart.cson +++ b/tools/editors/atom/heart/grammars/heart.cson @@ -146,21 +146,6 @@ patterns: [ } ] } - { - begin: '\\(' - beginCaptures: - '0': - name: 'punctuation.section.parens.begin.bracket.round.heart' - end: '\\)|(?=//)|(?=/\\*(?!.*\\\\\\s*\\n))|(? Date: Mon, 8 Jun 2020 09:29:43 +0200 Subject: [PATCH 10/11] Add snippets --- .../vs_code_extension/soul/package.json | 4 + .../vs_code_extension/soul/snippets/soul.json | 90 +++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 tools/editors/vs_code_extension/soul/snippets/soul.json diff --git a/tools/editors/vs_code_extension/soul/package.json b/tools/editors/vs_code_extension/soul/package.json index 07cc69b1..a7a7730b 100644 --- a/tools/editors/vs_code_extension/soul/package.json +++ b/tools/editors/vs_code_extension/soul/package.json @@ -20,6 +20,10 @@ "language": "soul", "scopeName": "source.soul", "path": "./syntaxes/soul.tmLanguage.json" + }], + "snippets": [{ + "language": "soul", + "path": "./snippets/soul.json" }] } } \ No newline at end of file diff --git a/tools/editors/vs_code_extension/soul/snippets/soul.json b/tools/editors/vs_code_extension/soul/snippets/soul.json new file mode 100644 index 00000000..4cf1995b --- /dev/null +++ b/tools/editors/vs_code_extension/soul/snippets/soul.json @@ -0,0 +1,90 @@ +{ + "Mono Out Processor": { + "prefix": ["processor", "prm"], + "body": [ + "processor ${1:Name}", + "{", + "\toutput stream float audioOut;", + "", + "\tvoid run()", + "\t{", + "\t\tloop", + "\t\t{", + "\t\t\t$2", + "\t\t}", + "\t}", + "}" + ], + "description": "Simplest processor." + }, + "Stereo I/O Processor": { + "prefix": ["processors", "prs"], + "body": [ + "processor ${1:Name}", + "{", + "\tinput stream float<2> audioIn;", + "\toutput stream float<2> audioOut;", + "", + "\tvoid run()", + "\t{", + "\t\tloop", + "\t\t{", + "\t\t\t$2", + "\t\t}", + "\t}", + "}" + ], + "description": "Stereo in/out processor." + }, + "Mono Out Graph": { + "prefix": ["graph", "grm"], + "body": [ + "graph ${1:Name}", + "{", + "\toutput stream float audioOut;", + "", + "\tlet", + "\t{", + "\t\t$2", + "\t}", + "", + "\tconnection", + "\t{", + "\t\t$3", + "\t}", + "}" + ], + "description": "Simplest Graph." + }, + "Stereo I/O Graph": { + "prefix": ["graphs", "grs"], + "body": [ + "graph ${1:Name}", + "{", + "\tinput stream float<2> audioOut;", + "\toutput stream float<2> audioOut;", + "", + "\tlet", + "\t{", + "\t\t$2", + "\t}", + "", + "\tconnection", + "\t{", + "\t\t$3", + "\t}", + "}" + ], + "description": "Simplest Graph." + }, + "Namespace": { + "prefix": ["namespace", "nmsp"], + "body": [ + "namespace ${1:Name}", + "{", + "\t$2", + "}" + ], + "description": "Namespace skeleton." + } +} From ca8e75cd417213ddf14fc54e9adba4adec956041 Mon Sep 17 00:00:00 2001 From: Nico Chatzi Date: Mon, 8 Jun 2020 09:32:38 +0200 Subject: [PATCH 11/11] Add stereo IO snippet --- tools/editors/vs_code_extension/soul/snippets/soul.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/editors/vs_code_extension/soul/snippets/soul.json b/tools/editors/vs_code_extension/soul/snippets/soul.json index 4cf1995b..2f6c0891 100644 --- a/tools/editors/vs_code_extension/soul/snippets/soul.json +++ b/tools/editors/vs_code_extension/soul/snippets/soul.json @@ -1,4 +1,12 @@ { + "Stereo I/O Pair": { + "prefix": ["strio"], + "body": [ + "input stream float<2> audioIn;", + "output stream float<2> audioOut;" + ], + "description": "Stereo I/O stream pair." + }, "Mono Out Processor": { "prefix": ["processor", "prm"], "body": [