Skip to content

Commit b20b11a

Browse files
committed
initial support for *.inc files
1 parent 1780839 commit b20b11a

File tree

2 files changed

+154
-8
lines changed

2 files changed

+154
-8
lines changed

package.json

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-cos",
33
"displayName": "Caché ObjectScript",
44
"description": "Caché ObjectScript language support for Visual Studio Code",
5-
"version": "0.0.3",
5+
"version": "0.0.4",
66
"icon": "images/logo.png",
77
"categories": [
88
"Languages",
@@ -24,21 +24,28 @@
2424
"languages": [
2525
{
2626
"id": "cachéobjectscript",
27-
"aliases": [
28-
"Caché ObjectScript",
29-
"COS"
30-
],
31-
"extensions": [
32-
".cls"
33-
],
27+
"aliases": [ "COS" ],
28+
"extensions": [ ".cls" ],
29+
"configuration": "./language-configuration.json"
30+
},
31+
{
32+
"id": "cachéobjectscriptinclude",
33+
"aliases": [ "COS.INC" ],
34+
"extensions": [ ".inc" ],
3435
"configuration": "./language-configuration.json"
3536
}
37+
3638
],
3739
"grammars": [
3840
{
3941
"language": "cachéobjectscript",
4042
"scopeName": "source.cos",
4143
"path": "syntaxes/cos.tmLanguage.json"
44+
},
45+
{
46+
"language": "cachéobjectscriptinclude",
47+
"scopeName": "source.cosinc",
48+
"path": "syntaxes/cosinc.tmLanguage.json"
4249
}
4350
],
4451
"commands": [

syntaxes/cosinc.tmLanguage.json

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3+
"name": "cachéobjectscriptinclude",
4+
"scopeName": "source.cosinc",
5+
"patterns": [
6+
7+
{ "include": "#include" },
8+
{ "include": "#define" },
9+
{ "include": "#def1arg" },
10+
{ "include": "#ifdef" },
11+
{ "include": "#comment-line" }
12+
13+
],
14+
15+
"repository": {
16+
17+
"include": {
18+
"patterns": [
19+
{ "begin": "^\\s*(\\#\\s*(?:(?i)include))\\s+([a-zA-Z%][a-zA-Z0-9]*)", "end": "(?=$)",
20+
"beginCaptures": {
21+
"1": {"name":"keyword.other.cos"},
22+
"2": { "name": "entity.name.cos" }
23+
}
24+
}
25+
]
26+
27+
},
28+
29+
"define": {
30+
"patterns": [
31+
{
32+
"name": "meta.preprocessor.cos",
33+
"begin": "^\\s*(\\#\\s*(?:(?i)define))\\s+((?<id>[a-zA-Z%][a-zA-Z0-9]*))(?:(\\()(\\s*\\g<id>\\s*((,)\\s*\\g<id>\\s*)*)(\\)))?",
34+
"beginCaptures": {
35+
36+
"1": { "name": "keyword.control.cos" },
37+
"2": { "name": "entity.name.cos" },
38+
"4": { "name": "punctuation.definition.cos" },
39+
"5": { "name": "variable.parameter.cos" },
40+
"7": { "name": "punctuation.definition.cos" }
41+
42+
},
43+
"end": "(?<!\\#\\#continue)\\n",
44+
45+
"patterns":[
46+
47+
{ "include": "#comment-line" },
48+
{ "include": "#continue" },
49+
{ "include": "#digits" },
50+
{ "include": "#macros" }
51+
52+
]
53+
}
54+
]
55+
},
56+
57+
"def1arg": {
58+
"patterns": [
59+
{
60+
"name": "meta.preprocessor.cos",
61+
"begin": "^\\s*(\\#\\s*(?:(?i)def1arg))\\s+((?<id>[a-zA-Z%][a-zA-Z0-9]*))(?:(\\()(\\s*\\g<id>\\s*)(\\)))",
62+
"beginCaptures": {
63+
64+
"1": { "name": "keyword.control.cos" },
65+
"2": { "name": "entity.name.cos" },
66+
"4": { "name": "punctuation.definition.cos" },
67+
"5": { "name": "variable.parameter.cos" },
68+
"6": { "name": "punctuation.definition.cos" }
69+
70+
},
71+
"end": "(?<!\\#\\#continue)\\n",
72+
73+
"patterns":[
74+
75+
{ "include": "#comment-line" },
76+
{ "include": "#continue" },
77+
{ "include": "#digits" },
78+
{ "include": "#macros" }
79+
80+
]
81+
}
82+
]
83+
},
84+
85+
"ifdef": {
86+
"patterns": [
87+
{
88+
"name": "meta.preprocessor.cos",
89+
"begin": "^\\s*(#\\s*(?i)(?:if|ifdef|ifndef|elif|else|undef|endif))\\b",
90+
"beginCaptures": { "1": { "name": "keyword.control.cos" } },
91+
"end": "(?=(?:;|//|/\\*))|$",
92+
"patterns": [
93+
{ "include": "#digits" },
94+
{ "include": "#comment-line" }
95+
]
96+
97+
}
98+
99+
]
100+
},
101+
102+
"continue": {
103+
"patterns": [
104+
{ "match": "(\\s+\\#\\#(?i)(continue)\\s*)", "name": "keyword.control.cos" }
105+
]
106+
},
107+
108+
"digits": {
109+
"patterns":[
110+
{ "match": "\\b((([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)\\b",
111+
"name": "constant.numeric.cos"
112+
}
113+
]
114+
},
115+
116+
"macros": {
117+
"patterns": [
118+
{ "match": "\\$\\$\\$[a-zA-Z]([a-zA-Z0-9])*", "name":"support.constant" }
119+
]
120+
},
121+
122+
"comment-line": {
123+
"patterns": [
124+
{ "match": "^///.*$", "name": "comment.line.cos" },
125+
{ "match": "\\s+//.*$", "name": "comment.line.cos" },
126+
{ "match": "\\s+;.*$", "name": "comment.line.cos" },
127+
{ "match": "^\\s*#;.*$", "name": "comment.line.cos" },
128+
{ "name": "comment.block.cos", "begin": "/\\*", "end": "\\*/",
129+
"beginCaptures": { "0": { "name": "punctuation.definition.cos" } },
130+
"endCaptures": { "0": { "name": "punctuation.definition.cos" } }
131+
}
132+
]
133+
134+
}
135+
136+
137+
138+
}
139+
}

0 commit comments

Comments
 (0)