@qrvey/formula-lang
Version:
QFormula support for qrvey projects
39 lines • 3.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Transpile = exports.getPrimitiveAsValue = exports.cleanInvalidItemsInContext = exports.errorAnalyzer = exports.BaseError = exports.TranspileAST = exports.getFunctionDetail = exports.FUNCTION_LIST = exports.AST_PRIMITIVES = exports.ENGINES = exports.calculateAST = exports.FormulaParser = exports.FormulaLang = exports.FormulaHighlight = void 0;
const qformula_grammar_1 = require("./grammar/qformula.grammar");
const json_parser_1 = require("./parser/json-parser");
const index_1 = require("./transpiler/index");
var qformula_grammar_2 = require("./grammar/qformula.grammar");
Object.defineProperty(exports, "FormulaHighlight", { enumerable: true, get: function () { return qformula_grammar_2.QFormula; } });
Object.defineProperty(exports, "FormulaLang", { enumerable: true, get: function () { return qformula_grammar_2.QFormulaLang; } });
Object.defineProperty(exports, "FormulaParser", { enumerable: true, get: function () { return qformula_grammar_2.QFormulaParser; } });
var json_parser_2 = require("./parser/json-parser");
Object.defineProperty(exports, "calculateAST", { enumerable: true, get: function () { return json_parser_2.calculateAST; } });
var index_2 = require("./constants/index");
Object.defineProperty(exports, "ENGINES", { enumerable: true, get: function () { return index_2.ENGINES; } });
Object.defineProperty(exports, "AST_PRIMITIVES", { enumerable: true, get: function () { return index_2.AST_PRIMITIVES; } });
var index_3 = require("./functions/index");
Object.defineProperty(exports, "FUNCTION_LIST", { enumerable: true, get: function () { return index_3.FUNCTION_LIST; } });
Object.defineProperty(exports, "getFunctionDetail", { enumerable: true, get: function () { return index_3.getFunctionDetail; } });
var index_4 = require("./transpiler/index");
Object.defineProperty(exports, "TranspileAST", { enumerable: true, get: function () { return index_4.TranspileAST; } });
var errors_1 = require("./errors");
Object.defineProperty(exports, "BaseError", { enumerable: true, get: function () { return errors_1.BaseError; } });
Object.defineProperty(exports, "errorAnalyzer", { enumerable: true, get: function () { return errors_1.errorAnalyzer; } });
var utils_1 = require("./utils");
Object.defineProperty(exports, "cleanInvalidItemsInContext", { enumerable: true, get: function () { return utils_1.cleanInvalidItemsInContext; } });
var primitiveFunctions_1 = require("./utils/primitiveFunctions");
Object.defineProperty(exports, "getPrimitiveAsValue", { enumerable: true, get: function () { return primitiveFunctions_1.getPrimitiveAsValue; } });
function Transpile(program, engine, context) {
const parser = qformula_grammar_1.QFormulaLang.parser;
const tree = parser.parse(program);
if (!tree.topNode)
return;
const ast = (0, json_parser_1.calculateAST)(program, tree, context);
if (!ast)
return;
return (0, index_1.TranspileAST)(ast, engine, context);
}
exports.Transpile = Transpile;
//# sourceMappingURL=index.js.map