syntax: modified clojure grammar to work decently for OpenGOAL

This commit is contained in:
Tyler Wilding 2022-03-16 22:48:42 -04:00
parent aaceaedbde
commit f28643ce7c
No known key found for this signature in database
GPG key ID: A89403EB356ED106
16 changed files with 833 additions and 273 deletions

3
.gitignore vendored
View file

@ -1,2 +1,3 @@
node_modules
*.vsix
*.vsix
TODO.md

View file

@ -1,9 +0,0 @@
# Change Log
All notable changes to the "opengoal" extension will be documented in this file.
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
## [Unreleased]
- Initial release

15
LICENSE Normal file
View file

@ -0,0 +1,15 @@
ISC License
Copyright (c) 2022-2022 OpenGOAL Team
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View file

@ -1,65 +1,22 @@
# opengoal README
# OpenGOAL for VSCode
This is the README for your extension "opengoal". After writing up a brief description, we recommend including the following sections.
Provides syntax highlighting, snippets, and more for the OpenGOAL language and it's related languages as well - https://open-goal.github.io
Therefore, this repo also contains TextMate grammars for the languages that you should be able to use for any other editor if you so choose.
## Features
Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.
- Syntax Highlighting for `.gc` (OpenGOAL) files
- Syntax Highlighting for `*_ir2.asm` (OpenGOAL IR) files
- Supports embedded highlighting for OpenGOAL blocks
- File Icons distinct for each sub-language
For example if there is an image subfolder under your extension project workspace:
## Example Screenshots
\!\[feature X\]\(images/feature-x.png\)
OpenGOAL Syntax Highlighting:
> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.
![](docs/img/opengoal-highlighting.png)
## Requirements
OpenGOAL IR Syntax Highlighting:
If you have any requirements or dependencies, add a section describing those and how to install and configure them.
## Extension Settings
Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.
For example:
This extension contributes the following settings:
* `myExtension.enable`: enable/disable this extension
* `myExtension.thing`: set to `blah` to do something
## Known Issues
Calling out known issues can help limit users opening duplicate issues against your extension.
## Release Notes
Users appreciate release notes as you update your extension.
### 1.0.0
Initial release of ...
### 1.0.1
Fixed issue #.
### 1.1.0
Added features X, Y, and Z.
-----------------------------------------------------------------------------------------------------------
## Working with Markdown
**Note:** You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux)
* Toggle preview (`Shift+CMD+V` on macOS or `Shift+Ctrl+V` on Windows and Linux)
* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (macOS) to see a list of Markdown snippets
### For more information
* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
**Enjoy!**
![](docs/img/opengoal-ir-highlighting.png)

View file

@ -1,3 +1,4 @@
## A bunch of articles that were invaluable:
## A bunch of articles are invaluable resources:
-
- https://www.apeth.com/nonblog/stories/textmatebundle.html
- https://rubular.com/

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View file

@ -16,6 +16,44 @@
},
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"name": "OpenGOAL Globals",
"scope": [
"entity.global.opengoal"
],
"settings": {
"foreground": "#36f9f6",
"fontStyle": "bold"
}
},
{
"name": "OpenGOAL Storage",
"scope": [
"storage.control.opengoal"
],
"settings": {
"foreground": "#36f9f6",
"fontStyle": "italic"
}
},
{
"name": "OpenGOAL Macros, Quoted",
"scope": [
"meta.quoted-expression.opengoal"
],
"settings": {
"fontStyle": "italic"
}
},
{
"name": "OpenGOAL Symbols",
"scope": [
"meta.symbol.opengoal"
],
"settings": {
"foreground": "#ff7edbff"
}
},
{
"scope": "opengoal.ir.typeanalysis",
"settings": {

View file

@ -1,15 +1,13 @@
{
"comments": {
"lineComment": ";;",
"blockComment": [ "#|", "|#" ]
"lineComment": ";;",
"blockComment": ["#|", "|#"]
},
// symbols used as brackets
"brackets": [
["(", ")"]
],
"brackets": [["(", ")"]],
"surroundingPairs": [
["(", ")"],
["\"", "\""]
["(", ")"],
["\"", "\""]
],
"folding": {
"markers": {

View file

@ -1,25 +1,31 @@
{
"comments": {
"lineComment": ";;",
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
"blockComment": [ "#|", "|#" ]
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["(", ")"],
["\"", "\""],
],
// symbols that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
]
"comments": {
"lineComment": ";;",
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
"blockComment": ["#|", "|#"]
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["(", ")"],
["\"", "\""]
],
// symbols that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""]
],
"folding": {
"markers": {
"start": "\\(\\s*$",
"end": "^\\s*\\)"
}
}
}

View file

@ -1,32 +1,34 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "OpenGOAL-GOOS",
"patterns": [
{
"include": "#keywords"
},
{
"include": "#strings"
}
],
"repository": {
"keywords": {
"patterns": [{
"name": "keyword.control.opengoal-goos",
"match": "\\b(if|while|for|return)\\b"
}]
},
"strings": {
"name": "string.quoted.double.opengoal-goos",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.opengoal-goos",
"match": "\\\\."
}
]
}
},
"scopeName": "source.opengoal-goos"
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "OpenGOAL-GOOS",
"patterns": [
{
"include": "#keywords"
},
{
"include": "#strings"
}
],
"repository": {
"keywords": {
"patterns": [
{
"name": "keyword.control.opengoal-goos",
"match": "\\b(if|while|for|return)\\b"
}
]
},
"strings": {
"name": "string.quoted.double.opengoal-goos",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.opengoal-goos",
"match": "\\\\."
}
]
}
},
"scopeName": "source.opengoal-goos"
}

View file

@ -25,13 +25,11 @@
"goalCode": {
"patterns": [
{
"name": "meta.embedded.block.opengoal",
"begin": ";;-\\*-OpenGOAL-Start-\\*-",
"end": ";;-\\*-OpenGOAL-End-\\*-",
"patterns": [
{"include": "source.opengoal"}
]
}
"name": "meta.embedded.block.opengoal",
"begin": ";;-\\*-OpenGOAL-Start-\\*-",
"end": ";;-\\*-OpenGOAL-End-\\*-",
"patterns": [{ "include": "source.opengoal" }]
}
]
},
"errorsAndWarnings": {
@ -49,7 +47,6 @@
"match": "^.*INFO:.*"
}
]
},
"irSyntax": {
"patterns": [
@ -252,15 +249,15 @@
}
]
},
"comments": {
"patterns": [
{
"name": "comment.opengoal.ir",
"begin": "^(?!.*;; \\[)\\s*;(?:; \\[){0}",
"comments": {
"patterns": [
{
"name": "comment.opengoal.ir",
"begin": "^(?!.*;; \\[)\\s*;(?:; \\[){0}",
"end": "$"
}
]
},
}
]
},
"mnemonics": {
"patterns": [
{

View file

@ -1,109 +1,270 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"information_for_contributors": [
"Largely converted from - https://github.com/microsoft/vscode/blob/main/extensions/clojure/syntaxes/clojure.tmLanguage.json"
],
"name": "OpenGOAL",
"scopeName": "source.opengoal",
"patterns": [
{
"include": "#comments"
},
{
"include": "#readerMacros"
},
{
"include": "#functionsAndMacros"
},
{
"include": "#keywords"
"include": "#comment"
},
{
"include": "#strings"
"include": "#quoted-sexp"
},
{
"include": "#sexp"
},
{
"include": "#keyfn"
},
{
"include": "#string"
},
{
"include": "#regexp"
},
{
"include": "#var"
},
{
"include": "#constants"
},
{
"include": "#symbol"
},
{
"include": "#readerMacros"
}
],
"repository": {
"comments": {
"patterns": [
{
"name": "comment.opengoal",
"begin": ";+",
"end": "$"
},
{
"name": "comment.block.opengoal",
"begin": "#\\|",
"end": "\\|#"
}
]
},
"readerMacros": {
"patterns": [
{
"match": "(')(\\b|\\()",
"captures": {
"1": {
"name": "keyword.operator.quote.opengoal"
}
}
},
{
"match": "(`)(\\b|\\()",
"captures": {
"1": {
"name": "keyword.operator.quasiquote.opengoal"
}
}
},
{
"match": "(,)(\\b|\\()",
"captures": {
"1": {
"name": "keyword.operator.unquote.opengoal"
}
}
},
{
"match": "(,@)(\\b|\\()",
"captures": {
"1": {
"name": "keyword.operator.unquoteSplicing.opengoal"
}
}
}
]
},
"keywords": {
"comment": {
"patterns": [
{
"name": "keyword.opengoal",
"match": ":\\b\\w*"
"begin": ";",
"beginCaptures": {
"0": {
"name": "punctuation.definition.comment.opengoal"
}
},
"end": "$",
"name": "comment.line.semicolon.opengoal"
},
{
"begin": "#\\|",
"end": "\\|#",
"name": "comment.block.opengoal"
}
]
},
"functionsAndMacros": {
"patterns": [
{
"match": "\\(\\s*(\\:(?:bp|break|clear|cont|di|disasm|dump-all-mem|exit|pm|status|stop|sym-name|ubp)|\\.(?:abs|add|add\\.mul|blend|div|ftoi|isqrt|itof|max|min|mov|mul|nop|outer\\.product|outer\\.product\\.a|outer\\.product\\.b|sqrt|sub|wait|xor)\\.vf|\\.(?:add|add\\.mul|max|min|mul|sub\\.mul|sub)\\.[w-z]\\.vf|\\.(?:add|jr|load-sym|lvf|mov|nop|pand|pceqb|pceqh|pceqw|pceqw|pcgtb|pcgth|pcgtw|pcpyld|pcpyud|pextlb|pextlh|pextlw|pextub|pextuh|pextuw|pnor|pop|por|ppach|psubw|push|pw\\.sll|pw\\.sra|pw\\.srl|xor\\.p|ret|sub|svf)|(?:\\-|\\-\\>|\/|\\&\\+?|\\#cond|\\+|\\*|\\<\\=?|\\!?\\=|\\>\\=?)|(?:add-macro-to-autocomplete|and|asm-data-file|asm-file|asm-text-file|autocomplete|begin|block|build-dgos|car|cdr|cond|dbg|dbs|declare-file|declare-type|declare|defconstant|defenum|defglobalconstant|define-extern|define-state-hook|define-virtual-state-hook|define|defmethod|deftype|eq\\?|fmax|fmin|get-info|go-hook|goto|gs|imul64|in-package|inline|label|lambda|listen-to-target|load-project|local-vars|logand|logior|lognot|logxor|make|method-of-object|method-of-type|mlet|mod|neq\\?|new|none|nop!|not|or|print-debug-compiler-stats|print-type|psize-of|quote|reload|repl-help|reset-target|return-from|rlet|sar|set-config\\!|set\\!|seval|shl|shr|size-of|sqrtf-no-fabs|the-as|the|top-level|when-goto)|(?:defun|defmacro|defstep|defstate|let|let\\*|while))(?:\\s|\\))",
"captures": {
"1": {
"name": "entity.name.function.builtin"
}
}
}
]
},
"strings": {
"constants": {
"patterns": [
{
"name": "string.quoted.double.opengoal",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.opengoal",
"match": "\\\\."
}
]
"match": "(none|#f)(?=(\\s|\\)|\\]|\\}))",
"name": "constant.language.nil.opengoal"
},
{
"match": "(#t|#f)",
"name": "constant.language.boolean.opengoal"
},
{
"match": "([-+]?\\d+/\\d+)",
"name": "constant.numeric.ratio.opengoal"
},
{
"match": "([-+]?(?:(?:3[0-6])|(?:[12]\\d)|[2-9])[rR][0-9A-Za-z]+N?)",
"name": "constant.numeric.arbitrary-radix.opengoal"
},
{
"match": "([-+]?0[xX][0-9a-fA-F]+N?)",
"name": "constant.numeric.hexadecimal.opengoal"
},
{
"match": "([-+]?0[0-7]+N?)",
"name": "constant.numeric.octal.opengoal"
},
{
"match": "([-+]?[0-9]+(?:(\\.|(?=[eEM]))[0-9]*([eE][-+]?[0-9]+)?)M?)",
"name": "constant.numeric.double.opengoal"
},
{
"match": "([-+]?\\d+N?)",
"name": "constant.numeric.long.opengoal"
},
{
"include": "#keyword"
}
]
},
"keyword": {
"match": "(?<=(\\s|\\(|\\[|\\{)):[\\w\\#\\.\\-\\_\\:\\+\\=\\>\\<\\/\\!\\?\\*]+(?=(\\s|\\)|\\]|\\}|\\,))",
"name": "constant.keyword.opengoal"
},
"keyfn": {
"patterns": [
{
"match": "(?<=(\\s|\\(|\\[|\\{))(if(-[-\\p{Ll}\\?]*)?|when(-[-\\p{Ll}]*)?|unless(-[-\\p{Ll}]*)?|cond|do|let(-[-\\p{Ll}\\?]*)?|lambda|throw[\\p{Ll}\\-]*|([\\p{Ll}]*case))(?=(\\s|\\)|\\]|\\}))",
"name": "storage.control.opengoal"
},
{
"match": "(?<=(\\s|\\(|\\[|\\{))(declare-?|(in-)?ns|import|use|require|load|compile|(def[\\p{Ll}\\-]*))(?=(\\s|\\)|\\]|\\}))",
"name": "keyword.control.opengoal"
}
]
},
"quoted-sexp": {
"begin": "(['``]\\()",
"beginCaptures": {
"1": {
"name": "keyword.operator.opengoal punctuation.section.expression.begin.opengoal"
}
},
"end": "(\\))$|(\\)(?=[\\}\\]\\)\\s]*(?:;|$)))|(\\))",
"endCaptures": {
"1": {
"name": "punctuation.section.expression.end.trailing.opengoal"
},
"2": {
"name": "punctuation.section.expression.end.trailing.opengoal"
},
"3": {
"name": "punctuation.section.expression.end.opengoal"
}
},
"name": "meta.quoted-expression.opengoal",
"patterns": [
{
"include": "$self"
}
]
},
"regexp": {
"begin": "#\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.regexp.begin.opengoal"
}
},
"end": "\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.regexp.end.opengoal"
}
},
"name": "string.regexp.opengoal",
"patterns": [
{
"include": "#regexp_escaped_char"
}
]
},
"regexp_escaped_char": {
"match": "\\\\.",
"name": "constant.character.escape.opengoal"
},
"sexp": {
"begin": "(\\()",
"beginCaptures": {
"1": {
"name": "punctuation.section.expression.begin.opengoal"
}
},
"end": "(\\))$|(\\)(?=[\\}\\]\\)\\s]*(?:;|$)))|(\\))",
"endCaptures": {
"1": {
"name": "punctuation.section.expression.end.trailing.opengoal"
},
"2": {
"name": "punctuation.section.expression.end.trailing.opengoal"
},
"3": {
"name": "punctuation.section.expression.end.opengoal"
}
},
"name": "meta.expression.opengoal",
"patterns": [
{
"begin": "(?<=\\()(ns|declare|def[\\w\\d._:+=><!?*-]*|[\\w._:+=><!?*-][\\w\\d._:+=><!?*-]*/def[\\w\\d._:+=><!?*-]*)\\s+",
"beginCaptures": {
"1": {
"name": "keyword.control.opengoal"
}
},
"end": "(?=\\))",
"name": "meta.definition.global.opengoal",
"patterns": [
{
"match": "([\\p{L}\\.\\-\\_\\+\\=\\>\\<\\!\\?\\*][\\w\\.\\-\\_\\:\\+\\=\\>\\<\\!\\?\\*\\d]*)",
"name": "entity.global.opengoal"
},
{
"include": "$self"
}
]
},
{
"include": "#keyfn"
},
{
"include": "#constants"
},
{
"include": "#sexp"
},
{
"match": "(?<=\\()(.+?)(?=\\s|\\))",
"captures": {
"1": {
"name": "entity.name.function.opengoal"
}
},
"patterns": [
{
"include": "$self"
}
]
},
{
"include": "$self"
}
]
},
"string": {
"begin": "(?<!\\\\)(\")",
"beginCaptures": {
"1": {
"name": "punctuation.definition.string.begin.opengoal"
}
},
"end": "(\")",
"endCaptures": {
"1": {
"name": "punctuation.definition.string.end.opengoal"
}
},
"name": "string.quoted.double.opengoal",
"patterns": [
{
"match": "\\\\.",
"name": "constant.character.escape.opengoal"
}
]
},
"symbol": {
"patterns": [
{
"match": "([\\p{L}\\.\\-\\_\\+\\=\\>\\<\\!\\?\\*][\\w\\.\\-\\_\\:\\+\\=\\>\\<\\!\\?\\*\\d]*)",
"name": "meta.symbol.opengoal"
}
]
},
"var": {
"match": "(?<=(\\s|\\(|\\[|\\{)\\#)'[\\w\\.\\-\\_\\:\\+\\=\\>\\<\\/\\!\\?\\*]+(?=(\\s|\\)|\\]|\\}))",
"name": "meta.var.opengoal"
},
"readerMacros": {
"match": "('|,@|`|,)",
"name": "keyword.operator.opengoal"
}
},
"scopeName": "source.opengoal"
}
}

431
syntaxes/sample.json Normal file
View file

@ -0,0 +1,431 @@
{
"information_for_contributors": [
"This file has been converted from https://github.com/atom/language-clojure/blob/master/grammars/clojure.cson",
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
],
"version": "https://github.com/atom/language-clojure/commit/45bdb881501d0b8f8b707ca1d3fcc8b4b99fca03",
"name": "Clojure",
"scopeName": "source.clojure",
"patterns": [
{
"include": "#comment"
},
{
"include": "#shebang-comment"
},
{
"include": "#quoted-sexp"
},
{
"include": "#sexp"
},
{
"include": "#keyfn"
},
{
"include": "#string"
},
{
"include": "#vector"
},
{
"include": "#set"
},
{
"include": "#map"
},
{
"include": "#regexp"
},
{
"include": "#var"
},
{
"include": "#constants"
},
{
"include": "#dynamic-variables"
},
{
"include": "#metadata"
},
{
"include": "#namespace-symbol"
},
{
"include": "#symbol"
}
],
"repository": {
"comment": {
"begin": "(?<!\\\\);",
"beginCaptures": {
"0": {
"name": "punctuation.definition.comment.clojure"
}
},
"end": "$",
"name": "comment.line.semicolon.clojure"
},
"constants": {
"patterns": [
{
"match": "(nil)(?=(\\s|\\)|\\]|\\}))",
"name": "constant.language.nil.clojure"
},
{
"match": "(true|false)",
"name": "constant.language.boolean.clojure"
},
{
"match": "(##(?:Inf|-Inf|NaN))",
"name": "constant.numeric.symbol.clojure"
},
{
"match": "([-+]?\\d+/\\d+)",
"name": "constant.numeric.ratio.clojure"
},
{
"match": "([-+]?(?:(?:3[0-6])|(?:[12]\\d)|[2-9])[rR][0-9A-Za-z]+N?)",
"name": "constant.numeric.arbitrary-radix.clojure"
},
{
"match": "([-+]?0[xX][0-9a-fA-F]+N?)",
"name": "constant.numeric.hexadecimal.clojure"
},
{
"match": "([-+]?0[0-7]+N?)",
"name": "constant.numeric.octal.clojure"
},
{
"match": "([-+]?[0-9]+(?:(\\.|(?=[eEM]))[0-9]*([eE][-+]?[0-9]+)?)M?)",
"name": "constant.numeric.double.clojure"
},
{
"match": "([-+]?\\d+N?)",
"name": "constant.numeric.long.clojure"
},
{
"include": "#keyword"
}
]
},
"keyword": {
"match": "(?<=(\\s|\\(|\\[|\\{)):[\\w\\#\\.\\-\\_\\:\\+\\=\\>\\<\\/\\!\\?\\*]+(?=(\\s|\\)|\\]|\\}|\\,))",
"name": "constant.keyword.clojure"
},
"keyfn": {
"patterns": [
{
"match": "(?<=(\\s|\\(|\\[|\\{))(if(-[-\\p{Ll}\\?]*)?|when(-[-\\p{Ll}]*)?|for(-[-\\p{Ll}]*)?|cond|do|let(-[-\\p{Ll}\\?]*)?|binding|loop|recur|fn|throw[\\p{Ll}\\-]*|try|catch|finally|([\\p{Ll}]*case))(?=(\\s|\\)|\\]|\\}))",
"name": "storage.control.clojure"
},
{
"match": "(?<=(\\s|\\(|\\[|\\{))(declare-?|(in-)?ns|import|use|require|load|compile|(def[\\p{Ll}\\-]*))(?=(\\s|\\)|\\]|\\}))",
"name": "keyword.control.clojure"
}
]
},
"dynamic-variables": {
"match": "\\*[\\w\\.\\-\\_\\:\\+\\=\\>\\<\\!\\?\\d]+\\*",
"name": "meta.symbol.dynamic.clojure"
},
"map": {
"begin": "(\\{)",
"beginCaptures": {
"1": {
"name": "punctuation.section.map.begin.clojure"
}
},
"end": "(\\}(?=[\\}\\]\\)\\s]*(?:;|$)))|(\\})",
"endCaptures": {
"1": {
"name": "punctuation.section.map.end.trailing.clojure"
},
"2": {
"name": "punctuation.section.map.end.clojure"
}
},
"name": "meta.map.clojure",
"patterns": [
{
"include": "$self"
}
]
},
"metadata": {
"patterns": [
{
"begin": "(\\^\\{)",
"beginCaptures": {
"1": {
"name": "punctuation.section.metadata.map.begin.clojure"
}
},
"end": "(\\}(?=[\\}\\]\\)\\s]*(?:;|$)))|(\\})",
"endCaptures": {
"1": {
"name": "punctuation.section.metadata.map.end.trailing.clojure"
},
"2": {
"name": "punctuation.section.metadata.map.end.clojure"
}
},
"name": "meta.metadata.map.clojure",
"patterns": [
{
"include": "$self"
}
]
},
{
"begin": "(\\^)",
"end": "(\\s)",
"name": "meta.metadata.simple.clojure",
"patterns": [
{
"include": "#keyword"
},
{
"include": "$self"
}
]
}
]
},
"quoted-sexp": {
"begin": "(['``]\\()",
"beginCaptures": {
"1": {
"name": "punctuation.section.expression.begin.clojure"
}
},
"end": "(\\))$|(\\)(?=[\\}\\]\\)\\s]*(?:;|$)))|(\\))",
"endCaptures": {
"1": {
"name": "punctuation.section.expression.end.trailing.clojure"
},
"2": {
"name": "punctuation.section.expression.end.trailing.clojure"
},
"3": {
"name": "punctuation.section.expression.end.clojure"
}
},
"name": "meta.quoted-expression.clojure",
"patterns": [
{
"include": "$self"
}
]
},
"regexp": {
"begin": "#\"",
"beginCaptures": {
"0": {
"name": "punctuation.definition.regexp.begin.clojure"
}
},
"end": "\"",
"endCaptures": {
"0": {
"name": "punctuation.definition.regexp.end.clojure"
}
},
"name": "string.regexp.clojure",
"patterns": [
{
"include": "#regexp_escaped_char"
}
]
},
"regexp_escaped_char": {
"match": "\\\\.",
"name": "constant.character.escape.clojure"
},
"set": {
"begin": "(\\#\\{)",
"beginCaptures": {
"1": {
"name": "punctuation.section.set.begin.clojure"
}
},
"end": "(\\}(?=[\\}\\]\\)\\s]*(?:;|$)))|(\\})",
"endCaptures": {
"1": {
"name": "punctuation.section.set.end.trailing.clojure"
},
"2": {
"name": "punctuation.section.set.end.clojure"
}
},
"name": "meta.set.clojure",
"patterns": [
{
"include": "$self"
}
]
},
"sexp": {
"begin": "(\\()",
"beginCaptures": {
"1": {
"name": "punctuation.section.expression.begin.clojure"
}
},
"end": "(\\))$|(\\)(?=[\\}\\]\\)\\s]*(?:;|$)))|(\\))",
"endCaptures": {
"1": {
"name": "punctuation.section.expression.end.trailing.clojure"
},
"2": {
"name": "punctuation.section.expression.end.trailing.clojure"
},
"3": {
"name": "punctuation.section.expression.end.clojure"
}
},
"name": "meta.expression.clojure",
"patterns": [
{
"begin": "(?<=\\()(ns|declare|def[\\w\\d._:+=><!?*-]*|[\\w._:+=><!?*-][\\w\\d._:+=><!?*-]*/def[\\w\\d._:+=><!?*-]*)\\s+",
"beginCaptures": {
"1": {
"name": "keyword.control.clojure"
}
},
"end": "(?=\\))",
"name": "meta.definition.global.clojure",
"patterns": [
{
"include": "#metadata"
},
{
"include": "#dynamic-variables"
},
{
"match": "([\\p{L}\\.\\-\\_\\+\\=\\>\\<\\!\\?\\*][\\w\\.\\-\\_\\:\\+\\=\\>\\<\\!\\?\\*\\d]*)",
"name": "entity.global.clojure"
},
{
"include": "$self"
}
]
},
{
"include": "#keyfn"
},
{
"include": "#constants"
},
{
"include": "#vector"
},
{
"include": "#map"
},
{
"include": "#set"
},
{
"include": "#sexp"
},
{
"match": "(?<=\\()(.+?)(?=\\s|\\))",
"captures": {
"1": {
"name": "entity.name.function.clojure"
}
},
"patterns": [
{
"include": "$self"
}
]
},
{
"include": "$self"
}
]
},
"shebang-comment": {
"begin": "^(#!)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.comment.shebang.clojure"
}
},
"end": "$",
"name": "comment.line.shebang.clojure"
},
"string": {
"begin": "(?<!\\\\)(\")",
"beginCaptures": {
"1": {
"name": "punctuation.definition.string.begin.clojure"
}
},
"end": "(\")",
"endCaptures": {
"1": {
"name": "punctuation.definition.string.end.clojure"
}
},
"name": "string.quoted.double.clojure",
"patterns": [
{
"match": "\\\\.",
"name": "constant.character.escape.clojure"
}
]
},
"namespace-symbol": {
"patterns": [
{
"match": "([\\p{L}\\.\\-\\_\\+\\=\\>\\<\\!\\?\\*][\\w\\.\\-\\_\\:\\+\\=\\>\\<\\!\\?\\*\\d]*)/",
"captures": {
"1": {
"name": "meta.symbol.namespace.clojure"
}
}
}
]
},
"symbol": {
"patterns": [
{
"match": "([\\p{L}\\.\\-\\_\\+\\=\\>\\<\\!\\?\\*][\\w\\.\\-\\_\\:\\+\\=\\>\\<\\!\\?\\*\\d]*)",
"name": "meta.symbol.clojure"
}
]
},
"var": {
"match": "(?<=(\\s|\\(|\\[|\\{)\\#)'[\\w\\.\\-\\_\\:\\+\\=\\>\\<\\/\\!\\?\\*]+(?=(\\s|\\)|\\]|\\}))",
"name": "meta.var.clojure"
},
"vector": {
"begin": "(\\[)",
"beginCaptures": {
"1": {
"name": "punctuation.section.vector.begin.clojure"
}
},
"end": "(\\](?=[\\}\\]\\)\\s]*(?:;|$)))|(\\])",
"endCaptures": {
"1": {
"name": "punctuation.section.vector.end.trailing.clojure"
},
"2": {
"name": "punctuation.section.vector.end.clojure"
}
},
"name": "meta.vector.clojure",
"patterns": [
{
"include": "$self"
}
]
}
}
}

View file

@ -85,22 +85,13 @@ a block comment
(let* ((first-thing `(goal-src ,(string-append prefix (first sequence)) ,@deps))
(result (cons first-thing '()))
(iter result))
(let ((prev (first sequence))
(in-iter (rest sequence)))
(while (not (null? in-iter))
;; (fmt #t "{} dep on {}\n" (first in-iter) prev)
(let ((next (make-src-sequence-elt (first in-iter) prev prefix)))
(set-cdr! iter (cons next '()))
(set! iter (cdr iter))
)
(set! iter (cdr iter)))
(set! prev (car in-iter))
(set! in-iter (cdr in-iter))
)
)
`(begin ,@result)
)
)
(set! in-iter (cdr in-iter))))
`(begin ,@result)))

View file

@ -1,29 +0,0 @@
# Welcome to your VS Code Extension
## What's in the folder
* This folder contains all of the files necessary for your extension.
* `package.json` - this is the manifest file in which you declare your language support and define the location of the grammar file that has been copied into your extension.
* `syntaxes/opengoal.tmLanguage.json` - this is the Text mate grammar file that is used for tokenization.
* `language-configuration.json` - this is the language configuration, defining the tokens that are used for comments and brackets.
## Get up and running straight away
* Make sure the language configuration settings in `language-configuration.json` are accurate.
* Press `F5` to open a new window with your extension loaded.
* Create a new file with a file name suffix matching your language.
* Verify that syntax highlighting works and that the language configuration settings are working.
## Make changes
* You can relaunch the extension from the debug toolbar after making changes to the files listed above.
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
## Add more language features
* To add features such as intellisense, hovers and validators check out the VS Code extenders documentation at https://code.visualstudio.com/docs
## Install your extension
* To start using your extension with Visual Studio Code copy it into the `<user home>/.vscode/extensions` folder and restart Code.
* To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension.