Skip to content

Commit 922ab6d

Browse files
committed
Update grammar script to include option path for version
Update C grammars to get macro fix
1 parent 9e769ab commit 922ab6d

7 files changed

Lines changed: 59 additions & 44 deletions

File tree

build/npm/update-grammar.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function getCommitSha(repoId, repoPath) {
8282
});
8383
}
8484

85-
exports.update = function (repoId, repoPath, dest, modifyGrammar, version = 'master') {
85+
exports.update = function (repoId, repoPath, dest, modifyGrammar, version = 'master', packageJsonPathOverride = '') {
8686
var contentPath = 'https://raw.githubusercontent.com/' + repoId + `/${version}/` + repoPath;
8787
console.log('Reading from ' + contentPath);
8888
return download(contentPath).then(function (content) {
@@ -128,7 +128,11 @@ exports.update = function (repoId, repoPath, dest, modifyGrammar, version = 'mas
128128

129129
// Add commit sha to cgmanifest.
130130
if (currentCommitDate > commitDate) {
131-
let packageJsonPath = 'https://raw.githubusercontent.com/' + repoId + `/${info.commitSha}/package.json`;
131+
let packageJsonPath = 'https://raw.githubusercontent.com/' + repoId + `/${info.commitSha}/`;
132+
if (packageJsonPathOverride) {
133+
packageJsonPath += packageJsonPathOverride;
134+
}
135+
packageJsonPath += '/package.json';
132136
for (let i = 0; i < cgmanifestRead.registrations.length; i++) {
133137
if (cgmanifestRead.registrations[i].component.git.repositoryUrl.substr(cgmanifestRead.registrations[i].component.git.repositoryUrl.length - repoId.length, repoId.length) === repoId) {
134138
cgmanifestRead.registrations[i].component.git.commitHash = info.commitSha;

extensions/cpp/build/update-grammars.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
var updateGrammar = require('../../../build/npm/update-grammar');
88

9-
updateGrammar.update('jeff-hykin/cpp-textmate-grammar', '/syntaxes/c.tmLanguage.json', './syntaxes/c.tmLanguage.json');
10-
updateGrammar.update('jeff-hykin/cpp-textmate-grammar', '/syntaxes/cpp.tmLanguage.json', './syntaxes/cpp.tmLanguage.json');
9+
updateGrammar.update('jeff-hykin/cpp-textmate-grammar', '/syntaxes/c.tmLanguage.json', './syntaxes/c.tmLanguage.json', undefined, 'master', 'source/languages/cpp');
10+
updateGrammar.update('jeff-hykin/cpp-textmate-grammar', '/syntaxes/cpp.tmLanguage.json', './syntaxes/cpp.tmLanguage.json', undefined, 'master', 'source/languages/cpp');
1111

1212
// `source.c.platform` which is still included by other grammars
1313
updateGrammar.update('textmate/c.tmbundle', 'Syntaxes/Platform.tmLanguage', './syntaxes/platform.tmLanguage.json');

extensions/cpp/cgmanifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"git": {
77
"name": "jeff-hykin/cpp-textmate-grammar",
88
"repositoryUrl": "https://github.com/jeff-hykin/cpp-textmate-grammar",
9-
"commitHash": "cb9cb59b32d0cb9e2cbbca1a9cdb62769fc2ca8e"
9+
"commitHash": "992c5ba8789288707f2a13778452d644677d9699"
1010
}
1111
},
1212
"license": "MIT",
13-
"version": "1.0.0",
13+
"version": "1.12.18",
1414
"description": "The files syntaxes/c.json and syntaxes/c++.json were derived from https://github.com/atom/language-c which was originally converted from the C TextMate bundle https://github.com/textmate/c.tmbundle."
1515
},
1616
{

extensions/cpp/syntaxes/cpp.tmLanguage.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
55
"Once accepted there, we are happy to receive an update request."
66
],
7-
"version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/cb9cb59b32d0cb9e2cbbca1a9cdb62769fc2ca8e",
7+
"version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/992c5ba8789288707f2a13778452d644677d9699",
88
"name": "C++",
99
"scopeName": "source.cpp",
1010
"patterns": [
@@ -143,9 +143,6 @@
143143
{
144144
"include": "#preprocessor_rule_conditional"
145145
},
146-
{
147-
"include": "#macro_argument"
148-
},
149146
{
150147
"include": "#meta_preprocessor_macro"
151148
},
@@ -19409,6 +19406,9 @@
1940919406
},
1941019407
{
1941119408
"include": "#evaluation_context"
19409+
},
19410+
{
19411+
"include": "#macro_argument"
1941219412
}
1941319413
]
1941419414
}

extensions/cpp/test/colorize-results/test_cpp.json

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,58 +22,69 @@
2222
}
2323
},
2424
{
25-
"c": "#include",
26-
"t": "source.cpp variable.other.macro.argument.cpp",
25+
"c": "#",
26+
"t": "source.cpp meta.preprocessor.include.cpp keyword.control.directive.include.cpp punctuation.definition.directive.cpp",
2727
"r": {
28-
"dark_plus": "variable: #9CDCFE",
29-
"light_plus": "variable: #001080",
30-
"dark_vs": "default: #D4D4D4",
31-
"light_vs": "default: #000000",
32-
"hc_black": "variable: #9CDCFE"
28+
"dark_plus": "keyword.control: #C586C0",
29+
"light_plus": "keyword.control: #AF00DB",
30+
"dark_vs": "keyword.control: #569CD6",
31+
"light_vs": "keyword.control: #0000FF",
32+
"hc_black": "keyword.control: #C586C0"
33+
}
34+
},
35+
{
36+
"c": "include",
37+
"t": "source.cpp meta.preprocessor.include.cpp keyword.control.directive.include.cpp",
38+
"r": {
39+
"dark_plus": "keyword.control: #C586C0",
40+
"light_plus": "keyword.control: #AF00DB",
41+
"dark_vs": "keyword.control: #569CD6",
42+
"light_vs": "keyword.control: #0000FF",
43+
"hc_black": "keyword.control: #C586C0"
3344
}
3445
},
3546
{
3647
"c": " ",
37-
"t": "source.cpp",
48+
"t": "source.cpp meta.preprocessor.include.cpp",
3849
"r": {
39-
"dark_plus": "default: #D4D4D4",
40-
"light_plus": "default: #000000",
41-
"dark_vs": "default: #D4D4D4",
42-
"light_vs": "default: #000000",
43-
"hc_black": "default: #FFFFFF"
50+
"dark_plus": "meta.preprocessor: #569CD6",
51+
"light_plus": "meta.preprocessor: #0000FF",
52+
"dark_vs": "meta.preprocessor: #569CD6",
53+
"light_vs": "meta.preprocessor: #0000FF",
54+
"hc_black": "meta.preprocessor: #569CD6"
4455
}
4556
},
4657
{
4758
"c": "<",
48-
"t": "source.cpp keyword.operator.comparison.cpp",
59+
"t": "source.cpp meta.preprocessor.include.cpp string.quoted.other.lt-gt.include.cpp punctuation.definition.string.begin.cpp",
4960
"r": {
50-
"dark_plus": "keyword.operator: #D4D4D4",
51-
"light_plus": "keyword.operator: #000000",
52-
"dark_vs": "keyword.operator: #D4D4D4",
53-
"light_vs": "keyword.operator: #000000",
54-
"hc_black": "keyword.operator: #D4D4D4"
61+
"dark_plus": "string: #CE9178",
62+
"light_plus": "string: #A31515",
63+
"dark_vs": "string: #CE9178",
64+
"light_vs": "string: #A31515",
65+
"hc_black": "string: #CE9178"
5566
}
5667
},
5768
{
5869
"c": "iostream",
59-
"t": "source.cpp",
70+
"t": "source.cpp meta.preprocessor.include.cpp string.quoted.other.lt-gt.include.cpp",
6071
"r": {
61-
"dark_plus": "default: #D4D4D4",
62-
"light_plus": "default: #000000",
63-
"dark_vs": "default: #D4D4D4",
64-
"light_vs": "default: #000000",
65-
"hc_black": "default: #FFFFFF"
72+
"dark_plus": "string: #CE9178",
73+
"light_plus": "string: #A31515",
74+
"dark_vs": "string: #CE9178",
75+
"light_vs": "string: #A31515",
76+
"hc_black": "string: #CE9178"
6677
}
6778
},
6879
{
6980
"c": ">",
70-
"t": "source.cpp keyword.operator.comparison.cpp",
81+
"t": "source.cpp meta.preprocessor.include.cpp string.quoted.other.lt-gt.include.cpp punctuation.definition.string.end.cpp",
7182
"r": {
72-
"dark_plus": "keyword.operator: #D4D4D4",
73-
"light_plus": "keyword.operator: #000000",
74-
"dark_vs": "keyword.operator: #D4D4D4",
75-
"light_vs": "keyword.operator: #000000",
76-
"hc_black": "keyword.operator: #D4D4D4"
83+
"dark_plus": "string: #CE9178",
84+
"light_plus": "string: #A31515",
85+
"dark_vs": "string: #CE9178",
86+
"light_vs": "string: #A31515",
87+
"hc_black": "string: #CE9178"
7788
}
7889
},
7990
{

extensions/objective-c/build/update-grammars.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66

77
var updateGrammar = require('../../../build/npm/update-grammar');
88

9-
updateGrammar.update('jeff-hykin/cpp-textmate-grammar', '/syntaxes/objc.tmLanguage.json', './syntaxes/objective-c.tmLanguage.json');
10-
updateGrammar.update('jeff-hykin/cpp-textmate-grammar', '/syntaxes/objcpp.tmLanguage.json', './syntaxes/objective-c++.tmLanguage.json');
9+
updateGrammar.update('jeff-hykin/cpp-textmate-grammar', '/syntaxes/objc.tmLanguage.json', './syntaxes/objective-c.tmLanguage.json', undefined, 'master', 'source/languages/cpp');
10+
updateGrammar.update('jeff-hykin/cpp-textmate-grammar', '/syntaxes/objcpp.tmLanguage.json', './syntaxes/objective-c++.tmLanguage.json', undefined, 'master', 'source/languages/cpp');
1111

extensions/objective-c/cgmanifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
},
1212
"license": "MIT",
13-
"version": "1.0.0",
13+
"version": "1.12.11",
1414
"description": "The files syntaxes/objective-c.tmLanguage.json and syntaxes/objective-c++.tmLanguage.json were derived from the language package https://github.com/jeff-hykin/cpp-textmate-grammar."
1515
}
1616
],

0 commit comments

Comments
 (0)