Skip to content

Commit

Permalink
Merge pull request #5 from Toeffe3/support-more-variation
Browse files Browse the repository at this point in the history
Support more variation
  • Loading branch information
Victor Vejlgaard Schelde Jacobsen authored Oct 6, 2021
2 parents c9aa97d + 117ae27 commit e38ac8d
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 57 deletions.
16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"name": "asm-syntaxhighlight",
"version": "0.2.2",
"version": "0.2.3",
"preview": true,
"publisher": "Toeffe3",
"homepage": "https://github.com/Toeffe3/vscode-asm-syntaxhighlight",
"repository": { "url": "https://github.com/Toeffe3/vscode-vasm-oldstyle" },
"displayName": "Assembler code syntax and highlight",
"description": "Supports VASM oldstyle, 6502 architecture",
"engines": {
"vscode": "^1.60.0"
},
"displayName": "Assembler code syntax and highlight",
"description": "Supports VASM oldstyle, 6502 architecture",
"categories": [
"Programming Languages",
"Themes"
Expand All @@ -33,13 +35,17 @@
}],
"grammars": [{
"language": "asm",
"scopeName": "text.vasm.oldstyle.asm",
"scopeName": "source.asm",
"path": "./syntaxes/asm.tmLanguage.json"
}],
"themes": [{
"label": "VASM (oldstyle)",
"uiTheme": "vs-dark",
"path": "./themes/asm-color-theme.json"
}],
"configuration": [{
"properties": {

}
}]
}
}
71 changes: 40 additions & 31 deletions syntaxes/asm.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"scopeName": "text.vasm.oldstyle.asm",
"scopeName": "source.asm",
"foldingStartMarker": "^.+\\:$",
"foldingStopMarker": "^!( |\\\t)$",
"patterns": [
Expand All @@ -10,39 +10,51 @@
{ "include": "#directive" },
{ "include": "#expression" },
{ "include": "#userdefined" },
{ "include": "#constant" }
{ "include": "#constant" },
{ "include": "#address" }
],
"repository": {

"comment": {
"name": "comment.line",
"name": "comment.line.semi-colon",
"match": "\\s*;.*$"
},

"label": {
"match": "(?:^([a-z_]+):)|(?:^([a-z_]+) (macro)([^;]+)*)",
"match": "(?:^([0-9a-z_]+):)|(?:^([0-9a-z_]+) (macro)([^;]+)*)",
"captures": {
"1": {
"name": "reference.label.asm"
"name": "meta.label"
},
"2": {
"name": "reference.macro.asm"
"name": "meta.constant"
},
"3": {
"name": "directives.asm"
"name": "meta.preprocessor"
},
"4": {
"name": "variable.pp"
"name": "meta.parameter.type.variable"
}
}
},

"constant": {
"name": "definition",
"match": "^([A-Z_]+) *=([^;]+)",
"match": "^([0-9A-Z_]+)\\s*=([^;]+)",
"captures": {
"1": {
"name": "reference.constant.asm"
"name": "constant.asm"
},
"2": {
"patterns": [ { "include": "#parameters" } ]
}
}
},

"address": {
"match": "^([0-9a-z_]+)\\s*=([^;]+)",
"captures": {
"1": {
"name": "address.asm"
},
"2": {
"patterns": [ { "include": "#parameters" } ]
Expand All @@ -59,11 +71,8 @@
},

"values": {
"match": "(#)([^;]*)|([^#;]+)",
"match": "(#)([^;]*)|([^#][^;]+)",
"captures": {
"1" : {
"name": "immediate.asm"
},
"2": {
"name": "immediate.asm",
"patterns": [ { "include": "#values" } ]
Expand All @@ -75,43 +84,43 @@
"match": "[\\/0-9A-z_\\-]+(\\.[0-9A-z]+|\\/)"
},
{
"name": "variable.pp",
"name": "meta.parameter.type.variable",
"match": "\\\\[0-9A-z_]+"
},
{
"name": "constant.numeric.hex",
"match": "#?(\\$|0x)[0-9A-Fa-f]+"
"match": "(\\$|0x)[0-9A-Fa-f]+"
},
{
"name": "constant.numeric.octal",
"match": "#?(0o)[0-8]+"
"match": "(0o)[0-8]+"
},
{
"name": "constant.numeric.binary",
"match": "#?(%|0b)[01]+"
"match": "(%|0b)[01]+"
},
{
"name": "constant.numeric.decimal",
"match": "#?(\\d)+"
"match": "(?!\\w)(\\d)+"
},
{
"name": "string.quoted",
"match": "\".*?\""
"name": "entity.name.section",
"match": "[0-9A-z_\\-]"
},
{
"name": "address.asm",
"match": "(#?)[0-9A-z_\\-]"
"name": "string.quoted",
"match": "\".*?\""
}
]
}
}
},

"directive": {
"match": "(?:^ | )\\.?(2byte|4byte|8byte|asciiz|ascii|align|balignl|balignw|balign|byte|comm|double|endmacro|endm|endr|equ|equiv|err|extern|fail|file|float|global|half|ifeq|ifne|ifgt|ifge|iflt|ifle|ifb|ifnb|ifdef|ifndef|if|incbin|incdir|include|int|irpc|irp|lcomm|list|local|long|macro|nolist|org|p2alignw|p2align|popsection|pushsection|quad|rept|section|set|size|short|single|skip|space|stabs|stabn|stabd|string|swbeg|type|uahalf|ualong|uaquad|uasort|uaword|weak|word|zero)([^;]*)",
"match": "(?:^ | |\\t)\\.?(2byte|4byte|8byte|asciiz|ascii|align|balignl|balignw|balign|byte|comm|double|endmacro|endm|endr|equ|equiv|err|extern|fail|file|float|global|half|ifeq|ifne|ifgt|ifge|iflt|ifle|ifb|ifnb|ifdef|ifndef|if|incbin|incdir|include|int|irpc|irp|lcomm|list|local|long|macro|nolist|org|p2alignw|p2align|popsection|pushsection|quad|rept|section|set|size|short|single|skip|space|stabs|stabn|stabd|string|swbeg|type|uahalf|ualong|uaquad|uasort|uaword|weak|word|zero)([^;]*)",
"captures": {
"1": {
"name": "directives.asm"
"name": "meta.preprocessor"
},
"2": {
"patterns": [
Expand All @@ -122,16 +131,16 @@
},

"sections": {
"name": "storage",
"name": "meta.storage.label",
"match": "^\\.?(bss|data|rodata|sbss|sdata|sdata2|stab|stabstr|text|tocd|dpage)([^;]*)",
"captures": {}
},

"expression": {
"match": "(?:^ | )(adc|and|asl|bbr0|bbr1|bbr2|bbr3|bbr4|bbr5|bbr6|bbr7|bbs0|bbs1|bbs2|bbs3|bbs4|bbs5|bbs6|bbs7|bcc|bcs|beq|bit|bmi|bne|bpl|bra|brk|bvc|bvs|clc|cld|cli|clv|cmp|cpx|cpy|dec|dex|dey|eor|inc|inx|iny|jmp|jsr|lda|ldx|ldy|lsr|nop|ora|pha|php|phx|phy|pla|plp|plx|ply|rmb0|rmb1|rmb2|rmb3|rmb4|rmb5|rmb6|rmb7|rol|ror|rti|rts|sbc|sec|sed|sei|smb0|smb1|smb2|smb3|smb4|smb5|smb6|smb7|sta|stp|stx|sty|stz|tax|tay|trb|tsb|tsx|txa|txs|tya|wai)([^;]*)",
"match": "(?:^ | |\\t)(adc|and|asl|bbr0|bbr1|bbr2|bbr3|bbr4|bbr5|bbr6|bbr7|bbs0|bbs1|bbs2|bbs3|bbs4|bbs5|bbs6|bbs7|bcc|bcs|beq|bit|bmi|bne|bpl|bra|brk|bvc|bvs|clc|cld|cli|clv|cmp|cpx|cpy|dec|dex|dey|eor|inc|inx|iny|jmp|jsr|lda|ldx|ldy|lsr|nop|ora|pha|php|phx|phy|pla|plp|plx|ply|rmb0|rmb1|rmb2|rmb3|rmb4|rmb5|rmb6|rmb7|rol|ror|rti|rts|sbc|sec|sed|sei|smb0|smb1|smb2|smb3|smb4|smb5|smb6|smb7|sta|stp|stx|sty|stz|tax|tay|trb|tsb|tsx|txa|txs|tya|wai)([^;]*)",
"captures": {
"1": {
"name": "instructionname.asm"
"name": "support.function"
},
"2": {
"patterns": [
Expand All @@ -142,10 +151,10 @@
},

"userdefined": {
"match": "^ (\\S+)( [^;]*)?",
"match": "(?:^ |^\\t)(\\S+)( [^;]*)?",
"captures": {
"1": {
"name": "userdefined.asm"
"name": "meta.tag"
},
"2": {
"patterns": [
Expand Down
34 changes: 13 additions & 21 deletions themes/asm-color-theme.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
{
"semanticHighlighting": true,
"semanticTokenColors": {},
"name": "VASM (oldstyle)",
"type": "dark",
"colors": {
"editor.background": "#263238",
"editor.foreground": "#eeffff",
"activityBarBadge.background": "#007acc",
"sideBarTitle.foreground": "#bbbbbb"
},
"name": "Assembler",
"tokenColors": [
{
"name": "Comment",
"scope": [
"comment",
"punctuation.definition.comment"
"comment.line.semi-colon"
],
"settings": {
"fontStyle": "italic",
Expand Down Expand Up @@ -46,7 +36,7 @@
{
"name": "Address",
"scope": [
"address.asm",
"entity.name.section"
],
"settings": {
"foreground": "#ffae00",
Expand All @@ -56,7 +46,7 @@
{
"name": "Instruction",
"scope": [
"instructionname.asm",
"support.function"
],
"settings": {
"foreground": "#cc00ff",
Expand All @@ -66,7 +56,7 @@
{
"name": "Userdefined",
"scope": [
"userdefined.asm",
"meta.tag",
],
"settings": {
"foreground": "#ff00dd",
Expand All @@ -76,7 +66,7 @@
{
"name": "Directives",
"scope": [
"directives.asm"
"meta.preprocessor"
],
"settings": {
"foreground": "#7dffa8",
Expand All @@ -86,7 +76,7 @@
{
"name": "VariablePreProcessor",
"scope": [
"variable.pp"
"meta.parameter.type.variable"
],
"settings": {
"foreground": "#89fad8",
Expand All @@ -95,8 +85,8 @@
{
"name": "Label",
"scope": [
"reference.label.asm",
"storage"
"meta.label",
"meta.storage.label"
],
"settings": {
"foreground": "#4ac6ff",
Expand All @@ -106,8 +96,10 @@
{
"name": "Definitions",
"scope": [
"reference.constant.asm",
"reference.macro.asm"
"constant",
"constant.asm",
"address.asm",
"meta.constant"
],
"settings": {
"foreground": "#4ac6ff"
Expand Down

0 comments on commit e38ac8d

Please sign in to comment.