Skip to content

Commit e7aa242

Browse files
committed
Add highlighting for diff markup.
1 parent 6bb99d2 commit e7aa242

File tree

3 files changed

+68
-13
lines changed

3 files changed

+68
-13
lines changed

examples/diff.uir

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
%0:1 = input "a"
2+
%1:1 = input "b"
3+
%2:2 = input "op"
4+
%4:4 = not { %17 %20 %18 %19 }
5+
%8:1 = and %0 %1
6+
%9:1 = or %0 %1
7+
%10:1 = xor %0 %1
8+
-%11:0 = output "o" %24
9+
+%11:0 = output "o" %_28
10+
%12:0 = name "top a" %0
11+
%13:0 = name "top b" %1
12+
-%14:0 = name "top o" %24
13+
+%14:0 = name "top o" %_28
14+
%15:0 = name "top op" %2:2
15+
-%16:0 = name "top s_x" %24
16+
+%16:0 = name "top s_x" %_28
17+
%17:1 = eq %2:2 00
18+
%18:1 = eq %2:2 10
19+
%19:1 = eq %2:2 01
20+
%20:1 = eq %2:2 11
21+
%21:1 = mux %4+0 %8 0
22+
-%22:1 = mux %4+1 %9 %21
23+
+%22:1 = mux %4+1 %9 %_25
24+
-%23:1 = mux %4+2 %10 %22
25+
+%23:1 = mux %4+2 %10 %_26
26+
-%24:1 = mux %4+3 %0 %23
27+
+%24:1 = mux %4+3 %0 %_27
28+
+%_25:1 = mux %19 0 %8
29+
+%_26:1 = mux %18 %_25 %9
30+
+%_27:1 = mux %20 %_26 %10
31+
+%_28:1 = mux %17 %_27 %0

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"author": "Catherine <[email protected]>",
77
"license": "BSD-0-Clause",
88
"homepage": "https://github.com/prjunnamed/",
9-
"version": "0.1.0",
9+
"version": "0.2.0",
1010
"repository": {
1111
"type": "git",
1212
"url": "https://github.com/prjunnamed/vscode-syntax.git"

syntaxes/prjunnamed.tmLanguage.json

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
{
22
"scopeName": "source.prjunnamed",
3-
"patterns": [
4-
{"include": "#comment"},
5-
{"include": "#decimal"},
6-
{"include": "#ternary"},
7-
{"include": "#string"},
8-
{"include": "#io-port"},
9-
{"include": "#cell-ref"},
10-
{"include": "#cell-name"}
11-
],
3+
"patterns": [{"include": "#declaration"}],
124
"repository": {
5+
"declaration": {
6+
"patterns": [
7+
{"include": "#comment"},
8+
{"include": "#decimal"},
9+
{"include": "#ternary"},
10+
{"include": "#string"},
11+
{"include": "#io-port"},
12+
{"include": "#cell-ref"},
13+
{"include": "#cell-ref-added"},
14+
{"include": "#cell-name"},
15+
{"include": "#diff-added"},
16+
{"include": "#diff-removed"}
17+
]
18+
},
1319
"comment": {
1420
"match": ";.+",
1521
"name": "comment.line.prjunnamed"
@@ -30,21 +36,39 @@
3036
"begin": "\"",
3137
"end": "\"",
3238
"name": "string.quoted.double.prjunnamed",
33-
"patterns": [{ "include": "#string-escape" }]
39+
"patterns": [{"include": "#string-escape"}]
3440
},
3541
"io-port": {
3642
"begin": "&\"",
3743
"end": "(\"):\\d+",
3844
"name": "entity.name.io-port.prjunnamed",
39-
"patterns": [{ "include": "#string-escape" }]
45+
"patterns": [{"include": "#string-escape"}]
4046
},
4147
"cell-ref": {
4248
"match": "%\\d+(:\\d+)?(\\+\\d+)?",
43-
"name": "variable.parameter.prjunnamed"
49+
"name": "variable.other.prjunnamed"
50+
},
51+
"cell-ref-added": {
52+
"match": "%_\\d+(:\\d+)?(\\+\\d+)?",
53+
"name": "markup.inserted.prjunnamed"
4454
},
4555
"cell-name": {
4656
"match": "buf|not|and|or|xor|mux|adc|eq|ult|slt|shl|ushr|sshr|xshr|mul|udiv|umod|sdiv_trunc|sdiv_floor|smod_trunc|smod_floor|match|assign|dff|memory|iob|target|input|output|name",
4757
"name": "keyword.other.cell.prjunnamed"
58+
},
59+
"diff-added": {
60+
"begin": "^\\+%_?\\d+(:\\d+)?(\\+\\d+)?",
61+
"end": "\n",
62+
"beginCaptures": {"0": {"name": "markup.inserted.prjunnamed"}},
63+
"name": "meta.added.prjunnamed",
64+
"patterns": [{"include": "#declaration"}]
65+
},
66+
"diff-removed": {
67+
"begin": "^-%\\d+(:\\d+)?(\\+\\d+)?",
68+
"end": "\n",
69+
"beginCaptures": {"0": {"name": "markup.deleted.prjunnamed"}},
70+
"name": "meta.removed.prjunnamed",
71+
"patterns": [{"include": "#declaration"}]
4872
}
4973
}
5074
}

0 commit comments

Comments
 (0)