Initial commit
This commit is contained in:
commit
f16b121c8d
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
* text=auto
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
*.vsix
|
17
.vscode/launch.json
vendored
Normal file
17
.vscode/launch.json
vendored
Normal 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
.vscodeignore
Normal file
4
.vscodeignore
Normal file
@ -0,0 +1,4 @@
|
||||
.vscode/**
|
||||
.vscode-test/**
|
||||
.gitignore
|
||||
vsc-extension-quickstart.md
|
3
README.md
Normal file
3
README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# VSCode Central(ASM)
|
||||
|
||||
This extension provides basic syntax highlighting for the Central(ASM) language.
|
70
examples/hello.s
Normal file
70
examples/hello.s
Normal file
@ -0,0 +1,70 @@
|
||||
@@ text.start
|
||||
.g hello
|
||||
//Set HELLO variable to 1234
|
||||
%% set var="HELLO",
|
||||
%- to=1234,
|
||||
%% set var="RC_SUCCESS",to=0
|
||||
mov r1, %(HELLO)
|
||||
ldr.eq r0, [r1]
|
||||
nop
|
||||
.l world
|
||||
//Include other file
|
||||
%% include member="myfile"
|
||||
//Use the alloc macro
|
||||
%* alloc size=r0, align=0x1000,
|
||||
%- out=r1,
|
||||
svc 0x7b
|
||||
|
||||
adr r2, .my_fd.def
|
||||
%* nextrec "OK",fd=r2,
|
||||
%- out=.my_fd.out.data
|
||||
%* endprocess rc=%(RC_SUCCESS)
|
||||
|
||||
@@ rodata
|
||||
.l value
|
||||
//Defaults to dd(2)
|
||||
dd 0x1234
|
||||
dd 0x01'1, 0x02'1, 0xFFEE'2
|
||||
.l value.other
|
||||
dd "Hello, world!\0"
|
||||
|
||||
//File descriptor
|
||||
@@ data
|
||||
.l my_fd.def
|
||||
%* filedesc ddname="HELLO",recfm="FB",lrecl=200
|
||||
|
||||
@@ bss
|
||||
.l my_fd.out
|
||||
//Array of 4 integers
|
||||
ds int(4)
|
||||
//Named array of characters with last label prepended. 200 bytes in length.
|
||||
.. data
|
||||
ds char(200)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
%% macro name="nextrec"
|
||||
%% param name="ok",type="(OK,KO)"
|
||||
%% kwparam name="fd",type="label|reg"
|
||||
%% kwparam name="out",type="label|reg"
|
||||
|
||||
%% if val="ok",neq="OK"
|
||||
%% abort msg="Error: param 'ok' of macro 'nextrec' must be OK"
|
||||
%% endif
|
||||
|
||||
//Handle fd
|
||||
%% if type="fd",is="label"
|
||||
add r0, pc, %(fd)
|
||||
%% elif val="fd",neq=r0
|
||||
mov r0, %(fd)
|
||||
%% endif
|
||||
|
||||
//Handle out
|
||||
%% if type="out",is="label"
|
||||
add r1, pc, %(out)
|
||||
%% elif val="fd",neq=r0
|
||||
mov r1, %(out)
|
||||
%% endif
|
||||
//Call the privileged service
|
||||
svc 0x10
|
||||
%% endmacro
|
||||
///////////////////////////////////////////////////////////////////////////////
|
67
language-configuration.json
Normal file
67
language-configuration.json
Normal file
@ -0,0 +1,67 @@
|
||||
{
|
||||
"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": [
|
||||
[
|
||||
"{",
|
||||
"}"
|
||||
],
|
||||
[
|
||||
"[",
|
||||
"]"
|
||||
],
|
||||
[
|
||||
"(",
|
||||
")"
|
||||
],
|
||||
[
|
||||
"\"",
|
||||
"\""
|
||||
],
|
||||
[
|
||||
"'",
|
||||
"'"
|
||||
]
|
||||
]
|
||||
}
|
49
package.json
Normal file
49
package.json
Normal file
@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "central-asm",
|
||||
"displayName": "Central(ASM)",
|
||||
"description": "Syntax highlighting for Central(ASM)",
|
||||
"version": "1.0.0",
|
||||
"engines": {
|
||||
"vscode": "^1.95.0"
|
||||
},
|
||||
"categories": [
|
||||
"Programming Languages"
|
||||
],
|
||||
"contributes": {
|
||||
"languages": [
|
||||
{
|
||||
"id": "central-asm",
|
||||
"aliases": [
|
||||
"Central(ASM)",
|
||||
"central-asm"
|
||||
],
|
||||
"extensions": [
|
||||
".s",
|
||||
".S",
|
||||
".m",
|
||||
".M"
|
||||
],
|
||||
"configuration": "./language-configuration.json"
|
||||
}
|
||||
],
|
||||
"grammars": [
|
||||
{
|
||||
"language": "central-asm",
|
||||
"scopeName": "source.central-asm",
|
||||
"path": "./syntaxes/central-asm.tmLanguage.json"
|
||||
}
|
||||
],
|
||||
"configurationDefaults": {
|
||||
"[central-asm]": {
|
||||
"editor.guides.indentation": false,
|
||||
"editor.detectIndentation": false,
|
||||
"editor.insertSpaces": true,
|
||||
"editor.rulers": [
|
||||
2,
|
||||
4,
|
||||
120
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
212
syntaxes/central-asm.tmLanguage.json
Normal file
212
syntaxes/central-asm.tmLanguage.json
Normal file
@ -0,0 +1,212 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
||||
"name": "Central(ASM)",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#strings"
|
||||
},
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#sections"
|
||||
},
|
||||
{
|
||||
"include": "#labels"
|
||||
},
|
||||
{
|
||||
"include": "#numerics"
|
||||
},
|
||||
{
|
||||
"include": "#registers"
|
||||
},
|
||||
{
|
||||
"include": "#preprocessor-lines"
|
||||
},
|
||||
{
|
||||
"include": "#preprocessor-variables"
|
||||
},
|
||||
{
|
||||
"include": "#assembly"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"strings": {
|
||||
"name": "string.quoted.double.central-asm",
|
||||
"begin": "\"",
|
||||
"end": "\"",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.character.escape.central-asm",
|
||||
"match": "\\\\."
|
||||
}
|
||||
]
|
||||
},
|
||||
"comments": {
|
||||
"name": "comment.line.double-slash",
|
||||
"match": "^.{2}//.*$"
|
||||
},
|
||||
"sections": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "storage.section.named.central-asm",
|
||||
"match": "^@{2}\\s{2,}[a-zA-Z][a-zA-Z0-9]*(\\.[a-zA-Z][a-zA-Z0-9]*)+\\s*$"
|
||||
},
|
||||
{
|
||||
"name": "storage.section.auto-named.central-asm",
|
||||
"match": "^@{2}\\s{2,}([a-zA-Z][a-zA-Z0-9]*)\\s*$",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "emphasis"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"labels": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "entity.name.function.label.local.central-asm",
|
||||
"match": "^\\.l\\s{2,}([a-zA-Z_][a-zA-Z_0-9]*(\\.[a-zA-Z_][a-zA-Z_0-9]*)*)\\s*$",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "emphasis"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "entity.name.function.label.local.prepend-last.central-asm",
|
||||
"match": "^\\.{2}\\s{2,}([a-zA-Z_][a-zA-Z_0-9]*(\\.[a-zA-Z_][a-zA-Z_0-9]*)*)\\s*$",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "emphasis"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "entity.name.function.label.global.central-asm",
|
||||
"match": "^\\.g\\s{2,}([a-zA-Z_][a-zA-Z_0-9]*(\\.[a-zA-Z_][a-zA-Z_0-9]*)*)\\s*$",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "strong"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "entity.name.function.label.ref.relative.central-asm",
|
||||
"match": "\\.[a-zA-Z_][a-zA-Z_0-9]*(\\.[a-zA-Z_][a-zA-Z_0-9]*)*"
|
||||
},
|
||||
{
|
||||
"name": "entity.name.function.label.ref.absolute.central-asm",
|
||||
"match": "&[a-zA-Z_][a-zA-Z_0-9]*(\\.[a-zA-Z_][a-zA-Z_0-9]*)*"
|
||||
}
|
||||
]
|
||||
},
|
||||
"numerics": {
|
||||
"match": "((0x[0-9a-fA-F]+(_[0-9a-fA-F]+)*)|([0-9]+(_[0-9]+)*))('[0-9]+)?",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "constant.numeric.central-asm"
|
||||
},
|
||||
"6": {
|
||||
"name": "storage.modifier.width.central-asm"
|
||||
}
|
||||
}
|
||||
},
|
||||
"registers": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "variable.other.central-asm",
|
||||
"match": "\\b((r[0-9]+)|lr|pc|sp|pc_user|sp_user|pc_svc|sp_svc|pc_fault|sp_fault)\\b"
|
||||
},
|
||||
{
|
||||
"name": "variable.other.central-asm",
|
||||
"match": "(ss[0-9]+)|(sr[0-9]+)"
|
||||
}
|
||||
]
|
||||
},
|
||||
"preprocessor-lines": {
|
||||
"patterns": [
|
||||
{
|
||||
"name": "meta.preprocessor.line.central-asm",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "meta.preprocessor.directive.central-asm",
|
||||
"match": "^%%\\s{2,}([a-zA-Z_][a-zA-Z_0-9]*)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "emphasis"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "meta.preprocessor.macro-call.central-asm",
|
||||
"match": "^%\\*\\s{2,}([a-zA-Z_][a-zA-Z_0-9]*)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "strong"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "meta.preprocessor.continuation.central-asm",
|
||||
"match": "^%-"
|
||||
},
|
||||
{
|
||||
"include": "#preprocessor-key-value-args"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"preprocessor-key-value-args": {
|
||||
"name": "meta.preprocessor.arg-key.central-asm",
|
||||
"match": "\\b([a-zA-Z_][a-zA-Z_0-9]*)=",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "variable.parameter.central-asm"
|
||||
}
|
||||
}
|
||||
},
|
||||
"preprocessor-variables": {
|
||||
"name": "meta.preprocessor.variable-substitution.central-asm",
|
||||
"match": "%\\(([a-zA-Z_][a-zA-Z_0-9]*)\\)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "variable.name.central-asm"
|
||||
}
|
||||
}
|
||||
},
|
||||
"assembly": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "^\\s{4,}(nop|svc|ldr|str|add|adr|mov|movn|b|bx|ssr|ssw)(\\.(al|eq|neq|uge|cs|ult|cc|neg|pos|vs|vc|ugt|ule|sge|slt|sgt|sle))?\\b",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "keyword.control.instructions.central-asm"
|
||||
},
|
||||
"2": {
|
||||
"name": "keyword.other.conditions.central-asm"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "keyword.other.data-definition.central-asm",
|
||||
"match": "^dd\\s{2,}"
|
||||
},
|
||||
{
|
||||
"match": "^(ds)\\s{2,}(int|short|char|ptr)",
|
||||
"captures": {
|
||||
"1": {
|
||||
"name": "keyword.other.data-space.central-asm"
|
||||
},
|
||||
"2": {
|
||||
"name": "entity.name.type.data-space.central-asm"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"scopeName": "source.central-asm"
|
||||
}
|
Loading…
Reference in New Issue
Block a user