Skip to content

Commit 7ee19c5

Browse files
committed
Code cleanup of generator.
1 parent dd16ffe commit 7ee19c5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tests/src/extract_macros.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ let document = function(packages, output = false) {
7373
};
7474

7575

76+
let outputError = function(char, type) {
77+
console.error(`${type} Error: ` + char._symbol);
78+
};
79+
80+
81+
7682
let convert = function(command, packages) {
7783
let doc = document(packages);
7884
let root = doc.convert(command, {end: STATE.CONVERT});
@@ -95,7 +101,7 @@ let collateDelimiters = function(map, packages) {
95101
let entry = `\\left${key} A \\middle${key} B \\right${key}`;
96102
let [conversion, error] = convert(entry, packages);
97103
if (error) {
98-
console.log('Delimiter Error: ' + char._symbol);
104+
outputError(char, 'Delimiter');
99105
} else {
100106
result[key] = {'input': entry, 'expected': conversion};
101107
}
@@ -174,7 +180,7 @@ let convertMacro = function(key, char, packages) {
174180
[conversion, error] = convert(str, packages);
175181
}
176182
if (error) {
177-
console.log('Command Error: ' + char._symbol);
183+
outputError(char, 'Command');
178184
str = '';
179185
}
180186
return [str, conversion];
@@ -201,7 +207,7 @@ let collateEnvironments = function(map, packages) {
201207
[conversion, error] = convert(entry, packages);
202208
}
203209
if (error) {
204-
console.log('Environment Error: ' + char._symbol);
210+
outputError(char, 'Environment');
205211
} else {
206212
result[key] = {'input': entry, 'expected': conversion};
207213
}
@@ -228,6 +234,7 @@ let collateMap = function(table, packages, pkg, method) {
228234

229235

230236
for (let pkg of ConfigurationHandler.keys()) {
237+
// We ignore these two packages for automatic completion.
231238
if (pkg === 'bussproofs' || pkg === 'newcommand') continue;
232239
let configuration = ConfigurationHandler.get(pkg);
233240
packageMkdir(configuration);
@@ -236,7 +243,6 @@ for (let pkg of ConfigurationHandler.keys()) {
236243
for (let handler of handlers) {
237244
let table = MapHandler.getMap(handler);
238245
if (table instanceof sm.RegExpMap) continue;
239-
//TODO: Be careful if the table is a delimiter table!
240246
if (table instanceof sm.DelimiterMap) {
241247
collateMap(table, packages, pkg, collateDelimiters);
242248
};

0 commit comments

Comments
 (0)