Skip to content

Commit f5bdaf6

Browse files
authored
fix: patch 1.5.2 (#27)
Corrects highlighting of return indexes in asm arrangements/shuffles according to `grammar.ohm` of Tact
1 parent f6d3d1f commit f5bdaf6

File tree

3 files changed

+104
-2
lines changed

3 files changed

+104
-2
lines changed

package/Tact.tmLanguage

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,18 @@
243243
<string>keyword.operator.mapsto.tact</string>
244244
</dict>
245245
<dict>
246+
<key>comment</key>
247+
<string>Decimal integer WITH leading zero</string>
248+
<key>match</key>
249+
<string>\b(0[0-9]*)\b</string>
250+
<key>name</key>
251+
<string>constant.numeric.decimal.tact</string>
252+
</dict>
253+
<dict>
254+
<key>comment</key>
255+
<string>Decimal integer WITHOUT leading zero</string>
246256
<key>match</key>
247-
<string>\b([0-9]+)\b</string>
257+
<string>\b([1-9](?:_?[0-9])*)\b</string>
248258
<key>name</key>
249259
<string>constant.numeric.decimal.tact</string>
250260
</dict>

package/Tact.tmLanguage.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,13 @@
158158
"name": "keyword.operator.mapsto.tact"
159159
},
160160
{
161-
"match": "\\b([0-9]+)\\b",
161+
"comment": "Decimal integer WITH leading zero",
162+
"match": "\\b(0[0-9]*)\\b",
163+
"name": "constant.numeric.decimal.tact"
164+
},
165+
{
166+
"comment": "Decimal integer WITHOUT leading zero",
167+
"match": "\\b([1-9](?:_?[0-9])*)\\b",
162168
"name": "constant.numeric.decimal.tact"
163169
}
164170
],

tests/syntax_test_asm_function.tact

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// SYNTAX TEST "Packages/Tact/package/Tact.tmLanguage"
2+
3+
asm fun empty() { }
4+
// <- entity.other.attribute-name.tact
5+
// ^^^ keyword.other.function.tact
6+
// ^^^^^ entity.name.function.tact
7+
// ^ punctuation.brackets.round.tact
8+
// ^ punctuation.brackets.round.tact
9+
// ^ punctuation.brackets.curly.tact
10+
// ^ punctuation.brackets.curly.tact
11+
12+
asm() fun empty2() { }
13+
// <- entity.other.attribute-name.tact
14+
// ^^ punctuation.brackets.round.tact
15+
16+
asm(-> 000) fun rets(): Int { }
17+
// <- entity.other.attribute-name.tact
18+
// ^ punctuation.brackets.round.tact
19+
// ^^ keyword.operator.mapsto.tact
20+
// ^^^ constant.numeric.decimal.tact
21+
// ^ punctuation.brackets.round.tact
22+
23+
asm(arg1 arg2 -> 0) fun args(arg1: Int, arg2: Int): Int { }
24+
// <- entity.other.attribute-name.tact
25+
// ^ punctuation.brackets.round.tact
26+
// ^^^^ variable.other.tact
27+
// ^^^^ variable.other.tact
28+
// ^^ keyword.operator.mapsto.tact
29+
// ^ constant.numeric.decimal.tact
30+
// ^ punctuation.brackets.round.tact
31+
32+
struct Eleven { /* imagine 11 fields */ }
33+
34+
asm(-> 1_0 9 8 7 6 5 4 3 2 1 0) extends fun eleven(self: Int): Eleven { INSTRUCTION INSTRUCTION 000 }
35+
// <- entity.other.attribute-name.tact
36+
// ^ punctuation.brackets.round.tact
37+
// ^^ keyword.operator.mapsto.tact
38+
// ^^^ constant.numeric.decimal.tact
39+
// ^ constant.numeric.decimal.tact
40+
// ^ constant.numeric.decimal.tact
41+
// ^ constant.numeric.decimal.tact
42+
// ^ constant.numeric.decimal.tact
43+
// ^ constant.numeric.decimal.tact
44+
// ^ constant.numeric.decimal.tact
45+
// ^ constant.numeric.decimal.tact
46+
// ^ constant.numeric.decimal.tact
47+
// ^ constant.numeric.decimal.tact
48+
// ^ constant.numeric.decimal.tact
49+
// ^ punctuation.brackets.round.tact
50+
// ^^^^^^^ keyword.other.attribute.tact
51+
// ^^^ keyword.other.function.tact
52+
// ^^^^^^ entity.name.function.tact
53+
// ^ punctuation.brackets.round.tact
54+
// ^^^^ variable.language.this.tact
55+
// ^ punctuation.colon.tact
56+
// ^^^ entity.name.type.tact
57+
// ^ punctuation.brackets.round.tact
58+
// ^ punctuation.colon.tact
59+
// ^^^^^^ entity.name.type.tact
60+
// ^ punctuation.brackets.curly.tact
61+
// ^^^^^^^^^^^ constant.other.caps.tact
62+
// ^^^^^^^^^^^ constant.other.caps.tact
63+
// ^^^ constant.numeric.decimal.tact
64+
// ^ punctuation.brackets.curly.tact
65+
66+
asm fun isIntAnInt(x: Int): Bool {
67+
<{
68+
TRY:<{
69+
0 PUSHINT ADD DROP -1 PUSHINT
70+
// <- constant.numeric.decimal.tact
71+
//^^^^^^^ constant.other.caps.tact
72+
// ^^^ constant.other.caps.tact
73+
// ^^^^ constant.other.caps.tact
74+
// ^ keyword.operator.arithmetic.tact
75+
// ^ constant.numeric.decimal.tact
76+
// ^^^^^^^ constant.other.caps.tact
77+
}>CATCH<{
78+
2DROP 0 PUSHINT
79+
// ^ constant.numeric.decimal.tact
80+
// ^^^^^^^ constant.other.caps.tact
81+
}>
82+
}>CONT 1 1 CALLXARGS
83+
// ^ constant.numeric.decimal.tact
84+
// ^ constant.numeric.decimal.tact
85+
// ^^^^^^^^^ constant.other.caps.tact
86+
}

0 commit comments

Comments
 (0)