Skip to content

Commit

Permalink
Fix highlighting for registers
Browse files Browse the repository at this point in the history
  • Loading branch information
FreeFlyingSheep committed Dec 2, 2021
1 parent 978423e commit 740f5c2
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 30 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
### Changed

- Change the minimum version of VS Code API that the extension depends on.

## [1.1.4] - 2021-12-02

### Changed

- Fix highlighting for words like `kernelsp`.
- Remove highlighting for registers not beginning with `$`.
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,10 @@ An extension that provides language support for LoongArch assembly language.

## Features

Provide syntax highlighting for LoongArch assembly language.
* Provide syntax highlighting for LoongArch assembly language.
* Provide support for comment shortcuts.

Screenshot:

* Color theme: Dark+
![dark](images/dark.png)

* Color theme: Light+
![light](images/light.png)

## Requirements
## Developing

```bash
# Install js-yaml as a development only dependency in your extension
Expand Down Expand Up @@ -62,6 +55,12 @@ Fix highlighting for comments like `// xxx: xxx`.

Change the minimum version of VS Code API that the extension depends on.

### 1.1.4

Fix highlighting for words like `kernelsp`.

Remove highlighting for registers not beginning with `$`.

## Reference

* [Vscode Language Extensions, Syntax Highlight Guide](https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide)
Expand All @@ -70,4 +69,3 @@ Change the minimum version of VS Code API that the extension depends on.
* [LoongArch Opcodes](https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=opcodes/loongarch-opc.c)
* [Assembler Directives](https://sourceware.org/binutils/docs/as/Pseudo-Ops.html#Pseudo-Ops)
* [Directives](https://gcc.gnu.org/onlinedocs/cpp/Index-of-Directives.html#Index-of-Directives_fn_symbol-1)
* [Test File](https://github.com/loongson/linux/blob/loongarch-next/arch/loongarch/kernel/head.S)
Binary file removed images/dark.png
Binary file not shown.
Binary file removed images/light.png
Binary file not shown.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "loongarch-assembly",
"displayName": "LoongArch Assembly",
"description": "Provides language support for LoongArch assembly language.",
"version": "1.1.3",
"version": "1.1.4",
"publisher": "FreeFlyingSheep",
"license": "MIT",
"repository": {
Expand Down
16 changes: 8 additions & 8 deletions syntaxes/loongarch.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,35 +160,35 @@
]
},
"r_normal_registers": {
"match": "\\$(r9|r8|r7|r6|r5|r4|r31|r30|r3|r29|r28|r27|r26|r25|r24|r23|r22|r21|r20|r2|r19|r18|r17|r16|r15|r14|r13|r12|r11|r10|r1|r0)\\b",
"match": "\\B\\$(r9|r8|r7|r6|r5|r4|r31|r30|r3|r29|r28|r27|r26|r25|r24|r23|r22|r21|r20|r2|r19|r18|r17|r16|r15|r14|r13|r12|r11|r10|r1|r0)\\b",
"name": "storage.loongarch"
},
"r_lp64_registers": {
"match": "\\$?(zero|x|v1|v0|tp|t8|t7|t6|t5|t4|t3|t2|t1|t0|sp|s8|s7|s6|s5|s4|s3|s2|s1|s0|ra|fp|a7|a6|a5|a4|a3|a2|a1|a0)\\b",
"match": "\\B\\$(zero|x|v1|v0|tp|t8|t7|t6|t5|t4|t3|t2|t1|t0|sp|s8|s7|s6|s5|s4|s3|s2|s1|s0|ra|fp|a7|a6|a5|a4|a3|a2|a1|a0)\\b",
"name": "storage.loongarch"
},
"f_normal_registers": {
"match": "\\$(f9|f8|f7|f6|f5|f4|f31|f30|f3|f29|f28|f27|f26|f25|f24|f23|f22|f21|f20|f2|f19|f18|f17|f16|f15|f14|f13|f12|f11|f10|f1|f0)\\b",
"match": "\\B\\$(f9|f8|f7|f6|f5|f4|f31|f30|f3|f29|f28|f27|f26|f25|f24|f23|f22|f21|f20|f2|f19|f18|f17|f16|f15|f14|f13|f12|f11|f10|f1|f0)\\b",
"name": "storage.loongarch"
},
"f_lp64_registers": {
"match": "\\$?(fv1|fv0|ft9|ft8|ft7|ft6|ft5|ft4|ft3|ft2|ft15|ft14|ft13|ft12|ft11|ft10|ft1|ft0|fs7|fs6|fs5|fs4|fs3|fs2|fs1|fs0|fa7|fa6|fa5|fa4|fa3|fa2|fa1|fa0)\\b",
"match": "\\B\\$(fv1|fv0|ft9|ft8|ft7|ft6|ft5|ft4|ft3|ft2|ft15|ft14|ft13|ft12|ft11|ft10|ft1|ft0|fs7|fs6|fs5|fs4|fs3|fs2|fs1|fs0|fa7|fa6|fa5|fa4|fa3|fa2|fa1|fa0)\\b",
"name": "storage.loongarch"
},
"c_normal_registers": {
"match": "\\$(scr3|scr2|scr1|scr0)\\b",
"match": "\\B\\$(scr3|scr2|scr1|scr0)\\b",
"name": "storage.loongarch"
},
"cr_normal_registers": {
"match": "\\$(fcc7|fcc6|fcc5|fcc4|fcc3|fcc2|fcc1|fcc0)\\b",
"match": "\\B\\$(fcc7|fcc6|fcc5|fcc4|fcc3|fcc2|fcc1|fcc0)\\b",
"name": "storage.loongarch"
},
"v_normal_registers": {
"match": "\\$(vr9|vr8|vr7|vr6|vr5|vr4|vr31|vr30|vr3|vr29|vr28|vr27|vr26|vr25|vr24|vr23|vr22|vr21|vr20|vr2|vr19|vr18|vr17|vr16|vr15|vr14|vr13|vr12|vr11|vr10|vr1|vr0)\\b",
"match": "\\B\\$(vr9|vr8|vr7|vr6|vr5|vr4|vr31|vr30|vr3|vr29|vr28|vr27|vr26|vr25|vr24|vr23|vr22|vr21|vr20|vr2|vr19|vr18|vr17|vr16|vr15|vr14|vr13|vr12|vr11|vr10|vr1|vr0)\\b",
"name": "storage.loongarch"
},
"x_normal_registers": {
"match": "\\$(xr9|xr8|xr7|xr6|xr5|xr4|xr31|xr30|xr3|xr29|xr28|xr27|xr26|xr25|xr24|xr23|xr22|xr21|xr20|xr2|xr19|xr18|xr17|xr16|xr15|xr14|xr13|xr12|xr11|xr10|xr1|xr0)\\b",
"match": "\\B\\$(xr9|xr8|xr7|xr6|xr5|xr4|xr31|xr30|xr3|xr29|xr28|xr27|xr26|xr25|xr24|xr23|xr22|xr21|xr20|xr2|xr19|xr18|xr17|xr16|xr15|xr14|xr13|xr12|xr11|xr10|xr1|xr0)\\b",
"name": "storage.loongarch"
},
"opcodes": {
Expand Down
16 changes: 8 additions & 8 deletions syntaxes/loongarch.tmLanguage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,28 +95,28 @@ repository:
- include: '#v_normal_registers'
- include: '#x_normal_registers'
r_normal_registers:
match: '\$(r9|r8|r7|r6|r5|r4|r31|r30|r3|r29|r28|r27|r26|r25|r24|r23|r22|r21|r20|r2|r19|r18|r17|r16|r15|r14|r13|r12|r11|r10|r1|r0)\b'
match: '\B\$(r9|r8|r7|r6|r5|r4|r31|r30|r3|r29|r28|r27|r26|r25|r24|r23|r22|r21|r20|r2|r19|r18|r17|r16|r15|r14|r13|r12|r11|r10|r1|r0)\b'
name: 'storage.loongarch'
r_lp64_registers:
match: '\$?(zero|x|v1|v0|tp|t8|t7|t6|t5|t4|t3|t2|t1|t0|sp|s8|s7|s6|s5|s4|s3|s2|s1|s0|ra|fp|a7|a6|a5|a4|a3|a2|a1|a0)\b'
match: '\B\$(zero|x|v1|v0|tp|t8|t7|t6|t5|t4|t3|t2|t1|t0|sp|s8|s7|s6|s5|s4|s3|s2|s1|s0|ra|fp|a7|a6|a5|a4|a3|a2|a1|a0)\b'
name: 'storage.loongarch'
f_normal_registers:
match: '\$(f9|f8|f7|f6|f5|f4|f31|f30|f3|f29|f28|f27|f26|f25|f24|f23|f22|f21|f20|f2|f19|f18|f17|f16|f15|f14|f13|f12|f11|f10|f1|f0)\b'
match: '\B\$(f9|f8|f7|f6|f5|f4|f31|f30|f3|f29|f28|f27|f26|f25|f24|f23|f22|f21|f20|f2|f19|f18|f17|f16|f15|f14|f13|f12|f11|f10|f1|f0)\b'
name: 'storage.loongarch'
f_lp64_registers:
match: '\$?(fv1|fv0|ft9|ft8|ft7|ft6|ft5|ft4|ft3|ft2|ft15|ft14|ft13|ft12|ft11|ft10|ft1|ft0|fs7|fs6|fs5|fs4|fs3|fs2|fs1|fs0|fa7|fa6|fa5|fa4|fa3|fa2|fa1|fa0)\b'
match: '\B\$(fv1|fv0|ft9|ft8|ft7|ft6|ft5|ft4|ft3|ft2|ft15|ft14|ft13|ft12|ft11|ft10|ft1|ft0|fs7|fs6|fs5|fs4|fs3|fs2|fs1|fs0|fa7|fa6|fa5|fa4|fa3|fa2|fa1|fa0)\b'
name: 'storage.loongarch'
c_normal_registers:
match: '\$(scr3|scr2|scr1|scr0)\b'
match: '\B\$(scr3|scr2|scr1|scr0)\b'
name: 'storage.loongarch'
cr_normal_registers:
match: '\$(fcc7|fcc6|fcc5|fcc4|fcc3|fcc2|fcc1|fcc0)\b'
match: '\B\$(fcc7|fcc6|fcc5|fcc4|fcc3|fcc2|fcc1|fcc0)\b'
name: 'storage.loongarch'
v_normal_registers:
match: '\$(vr9|vr8|vr7|vr6|vr5|vr4|vr31|vr30|vr3|vr29|vr28|vr27|vr26|vr25|vr24|vr23|vr22|vr21|vr20|vr2|vr19|vr18|vr17|vr16|vr15|vr14|vr13|vr12|vr11|vr10|vr1|vr0)\b'
match: '\B\$(vr9|vr8|vr7|vr6|vr5|vr4|vr31|vr30|vr3|vr29|vr28|vr27|vr26|vr25|vr24|vr23|vr22|vr21|vr20|vr2|vr19|vr18|vr17|vr16|vr15|vr14|vr13|vr12|vr11|vr10|vr1|vr0)\b'
name: 'storage.loongarch'
x_normal_registers:
match: '\$(xr9|xr8|xr7|xr6|xr5|xr4|xr31|xr30|xr3|xr29|xr28|xr27|xr26|xr25|xr24|xr23|xr22|xr21|xr20|xr2|xr19|xr18|xr17|xr16|xr15|xr14|xr13|xr12|xr11|xr10|xr1|xr0)\b'
match: '\B\$(xr9|xr8|xr7|xr6|xr5|xr4|xr31|xr30|xr3|xr29|xr28|xr27|xr26|xr25|xr24|xr23|xr22|xr21|xr20|xr2|xr19|xr18|xr17|xr16|xr15|xr14|xr13|xr12|xr11|xr10|xr1|xr0)\b'
name: 'storage.loongarch'
opcodes:
# instruction name (add.w)
Expand Down

0 comments on commit 740f5c2

Please sign in to comment.