start adding colours

This commit is contained in:
William Bell committed 2023-08-06 13:36:49 +01:00
1 parent cb70baa629
commit 4172148ca7
10 files changed
+278 -2

No files matched your search

+1
View File
@@ -0,0 +1 @@
*.vsix
+17
View File
@@ -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
View File
@@ -0,0 +1,4 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md
+9
View File
@@ -0,0 +1,9 @@
# Change Log
All notable changes to the "argon" 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
+3 -2
View File
@@ -1,2 +1,3 @@
# argon vsc syntax highlighting # Argon Syntax Highlighting for VS Code
This extension adds syntax highlighting for the Argon Programming Language to VS Code.
+33
View File
@@ -0,0 +1,33 @@
{
"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 can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
"indentationRules": {
// increase when do is at the end of the line, and only the word do
"increaseIndentPattern": "^.*\\b(do)\\b\\s*$",
"decreaseIndentPattern": "^\\s*\\b(else)\\b\\s*$"
}
}
+29
View File
@@ -0,0 +1,29 @@
{
"name": "argon",
"displayName": "Argon",
"description": "",
"version": "1.0.0",
"publisher": "Ugric",
"engines": {
"vscode": "^1.81.0"
},
"categories": [
"Programming Languages"
],
"repository": {
},
"contributes": {
"languages": [{
"id": "argon",
"aliases": ["Argon", "argon"],
"extensions": [".ar"],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "argon",
"scopeName": "source.ar",
"path": "./syntaxes/argon.tmLanguage.json"
}]
}
}
+126
View File
@@ -0,0 +1,126 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Argon",
"patterns": [
{
"include": "#keywords"
},
{
"include": "#strings"
},
{
"include": "#comments"
},
{
"include": "#numbers"
},
{
"include": "#variables"
}
],
"repository": {
"keywords": {
"patterns": [
{
"name": "keyword.control.argon",
"match": "\\b(if|while|for|return|do|else|continue|break|to|from|import|as)\\b"
},
{
"name": "keyword.operator.argon",
"match": "\\b((\\+|\\-|\\*|\\/|\\%|\\^|\\=|\\<|\\>)+)\\b"
},
{
"name": "keyword.operator.argon",
"match": "\\b(\\&\\&|\\|\\||\\:|\\,|\\!|\\.)\\b"
},
{
"name": "constant.character.argon",
"match": "\\b(true|false|null)\\b"
},
{
"name": "keyword.declaration.argon",
"match": "\\b(let)\\b"
}
]
},
"strings": {
"patterns": [
{
"name": "string.quoted.double.argon",
"begin": "\"",
"end": "\"",
"patterns": [
{
"name": "constant.character.escape.argon",
"match": "\\\\([^'])"
},
{
"name": "invalid.illegal",
"match": "\\\\."
},
{
"name": "keyword.operator.argon",
"match": "\""
}
]
},
{
"name": "string.quoted.single.argon",
"begin": "'",
"end": "'",
"patterns": [
{
"name": "constant.character.escape.argon",
"match": "\\\\([^\"])"
},
{
"name": "invalid.illegal",
"match": "\\\\."
},
{
"name": "keyword.operator.argon",
"match": "'"
}
]
}
]
},
"comments": {
"name": "comment.line",
"match": "#.*$"
},
"numbers": {
"patterns": [
{
"name": "constant.numeric.argon",
"match": "\\b((((([0-9]+(\\.[0-9]+)?)|(\\.[0-9]+))(e((\\-|\\+)?([0-9]+(\\.[0-9]+)?)))?)|([0-9]+/[0-9]+)))\\b"
},
{
"name": "constant.numeric.argon",
"match": "\\b((0b[10]+(.\\[10]+)?(e((\\-|\\+)?([0-9]+(\\.[0-9]+)?)))?))\\b"
},
{
"name": "constant.numeric.argon",
"match": "\\b((0x[a-fA-F0-9]+(\\.[a-fA-F0-9]+)?))\\b"
},
{
"name": "constant.numeric.argon",
"match": "\\b((0o[0-7]+(\\.[0-7]+)?(e((\\-|\\+)?([0-9]+(\\.[0-9]+)?)))?))\\b"
}
]
},
"variables": {
"patterns": [
{
"name": "entity.name.function",
"match": "\\b(([a-zA-Z_]|(\\p{L}\\p{M}*))([a-zA-Z0-9_]|(\\p{L}\\p{M}*))*)\\b\\("
},
{
"name": "variable.name",
"match": "\\b(([a-zA-Z_]|(\\p{L}\\p{M}*))([a-zA-Z0-9_]|(\\p{L}\\p{M}*))*)\\b"
}
]
}
},
"scopeName": "source.ar"
}
+27
View File
@@ -0,0 +1,27 @@
let read(path) = do
f = file.read(path)
text = f.text()
data = []
splitlines = text.split("\n")
for (i from 0 to splitlines.length) do
values = []
in_quotes = false
start = 0
line = splitlines[i]
for (j from 0 to line.length) do
char = line[j]
if (char == "," && not in_quotes) do
value = line[start:j].rightstrip("\r").strip()
if (value && value[0] == "\"" && value[-1] == "\"") value = value[1:value.length - 1]
value = value.replace("\"\"", "\"")
values.append(value)
start = j + 1
else if (char == "\"") in_quotes = not in_quotes
if (j == line.length - 1) do
value = line[start:j + 1].rightstrip("\r").strip()
if (value && value[0] == "\"" && value[-1] == "\"") value = value[1:value.length - 1]
value = value.replace("\"\"", "\"")
values.append(value)
data.append(values)
return data
+29
View File
@@ -0,0 +1,29 @@
# 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/argon.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.