Update grammar script to include option path for version

Update C grammars to get macro fix
This commit is contained in:
Alex Ross 2019-07-09 10:47:13 +02:00
parent 9e769ab2ad
commit 922ab6db62
7 changed files with 59 additions and 44 deletions

View File

@ -82,7 +82,7 @@ function getCommitSha(repoId, repoPath) {
}); });
} }
exports.update = function (repoId, repoPath, dest, modifyGrammar, version = 'master') { exports.update = function (repoId, repoPath, dest, modifyGrammar, version = 'master', packageJsonPathOverride = '') {
var contentPath = 'https://raw.githubusercontent.com/' + repoId + `/${version}/` + repoPath; var contentPath = 'https://raw.githubusercontent.com/' + repoId + `/${version}/` + repoPath;
console.log('Reading from ' + contentPath); console.log('Reading from ' + contentPath);
return download(contentPath).then(function (content) { return download(contentPath).then(function (content) {
@ -128,7 +128,11 @@ exports.update = function (repoId, repoPath, dest, modifyGrammar, version = 'mas
// Add commit sha to cgmanifest. // Add commit sha to cgmanifest.
if (currentCommitDate > commitDate) { if (currentCommitDate > commitDate) {
let packageJsonPath = 'https://raw.githubusercontent.com/' + repoId + `/${info.commitSha}/package.json`; let packageJsonPath = 'https://raw.githubusercontent.com/' + repoId + `/${info.commitSha}/`;
if (packageJsonPathOverride) {
packageJsonPath += packageJsonPathOverride;
}
packageJsonPath += '/package.json';
for (let i = 0; i < cgmanifestRead.registrations.length; i++) { for (let i = 0; i < cgmanifestRead.registrations.length; i++) {
if (cgmanifestRead.registrations[i].component.git.repositoryUrl.substr(cgmanifestRead.registrations[i].component.git.repositoryUrl.length - repoId.length, repoId.length) === repoId) { if (cgmanifestRead.registrations[i].component.git.repositoryUrl.substr(cgmanifestRead.registrations[i].component.git.repositoryUrl.length - repoId.length, repoId.length) === repoId) {
cgmanifestRead.registrations[i].component.git.commitHash = info.commitSha; cgmanifestRead.registrations[i].component.git.commitHash = info.commitSha;

View File

@ -6,8 +6,8 @@
var updateGrammar = require('../../../build/npm/update-grammar'); var updateGrammar = require('../../../build/npm/update-grammar');
updateGrammar.update('jeff-hykin/cpp-textmate-grammar', '/syntaxes/c.tmLanguage.json', './syntaxes/c.tmLanguage.json'); updateGrammar.update('jeff-hykin/cpp-textmate-grammar', '/syntaxes/c.tmLanguage.json', './syntaxes/c.tmLanguage.json', undefined, 'master', 'source/languages/cpp');
updateGrammar.update('jeff-hykin/cpp-textmate-grammar', '/syntaxes/cpp.tmLanguage.json', './syntaxes/cpp.tmLanguage.json'); updateGrammar.update('jeff-hykin/cpp-textmate-grammar', '/syntaxes/cpp.tmLanguage.json', './syntaxes/cpp.tmLanguage.json', undefined, 'master', 'source/languages/cpp');
// `source.c.platform` which is still included by other grammars // `source.c.platform` which is still included by other grammars
updateGrammar.update('textmate/c.tmbundle', 'Syntaxes/Platform.tmLanguage', './syntaxes/platform.tmLanguage.json'); updateGrammar.update('textmate/c.tmbundle', 'Syntaxes/Platform.tmLanguage', './syntaxes/platform.tmLanguage.json');

View File

@ -6,11 +6,11 @@
"git": { "git": {
"name": "jeff-hykin/cpp-textmate-grammar", "name": "jeff-hykin/cpp-textmate-grammar",
"repositoryUrl": "https://github.com/jeff-hykin/cpp-textmate-grammar", "repositoryUrl": "https://github.com/jeff-hykin/cpp-textmate-grammar",
"commitHash": "cb9cb59b32d0cb9e2cbbca1a9cdb62769fc2ca8e" "commitHash": "992c5ba8789288707f2a13778452d644677d9699"
} }
}, },
"license": "MIT", "license": "MIT",
"version": "1.0.0", "version": "1.12.18",
"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." "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."
}, },
{ {

View File

@ -4,7 +4,7 @@
"If you want to provide a fix or improvement, please create a pull request against the original repository.", "If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request." "Once accepted there, we are happy to receive an update request."
], ],
"version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/cb9cb59b32d0cb9e2cbbca1a9cdb62769fc2ca8e", "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/992c5ba8789288707f2a13778452d644677d9699",
"name": "C++", "name": "C++",
"scopeName": "source.cpp", "scopeName": "source.cpp",
"patterns": [ "patterns": [
@ -143,9 +143,6 @@
{ {
"include": "#preprocessor_rule_conditional" "include": "#preprocessor_rule_conditional"
}, },
{
"include": "#macro_argument"
},
{ {
"include": "#meta_preprocessor_macro" "include": "#meta_preprocessor_macro"
}, },
@ -19409,6 +19406,9 @@
}, },
{ {
"include": "#evaluation_context" "include": "#evaluation_context"
},
{
"include": "#macro_argument"
} }
] ]
} }

View File

@ -22,58 +22,69 @@
} }
}, },
{ {
"c": "#include", "c": "#",
"t": "source.cpp variable.other.macro.argument.cpp", "t": "source.cpp meta.preprocessor.include.cpp keyword.control.directive.include.cpp punctuation.definition.directive.cpp",
"r": { "r": {
"dark_plus": "variable: #9CDCFE", "dark_plus": "keyword.control: #C586C0",
"light_plus": "variable: #001080", "light_plus": "keyword.control: #AF00DB",
"dark_vs": "default: #D4D4D4", "dark_vs": "keyword.control: #569CD6",
"light_vs": "default: #000000", "light_vs": "keyword.control: #0000FF",
"hc_black": "variable: #9CDCFE" "hc_black": "keyword.control: #C586C0"
}
},
{
"c": "include",
"t": "source.cpp meta.preprocessor.include.cpp keyword.control.directive.include.cpp",
"r": {
"dark_plus": "keyword.control: #C586C0",
"light_plus": "keyword.control: #AF00DB",
"dark_vs": "keyword.control: #569CD6",
"light_vs": "keyword.control: #0000FF",
"hc_black": "keyword.control: #C586C0"
} }
}, },
{ {
"c": " ", "c": " ",
"t": "source.cpp", "t": "source.cpp meta.preprocessor.include.cpp",
"r": { "r": {
"dark_plus": "default: #D4D4D4", "dark_plus": "meta.preprocessor: #569CD6",
"light_plus": "default: #000000", "light_plus": "meta.preprocessor: #0000FF",
"dark_vs": "default: #D4D4D4", "dark_vs": "meta.preprocessor: #569CD6",
"light_vs": "default: #000000", "light_vs": "meta.preprocessor: #0000FF",
"hc_black": "default: #FFFFFF" "hc_black": "meta.preprocessor: #569CD6"
} }
}, },
{ {
"c": "<", "c": "<",
"t": "source.cpp keyword.operator.comparison.cpp", "t": "source.cpp meta.preprocessor.include.cpp string.quoted.other.lt-gt.include.cpp punctuation.definition.string.begin.cpp",
"r": { "r": {
"dark_plus": "keyword.operator: #D4D4D4", "dark_plus": "string: #CE9178",
"light_plus": "keyword.operator: #000000", "light_plus": "string: #A31515",
"dark_vs": "keyword.operator: #D4D4D4", "dark_vs": "string: #CE9178",
"light_vs": "keyword.operator: #000000", "light_vs": "string: #A31515",
"hc_black": "keyword.operator: #D4D4D4" "hc_black": "string: #CE9178"
} }
}, },
{ {
"c": "iostream", "c": "iostream",
"t": "source.cpp", "t": "source.cpp meta.preprocessor.include.cpp string.quoted.other.lt-gt.include.cpp",
"r": { "r": {
"dark_plus": "default: #D4D4D4", "dark_plus": "string: #CE9178",
"light_plus": "default: #000000", "light_plus": "string: #A31515",
"dark_vs": "default: #D4D4D4", "dark_vs": "string: #CE9178",
"light_vs": "default: #000000", "light_vs": "string: #A31515",
"hc_black": "default: #FFFFFF" "hc_black": "string: #CE9178"
} }
}, },
{ {
"c": ">", "c": ">",
"t": "source.cpp keyword.operator.comparison.cpp", "t": "source.cpp meta.preprocessor.include.cpp string.quoted.other.lt-gt.include.cpp punctuation.definition.string.end.cpp",
"r": { "r": {
"dark_plus": "keyword.operator: #D4D4D4", "dark_plus": "string: #CE9178",
"light_plus": "keyword.operator: #000000", "light_plus": "string: #A31515",
"dark_vs": "keyword.operator: #D4D4D4", "dark_vs": "string: #CE9178",
"light_vs": "keyword.operator: #000000", "light_vs": "string: #A31515",
"hc_black": "keyword.operator: #D4D4D4" "hc_black": "string: #CE9178"
} }
}, },
{ {

View File

@ -6,6 +6,6 @@
var updateGrammar = require('../../../build/npm/update-grammar'); var updateGrammar = require('../../../build/npm/update-grammar');
updateGrammar.update('jeff-hykin/cpp-textmate-grammar', '/syntaxes/objc.tmLanguage.json', './syntaxes/objective-c.tmLanguage.json'); updateGrammar.update('jeff-hykin/cpp-textmate-grammar', '/syntaxes/objc.tmLanguage.json', './syntaxes/objective-c.tmLanguage.json', undefined, 'master', 'source/languages/cpp');
updateGrammar.update('jeff-hykin/cpp-textmate-grammar', '/syntaxes/objcpp.tmLanguage.json', './syntaxes/objective-c++.tmLanguage.json'); updateGrammar.update('jeff-hykin/cpp-textmate-grammar', '/syntaxes/objcpp.tmLanguage.json', './syntaxes/objective-c++.tmLanguage.json', undefined, 'master', 'source/languages/cpp');

View File

@ -10,7 +10,7 @@
} }
}, },
"license": "MIT", "license": "MIT",
"version": "1.0.0", "version": "1.12.11",
"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." "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."
} }
], ],