@qrvey/formula-lang 2.0.0-post-mvp → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +210 -0
- package/README.md +32 -0
- package/dist/cjs/constants/index.d.ts +9 -2
- package/dist/cjs/constants/index.js +12 -1
- package/dist/cjs/constants/index.js.map +1 -1
- package/dist/cjs/constants/interfaces.d.ts +44 -14
- package/dist/cjs/errors/analyzer/index.js +1 -1
- package/dist/cjs/errors/analyzer/index.js.map +1 -1
- package/dist/cjs/errors/definitions.d.ts +27 -15
- package/dist/cjs/errors/definitions.js +47 -21
- package/dist/cjs/errors/definitions.js.map +1 -1
- package/dist/cjs/errors/dictionary.d.ts +6 -5
- package/dist/cjs/errors/dictionary.js +27 -22
- package/dist/cjs/errors/dictionary.js.map +1 -1
- package/dist/cjs/errors/index.d.ts +1 -0
- package/dist/cjs/errors/index.js +1 -0
- package/dist/cjs/errors/index.js.map +1 -1
- package/dist/cjs/errors/mismatch.d.ts +31 -0
- package/dist/cjs/errors/mismatch.js +77 -0
- package/dist/cjs/errors/mismatch.js.map +1 -0
- package/dist/cjs/functions/abs.js +1 -2
- package/dist/cjs/functions/abs.js.map +1 -1
- package/dist/cjs/functions/and.d.ts +5 -0
- package/dist/cjs/functions/and.js +55 -0
- package/dist/cjs/functions/and.js.map +1 -0
- package/dist/cjs/functions/concatenate.d.ts +5 -0
- package/dist/cjs/functions/concatenate.js +56 -0
- package/dist/cjs/functions/concatenate.js.map +1 -0
- package/dist/cjs/functions/dateadd.d.ts +5 -0
- package/dist/cjs/functions/dateadd.js +114 -0
- package/dist/cjs/functions/dateadd.js.map +1 -0
- package/dist/cjs/functions/datedif.js +9 -15
- package/dist/cjs/functions/datedif.js.map +1 -1
- package/dist/cjs/functions/datesubtract.d.ts +5 -0
- package/dist/cjs/functions/datesubtract.js +114 -0
- package/dist/cjs/functions/datesubtract.js.map +1 -0
- package/dist/cjs/functions/day.js +1 -2
- package/dist/cjs/functions/day.js.map +1 -1
- package/dist/cjs/functions/dayofweek.d.ts +5 -0
- package/dist/cjs/functions/dayofweek.js +90 -0
- package/dist/cjs/functions/dayofweek.js.map +1 -0
- package/dist/cjs/functions/even.d.ts +5 -0
- package/dist/cjs/functions/even.js +46 -0
- package/dist/cjs/functions/even.js.map +1 -0
- package/dist/cjs/functions/exp.d.ts +5 -0
- package/dist/cjs/functions/exp.js +42 -0
- package/dist/cjs/functions/exp.js.map +1 -0
- package/dist/cjs/functions/hour.js +1 -2
- package/dist/cjs/functions/hour.js.map +1 -1
- package/dist/cjs/functions/if.js +32 -13
- package/dist/cjs/functions/if.js.map +1 -1
- package/dist/cjs/functions/ifs.js +37 -15
- package/dist/cjs/functions/ifs.js.map +1 -1
- package/dist/cjs/functions/include.d.ts +5 -0
- package/dist/cjs/functions/include.js +48 -0
- package/dist/cjs/functions/include.js.map +1 -0
- package/dist/cjs/functions/index.js +54 -0
- package/dist/cjs/functions/index.js.map +1 -1
- package/dist/cjs/functions/isNull.js +53 -12
- package/dist/cjs/functions/isNull.js.map +1 -1
- package/dist/cjs/functions/left.d.ts +5 -0
- package/dist/cjs/functions/left.js +62 -0
- package/dist/cjs/functions/left.js.map +1 -0
- package/dist/cjs/functions/length.d.ts +5 -0
- package/dist/cjs/functions/length.js +45 -0
- package/dist/cjs/functions/length.js.map +1 -0
- package/dist/cjs/functions/log.d.ts +5 -0
- package/dist/cjs/functions/log.js +59 -0
- package/dist/cjs/functions/log.js.map +1 -0
- package/dist/cjs/functions/lower.d.ts +5 -0
- package/dist/cjs/functions/lower.js +42 -0
- package/dist/cjs/functions/lower.js.map +1 -0
- package/dist/cjs/functions/max.d.ts +5 -0
- package/dist/cjs/functions/max.js +60 -0
- package/dist/cjs/functions/max.js.map +1 -0
- package/dist/cjs/functions/mid.js +32 -13
- package/dist/cjs/functions/mid.js.map +1 -1
- package/dist/cjs/functions/min.d.ts +5 -0
- package/dist/cjs/functions/min.js +60 -0
- package/dist/cjs/functions/min.js.map +1 -0
- package/dist/cjs/functions/minute.js +1 -2
- package/dist/cjs/functions/minute.js.map +1 -1
- package/dist/cjs/functions/month.js +1 -2
- package/dist/cjs/functions/month.js.map +1 -1
- package/dist/cjs/functions/odd.d.ts +5 -0
- package/dist/cjs/functions/odd.js +46 -0
- package/dist/cjs/functions/odd.js.map +1 -0
- package/dist/cjs/functions/or.d.ts +5 -0
- package/dist/cjs/functions/or.js +55 -0
- package/dist/cjs/functions/or.js.map +1 -0
- package/dist/cjs/functions/power.d.ts +5 -0
- package/dist/cjs/functions/power.js +53 -0
- package/dist/cjs/functions/power.js.map +1 -0
- package/dist/cjs/functions/proper.d.ts +5 -0
- package/dist/cjs/functions/proper.js +39 -0
- package/dist/cjs/functions/proper.js.map +1 -0
- package/dist/cjs/functions/random.d.ts +5 -0
- package/dist/cjs/functions/random.js +34 -0
- package/dist/cjs/functions/random.js.map +1 -0
- package/dist/cjs/functions/replace.d.ts +5 -0
- package/dist/cjs/functions/replace.js +54 -0
- package/dist/cjs/functions/replace.js.map +1 -0
- package/dist/cjs/functions/right.d.ts +5 -0
- package/dist/cjs/functions/right.js +63 -0
- package/dist/cjs/functions/right.js.map +1 -0
- package/dist/cjs/functions/round.d.ts +5 -0
- package/dist/cjs/functions/round.js +59 -0
- package/dist/cjs/functions/round.js.map +1 -0
- package/dist/cjs/functions/rounddown.d.ts +5 -0
- package/dist/cjs/functions/rounddown.js +59 -0
- package/dist/cjs/functions/rounddown.js.map +1 -0
- package/dist/cjs/functions/roundup.d.ts +5 -0
- package/dist/cjs/functions/roundup.js +59 -0
- package/dist/cjs/functions/roundup.js.map +1 -0
- package/dist/cjs/functions/second.js +1 -2
- package/dist/cjs/functions/second.js.map +1 -1
- package/dist/cjs/functions/sqrt.d.ts +5 -0
- package/dist/cjs/functions/sqrt.js +46 -0
- package/dist/cjs/functions/sqrt.js.map +1 -0
- package/dist/cjs/functions/trim.d.ts +5 -0
- package/dist/cjs/functions/trim.js +42 -0
- package/dist/cjs/functions/trim.js.map +1 -0
- package/dist/cjs/functions/upper.d.ts +5 -0
- package/dist/cjs/functions/upper.js +42 -0
- package/dist/cjs/functions/upper.js.map +1 -0
- package/dist/cjs/functions/year.js +1 -2
- package/dist/cjs/functions/year.js.map +1 -1
- package/dist/cjs/grammar/generated/qformula.lang.d.ts +2 -9
- package/dist/cjs/grammar/generated/qformula.lang.js +58 -33
- package/dist/cjs/grammar/generated/qformula.lang.js.map +1 -1
- package/dist/cjs/grammar/generated/qformula.lang.terms.d.ts +20 -19
- package/dist/cjs/grammar/generated/qformula.lang.terms.js +2 -2
- package/dist/cjs/grammar/generated/qformula.lang.terms.js.map +1 -1
- package/dist/cjs/grammar/tokens.d.ts +2 -0
- package/dist/cjs/grammar/tokens.js +26 -0
- package/dist/cjs/grammar/tokens.js.map +1 -0
- package/dist/cjs/index.d.ts +3 -1
- package/dist/cjs/index.js +6 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/parser/formula-parser.d.ts +2 -1
- package/dist/cjs/parser/formula-parser.js +11 -12
- package/dist/cjs/parser/formula-parser.js.map +1 -1
- package/dist/cjs/parser/json-parser.js +73 -27
- package/dist/cjs/parser/json-parser.js.map +1 -1
- package/dist/cjs/transpiler/columnTranspilation.d.ts +1 -1
- package/dist/cjs/transpiler/columnTranspilation.js +22 -4
- package/dist/cjs/transpiler/columnTranspilation.js.map +1 -1
- package/dist/cjs/transpiler/index.js +104 -17
- package/dist/cjs/transpiler/index.js.map +1 -1
- package/dist/cjs/transpiler/validateFuncStructure.d.ts +1 -1
- package/dist/cjs/transpiler/validateFuncStructure.js +65 -17
- package/dist/cjs/transpiler/validateFuncStructure.js.map +1 -1
- package/dist/cjs/utils/addDecimalPointIfNeeded.d.ts +3 -0
- package/dist/cjs/utils/addDecimalPointIfNeeded.js +19 -0
- package/dist/cjs/utils/addDecimalPointIfNeeded.js.map +1 -0
- package/dist/cjs/utils/cleanInvalidItemsInContext.d.ts +3 -0
- package/dist/cjs/utils/cleanInvalidItemsInContext.js +28 -0
- package/dist/cjs/utils/cleanInvalidItemsInContext.js.map +1 -0
- package/dist/cjs/utils/elasticsearch/index.js +33 -0
- package/dist/cjs/utils/elasticsearch/index.js.map +1 -1
- package/dist/cjs/utils/elasticsearch/scripts.d.ts +16 -1
- package/dist/cjs/utils/elasticsearch/scripts.js +150 -12
- package/dist/cjs/utils/elasticsearch/scripts.js.map +1 -1
- package/dist/cjs/utils/escapeCharacters.d.ts +2 -0
- package/dist/cjs/utils/escapeCharacters.js +41 -0
- package/dist/cjs/utils/escapeCharacters.js.map +1 -0
- package/dist/cjs/utils/getNumericValueFromArgument.d.ts +3 -0
- package/dist/cjs/utils/getNumericValueFromArgument.js +32 -0
- package/dist/cjs/utils/getNumericValueFromArgument.js.map +1 -0
- package/dist/cjs/utils/getValidDataTypeParam.d.ts +3 -0
- package/dist/cjs/utils/getValidDataTypeParam.js +10 -0
- package/dist/cjs/utils/getValidDataTypeParam.js.map +1 -0
- package/dist/cjs/utils/getVariableType.js +2 -0
- package/dist/cjs/utils/getVariableType.js.map +1 -1
- package/dist/cjs/utils/greaterThanOrEqualToReference.d.ts +3 -0
- package/dist/cjs/utils/greaterThanOrEqualToReference.js +20 -0
- package/dist/cjs/utils/greaterThanOrEqualToReference.js.map +1 -0
- package/dist/cjs/utils/greaterThanReference.d.ts +3 -0
- package/dist/cjs/utils/greaterThanReference.js +19 -0
- package/dist/cjs/utils/greaterThanReference.js.map +1 -0
- package/dist/cjs/utils/index.d.ts +1 -0
- package/dist/cjs/utils/index.js +2 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/isAColumn.d.ts +2 -3
- package/dist/cjs/utils/isAColumn.js +2 -6
- package/dist/cjs/utils/isAColumn.js.map +1 -1
- package/dist/cjs/utils/isALiteral.d.ts +2 -0
- package/dist/cjs/utils/isALiteral.js +9 -0
- package/dist/cjs/utils/isALiteral.js.map +1 -0
- package/dist/cjs/utils/isAValidPower.d.ts +3 -0
- package/dist/cjs/utils/isAValidPower.js +21 -0
- package/dist/cjs/utils/isAValidPower.js.map +1 -0
- package/dist/cjs/utils/isAnAllowedValue.d.ts +2 -0
- package/dist/cjs/utils/isAnAllowedValue.js +20 -0
- package/dist/cjs/utils/isAnAllowedValue.js.map +1 -0
- package/dist/cjs/utils/isBetweenInclusiveRange.d.ts +3 -0
- package/dist/cjs/utils/isBetweenInclusiveRange.js +21 -0
- package/dist/cjs/utils/isBetweenInclusiveRange.js.map +1 -0
- package/dist/cjs/utils/isBooleanExpression.d.ts +1 -1
- package/dist/cjs/utils/isBooleanExpression.js +9 -5
- package/dist/cjs/utils/isBooleanExpression.js.map +1 -1
- package/dist/cjs/utils/isDateParam.js +8 -2
- package/dist/cjs/utils/isDateParam.js.map +1 -1
- package/dist/cjs/utils/isInteger.d.ts +3 -0
- package/dist/cjs/utils/isInteger.js +25 -0
- package/dist/cjs/utils/isInteger.js.map +1 -0
- package/dist/cjs/utils/isLongLiteralNumber.js +2 -1
- package/dist/cjs/utils/isLongLiteralNumber.js.map +1 -1
- package/dist/cjs/utils/isNumberParam.js +8 -2
- package/dist/cjs/utils/isNumberParam.js.map +1 -1
- package/dist/cjs/utils/isSameAndValidRecursiveDataType.d.ts +3 -0
- package/dist/cjs/utils/isSameAndValidRecursiveDataType.js +32 -0
- package/dist/cjs/utils/isSameAndValidRecursiveDataType.js.map +1 -0
- package/dist/cjs/utils/isStringParam.js +8 -2
- package/dist/cjs/utils/isStringParam.js.map +1 -1
- package/dist/cjs/utils/primitiveFunctions.d.ts +4 -0
- package/dist/cjs/utils/primitiveFunctions.js +11 -1
- package/dist/cjs/utils/primitiveFunctions.js.map +1 -1
- package/dist/module/constants/index.d.ts +9 -2
- package/dist/module/constants/index.js +11 -0
- package/dist/module/constants/index.js.map +1 -1
- package/dist/module/constants/interfaces.d.ts +44 -14
- package/dist/module/errors/analyzer/index.js +1 -1
- package/dist/module/errors/analyzer/index.js.map +1 -1
- package/dist/module/errors/definitions.d.ts +27 -15
- package/dist/module/errors/definitions.js +41 -17
- package/dist/module/errors/definitions.js.map +1 -1
- package/dist/module/errors/dictionary.d.ts +6 -5
- package/dist/module/errors/dictionary.js +27 -22
- package/dist/module/errors/dictionary.js.map +1 -1
- package/dist/module/errors/index.d.ts +1 -0
- package/dist/module/errors/index.js +1 -0
- package/dist/module/errors/index.js.map +1 -1
- package/dist/module/errors/mismatch.d.ts +31 -0
- package/dist/module/errors/mismatch.js +72 -0
- package/dist/module/errors/mismatch.js.map +1 -0
- package/dist/module/functions/abs.js +1 -2
- package/dist/module/functions/abs.js.map +1 -1
- package/dist/module/functions/and.d.ts +5 -0
- package/dist/module/functions/and.js +52 -0
- package/dist/module/functions/and.js.map +1 -0
- package/dist/module/functions/concatenate.d.ts +5 -0
- package/dist/module/functions/concatenate.js +53 -0
- package/dist/module/functions/concatenate.js.map +1 -0
- package/dist/module/functions/dateadd.d.ts +5 -0
- package/dist/module/functions/dateadd.js +111 -0
- package/dist/module/functions/dateadd.js.map +1 -0
- package/dist/module/functions/datedif.js +9 -15
- package/dist/module/functions/datedif.js.map +1 -1
- package/dist/module/functions/datesubtract.d.ts +5 -0
- package/dist/module/functions/datesubtract.js +111 -0
- package/dist/module/functions/datesubtract.js.map +1 -0
- package/dist/module/functions/day.js +1 -2
- package/dist/module/functions/day.js.map +1 -1
- package/dist/module/functions/dayofweek.d.ts +5 -0
- package/dist/module/functions/dayofweek.js +87 -0
- package/dist/module/functions/dayofweek.js.map +1 -0
- package/dist/module/functions/even.d.ts +5 -0
- package/dist/module/functions/even.js +43 -0
- package/dist/module/functions/even.js.map +1 -0
- package/dist/module/functions/exp.d.ts +5 -0
- package/dist/module/functions/exp.js +39 -0
- package/dist/module/functions/exp.js.map +1 -0
- package/dist/module/functions/hour.js +1 -2
- package/dist/module/functions/hour.js.map +1 -1
- package/dist/module/functions/if.js +33 -14
- package/dist/module/functions/if.js.map +1 -1
- package/dist/module/functions/ifs.js +38 -16
- package/dist/module/functions/ifs.js.map +1 -1
- package/dist/module/functions/include.d.ts +5 -0
- package/dist/module/functions/include.js +45 -0
- package/dist/module/functions/include.js.map +1 -0
- package/dist/module/functions/index.js +54 -0
- package/dist/module/functions/index.js.map +1 -1
- package/dist/module/functions/isNull.js +55 -14
- package/dist/module/functions/isNull.js.map +1 -1
- package/dist/module/functions/left.d.ts +5 -0
- package/dist/module/functions/left.js +59 -0
- package/dist/module/functions/left.js.map +1 -0
- package/dist/module/functions/length.d.ts +5 -0
- package/dist/module/functions/length.js +42 -0
- package/dist/module/functions/length.js.map +1 -0
- package/dist/module/functions/log.d.ts +5 -0
- package/dist/module/functions/log.js +56 -0
- package/dist/module/functions/log.js.map +1 -0
- package/dist/module/functions/lower.d.ts +5 -0
- package/dist/module/functions/lower.js +39 -0
- package/dist/module/functions/lower.js.map +1 -0
- package/dist/module/functions/max.d.ts +5 -0
- package/dist/module/functions/max.js +57 -0
- package/dist/module/functions/max.js.map +1 -0
- package/dist/module/functions/mid.js +32 -13
- package/dist/module/functions/mid.js.map +1 -1
- package/dist/module/functions/min.d.ts +5 -0
- package/dist/module/functions/min.js +57 -0
- package/dist/module/functions/min.js.map +1 -0
- package/dist/module/functions/minute.js +1 -2
- package/dist/module/functions/minute.js.map +1 -1
- package/dist/module/functions/month.js +1 -2
- package/dist/module/functions/month.js.map +1 -1
- package/dist/module/functions/odd.d.ts +5 -0
- package/dist/module/functions/odd.js +43 -0
- package/dist/module/functions/odd.js.map +1 -0
- package/dist/module/functions/or.d.ts +5 -0
- package/dist/module/functions/or.js +52 -0
- package/dist/module/functions/or.js.map +1 -0
- package/dist/module/functions/power.d.ts +5 -0
- package/dist/module/functions/power.js +50 -0
- package/dist/module/functions/power.js.map +1 -0
- package/dist/module/functions/proper.d.ts +5 -0
- package/dist/module/functions/proper.js +36 -0
- package/dist/module/functions/proper.js.map +1 -0
- package/dist/module/functions/random.d.ts +5 -0
- package/dist/module/functions/random.js +31 -0
- package/dist/module/functions/random.js.map +1 -0
- package/dist/module/functions/replace.d.ts +5 -0
- package/dist/module/functions/replace.js +51 -0
- package/dist/module/functions/replace.js.map +1 -0
- package/dist/module/functions/right.d.ts +5 -0
- package/dist/module/functions/right.js +60 -0
- package/dist/module/functions/right.js.map +1 -0
- package/dist/module/functions/round.d.ts +5 -0
- package/dist/module/functions/round.js +56 -0
- package/dist/module/functions/round.js.map +1 -0
- package/dist/module/functions/rounddown.d.ts +5 -0
- package/dist/module/functions/rounddown.js +56 -0
- package/dist/module/functions/rounddown.js.map +1 -0
- package/dist/module/functions/roundup.d.ts +5 -0
- package/dist/module/functions/roundup.js +56 -0
- package/dist/module/functions/roundup.js.map +1 -0
- package/dist/module/functions/second.js +1 -2
- package/dist/module/functions/second.js.map +1 -1
- package/dist/module/functions/sqrt.d.ts +5 -0
- package/dist/module/functions/sqrt.js +43 -0
- package/dist/module/functions/sqrt.js.map +1 -0
- package/dist/module/functions/trim.d.ts +5 -0
- package/dist/module/functions/trim.js +39 -0
- package/dist/module/functions/trim.js.map +1 -0
- package/dist/module/functions/upper.d.ts +5 -0
- package/dist/module/functions/upper.js +39 -0
- package/dist/module/functions/upper.js.map +1 -0
- package/dist/module/functions/year.js +1 -2
- package/dist/module/functions/year.js.map +1 -1
- package/dist/module/grammar/generated/qformula.lang.d.ts +2 -9
- package/dist/module/grammar/generated/qformula.lang.js +58 -33
- package/dist/module/grammar/generated/qformula.lang.js.map +1 -1
- package/dist/module/grammar/generated/qformula.lang.terms.d.ts +20 -19
- package/dist/module/grammar/generated/qformula.lang.terms.js +1 -1
- package/dist/module/grammar/generated/qformula.lang.terms.js.map +1 -1
- package/dist/module/grammar/tokens.d.ts +2 -0
- package/dist/module/grammar/tokens.js +23 -0
- package/dist/module/grammar/tokens.js.map +1 -0
- package/dist/module/index.d.ts +3 -1
- package/dist/module/index.js +3 -1
- package/dist/module/index.js.map +1 -1
- package/dist/module/parser/formula-parser.d.ts +2 -1
- package/dist/module/parser/formula-parser.js +9 -11
- package/dist/module/parser/formula-parser.js.map +1 -1
- package/dist/module/parser/json-parser.js +75 -29
- package/dist/module/parser/json-parser.js.map +1 -1
- package/dist/module/transpiler/columnTranspilation.d.ts +1 -1
- package/dist/module/transpiler/columnTranspilation.js +22 -4
- package/dist/module/transpiler/columnTranspilation.js.map +1 -1
- package/dist/module/transpiler/index.js +104 -17
- package/dist/module/transpiler/index.js.map +1 -1
- package/dist/module/transpiler/validateFuncStructure.d.ts +1 -1
- package/dist/module/transpiler/validateFuncStructure.js +65 -17
- package/dist/module/transpiler/validateFuncStructure.js.map +1 -1
- package/dist/module/utils/addDecimalPointIfNeeded.d.ts +3 -0
- package/dist/module/utils/addDecimalPointIfNeeded.js +15 -0
- package/dist/module/utils/addDecimalPointIfNeeded.js.map +1 -0
- package/dist/module/utils/cleanInvalidItemsInContext.d.ts +3 -0
- package/dist/module/utils/cleanInvalidItemsInContext.js +24 -0
- package/dist/module/utils/cleanInvalidItemsInContext.js.map +1 -0
- package/dist/module/utils/elasticsearch/index.js +34 -1
- package/dist/module/utils/elasticsearch/index.js.map +1 -1
- package/dist/module/utils/elasticsearch/scripts.d.ts +16 -1
- package/dist/module/utils/elasticsearch/scripts.js +149 -11
- package/dist/module/utils/elasticsearch/scripts.js.map +1 -1
- package/dist/module/utils/escapeCharacters.d.ts +2 -0
- package/dist/module/utils/escapeCharacters.js +37 -0
- package/dist/module/utils/escapeCharacters.js.map +1 -0
- package/dist/module/utils/getNumericValueFromArgument.d.ts +3 -0
- package/dist/module/utils/getNumericValueFromArgument.js +27 -0
- package/dist/module/utils/getNumericValueFromArgument.js.map +1 -0
- package/dist/module/utils/getValidDataTypeParam.d.ts +3 -0
- package/dist/module/utils/getValidDataTypeParam.js +6 -0
- package/dist/module/utils/getValidDataTypeParam.js.map +1 -0
- package/dist/module/utils/getVariableType.js +2 -0
- package/dist/module/utils/getVariableType.js.map +1 -1
- package/dist/module/utils/greaterThanOrEqualToReference.d.ts +3 -0
- package/dist/module/utils/greaterThanOrEqualToReference.js +16 -0
- package/dist/module/utils/greaterThanOrEqualToReference.js.map +1 -0
- package/dist/module/utils/greaterThanReference.d.ts +3 -0
- package/dist/module/utils/greaterThanReference.js +15 -0
- package/dist/module/utils/greaterThanReference.js.map +1 -0
- package/dist/module/utils/index.d.ts +1 -0
- package/dist/module/utils/index.js +2 -1
- package/dist/module/utils/index.js.map +1 -1
- package/dist/module/utils/isAColumn.d.ts +2 -3
- package/dist/module/utils/isAColumn.js +2 -6
- package/dist/module/utils/isAColumn.js.map +1 -1
- package/dist/module/utils/isALiteral.d.ts +2 -0
- package/dist/module/utils/isALiteral.js +5 -0
- package/dist/module/utils/isALiteral.js.map +1 -0
- package/dist/module/utils/isAValidPower.d.ts +3 -0
- package/dist/module/utils/isAValidPower.js +17 -0
- package/dist/module/utils/isAValidPower.js.map +1 -0
- package/dist/module/utils/isAnAllowedValue.d.ts +2 -0
- package/dist/module/utils/isAnAllowedValue.js +16 -0
- package/dist/module/utils/isAnAllowedValue.js.map +1 -0
- package/dist/module/utils/isBetweenInclusiveRange.d.ts +3 -0
- package/dist/module/utils/isBetweenInclusiveRange.js +17 -0
- package/dist/module/utils/isBetweenInclusiveRange.js.map +1 -0
- package/dist/module/utils/isBooleanExpression.d.ts +1 -1
- package/dist/module/utils/isBooleanExpression.js +9 -5
- package/dist/module/utils/isBooleanExpression.js.map +1 -1
- package/dist/module/utils/isDateParam.js +8 -2
- package/dist/module/utils/isDateParam.js.map +1 -1
- package/dist/module/utils/isInteger.d.ts +3 -0
- package/dist/module/utils/isInteger.js +21 -0
- package/dist/module/utils/isInteger.js.map +1 -0
- package/dist/module/utils/isLongLiteralNumber.js +2 -1
- package/dist/module/utils/isLongLiteralNumber.js.map +1 -1
- package/dist/module/utils/isNumberParam.js +8 -2
- package/dist/module/utils/isNumberParam.js.map +1 -1
- package/dist/module/utils/isSameAndValidRecursiveDataType.d.ts +3 -0
- package/dist/module/utils/isSameAndValidRecursiveDataType.js +28 -0
- package/dist/module/utils/isSameAndValidRecursiveDataType.js.map +1 -0
- package/dist/module/utils/isStringParam.js +8 -2
- package/dist/module/utils/isStringParam.js.map +1 -1
- package/dist/module/utils/primitiveFunctions.d.ts +4 -0
- package/dist/module/utils/primitiveFunctions.js +8 -0
- package/dist/module/utils/primitiveFunctions.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/utils/isNotAColumn.d.ts +0 -3
- package/dist/cjs/utils/isNotAColumn.js +0 -13
- package/dist/cjs/utils/isNotAColumn.js.map +0 -1
- package/dist/module/utils/isNotAColumn.d.ts +0 -3
- package/dist/module/utils/isNotAColumn.js +0 -9
- package/dist/module/utils/isNotAColumn.js.map +0 -1
|
@@ -1,51 +1,76 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.QFormulaParser = exports.QFormulaLang = exports.QFormula = void 0;
|
|
4
4
|
const lr_1 = require("@lezer/lr");
|
|
5
5
|
const language_1 = require("@codemirror/language");
|
|
6
6
|
const highlight_1 = require("@lezer/highlight");
|
|
7
7
|
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
8
|
-
const
|
|
8
|
+
const noOprt = 25;
|
|
9
|
+
const space = [
|
|
10
|
+
9, 10, 11, 12, 13, 32, 133, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197,
|
|
11
|
+
8198, 8199, 8200, 8201, 8202, 8232, 8233, 8239, 8287, 12288,
|
|
12
|
+
];
|
|
13
|
+
const operators = [43, 45, 42, 47, 60, 61, 62];
|
|
14
|
+
const parenteses = [41, 40];
|
|
15
|
+
const comma = 44;
|
|
16
|
+
const noOperator = new lr_1.ExternalTokenizer((input, stack) => {
|
|
17
|
+
const { next } = input;
|
|
18
|
+
if (space.indexOf(next) > -1 ||
|
|
19
|
+
parenteses.indexOf(next) > -1 ||
|
|
20
|
+
next === comma)
|
|
21
|
+
return;
|
|
22
|
+
if (operators.indexOf(next) === -1 &&
|
|
23
|
+
next != -1 &&
|
|
24
|
+
!stack.context &&
|
|
25
|
+
stack.canShift(noOprt)) {
|
|
26
|
+
input.acceptToken(noOprt);
|
|
27
|
+
}
|
|
28
|
+
}, { contextual: true });
|
|
29
|
+
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
30
|
+
const spec_identifier = { __proto__: null, true: 16, false: 16 };
|
|
9
31
|
const parser = lr_1.LRParser.deserialize({
|
|
10
32
|
version: 14,
|
|
11
|
-
states: "
|
|
12
|
-
stateData: "%
|
|
13
|
-
goto: "#
|
|
14
|
-
nodeNames: "⚠ Program Expression Value Number Date String Boolean ParenthesisEnd Function FunctionIdentifier ParenthesisStart FunctionArguments Variable UnaryExpression ArithOp BinaryExpression ArithOp ArithOp LogicOp LogicOp ParenthesizedExpression",
|
|
15
|
-
maxTerm:
|
|
33
|
+
states: "%^O]QQOOOOQP'#C`'#C`OOQO'#Cg'#CgOwQQO'#CfO|QSO'#CjO]QQO'#CkQ!RQROOO]QQO'#CrOOQP'#C_'#C_O!gQQO,59QO!nQQO,59UOOQP,59V,59VO]QQO,59XO]QQO,59XO]QQO,59XO]QQO,59XO]QQO,59XO!sQRO,59^O!zQRO'#CzOOQO'#Ci'#CiO#UQQO1G.lOOQP1G.p1G.pOOQP1G.s1G.sO#uQRO1G.sO#|QRO1G.sO$oQRO1G.sO$vQRO1G.sOOQP1G.x1G.xO]QQO'#CsO$}QQO,59fOOQP7+$W7+$WO%VQRO,59_OOQO-E6q-E6q",
|
|
34
|
+
stateData: "%k~OkOSlOSPOS~OTPOUPOVPOWPO[VO`TOmQOqSO~O[XO~OrYO~O`]Ob[Oc[Od^Oe_Oi`O~OXnP~P]OpeO~OXkO~P!ROolOXnX~P!ROXnO~Ob[Oc[OdaieaihaiiaiXaioai~O`ai~P#ZO`]O~P#ZO`]Ob[Oc[Od^OhaiiaiXaioai~Oeai~P$TOe_O~P$TOolOXna~OXgaoga~P!ROUVklkPmPb~",
|
|
35
|
+
goto: "#UoPPPp!`PPPPP!`!lP!x!`!`P!`PPPP!`!{PPPPPP#RQUOQZTQaVQbXQf[Qg]Qh^Qi_Qj`RoleWOTVX[]^_`leROTVX[]^_`lRdXQmbRpmRcX",
|
|
36
|
+
nodeNames: "⚠ LineComment Program Expression Value Number Date String Boolean ParenthesisEnd Function FunctionIdentifier ParenthesisStart FunctionArguments Variable UnaryExpression ArithOp BinaryExpression ArithOp ArithOp LogicOp LogicOp ParenthesizedExpression",
|
|
37
|
+
maxTerm: 34,
|
|
16
38
|
nodeProps: [
|
|
17
|
-
["openedBy",
|
|
18
|
-
["closedBy",
|
|
39
|
+
["openedBy", 9, "ParenthesisStart"],
|
|
40
|
+
["closedBy", 12, "ParenthesisEnd"]
|
|
19
41
|
],
|
|
20
|
-
skippedNodes: [0],
|
|
42
|
+
skippedNodes: [0, 1],
|
|
21
43
|
repeatNodeCount: 1,
|
|
22
|
-
tokenData: "=T~RpXY#VYZ#zZ[#V]^#zpq#Vrs$Pxy7kyz7pz{7u{|7z|}9S}!O7z!O!P9X!P!Q:a!Q![;Q!^!_;n!_!`<O!`!a<T!c!}<]!}#O<y#P#Q=O#R#S8h#T#o<]$f$g#V#BY#BZ#V$IS$I_#V$I|$I}#z$I}$JO#z$JT$JU#V$KV$KW#V&FU&FV#V?HT?HU#V~#[
|
|
23
|
-
tokenizers: [0, 1],
|
|
24
|
-
topRules: { "Program": [0,
|
|
25
|
-
specialized: [{ term:
|
|
26
|
-
tokenPrec:
|
|
44
|
+
tokenData: "=T~RpXY#VYZ#zZ[#V]^#zpq#Vrs$Pxy7kyz7pz{7u{|7z|}9S}!O7z!O!P9X!P!Q:a!Q![;Q!^!_;n!_!`<O!`!a<T!c!}<]!}#O<y#P#Q=O#R#S8h#T#o<]$f$g#V#BY#BZ#V$IS$I_#V$I|$I}#z$I}$JO#z$JT$JU#V$KV$KW#V&FU&FV#V?HT?HU#V~#[Yk~XY#VZ[#Vpq#V$f$g#V#BY#BZ#V$IS$I_#V$JT$JU#V$KV$KW#V&FU&FV#V?HT?HU#V~$POl~~$SZOr$urs%_s!Q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Oe~~<YPd~!_!`;yR<dVrQmP{|8h}!O8h!O!P8h!Q![<]!c!}<]#R#S<]#T#o<]~=OOq~~=TOp~",
|
|
45
|
+
tokenizers: [noOperator, 0, 1],
|
|
46
|
+
topRules: { "Program": [0, 2] },
|
|
47
|
+
specialized: [{ term: 29, get: value => spec_identifier[value] || -1 }],
|
|
48
|
+
tokenPrec: 201
|
|
49
|
+
});
|
|
50
|
+
const QFormulaParser = parser.configure({
|
|
51
|
+
props: [
|
|
52
|
+
(0, highlight_1.styleTags)({
|
|
53
|
+
Boolean: highlight_1.tags.bool,
|
|
54
|
+
String: highlight_1.tags.string,
|
|
55
|
+
Date: highlight_1.tags.string,
|
|
56
|
+
Number: highlight_1.tags.number,
|
|
57
|
+
Variable: highlight_1.tags.variableName,
|
|
58
|
+
LineComment: highlight_1.tags.lineComment,
|
|
59
|
+
FunctionIdentifier: highlight_1.tags.keyword,
|
|
60
|
+
ParenthesisStart: highlight_1.tags.paren,
|
|
61
|
+
ParenthesisEnd: highlight_1.tags.paren,
|
|
62
|
+
LogicOp: highlight_1.tags.operator,
|
|
63
|
+
ArithOp: highlight_1.tags.operator,
|
|
64
|
+
}),
|
|
65
|
+
],
|
|
27
66
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
(0, highlight_1.styleTags)({
|
|
32
|
-
Boolean: highlight_1.tags.bool,
|
|
33
|
-
String: highlight_1.tags.string,
|
|
34
|
-
Date: highlight_1.tags.string,
|
|
35
|
-
Number: highlight_1.tags.number,
|
|
36
|
-
Variable: highlight_1.tags.keyword,
|
|
37
|
-
LineComment: highlight_1.tags.lineComment,
|
|
38
|
-
FunctionIdentifier: highlight_1.tags.lineComment,
|
|
39
|
-
'( )': highlight_1.tags.paren,
|
|
40
|
-
}),
|
|
41
|
-
],
|
|
42
|
-
}),
|
|
67
|
+
exports.QFormulaParser = QFormulaParser;
|
|
68
|
+
const QFormulaLang = language_1.LRLanguage.define({
|
|
69
|
+
parser: QFormulaParser,
|
|
43
70
|
languageData: {
|
|
44
71
|
commentTokens: { line: '//' },
|
|
45
72
|
},
|
|
46
|
-
};
|
|
47
|
-
exports.QFormulaHighlightConfig = QFormulaHighlightConfig;
|
|
48
|
-
const QFormulaLang = language_1.LRLanguage.define(QFormulaHighlightConfig);
|
|
73
|
+
});
|
|
49
74
|
exports.QFormulaLang = QFormulaLang;
|
|
50
75
|
function QFormula() {
|
|
51
76
|
return new language_1.LanguageSupport(QFormulaLang);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qformula.lang.js","sourceRoot":"","sources":["../../../../src/grammar/generated/qformula.lang.js"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"qformula.lang.js","sourceRoot":"","sources":["../../../../src/grammar/generated/qformula.lang.js"],"names":[],"mappings":";;;AAAA,kCAAwD;AACxD,mDAAmE;AACnE,gDAAmD;AAEnD,8EAA8E;AAC9E,MAAM,MAAM,GAAG,EAAE,CAAC;AAElB,MAAM,KAAK,GAAG;IACV,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IACzE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK;CAC9D,CAAC;AACF,MAAM,SAAS,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAC/C,MAAM,UAAU,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC5B,MAAM,KAAK,GAAG,EAAE,CAAC;AACjB,MAAM,UAAU,GAAG,IAAI,sBAAiB,CAAC,CAAC,KAAK,EAAE,KAAK,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AI,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAC,CAAC;IACrE,SAAS,EAAE,GAAG;CACf,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,MAAM,CAAC,SAAS,CAAC;IACpC,KAAK,EAAE;QACH,IAAA,qBAAS,EAAC;YACN,OAAO,EAAE,gBAAI,CAAC,IAAI;YAClB,MAAM,EAAE,gBAAI,CAAC,MAAM;YACnB,IAAI,EAAE,gBAAI,CAAC,MAAM;YACjB,MAAM,EAAE,gBAAI,CAAC,MAAM;YACnB,QAAQ,EAAE,gBAAI,CAAC,YAAY;YAC3B,WAAW,EAAE,gBAAI,CAAC,WAAW;YAC7B,kBAAkB,EAAE,gBAAI,CAAC,OAAO;YAChC,gBAAgB,EAAE,gBAAI,CAAC,KAAK;YAC5B,cAAc,EAAE,gBAAI,CAAC,KAAK;YAC1B,OAAO,EAAE,gBAAI,CAAC,QAAQ;YACtB,OAAO,EAAE,gBAAI,CAAC,QAAQ;SACzB,CAAC;KACL;CACJ,CAAC,CAAC;AAW8B,wCAAc;AAV/C,MAAM,YAAY,GAAG,qBAAU,CAAC,MAAM,CAAC;IACnC,MAAM,EAAE,cAAc;IACtB,YAAY,EAAE;QACV,aAAa,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;KAChC;CACJ,CAAC,CAAC;AAKgB,oCAAY;AAJ/B,SAAS,QAAQ;IACb,OAAO,IAAI,0BAAe,CAAC,YAAY,CAAC,CAAC;AAC7C,CAAC;AAEQ,4BAAQ"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
export const
|
|
2
|
-
export const
|
|
3
|
-
export const
|
|
4
|
-
export const
|
|
5
|
-
export const
|
|
6
|
-
export const
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
11
|
-
export const
|
|
12
|
-
export const
|
|
13
|
-
export const
|
|
14
|
-
export const
|
|
15
|
-
export const
|
|
16
|
-
export const
|
|
17
|
-
export const
|
|
18
|
-
export const
|
|
19
|
-
export const
|
|
1
|
+
export const noOprt: 25;
|
|
2
|
+
export const spaces: 27;
|
|
3
|
+
export const newline: 28;
|
|
4
|
+
export const lineComment: 1;
|
|
5
|
+
export const Program: 2;
|
|
6
|
+
export const Expression: 3;
|
|
7
|
+
export const Value: 4;
|
|
8
|
+
export const Number: 5;
|
|
9
|
+
export const Date: 6;
|
|
10
|
+
export const String: 7;
|
|
11
|
+
export const ParenthesisEnd: 9;
|
|
12
|
+
export const Function: 10;
|
|
13
|
+
export const FunctionIdentifier: 11;
|
|
14
|
+
export const ParenthesisStart: 12;
|
|
15
|
+
export const FunctionArguments: 13;
|
|
16
|
+
export const Variable: 14;
|
|
17
|
+
export const UnaryExpression: 15;
|
|
18
|
+
export const BinaryExpression: 17;
|
|
19
|
+
export const divide: 18;
|
|
20
|
+
export const ParenthesizedExpression: 22;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ParenthesizedExpression = exports.divide = exports.BinaryExpression = exports.UnaryExpression = exports.Variable = exports.FunctionArguments = exports.ParenthesisStart = exports.FunctionIdentifier = exports.Function = exports.ParenthesisEnd = exports.String = exports.Date = exports.Number = exports.Value = exports.Expression = exports.Program = exports.lineComment = exports.newline = exports.spaces = void 0;
|
|
3
|
+
exports.ParenthesizedExpression = exports.divide = exports.BinaryExpression = exports.UnaryExpression = exports.Variable = exports.FunctionArguments = exports.ParenthesisStart = exports.FunctionIdentifier = exports.Function = exports.ParenthesisEnd = exports.String = exports.Date = exports.Number = exports.Value = exports.Expression = exports.Program = exports.lineComment = exports.newline = exports.spaces = exports.noOprt = void 0;
|
|
4
4
|
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
|
5
|
-
exports.
|
|
5
|
+
exports.noOprt = 25, exports.spaces = 27, exports.newline = 28, exports.lineComment = 1, exports.Program = 2, exports.Expression = 3, exports.Value = 4, exports.Number = 5, exports.Date = 6, exports.String = 7, exports.ParenthesisEnd = 9, exports.Function = 10, exports.FunctionIdentifier = 11, exports.ParenthesisStart = 12, exports.FunctionArguments = 13, exports.Variable = 14, exports.UnaryExpression = 15, exports.BinaryExpression = 17, exports.divide = 18, exports.ParenthesizedExpression = 22;
|
|
6
6
|
//# sourceMappingURL=qformula.lang.terms.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qformula.lang.terms.js","sourceRoot":"","sources":["../../../../src/grammar/generated/qformula.lang.terms.js"],"names":[],"mappings":";;;AAAA,8EAA8E;AAE5E,QAAA,MAAM,GAAG,EAAE,EACX,QAAA,OAAO,GAAG,EAAE,EACZ,QAAA,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"qformula.lang.terms.js","sourceRoot":"","sources":["../../../../src/grammar/generated/qformula.lang.terms.js"],"names":[],"mappings":";;;AAAA,8EAA8E;AAE5E,QAAA,MAAM,GAAG,EAAE,EACX,QAAA,MAAM,GAAG,EAAE,EACX,QAAA,OAAO,GAAG,EAAE,EACZ,QAAA,WAAW,GAAG,CAAC,EACf,QAAA,OAAO,GAAG,CAAC,EACX,QAAA,UAAU,GAAG,CAAC,EACd,QAAA,KAAK,GAAG,CAAC,EACT,QAAA,MAAM,GAAG,CAAC,EACV,QAAA,IAAI,GAAG,CAAC,EACR,QAAA,MAAM,GAAG,CAAC,EACV,QAAA,cAAc,GAAG,CAAC,EAClB,QAAA,QAAQ,GAAG,EAAE,EACb,QAAA,kBAAkB,GAAG,EAAE,EACvB,QAAA,gBAAgB,GAAG,EAAE,EACrB,QAAA,iBAAiB,GAAG,EAAE,EACtB,QAAA,QAAQ,GAAG,EAAE,EACb,QAAA,eAAe,GAAG,EAAE,EACpB,QAAA,gBAAgB,GAAG,EAAE,EACrB,QAAA,MAAM,GAAG,EAAE,EACX,QAAA,uBAAuB,GAAG,EAAE,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.noOperator = void 0;
|
|
4
|
+
const lr_1 = require("@lezer/lr");
|
|
5
|
+
const qformula_lang_terms_1 = require("./generated/qformula.lang.terms");
|
|
6
|
+
const space = [
|
|
7
|
+
9, 10, 11, 12, 13, 32, 133, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197,
|
|
8
|
+
8198, 8199, 8200, 8201, 8202, 8232, 8233, 8239, 8287, 12288,
|
|
9
|
+
];
|
|
10
|
+
const operators = [43, 45, 42, 47, 60, 61, 62];
|
|
11
|
+
const parenteses = [41, 40];
|
|
12
|
+
const comma = 44;
|
|
13
|
+
exports.noOperator = new lr_1.ExternalTokenizer((input, stack) => {
|
|
14
|
+
const { next } = input;
|
|
15
|
+
if (space.indexOf(next) > -1 ||
|
|
16
|
+
parenteses.indexOf(next) > -1 ||
|
|
17
|
+
next === comma)
|
|
18
|
+
return;
|
|
19
|
+
if (operators.indexOf(next) === -1 &&
|
|
20
|
+
next != -1 &&
|
|
21
|
+
!stack.context &&
|
|
22
|
+
stack.canShift(qformula_lang_terms_1.noOprt)) {
|
|
23
|
+
input.acceptToken(qformula_lang_terms_1.noOprt);
|
|
24
|
+
}
|
|
25
|
+
}, { contextual: true });
|
|
26
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/grammar/tokens.ts"],"names":[],"mappings":";;;AAAA,kCAA8C;AAC9C,yEAAyD;AAEzD,MAAM,KAAK,GAAG;IACV,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI;IACzE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK;CAC9D,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAC/C,MAAM,UAAU,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAC5B,MAAM,KAAK,GAAG,EAAE,CAAC;AAEJ,QAAA,UAAU,GAAG,IAAI,sBAAiB,CAC3C,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;IACb,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IACvB,IACI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,KAAK,KAAK;QAEd,OAAO;IACX,IACI,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,IAAI,CAAC,CAAC;QACV,CAAC,KAAK,CAAC,OAAO;QACd,KAAK,CAAC,QAAQ,CAAC,4BAAM,CAAC,EACxB;QACE,KAAK,CAAC,WAAW,CAAC,4BAAM,CAAC,CAAC;KAC7B;AACL,CAAC,EACD,EAAE,UAAU,EAAE,IAAI,EAAE,CACvB,CAAC"}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ENGINES } from './constants/index';
|
|
2
2
|
import { FormulaContext, TranspilationResponse } from './constants/interfaces';
|
|
3
|
-
export { QFormula as FormulaHighlight, QFormulaLang as FormulaLang,
|
|
3
|
+
export { QFormula as FormulaHighlight, QFormulaLang as FormulaLang, QFormulaParser as FormulaParser, } from './grammar/qformula.grammar';
|
|
4
4
|
export { calculateAST } from './parser/json-parser';
|
|
5
5
|
export { ENGINES, AST_PRIMITIVES } from './constants/index';
|
|
6
6
|
export { FUNCTION_LIST, getFunctionDetail } from './functions/index';
|
|
7
7
|
export { TranspileAST } from './transpiler/index';
|
|
8
8
|
export { ProgramAST, TranspilationResponse, FormulaContext, } from './constants/interfaces';
|
|
9
9
|
export { BaseError, errorAnalyzer } from './errors';
|
|
10
|
+
export { cleanInvalidItemsInContext } from './utils';
|
|
11
|
+
export { getPrimitiveAsValue } from './utils/primitiveFunctions';
|
|
10
12
|
export declare function Transpile(program: string, engine: ENGINES, context?: FormulaContext): TranspilationResponse | undefined;
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Transpile = exports.errorAnalyzer = exports.BaseError = exports.TranspileAST = exports.getFunctionDetail = exports.FUNCTION_LIST = exports.AST_PRIMITIVES = exports.ENGINES = exports.calculateAST = exports.
|
|
3
|
+
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;
|
|
4
4
|
const qformula_grammar_1 = require("./grammar/qformula.grammar");
|
|
5
5
|
const json_parser_1 = require("./parser/json-parser");
|
|
6
6
|
const index_1 = require("./transpiler/index");
|
|
7
7
|
var qformula_grammar_2 = require("./grammar/qformula.grammar");
|
|
8
8
|
Object.defineProperty(exports, "FormulaHighlight", { enumerable: true, get: function () { return qformula_grammar_2.QFormula; } });
|
|
9
9
|
Object.defineProperty(exports, "FormulaLang", { enumerable: true, get: function () { return qformula_grammar_2.QFormulaLang; } });
|
|
10
|
-
Object.defineProperty(exports, "
|
|
10
|
+
Object.defineProperty(exports, "FormulaParser", { enumerable: true, get: function () { return qformula_grammar_2.QFormulaParser; } });
|
|
11
11
|
var json_parser_2 = require("./parser/json-parser");
|
|
12
12
|
Object.defineProperty(exports, "calculateAST", { enumerable: true, get: function () { return json_parser_2.calculateAST; } });
|
|
13
13
|
var index_2 = require("./constants/index");
|
|
@@ -21,6 +21,10 @@ Object.defineProperty(exports, "TranspileAST", { enumerable: true, get: function
|
|
|
21
21
|
var errors_1 = require("./errors");
|
|
22
22
|
Object.defineProperty(exports, "BaseError", { enumerable: true, get: function () { return errors_1.BaseError; } });
|
|
23
23
|
Object.defineProperty(exports, "errorAnalyzer", { enumerable: true, get: function () { return errors_1.errorAnalyzer; } });
|
|
24
|
+
var utils_1 = require("./utils");
|
|
25
|
+
Object.defineProperty(exports, "cleanInvalidItemsInContext", { enumerable: true, get: function () { return utils_1.cleanInvalidItemsInContext; } });
|
|
26
|
+
var primitiveFunctions_1 = require("./utils/primitiveFunctions");
|
|
27
|
+
Object.defineProperty(exports, "getPrimitiveAsValue", { enumerable: true, get: function () { return primitiveFunctions_1.getPrimitiveAsValue; } });
|
|
24
28
|
function Transpile(program, engine, context) {
|
|
25
29
|
const parser = qformula_grammar_1.QFormulaLang.parser;
|
|
26
30
|
const tree = parser.parse(program);
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAEA,iEAA0D;AAC1D,sDAAoD;AACpD,8CAAkD;AAElD,+DAIoC;AAHhC,oHAAA,QAAQ,OAAoB;AAC5B,+GAAA,YAAY,OAAe;AAC3B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAEA,iEAA0D;AAC1D,sDAAoD;AACpD,8CAAkD;AAElD,+DAIoC;AAHhC,oHAAA,QAAQ,OAAoB;AAC5B,+GAAA,YAAY,OAAe;AAC3B,iHAAA,cAAc,OAAiB;AAEnC,oDAAoD;AAA3C,2GAAA,YAAY,OAAA;AACrB,2CAA4D;AAAnD,gGAAA,OAAO,OAAA;AAAE,uGAAA,cAAc,OAAA;AAChC,2CAAqE;AAA5D,sGAAA,aAAa,OAAA;AAAE,0GAAA,iBAAiB,OAAA;AACzC,4CAAkD;AAAzC,qGAAA,YAAY,OAAA;AAMrB,mCAAoD;AAA3C,mGAAA,SAAS,OAAA;AAAE,uGAAA,aAAa,OAAA;AACjC,iCAAqD;AAA5C,mHAAA,0BAA0B,OAAA;AACnC,iEAAiE;AAAxD,yHAAA,mBAAmB,OAAA;AAE5B,SAAgB,SAAS,CACrB,OAAe,EACf,MAAe,EACf,OAAwB;IAExB,MAAM,MAAM,GAAG,+BAAY,CAAC,MAAM,CAAC;IACnC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnC,IAAI,CAAC,IAAI,CAAC,OAAO;QAAE,OAAO;IAC1B,MAAM,GAAG,GAAG,IAAA,0BAAY,EAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACjD,IAAI,CAAC,GAAG;QAAE,OAAO;IACjB,OAAO,IAAA,oBAAY,EAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAXD,8BAWC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SyntaxNode } from '@lezer/common';
|
|
2
|
-
import { FormulaContext, FormulaInference, FunctionCallAST } from '../constants/interfaces';
|
|
2
|
+
import { FormulaContext, FormulaInference, FunctionCallAST, ProgramPosition } from '../constants/interfaces';
|
|
3
3
|
import { TransformNodeFNType } from './interfaces';
|
|
4
4
|
export declare function transformFunctionExpression(program: string, node: SyntaxNode, inference: FormulaInference, context: FormulaContext | undefined, transformNodeFunction: TransformNodeFNType): FunctionCallAST;
|
|
5
|
+
export declare function createPositionASTFromSyntaxNode({ from, to, }: SyntaxNode): ProgramPosition;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformFunctionExpression = void 0;
|
|
3
|
+
exports.createPositionASTFromSyntaxNode = exports.transformFunctionExpression = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
const syntax_errors_1 = require("./syntax-errors");
|
|
6
6
|
const primitiveFunctions_1 = require("../utils/primitiveFunctions");
|
|
@@ -14,6 +14,7 @@ function transformFunctionExpression(program, node, inference, context, transfor
|
|
|
14
14
|
const parenthesisStart = node.getChild('ParenthesisStart');
|
|
15
15
|
const parenthesisEnd = node.getChild('ParenthesisEnd');
|
|
16
16
|
const args = getFunctionArguments(node, parenthesisStart, program, inference, context, transformNodeFunction);
|
|
17
|
+
const functionIdentifier = createPositionASTFromSyntaxNode(fnIdentifier);
|
|
17
18
|
const baseNode = {
|
|
18
19
|
type: constants_1.AST_TYPES.functionCall,
|
|
19
20
|
name: (0, utils_1.getNodeValue)(program, fnIdentifier),
|
|
@@ -22,22 +23,16 @@ function transformFunctionExpression(program, node, inference, context, transfor
|
|
|
22
23
|
to: node.to,
|
|
23
24
|
parenthesisStart: !!parenthesisStart,
|
|
24
25
|
parenthesisEnd: !!parenthesisEnd,
|
|
25
|
-
|
|
26
|
+
functionText: fnString,
|
|
27
|
+
functionIdentifier,
|
|
26
28
|
};
|
|
27
29
|
const functionExists = functions_1.FUNCTION_LIST.includes(fnName);
|
|
28
30
|
const functionDetail = functionExists
|
|
29
31
|
? (0, functions_1.getFunctionDetail)(fnName)
|
|
30
32
|
: undefined;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
? (0, primitiveFunctions_1.getFunctionPrimitive)(functionDetail, baseNode.arguments)
|
|
35
|
-
: constants_1.AST_PRIMITIVES.UNKNOWN;
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
primitive = constants_1.AST_PRIMITIVES.UNKNOWN;
|
|
39
|
-
inference.errorList.push(error);
|
|
40
|
-
}
|
|
33
|
+
const primitive = functionDetail
|
|
34
|
+
? (0, primitiveFunctions_1.getFunctionPrimitive)(functionDetail, baseNode.arguments)
|
|
35
|
+
: constants_1.AST_PRIMITIVES.UNKNOWN;
|
|
41
36
|
const resultNode = Object.assign(Object.assign({}, baseNode), { primitive });
|
|
42
37
|
if (functionExists && (!parenthesisStart || !parenthesisEnd)) {
|
|
43
38
|
inference.errorList.push(new errors_1.MissingParenthesisError(Object.assign(Object.assign({}, resultNode), { from: !parenthesisStart ? resultNode.from : resultNode.to })));
|
|
@@ -93,4 +88,8 @@ function createCommonASTFromNode(program, node, inference, context, transformNod
|
|
|
93
88
|
}
|
|
94
89
|
return transformNodeFunction(program, node, inference, context);
|
|
95
90
|
}
|
|
91
|
+
function createPositionASTFromSyntaxNode({ from, to, }) {
|
|
92
|
+
return { from, to };
|
|
93
|
+
}
|
|
94
|
+
exports.createPositionASTFromSyntaxNode = createPositionASTFromSyntaxNode;
|
|
96
95
|
//# sourceMappingURL=formula-parser.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formula-parser.js","sourceRoot":"","sources":["../../../src/parser/formula-parser.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"formula-parser.js","sourceRoot":"","sources":["../../../src/parser/formula-parser.ts"],"names":[],"mappings":";;;AAQA,oCAAwC;AACxC,mDAAqD;AACrD,oEAAmE;AACnE,4CAAyD;AACzD,4CAAgE;AAChE,sCAAoD;AAGpD,SAAgB,2BAA2B,CACvC,OAAe,EACf,IAAgB,EAChB,SAA2B,EAC3B,OAAmC,EACnC,qBAA0C;IAE1C,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAe,CAAC;IACvE,MAAM,MAAM,GAAG,IAAA,oBAAY,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,IAAA,oBAAY,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC7C,MAAM,gBAAgB,GAAG,IAAI,C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AAE,EAAE,CAAC;AACxB,CAAC;AALD,0EAKC"}
|
|
@@ -7,11 +7,13 @@ const syntax_errors_1 = require("./syntax-errors");
|
|
|
7
7
|
const errors_1 = require("../errors");
|
|
8
8
|
const primitiveFunctions_1 = require("../utils/primitiveFunctions");
|
|
9
9
|
const formula_parser_1 = require("./formula-parser");
|
|
10
|
+
const qformula_grammar_1 = require("../grammar/qformula.grammar");
|
|
10
11
|
const PARSER_VERSION = '0.0.0';
|
|
11
12
|
const LANG_NAME = 'QrveyLang';
|
|
12
13
|
function calculateAST(program, tree, context) {
|
|
13
14
|
var _a;
|
|
14
|
-
const
|
|
15
|
+
const cursor = tree.cursor();
|
|
16
|
+
const startNode = cursor.node;
|
|
15
17
|
if (!startNode)
|
|
16
18
|
return;
|
|
17
19
|
const syntaxErrors = (0, syntax_errors_1.calculateNodeSyntaxErrors)(program, startNode);
|
|
@@ -21,7 +23,7 @@ function calculateAST(program, tree, context) {
|
|
|
21
23
|
formulaFunctions: [],
|
|
22
24
|
flatBody: [],
|
|
23
25
|
};
|
|
24
|
-
const body = transformNode(program, startNode, inference, context);
|
|
26
|
+
const body = transformNode(program, startNode, inference, context, cursor);
|
|
25
27
|
const { errorList: errors, formulaVariables: variables, formulaFunctions, flatBody, } = inference;
|
|
26
28
|
return {
|
|
27
29
|
type: constants_1.AST_TYPES.program,
|
|
@@ -39,7 +41,8 @@ function calculateAST(program, tree, context) {
|
|
|
39
41
|
};
|
|
40
42
|
}
|
|
41
43
|
exports.calculateAST = calculateAST;
|
|
42
|
-
function transformNode(program,
|
|
44
|
+
function transformNode(program, refNode, inference, context, cursor) {
|
|
45
|
+
const node = refNode !== null && refNode !== void 0 ? refNode : cursor === null || cursor === void 0 ? void 0 : cursor.node;
|
|
43
46
|
if (!node)
|
|
44
47
|
return undefined;
|
|
45
48
|
let resultNode;
|
|
@@ -72,17 +75,41 @@ function transformNode(program, node, inference, context) {
|
|
|
72
75
|
resultNode = transformVariableValue(program, node, inference, context);
|
|
73
76
|
break;
|
|
74
77
|
default:
|
|
75
|
-
return node.firstChild
|
|
76
|
-
? transformNode(program, node.firstChild, inference, context)
|
|
78
|
+
return (cursor === null || cursor === void 0 ? void 0 : cursor.next()) || node.firstChild
|
|
79
|
+
? transformNode(program, node.firstChild, inference, context, cursor)
|
|
77
80
|
: undefined;
|
|
78
81
|
}
|
|
79
82
|
if (resultNode !== undefined)
|
|
80
83
|
inference.flatBody.push(resultNode);
|
|
81
84
|
return resultNode;
|
|
82
85
|
}
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
const VALID_OPERATIONS_BY_TYPE = {
|
|
87
|
+
[constants_1.AST_PRIMITIVES.NUMBER]: [
|
|
88
|
+
'+',
|
|
89
|
+
'-',
|
|
90
|
+
'*',
|
|
91
|
+
'/',
|
|
92
|
+
'<',
|
|
93
|
+
'<=',
|
|
94
|
+
'>',
|
|
95
|
+
'>=',
|
|
96
|
+
'=',
|
|
97
|
+
'<>',
|
|
98
|
+
],
|
|
99
|
+
[constants_1.AST_PRIMITIVES.STRING]: ['=', '<>'],
|
|
100
|
+
[constants_1.AST_PRIMITIVES.DATE]: ['=', '<>'],
|
|
101
|
+
[constants_1.AST_PRIMITIVES.BOOLEAN]: [],
|
|
102
|
+
[constants_1.AST_PRIMITIVES.UNKNOWN]: [],
|
|
103
|
+
};
|
|
104
|
+
function operatorIsValidForOperation(operator, leftPrimitive, rightPrimitive) {
|
|
105
|
+
const allowedOperators = calculateValidOperatorsByType(leftPrimitive, rightPrimitive);
|
|
106
|
+
return allowedOperators.includes(operator);
|
|
107
|
+
}
|
|
108
|
+
function calculateValidOperatorsByType(leftPrimitive, rightPrimitive) {
|
|
109
|
+
if (leftPrimitive === rightPrimitive && !Array.isArray(leftPrimitive)) {
|
|
110
|
+
return VALID_OPERATIONS_BY_TYPE[leftPrimitive];
|
|
111
|
+
}
|
|
112
|
+
return [];
|
|
86
113
|
}
|
|
87
114
|
function calculateBinaryElements(program, node, left, right) {
|
|
88
115
|
const leftPrimitive = left === null || left === void 0 ? void 0 : left.primitive;
|
|
@@ -91,23 +118,17 @@ function calculateBinaryElements(program, node, left, right) {
|
|
|
91
118
|
const arithOperator = node.getChild('ArithOp');
|
|
92
119
|
const leftIsAValidNumber = leftPrimitive === constants_1.AST_PRIMITIVES.NUMBER;
|
|
93
120
|
const rightIsAValidNumber = rightPrimitive === constants_1.AST_PRIMITIVES.NUMBER;
|
|
94
|
-
const leftIsAValidString = leftPrimitive === constants_1.AST_PRIMITIVES.STRING;
|
|
95
|
-
const rightIsAValidString = rightPrimitive === constants_1.AST_PRIMITIVES.STRING;
|
|
96
|
-
const leftIsAValidDate = leftPrimitive === constants_1.AST_PRIMITIVES.DATE;
|
|
97
|
-
const rightIsAValidDate = rightPrimitive === constants_1.AST_PRIMITIVES.DATE;
|
|
98
121
|
const operatorNode = (logicOperator !== null && logicOperator !== void 0 ? logicOperator : arithOperator);
|
|
99
122
|
const operator = (0, utils_1.getNodeValue)(program, operatorNode);
|
|
123
|
+
const operatorPosition = !operatorNode
|
|
124
|
+
? undefined
|
|
125
|
+
: (0, formula_parser_1.createPositionASTFromSyntaxNode)(operatorNode);
|
|
126
|
+
const validOperators = calculateValidOperatorsByType(leftPrimitive, rightPrimitive);
|
|
100
127
|
// primitive is number if arithOperator is not null and both left and right are numbers
|
|
101
128
|
// primitive is boolean if logicOperator is not null and both left and right are booleans
|
|
102
129
|
let primitive = constants_1.AST_PRIMITIVES.UNKNOWN;
|
|
103
130
|
if (logicOperator) {
|
|
104
|
-
if ((leftPrimitive
|
|
105
|
-
!leftIsAValidString &&
|
|
106
|
-
!leftIsAValidDate) ||
|
|
107
|
-
(((leftIsAValidString && rightIsAValidString) ||
|
|
108
|
-
(leftIsAValidDate && rightIsAValidDate)) &&
|
|
109
|
-
// string and date operation only with allowed operators
|
|
110
|
-
isValidStringDateBinaryOperation(operator))) {
|
|
131
|
+
if (operatorIsValidForOperation(operator, leftPrimitive, rightPrimitive)) {
|
|
111
132
|
primitive = constants_1.AST_PRIMITIVES.BOOLEAN;
|
|
112
133
|
}
|
|
113
134
|
}
|
|
@@ -122,25 +143,29 @@ function calculateBinaryElements(program, node, left, right) {
|
|
|
122
143
|
return {
|
|
123
144
|
primitive,
|
|
124
145
|
operator,
|
|
146
|
+
operatorNode: operatorPosition,
|
|
125
147
|
hasInvalidError,
|
|
148
|
+
validOperators,
|
|
126
149
|
};
|
|
127
150
|
}
|
|
128
151
|
function transformBinaryExpression(program, node, inference, context) {
|
|
129
152
|
const [leftNode, rightNode] = node.getChildren('Expression');
|
|
130
153
|
const left = transformNode(program, leftNode, inference, context);
|
|
131
154
|
const right = transformNode(program, rightNode, inference, context);
|
|
132
|
-
const { primitive, operator, hasInvalidError } = calculateBinaryElements(program, node, left, right);
|
|
155
|
+
const { primitive, operator, operatorNode, hasInvalidError, validOperators, } = calculateBinaryElements(program, node, left, right);
|
|
133
156
|
const binaryAST = {
|
|
134
157
|
operator,
|
|
158
|
+
operatorNode,
|
|
135
159
|
type: constants_1.AST_TYPES.binaryExpression,
|
|
136
160
|
left,
|
|
137
161
|
right,
|
|
138
162
|
from: node.from,
|
|
139
163
|
to: node.to,
|
|
140
164
|
primitive,
|
|
165
|
+
validOperators,
|
|
141
166
|
};
|
|
142
167
|
if (hasInvalidError) {
|
|
143
|
-
inference.errorList.push(new errors_1.
|
|
168
|
+
inference.errorList.push(new errors_1.NotAllowedOperationError(binaryAST));
|
|
144
169
|
}
|
|
145
170
|
return binaryAST;
|
|
146
171
|
}
|
|
@@ -151,16 +176,19 @@ function transformUnaryExpression(program, node, inference, context) {
|
|
|
151
176
|
const primitive = (0, primitiveFunctions_1.primitiveIsIncluded)(right === null || right === void 0 ? void 0 : right.primitive, constants_1.AST_PRIMITIVES.NUMBER, constants_1.AST_PRIMITIVES.BOOLEAN)
|
|
152
177
|
? right.primitive
|
|
153
178
|
: constants_1.AST_PRIMITIVES.UNKNOWN;
|
|
179
|
+
const validOperators = (right === null || right === void 0 ? void 0 : right.primitive) === constants_1.AST_PRIMITIVES.NUMBER ? ['+', '-'] : [];
|
|
154
180
|
const unaryAST = {
|
|
155
181
|
operator: (0, utils_1.getNodeValue)(program, operator),
|
|
182
|
+
operatorNode: (0, formula_parser_1.createPositionASTFromSyntaxNode)(operator),
|
|
156
183
|
type: constants_1.AST_TYPES.unaryExpression,
|
|
157
184
|
right,
|
|
158
185
|
from: node.from,
|
|
159
186
|
to: node.to,
|
|
160
187
|
primitive,
|
|
188
|
+
validOperators,
|
|
161
189
|
};
|
|
162
190
|
if (!rightNode) {
|
|
163
|
-
inference.errorList.push(new errors_1.
|
|
191
|
+
inference.errorList.push(new errors_1.NotAllowedOperationError(unaryAST));
|
|
164
192
|
}
|
|
165
193
|
return unaryAST;
|
|
166
194
|
}
|
|
@@ -171,10 +199,14 @@ function transformParenthesizedExpression(program, node, inference, context) {
|
|
|
171
199
|
const parenthesisEnd = node.getChild('ParenthesisEnd');
|
|
172
200
|
const resultNode = transformNode(program, expressionNode, inference, context);
|
|
173
201
|
if (!parenthesisStart || !parenthesisEnd) {
|
|
202
|
+
const [from, to] = [
|
|
203
|
+
!parenthesisStart ? node.from : parenthesisStart.from,
|
|
204
|
+
!parenthesisStart ? node.to : parenthesisStart.to,
|
|
205
|
+
];
|
|
174
206
|
inference.errorList.push(new errors_1.MissingParenthesisError({
|
|
175
207
|
type: constants_1.AST_TYPES.parenthesisExpression,
|
|
176
|
-
from
|
|
177
|
-
to
|
|
208
|
+
from,
|
|
209
|
+
to,
|
|
178
210
|
primitive: (_a = resultNode === null || resultNode === void 0 ? void 0 : resultNode.primitive) !== null && _a !== void 0 ? _a : constants_1.AST_PRIMITIVES.UNKNOWN,
|
|
179
211
|
}));
|
|
180
212
|
}
|
|
@@ -230,11 +262,11 @@ function transformBooleanValue(program, node) {
|
|
|
230
262
|
return createLiteralValue(node, constants_1.AST_PRIMITIVES.BOOLEAN, value);
|
|
231
263
|
}
|
|
232
264
|
function transformVariableValue(program, node, inference, context) {
|
|
233
|
-
var _a;
|
|
265
|
+
var _a, _b;
|
|
234
266
|
let variableValue = (0, utils_1.getNodeValue)(program, node).slice(1, -1);
|
|
235
267
|
const variableContext = (0, utils_1.getVariableContext)(variableValue, context);
|
|
236
268
|
const variableType = (0, utils_1.getVariableType)(variableContext);
|
|
237
|
-
if (variableType ===
|
|
269
|
+
if (variableType === constants_1.AST_TYPES.token)
|
|
238
270
|
variableValue = `{{${variableValue}}}`;
|
|
239
271
|
const variableExistInInference = inference.formulaVariables
|
|
240
272
|
.map((v) => v.id)
|
|
@@ -245,7 +277,7 @@ function transformVariableValue(program, node, inference, context) {
|
|
|
245
277
|
label: variableValue,
|
|
246
278
|
type: constants_1.AST_PRIMITIVES.STRING,
|
|
247
279
|
});
|
|
248
|
-
|
|
280
|
+
const baseResult = {
|
|
249
281
|
type: variableType,
|
|
250
282
|
value: variableValue,
|
|
251
283
|
context: variableContext,
|
|
@@ -253,5 +285,19 @@ function transformVariableValue(program, node, inference, context) {
|
|
|
253
285
|
to: node.to,
|
|
254
286
|
primitive: (_a = variableContext === null || variableContext === void 0 ? void 0 : variableContext.type) !== null && _a !== void 0 ? _a : constants_1.AST_PRIMITIVES.UNKNOWN,
|
|
255
287
|
};
|
|
288
|
+
//IF externalFormula AND NOT sampleData, due to sampleData will replace the externalFormulas into a Literal (in Transpiler)
|
|
289
|
+
if (variableType === constants_1.AST_TYPES.externalFormula && !(context === null || context === void 0 ? void 0 : context.useSampleData)) {
|
|
290
|
+
const isCircularDependency = (context === null || context === void 0 ? void 0 : context.currentFormulaId) &&
|
|
291
|
+
(context === null || context === void 0 ? void 0 : context.currentFormulaId) === variableValue;
|
|
292
|
+
if (isCircularDependency)
|
|
293
|
+
throw new errors_1.CircularDependencyError();
|
|
294
|
+
const parser = qformula_grammar_1.QFormulaLang.parser;
|
|
295
|
+
const externalFunctionProgram = (_b = variableContext === null || variableContext === void 0 ? void 0 : variableContext.replacement) !== null && _b !== void 0 ? _b : '';
|
|
296
|
+
const tree = parser.parse(externalFunctionProgram);
|
|
297
|
+
const ast = calculateAST(externalFunctionProgram, tree, context);
|
|
298
|
+
const formulaBody = ast === null || ast === void 0 ? void 0 : ast.body;
|
|
299
|
+
return Object.assign(Object.assign({ isExternalFormula: true }, baseResult), formulaBody);
|
|
300
|
+
}
|
|
301
|
+
return baseResult;
|
|
256
302
|
}
|
|
257
303
|
//# sourceMappingURL=json-parser.js.map
|