You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
543 B
21 lines
543 B
2 years ago
|
const convertTokens = require("./convertTokens.cjs");
|
||
|
|
||
|
const convertComments = require("./convertComments.cjs");
|
||
|
|
||
|
const convertAST = require("./convertAST.cjs");
|
||
|
|
||
|
exports.ast = function convert(ast, code, tokLabels, visitorKeys) {
|
||
|
ast.tokens = convertTokens(ast.tokens, code, tokLabels);
|
||
|
convertComments(ast.comments);
|
||
|
convertAST(ast, visitorKeys);
|
||
|
return ast;
|
||
|
};
|
||
|
|
||
|
exports.error = function convertError(err) {
|
||
|
if (err instanceof SyntaxError) {
|
||
|
err.lineNumber = err.loc.line;
|
||
|
err.column = err.loc.column;
|
||
|
}
|
||
|
|
||
|
return err;
|
||
|
};
|