Skip to content

Commit

Permalink
Add VS Code syntax highlighter
Browse files Browse the repository at this point in the history
  • Loading branch information
acook committed Mar 10, 2024
1 parent dbb3ebb commit 80377a1
Show file tree
Hide file tree
Showing 9 changed files with 5,868 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Set default behavior to automatically normalize line endings.
* text=auto
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ TAGS
.DS_Store
examples/_output.txt
blacklight.exe
ext
node_modules
*.vsix
17 changes: 17 additions & 0 deletions tools/syntax-vs-code/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// 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",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
}
]
}
4 changes: 4 additions & 0 deletions tools/syntax-vs-code/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md
3 changes: 3 additions & 0 deletions tools/syntax-vs-code/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# blacklight Language Support

Add syntax hilighting for `blacklight`.
28 changes: 28 additions & 0 deletions tools/syntax-vs-code/language-configuration.json
Original file line number Diff line number Diff line change
@@ -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": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
{ "open": "'", "close": "'", "notIn": ["string", "comment"] },
],
// symbols that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
]
}
30 changes: 30 additions & 0 deletions tools/syntax-vs-code/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "blacklight-language-support",
"displayName": "blacklight Language Support",
"description": "Add syntax highlighting for the blacklight programming language.",
"version": "0.0.1",
"engines": {
"vscode": "^1.87.0"
},
"categories": [
"Programming Languages"
],
"contributes": {
"languages": [{
"id": "bl",
"aliases": ["blacklight", "bl"],
"extensions": [".bl"],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "bl",
"scopeName": "source.blacklight",
"path": "./syntaxes/bl.tmLanguage.json"
}]
},
"devDependencies": {
"generator-code": "^1.8.4",
"vsce": "^2.15.0",
"yo": "^5.0.0"
}
}
97 changes: 97 additions & 0 deletions tools/syntax-vs-code/syntaxes/bl.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "blacklight",
"patterns": [
{
"include": "#keywords"
},
{
"include": "#strings"
},
{
"include": "#comments"
},
{
"include": "#numerics"
},
{
"include": "#variables"
},
{
"include": "#entities"
}
],
"repository": {
"comments": {
"patterns": [
{
"name": "comment.line.semicolons.bl",
"begin": ";;",
"end": "\\n"
}
]
},
"keywords": {
"patterns": [
{
"name": "keyword.control.bl",
"match": "\\s?(if|either|while|until|loop)\\s"
},
{
"name": "keyword.operator.bl",
"match": "\\s?(eq|or|and|is|not|add|sub|div|mul)\\s"
},
{
"name": "keyword.other",
"match": "\\s?(swap|drop|rot|decap|depth|dup|over|purge)\\s"
}

]
},
"strings": {
"name": "string.quoted.single.bl",
"begin": "'",
"end": "'",
"patterns": [
{
"name": "constant.character.escape.bl",
"match": "\\\\."
}
]
},
"variables": {
"patterns": [
{
"name": "variable.language.bl",
"match": "self|@|\\$|\\^"
},
{
"name": "variable.name.bl",
"match": ":[a-zA-Z_]+"
},
{
"name": "entity.name.function.bl",
"match": "[a-zA-Z_]+:"
}
]
},
"entity": {
"patterns": [
{
"name": "constant.numeric.dec.bl",
"match": "([+-]?[0-9]+)"
}
]
},
"types": {
"patterns": [
{
"name": "storage.type.other.bl",
"match": "[a-zA-Z_]-new"
}
]
}
},
"scopeName": "source.blacklight",
"fileTypes": ["bl"]
}
Loading

0 comments on commit 80377a1

Please sign in to comment.