Skip to content

Commit 06a667b

Browse files
committed
fix: capture inline block comments in strings
1 parent 20dc98e commit 06a667b

File tree

3 files changed

+32
-15
lines changed

3 files changed

+32
-15
lines changed

syntaxes/ccini.tmLanguage.json

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,24 @@
4545
}
4646
}
4747
},
48-
"comments": {
48+
"commentBlock": {
4949
"patterns": [
5050
{
5151
"name": "comment.block",
5252
"begin": "\\/\\*",
53-
"end": "\\*\\/"
54-
},
53+
"end": "\\*\\/",
54+
"patterns": [
55+
{
56+
"include": "#commentBlock"
57+
}
58+
]
59+
}
60+
]
61+
},
62+
"comments": {
63+
"patterns": [
5564
{
56-
"name": "comment.block.inline",
57-
"match": "(\\/\\*).*?(?=\\*\\/)(\\*\\/)"
65+
"include": "#commentBlock"
5866
},
5967
{
6068
"name": "comment.line.double-slash",
@@ -90,8 +98,8 @@
9098
},
9199
"strings": {
92100
"name": "string.unquoted",
93-
"begin": "(?=\\w)",
94-
"end": "(?=\\n|$|(\\/\\*)|(\\/\\/))",
101+
"begin": "(?=[\\w\\-])",
102+
"end": "(?=\\n|$|(\\/\\*(?!.*\\*\\/))|(\\/\\/))",
95103
"patterns": [
96104
{
97105
"include": "#comments"

syntaxes/ccini.tmLanguage.yaml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,20 @@ repository:
4040
- { include: "#numbers" }
4141
- { include: "#strings" }
4242

43-
comments:
43+
commentBlock:
4444
patterns:
4545
- name: comment.block
4646
begin: \/\*
4747
end: \*\/
48+
patterns:
49+
- include: "#commentBlock"
50+
51+
comments:
52+
patterns:
53+
- include: "#commentBlock"
4854

49-
- name: comment.block.inline
50-
match: (\/\*).*?(?=\*\/)(\*\/)
55+
# - name: comment.block.inline
56+
# match: (\/\*).*?(?=\*\/)(\*\/)
5157

5258
- name: comment.line.double-slash
5359
begin: (^[ \t]+)?(?=//)
@@ -73,8 +79,8 @@ repository:
7379

7480
strings:
7581
name: string.unquoted
76-
begin: (?=\w)
77-
end: (?=\n|$|(\/\*)|(\/\/))
82+
begin: (?=[\w\-])
83+
end: (?=\n|$|(\/\*(?!.*\*\/))|(\/\/))
7884
patterns:
7985
- include: "#comments"
8086
- include: "#modulePath"

testcases/test1.ini

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,23 @@ AddSoundC/*ontainer = SoundContainer
1515
FilePath = DarkStorm.rte/D22Bushi/D2TenguDeviceSwitch.wav
1616
*/
1717

18+
/*
19+
/* // adsdsa */
20+
welcome to hell */
1821
// asdasd
1922

2023
AddEffect = MOSParticle
21-
PresetName = D22Bushi Gib Blue Tiny /* */ dasdsadasd /*
24+
PresetName = D22Bushi Gib Blue Tiny /**/ dasdsadasd /*
2225
Mass = 0.92
2326
Sharpness = 1
2427
HitsMOs = 1
2528
*/
2629
GetsHitByMOs = 0
27-
SpriteFile = ContentFile
30+
SpriteFile = ContentFile // dasdsa
2831
FilePath = DarkStorm.rte/D22Bushi/D22BushiBlueGib.png
2932
FrameCount = 1
3033
SpriteOffset = Vector
31-
X = -2
34+
X = -2 /**/
3235
Y = -2
3336
AngularVel = 6
3437
Atom = Atom

0 commit comments

Comments
 (0)