Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax highlighting for SOUL & HEART in VSCode & Atom #28

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions docs/SOUL_Language.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:

Expand Down
4 changes: 2 additions & 2 deletions docs/SOUL_Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion source/API/soul_patch/API/soul_patch_Library.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion source/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion source/modules/soul_core/diagnostics/soul_Errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -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") \
Expand Down
181 changes: 181 additions & 0 deletions tools/editors/atom/heart/grammars/heart.cson
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
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'
}
]
}
{
match: '(\\[)|(\\])'
captures:
'1':
name: 'punctuation.definition.begin.bracket.square.heart'
'2':
name: 'punctuation.definition.end.bracket.square.heart'
}
{
match: '(\\[\\[)|(\\]\\])'
captures:
'1':
name: 'punctuation.definition.block.begin.bracket.square.heart'
'2':
name: 'punctuation.definition.block.end.bracket.square.heart'
}
{
name: 'string.quoted.double.heart'
begin: '"'
end: '"'
patterns: [
{
name: 'constant.character.escape.heart'
match: '\\\\.'
}
]
}
{
name: 'keyword.control.directive.heart'
begin: '^##'
end: '(?=\\n)'
}
]
11 changes: 11 additions & 0 deletions tools/editors/atom/heart/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "language-heart",
"version": "0.0.1",
"description": "Syntax highlighting for HEART",
"repository": "https://github.com/nicochatzi/SOUL",
"license": "MIT",
"engines": {
"atom": "*"
},
"dependencies": {}
}
Loading