diff --git a/.vscode/settings.json b/.vscode/settings.json index 0a0d922..3da3bd8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { "prettier.configPath": "", "editor.codeActionsOnSave": { - "source.organizeImports": true + "source.organizeImports": "explicit" }, "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnPaste": true, diff --git a/manifest.json b/manifest.json index 982c6d1..88121dc 100644 --- a/manifest.json +++ b/manifest.json @@ -1,9 +1,9 @@ { "id": "solve", "name": "Solve", - "version": "0.8.2", + "version": "0.9.0", "minAppVersion": "0.15.0", - "description": "Level Up Your Notes: Introducing Solve – Your Math Maestro! Real-time calculations without AI fuss. From date magic ('Now + 20 days') to arithmetic flair ('10 + 5'), your trusted sidekick in every note. More brilliance on the way!", + "description": "Supercharge your notes in Obsdian with real-time calculations without AI fuss. From date magic ('Now + 20 days') to arithmetic flair ('10 + 5').", "author": "Liam Riddell", "authorUrl": "https://github.com/LiamRiddell", "fundingUrl": { @@ -11,4 +11,4 @@ "GitHub Sponser": "https://github.com/sponsors/LiamRiddell" }, "isDesktopOnly": false -} \ No newline at end of file +} diff --git a/package.json b/package.json index c01a819..5c05d7c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "solve", - "version": "0.8.2", - "description": "Supercharge your notes in with real-time calculations without AI fuss. From date magic ('Now + 20 days') to arithmetic flair ('10 + 5').", + "version": "0.9.0", + "description": "Supercharge your notes in Obsdian with real-time calculations without AI fuss. From date magic ('Now + 20 days') to arithmetic flair ('10 + 5').", "main": "main.js", "scripts": { "dev": "node esbuild.config.mjs", diff --git a/src/codemirror/MarkdownEditorViewPlugin.ts b/src/codemirror/MarkdownEditorViewPlugin.ts index 35af730..ec17fdc 100644 --- a/src/codemirror/MarkdownEditorViewPlugin.ts +++ b/src/codemirror/MarkdownEditorViewPlugin.ts @@ -3,6 +3,7 @@ import { pluginEventBus } from "@/eventbus/PluginEventBus"; import { Pipeline } from "@/pipelines/definition/Pipeline"; import { SharedCommentsRemovalStage } from "@/pipelines/stages/CommentsRemovalStage"; import { SharedMarkdownRemovalStage } from "@/pipelines/stages/MarkdownRemovalStage"; +import { PreviousResultSubstitutionStage } from "@/pipelines/stages/PreviousResultSubstitutionStage"; import { VariableProcessingStage } from "@/pipelines/stages/VariableProcessingStage"; import UserSettings from "@/settings/UserSettings"; import { logger } from "@/utilities/Logger"; @@ -33,15 +34,20 @@ export class MarkdownEditorViewPlugin implements PluginValue { ]; private processingPipeline: Pipeline; + private previousResultSubstitutionStage: PreviousResultSubstitutionStage; constructor(view: EditorView) { logger.debug(`[SolveViewPlugin] Constructer`); this.userSettings = UserSettings.getInstance(); + this.previousResultSubstitutionStage = + new PreviousResultSubstitutionStage(); + this.processingPipeline = new Pipeline() .addStage(SharedMarkdownRemovalStage) .addStage(SharedCommentsRemovalStage) + .addStage(this.previousResultSubstitutionStage) .addStage(new VariableProcessingStage()); this.decorations = this.buildDecorations(view); @@ -221,7 +227,7 @@ export class MarkdownEditorViewPlugin implements PluginValue { } // Initial implementation will show the first valid result from available providers. - const result = solveProviderManager.provideFirst(sentence); + const result = solveProviderManager.provideFirst(sentence); if (result === undefined) { return undefined; @@ -229,12 +235,12 @@ export class MarkdownEditorViewPlugin implements PluginValue { // If the input sentence and the output is the same value ignore it. // For example, 10 = 10 - const sentenceLowercasedTrimmed = sentence.toLowerCase().trim(); - const resultLowercaseTrimmed = result.startsWith("= ") - ? result.substring(2).toLocaleLowerCase().trim() - : result.toLowerCase().trim(); + const sentenceTrimmed = sentence.trim(); + const resultTrimmed = result.startsWith("= ") + ? result.substring(2).trim() + : result.trim(); - if (sentenceLowercasedTrimmed === resultLowercaseTrimmed) { + if (sentenceTrimmed.toLowerCase() === resultTrimmed.toLowerCase()) { return undefined; } @@ -246,6 +252,11 @@ export class MarkdownEditorViewPlugin implements PluginValue { return undefined; } + // Updates the previous solve to be the new solve that's passed the checks + this.previousResultSubstitutionStage.setPreviousResultString( + resultTrimmed + ); + return Decoration.widget({ widget: new ResultWidget(result, lineNumber), side: 1, diff --git a/src/grammars/arithmetic/BasicArithmetic.ohm-bundle.js b/src/grammars/arithmetic/BasicArithmetic.ohm-bundle.js index 232081e..4b75b64 100644 --- a/src/grammars/arithmetic/BasicArithmetic.ohm-bundle.js +++ b/src/grammars/arithmetic/BasicArithmetic.ohm-bundle.js @@ -1 +1 @@ -'use strict';const {makeRecipe}=require('ohm-js');const result=makeRecipe(["grammar",{"source":"BasicArithmetic {\r\n Expression\r\n = LogicalShift\r\n\r\n LogicalShift\r\n = LogicalShift \"<<\" LogicalShift -- left\r\n | LogicalShift \">>\" LogicalShift -- right\r\n | AS \r\n\r\n // Addition or Subtraction\r\n AS\r\n = AS add MD -- addition\r\n | AS subtract MD -- subtraction\r\n | MD\r\n\r\n // Multiply or Divide\r\n MD\r\n = MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | MD modulo E -- modulo\r\n | E\r\n\r\n // Exponent\r\n E\r\n = P exponent E -- exponent\r\n | P\r\n\r\n // Parenthesis\r\n P\r\n = \"(\" Expression \")\" -- parenthesis\r\n | Primitive\r\n \r\n Primitive\r\n = \"+\" Primitive -- positive\r\n | \"-\" Primitive -- negative\r\n | constant\r\n | hex\r\n | number\r\n \r\n // Lexical Rules\r\n add \r\n \t= \"+\"\r\n | caseInsensitive<\"plus\">\r\n \t| caseInsensitive<\"add\">\r\n | caseInsensitive<\"and\">\r\n \r\n subtract \r\n = \"-\"\r\n | caseInsensitive<\"minus\">\r\n | caseInsensitive<\"subtract\">\r\n | caseInsensitive<\"remove\">\r\n | caseInsensitive<\"take\">\r\n \r\n multiply \r\n = \"*\"\r\n | \"\\\\*\" // Escaped e.g. \\* for markdown\r\n | \"\\u{00D7}\" // Multiplication Symbol ×\r\n | caseInsensitive<\"x\">\r\n | caseInsensitive<\"times by\">\r\n | caseInsensitive<\"times\">\r\n | caseInsensitive<\"multiply by\">\r\n | caseInsensitive<\"multiply\">\r\n \r\n divide\r\n = \"/\"\r\n | \"\\u{00F7}\" // Division Symbol ÷\r\n | caseInsensitive<\"divide by\">\r\n | caseInsensitive<\"divide\">\r\n\r\n modulo\r\n = \"%\"\r\n | caseInsensitive<\"modulo\">\r\n | caseInsensitive<\"mod\">\r\n\r\n exponent\r\n = \"^\"\r\n | caseInsensitive<\"to the power of\">\r\n | caseInsensitive<\"power of\">\r\n | caseInsensitive<\"exponent\">\r\n | caseInsensitive<\"prime\">\r\n\r\n constant \r\n \t= caseInsensitive<\"PI\"> \r\n | caseInsensitive<\"E\">\r\n\r\n number\r\n = digit* \".\" digit+ -- fract\r\n | digit+ -- whole\r\n \r\n hex\r\n = \"0x\" hexDigit+\r\n | hexDigit+ \"h\"\r\n}"},"BasicArithmetic",null,"Expression",{"Expression":["define",{"sourceInterval":[21,51]},null,[],["app",{"sourceInterval":[39,51]},"LogicalShift",[]]],"LogicalShift_left":["define",{"sourceInterval":[77,115]},null,[],["seq",{"sourceInterval":[77,107]},["app",{"sourceInterval":[77,89]},"LogicalShift",[]],["terminal",{"sourceInterval":[90,94]},"<<"],["app",{"sourceInterval":[95,107]},"LogicalShift",[]]]],"LogicalShift_right":["define",{"sourceInterval":[123,162]},null,[],["seq",{"sourceInterval":[123,153]},["app",{"sourceInterval":[123,135]},"LogicalShift",[]],["terminal",{"sourceInterval":[136,140]},">>"],["app",{"sourceInterval":[141,153]},"LogicalShift",[]]]],"LogicalShift":["define",{"sourceInterval":[57,172]},null,[],["alt",{"sourceInterval":[77,172]},["app",{"sourceInterval":[77,107]},"LogicalShift_left",[]],["app",{"sourceInterval":[123,153]},"LogicalShift_right",[]],["app",{"sourceInterval":[170,172]},"AS",[]]]],"AS_addition":["define",{"sourceInterval":[219,241]},null,[],["seq",{"sourceInterval":[219,228]},["app",{"sourceInterval":[219,221]},"AS",[]],["app",{"sourceInterval":[222,225]},"add",[]],["app",{"sourceInterval":[226,228]},"MD",[]]]],"AS_subtraction":["define",{"sourceInterval":[249,279]},null,[],["seq",{"sourceInterval":[249,263]},["app",{"sourceInterval":[249,251]},"AS",[]],["app",{"sourceInterval":[252,260]},"subtract",[]],["app",{"sourceInterval":[261,263]},"MD",[]]]],"AS":["define",{"sourceInterval":[209,289]},null,[],["alt",{"sourceInterval":[219,289]},["app",{"sourceInterval":[219,228]},"AS_addition",[]],["app",{"sourceInterval":[249,263]},"AS_subtraction",[]],["app",{"sourceInterval":[287,289]},"MD",[]]]],"MD_multiplication":["define",{"sourceInterval":[330,362]},null,[],["seq",{"sourceInterval":[330,343]},["app",{"sourceInterval":[330,332]},"MD",[]],["app",{"sourceInterval":[333,341]},"multiply",[]],["app",{"sourceInterval":[342,343]},"E",[]]]],"MD_division":["define",{"sourceInterval":[370,394]},null,[],["seq",{"sourceInterval":[370,381]},["app",{"sourceInterval":[370,372]},"MD",[]],["app",{"sourceInterval":[373,379]},"divide",[]],["app",{"sourceInterval":[380,381]},"E",[]]]],"MD_modulo":["define",{"sourceInterval":[402,424]},null,[],["seq",{"sourceInterval":[402,413]},["app",{"sourceInterval":[402,404]},"MD",[]],["app",{"sourceInterval":[405,411]},"modulo",[]],["app",{"sourceInterval":[412,413]},"E",[]]]],"MD":["define",{"sourceInterval":[320,433]},null,[],["alt",{"sourceInterval":[330,433]},["app",{"sourceInterval":[330,343]},"MD_multiplication",[]],["app",{"sourceInterval":[370,381]},"MD_division",[]],["app",{"sourceInterval":[402,413]},"MD_modulo",[]],["app",{"sourceInterval":[432,433]},"E",[]]]],"E_exponent":["define",{"sourceInterval":[463,488]},null,[],["seq",{"sourceInterval":[463,475]},["app",{"sourceInterval":[463,464]},"P",[]],["app",{"sourceInterval":[465,473]},"exponent",[]],["app",{"sourceInterval":[474,475]},"E",[]]]],"E":["define",{"sourceInterval":[454,497]},null,[],["alt",{"sourceInterval":[463,497]},["app",{"sourceInterval":[463,475]},"E_exponent",[]],["app",{"sourceInterval":[496,497]},"P",[]]]],"P_parenthesis":["define",{"sourceInterval":[530,564]},null,[],["seq",{"sourceInterval":[530,548]},["terminal",{"sourceInterval":[530,533]},"("],["app",{"sourceInterval":[534,544]},"Expression",[]],["terminal",{"sourceInterval":[545,548]},")"]]],"P":["define",{"sourceInterval":[521,581]},null,[],["alt",{"sourceInterval":[530,581]},["app",{"sourceInterval":[530,548]},"P_parenthesis",[]],["app",{"sourceInterval":[572,581]},"Primitive",[]]]],"Primitive_positive":["define",{"sourceInterval":[608,633]},null,[],["seq",{"sourceInterval":[608,621]},["terminal",{"sourceInterval":[608,611]},"+"],["app",{"sourceInterval":[612,621]},"Primitive",[]]]],"Primitive_negative":["define",{"sourceInterval":[641,666]},null,[],["seq",{"sourceInterval":[641,654]},["terminal",{"sourceInterval":[641,644]},"-"],["app",{"sourceInterval":[645,654]},"Primitive",[]]]],"Primitive":["define",{"sourceInterval":[591,707]},null,[],["alt",{"sourceInterval":[608,707]},["app",{"sourceInterval":[608,621]},"Primitive_positive",[]],["app",{"sourceInterval":[641,654]},"Primitive_negative",[]],["app",{"sourceInterval":[674,682]},"constant",[]],["app",{"sourceInterval":[690,693]},"hex",[]],["app",{"sourceInterval":[701,707]},"number",[]]]],"add":["define",{"sourceInterval":[734,838]},null,[],["alt",{"sourceInterval":[745,838]},["terminal",{"sourceInterval":[745,748]},"+"],["app",{"sourceInterval":[756,779]},"caseInsensitive",[["terminal",{"sourceInterval":[772,778]},"plus"]]],["app",{"sourceInterval":[786,808]},"caseInsensitive",[["terminal",{"sourceInterval":[802,807]},"add"]]],["app",{"sourceInterval":[816,838]},"caseInsensitive",[["terminal",{"sourceInterval":[832,837]},"and"]]]]],"subtract":["define",{"sourceInterval":[848,999]},null,[],["alt",{"sourceInterval":[865,999]},["terminal",{"sourceInterval":[865,868]},"-"],["app",{"sourceInterval":[876,900]},"caseInsensitive",[["terminal",{"sourceInterval":[892,899]},"minus"]]],["app",{"sourceInterval":[908,935]},"caseInsensitive",[["terminal",{"sourceInterval":[924,934]},"subtract"]]],["app",{"sourceInterval":[943,968]},"caseInsensitive",[["terminal",{"sourceInterval":[959,967]},"remove"]]],["app",{"sourceInterval":[976,999]},"caseInsensitive",[["terminal",{"sourceInterval":[992,998]},"take"]]]]],"multiply":["define",{"sourceInterval":[1011,1289]},null,[],["alt",{"sourceInterval":[1028,1289]},["terminal",{"sourceInterval":[1028,1031]},"*"],["terminal",{"sourceInterval":[1039,1044]},"\\*"],["terminal",{"sourceInterval":[1084,1094]},"×"],["app",{"sourceInterval":[1129,1149]},"caseInsensitive",[["terminal",{"sourceInterval":[1145,1148]},"x"]]],["app",{"sourceInterval":[1157,1184]},"caseInsensitive",[["terminal",{"sourceInterval":[1173,1183]},"times by"]]],["app",{"sourceInterval":[1192,1216]},"caseInsensitive",[["terminal",{"sourceInterval":[1208,1215]},"times"]]],["app",{"sourceInterval":[1224,1254]},"caseInsensitive",[["terminal",{"sourceInterval":[1240,1253]},"multiply by"]]],["app",{"sourceInterval":[1262,1289]},"caseInsensitive",[["terminal",{"sourceInterval":[1278,1288]},"multiply"]]]]],"divide":["define",{"sourceInterval":[1301,1426]},null,[],["alt",{"sourceInterval":[1315,1426]},["terminal",{"sourceInterval":[1315,1318]},"/"],["terminal",{"sourceInterval":[1326,1336]},"÷"],["app",{"sourceInterval":[1365,1393]},"caseInsensitive",[["terminal",{"sourceInterval":[1381,1392]},"divide by"]]],["app",{"sourceInterval":[1401,1426]},"caseInsensitive",[["terminal",{"sourceInterval":[1417,1425]},"divide"]]]]],"modulo":["define",{"sourceInterval":[1432,1512]},null,[],["alt",{"sourceInterval":[1446,1512]},["terminal",{"sourceInterval":[1446,1449]},"%"],["app",{"sourceInterval":[1457,1482]},"caseInsensitive",[["terminal",{"sourceInterval":[1473,1481]},"modulo"]]],["app",{"sourceInterval":[1490,1512]},"caseInsensitive",[["terminal",{"sourceInterval":[1506,1511]},"mod"]]]]],"exponent":["define",{"sourceInterval":[1518,1681]},null,[],["alt",{"sourceInterval":[1534,1681]},["terminal",{"sourceInterval":[1534,1537]},"^"],["app",{"sourceInterval":[1545,1579]},"caseInsensitive",[["terminal",{"sourceInterval":[1561,1578]},"to the power of"]]],["app",{"sourceInterval":[1587,1614]},"caseInsensitive",[["terminal",{"sourceInterval":[1603,1613]},"power of"]]],["app",{"sourceInterval":[1622,1649]},"caseInsensitive",[["terminal",{"sourceInterval":[1638,1648]},"exponent"]]],["app",{"sourceInterval":[1657,1681]},"caseInsensitive",[["terminal",{"sourceInterval":[1673,1680]},"prime"]]]]],"constant":["define",{"sourceInterval":[1687,1754]},null,[],["alt",{"sourceInterval":[1704,1754]},["app",{"sourceInterval":[1704,1725]},"caseInsensitive",[["terminal",{"sourceInterval":[1720,1724]},"PI"]]],["app",{"sourceInterval":[1734,1754]},"caseInsensitive",[["terminal",{"sourceInterval":[1750,1753]},"E"]]]]],"number_fract":["define",{"sourceInterval":[1774,1801]},null,[],["seq",{"sourceInterval":[1774,1791]},["star",{"sourceInterval":[1774,1780]},["app",{"sourceInterval":[1774,1779]},"digit",[]]],["terminal",{"sourceInterval":[1781,1784]},"."],["plus",{"sourceInterval":[1785,1791]},["app",{"sourceInterval":[1785,1790]},"digit",[]]]]],"number_whole":["define",{"sourceInterval":[1809,1836]},null,[],["plus",{"sourceInterval":[1809,1815]},["app",{"sourceInterval":[1809,1814]},"digit",[]]]],"number":["define",{"sourceInterval":[1760,1836]},null,[],["alt",{"sourceInterval":[1774,1836]},["app",{"sourceInterval":[1774,1791]},"number_fract",[]],["app",{"sourceInterval":[1809,1815]},"number_whole",[]]]],"hex":["define",{"sourceInterval":[1844,1890]},null,[],["alt",{"sourceInterval":[1855,1890]},["seq",{"sourceInterval":[1855,1869]},["terminal",{"sourceInterval":[1855,1859]},"0x"],["plus",{"sourceInterval":[1860,1869]},["app",{"sourceInterval":[1860,1868]},"hexDigit",[]]]],["seq",{"sourceInterval":[1877,1890]},["plus",{"sourceInterval":[1877,1886]},["app",{"sourceInterval":[1877,1885]},"hexDigit",[]]],["terminal",{"sourceInterval":[1887,1890]},"h"]]]]}]);module.exports=result; \ No newline at end of file +'use strict';const {makeRecipe}=require('ohm-js');const result=makeRecipe(["grammar",{"source":"BasicArithmetic {\r\n Expression\r\n = LogicalShift\r\n\r\n LogicalShift\r\n = LogicalShift \"<<\" LogicalShift -- left\r\n | LogicalShift \">>\" LogicalShift -- right\r\n | AS \r\n\r\n // Addition or Subtraction\r\n AS\r\n = AS add MD -- addition\r\n | AS subtract MD -- subtraction\r\n | MD\r\n\r\n // Multiply or Divide\r\n MD\r\n = MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | MD modulo E -- modulo\r\n | E\r\n\r\n // Exponent\r\n E\r\n = P exponent E -- exponent\r\n | P\r\n\r\n // Parenthesis\r\n P\r\n = \"(\" Expression \")\" -- parenthesis\r\n | Primitive\r\n \r\n Primitive\r\n = \"+\" Primitive -- positive\r\n | \"-\" Primitive -- negative\r\n | constant\r\n | hex\r\n | number\r\n \r\n // Lexical Rules\r\n add \r\n \t= \"+\"\r\n | caseInsensitive<\"plus\">\r\n \t| caseInsensitive<\"add\">\r\n | caseInsensitive<\"and\">\r\n \r\n subtract \r\n = \"-\"\r\n | caseInsensitive<\"minus\">\r\n | caseInsensitive<\"subtract\">\r\n | caseInsensitive<\"remove\">\r\n | caseInsensitive<\"take\">\r\n \r\n multiply \r\n = \"*\"\r\n | \"\\\\*\" // Escaped \\* for markdown\r\n | \"\\u{00D7}\" // ×\r\n | caseInsensitive<\"x\">\r\n | caseInsensitive<\"times by\">\r\n | caseInsensitive<\"times\">\r\n | caseInsensitive<\"multiply by\">\r\n | caseInsensitive<\"multiply\">\r\n \r\n divide\r\n = \"/\"\r\n | \"\\u{00F7}\" // ÷\r\n | caseInsensitive<\"divide by\">\r\n | caseInsensitive<\"divide\">\r\n\r\n modulo\r\n = \"%\"\r\n | caseInsensitive<\"modulo\">\r\n | caseInsensitive<\"mod\">\r\n\r\n exponent\r\n = \"^\"\r\n | caseInsensitive<\"to the power of\">\r\n | caseInsensitive<\"power of\">\r\n | caseInsensitive<\"exponent\">\r\n | caseInsensitive<\"prime\">\r\n\r\n constant \r\n \t= caseInsensitive<\"PI\"> \r\n | caseInsensitive<\"E\">\r\n\r\n number\r\n = digit* \".\" digit+ -- fract\r\n | digit+ -- whole\r\n \r\n hex\r\n = \"0x\" hexDigit+\r\n | hexDigit+ \"h\"\r\n}"},"BasicArithmetic",null,"Expression",{"Expression":["define",{"sourceInterval":[21,51]},null,[],["app",{"sourceInterval":[39,51]},"LogicalShift",[]]],"LogicalShift_left":["define",{"sourceInterval":[77,115]},null,[],["seq",{"sourceInterval":[77,107]},["app",{"sourceInterval":[77,89]},"LogicalShift",[]],["terminal",{"sourceInterval":[90,94]},"<<"],["app",{"sourceInterval":[95,107]},"LogicalShift",[]]]],"LogicalShift_right":["define",{"sourceInterval":[123,162]},null,[],["seq",{"sourceInterval":[123,153]},["app",{"sourceInterval":[123,135]},"LogicalShift",[]],["terminal",{"sourceInterval":[136,140]},">>"],["app",{"sourceInterval":[141,153]},"LogicalShift",[]]]],"LogicalShift":["define",{"sourceInterval":[57,172]},null,[],["alt",{"sourceInterval":[77,172]},["app",{"sourceInterval":[77,107]},"LogicalShift_left",[]],["app",{"sourceInterval":[123,153]},"LogicalShift_right",[]],["app",{"sourceInterval":[170,172]},"AS",[]]]],"AS_addition":["define",{"sourceInterval":[219,241]},null,[],["seq",{"sourceInterval":[219,228]},["app",{"sourceInterval":[219,221]},"AS",[]],["app",{"sourceInterval":[222,225]},"add",[]],["app",{"sourceInterval":[226,228]},"MD",[]]]],"AS_subtraction":["define",{"sourceInterval":[249,279]},null,[],["seq",{"sourceInterval":[249,263]},["app",{"sourceInterval":[249,251]},"AS",[]],["app",{"sourceInterval":[252,260]},"subtract",[]],["app",{"sourceInterval":[261,263]},"MD",[]]]],"AS":["define",{"sourceInterval":[209,289]},null,[],["alt",{"sourceInterval":[219,289]},["app",{"sourceInterval":[219,228]},"AS_addition",[]],["app",{"sourceInterval":[249,263]},"AS_subtraction",[]],["app",{"sourceInterval":[287,289]},"MD",[]]]],"MD_multiplication":["define",{"sourceInterval":[330,362]},null,[],["seq",{"sourceInterval":[330,343]},["app",{"sourceInterval":[330,332]},"MD",[]],["app",{"sourceInterval":[333,341]},"multiply",[]],["app",{"sourceInterval":[342,343]},"E",[]]]],"MD_division":["define",{"sourceInterval":[370,394]},null,[],["seq",{"sourceInterval":[370,381]},["app",{"sourceInterval":[370,372]},"MD",[]],["app",{"sourceInterval":[373,379]},"divide",[]],["app",{"sourceInterval":[380,381]},"E",[]]]],"MD_modulo":["define",{"sourceInterval":[402,424]},null,[],["seq",{"sourceInterval":[402,413]},["app",{"sourceInterval":[402,404]},"MD",[]],["app",{"sourceInterval":[405,411]},"modulo",[]],["app",{"sourceInterval":[412,413]},"E",[]]]],"MD":["define",{"sourceInterval":[320,433]},null,[],["alt",{"sourceInterval":[330,433]},["app",{"sourceInterval":[330,343]},"MD_multiplication",[]],["app",{"sourceInterval":[370,381]},"MD_division",[]],["app",{"sourceInterval":[402,413]},"MD_modulo",[]],["app",{"sourceInterval":[432,433]},"E",[]]]],"E_exponent":["define",{"sourceInterval":[463,488]},null,[],["seq",{"sourceInterval":[463,475]},["app",{"sourceInterval":[463,464]},"P",[]],["app",{"sourceInterval":[465,473]},"exponent",[]],["app",{"sourceInterval":[474,475]},"E",[]]]],"E":["define",{"sourceInterval":[454,497]},null,[],["alt",{"sourceInterval":[463,497]},["app",{"sourceInterval":[463,475]},"E_exponent",[]],["app",{"sourceInterval":[496,497]},"P",[]]]],"P_parenthesis":["define",{"sourceInterval":[530,564]},null,[],["seq",{"sourceInterval":[530,548]},["terminal",{"sourceInterval":[530,533]},"("],["app",{"sourceInterval":[534,544]},"Expression",[]],["terminal",{"sourceInterval":[545,548]},")"]]],"P":["define",{"sourceInterval":[521,581]},null,[],["alt",{"sourceInterval":[530,581]},["app",{"sourceInterval":[530,548]},"P_parenthesis",[]],["app",{"sourceInterval":[572,581]},"Primitive",[]]]],"Primitive_positive":["define",{"sourceInterval":[608,633]},null,[],["seq",{"sourceInterval":[608,621]},["terminal",{"sourceInterval":[608,611]},"+"],["app",{"sourceInterval":[612,621]},"Primitive",[]]]],"Primitive_negative":["define",{"sourceInterval":[641,666]},null,[],["seq",{"sourceInterval":[641,654]},["terminal",{"sourceInterval":[641,644]},"-"],["app",{"sourceInterval":[645,654]},"Primitive",[]]]],"Primitive":["define",{"sourceInterval":[591,707]},null,[],["alt",{"sourceInterval":[608,707]},["app",{"sourceInterval":[608,621]},"Primitive_positive",[]],["app",{"sourceInterval":[641,654]},"Primitive_negative",[]],["app",{"sourceInterval":[674,682]},"constant",[]],["app",{"sourceInterval":[690,693]},"hex",[]],["app",{"sourceInterval":[701,707]},"number",[]]]],"add":["define",{"sourceInterval":[734,838]},null,[],["alt",{"sourceInterval":[745,838]},["terminal",{"sourceInterval":[745,748]},"+"],["app",{"sourceInterval":[756,779]},"caseInsensitive",[["terminal",{"sourceInterval":[772,778]},"plus"]]],["app",{"sourceInterval":[786,808]},"caseInsensitive",[["terminal",{"sourceInterval":[802,807]},"add"]]],["app",{"sourceInterval":[816,838]},"caseInsensitive",[["terminal",{"sourceInterval":[832,837]},"and"]]]]],"subtract":["define",{"sourceInterval":[848,999]},null,[],["alt",{"sourceInterval":[865,999]},["terminal",{"sourceInterval":[865,868]},"-"],["app",{"sourceInterval":[876,900]},"caseInsensitive",[["terminal",{"sourceInterval":[892,899]},"minus"]]],["app",{"sourceInterval":[908,935]},"caseInsensitive",[["terminal",{"sourceInterval":[924,934]},"subtract"]]],["app",{"sourceInterval":[943,968]},"caseInsensitive",[["terminal",{"sourceInterval":[959,967]},"remove"]]],["app",{"sourceInterval":[976,999]},"caseInsensitive",[["terminal",{"sourceInterval":[992,998]},"take"]]]]],"multiply":["define",{"sourceInterval":[1011,1262]},null,[],["alt",{"sourceInterval":[1028,1262]},["terminal",{"sourceInterval":[1028,1031]},"*"],["terminal",{"sourceInterval":[1039,1044]},"\\*"],["terminal",{"sourceInterval":[1079,1089]},"×"],["app",{"sourceInterval":[1102,1122]},"caseInsensitive",[["terminal",{"sourceInterval":[1118,1121]},"x"]]],["app",{"sourceInterval":[1130,1157]},"caseInsensitive",[["terminal",{"sourceInterval":[1146,1156]},"times by"]]],["app",{"sourceInterval":[1165,1189]},"caseInsensitive",[["terminal",{"sourceInterval":[1181,1188]},"times"]]],["app",{"sourceInterval":[1197,1227]},"caseInsensitive",[["terminal",{"sourceInterval":[1213,1226]},"multiply by"]]],["app",{"sourceInterval":[1235,1262]},"caseInsensitive",[["terminal",{"sourceInterval":[1251,1261]},"multiply"]]]]],"divide":["define",{"sourceInterval":[1274,1383]},null,[],["alt",{"sourceInterval":[1288,1383]},["terminal",{"sourceInterval":[1288,1291]},"/"],["terminal",{"sourceInterval":[1299,1309]},"÷"],["app",{"sourceInterval":[1322,1350]},"caseInsensitive",[["terminal",{"sourceInterval":[1338,1349]},"divide by"]]],["app",{"sourceInterval":[1358,1383]},"caseInsensitive",[["terminal",{"sourceInterval":[1374,1382]},"divide"]]]]],"modulo":["define",{"sourceInterval":[1389,1469]},null,[],["alt",{"sourceInterval":[1403,1469]},["terminal",{"sourceInterval":[1403,1406]},"%"],["app",{"sourceInterval":[1414,1439]},"caseInsensitive",[["terminal",{"sourceInterval":[1430,1438]},"modulo"]]],["app",{"sourceInterval":[1447,1469]},"caseInsensitive",[["terminal",{"sourceInterval":[1463,1468]},"mod"]]]]],"exponent":["define",{"sourceInterval":[1475,1638]},null,[],["alt",{"sourceInterval":[1491,1638]},["terminal",{"sourceInterval":[1491,1494]},"^"],["app",{"sourceInterval":[1502,1536]},"caseInsensitive",[["terminal",{"sourceInterval":[1518,1535]},"to the power of"]]],["app",{"sourceInterval":[1544,1571]},"caseInsensitive",[["terminal",{"sourceInterval":[1560,1570]},"power of"]]],["app",{"sourceInterval":[1579,1606]},"caseInsensitive",[["terminal",{"sourceInterval":[1595,1605]},"exponent"]]],["app",{"sourceInterval":[1614,1638]},"caseInsensitive",[["terminal",{"sourceInterval":[1630,1637]},"prime"]]]]],"constant":["define",{"sourceInterval":[1644,1711]},null,[],["alt",{"sourceInterval":[1661,1711]},["app",{"sourceInterval":[1661,1682]},"caseInsensitive",[["terminal",{"sourceInterval":[1677,1681]},"PI"]]],["app",{"sourceInterval":[1691,1711]},"caseInsensitive",[["terminal",{"sourceInterval":[1707,1710]},"E"]]]]],"number_fract":["define",{"sourceInterval":[1731,1758]},null,[],["seq",{"sourceInterval":[1731,1748]},["star",{"sourceInterval":[1731,1737]},["app",{"sourceInterval":[1731,1736]},"digit",[]]],["terminal",{"sourceInterval":[1738,1741]},"."],["plus",{"sourceInterval":[1742,1748]},["app",{"sourceInterval":[1742,1747]},"digit",[]]]]],"number_whole":["define",{"sourceInterval":[1766,1793]},null,[],["plus",{"sourceInterval":[1766,1772]},["app",{"sourceInterval":[1766,1771]},"digit",[]]]],"number":["define",{"sourceInterval":[1717,1793]},null,[],["alt",{"sourceInterval":[1731,1793]},["app",{"sourceInterval":[1731,1748]},"number_fract",[]],["app",{"sourceInterval":[1766,1772]},"number_whole",[]]]],"hex":["define",{"sourceInterval":[1801,1847]},null,[],["alt",{"sourceInterval":[1812,1847]},["seq",{"sourceInterval":[1812,1826]},["terminal",{"sourceInterval":[1812,1816]},"0x"],["plus",{"sourceInterval":[1817,1826]},["app",{"sourceInterval":[1817,1825]},"hexDigit",[]]]],["seq",{"sourceInterval":[1834,1847]},["plus",{"sourceInterval":[1834,1843]},["app",{"sourceInterval":[1834,1842]},"hexDigit",[]]],["terminal",{"sourceInterval":[1844,1847]},"h"]]]]}]);module.exports=result; \ No newline at end of file diff --git a/src/grammars/function/FunctionArithmetic.ohm-bundle.js b/src/grammars/function/FunctionArithmetic.ohm-bundle.js index b73a5f4..54971fb 100644 --- a/src/grammars/function/FunctionArithmetic.ohm-bundle.js +++ b/src/grammars/function/FunctionArithmetic.ohm-bundle.js @@ -1 +1 @@ -'use strict';const {makeRecipe}=require('ohm-js');const result={};result.BasicArithmetic=makeRecipe(["grammar",{"source":"BasicArithmetic {\r\n Expression\r\n = LogicalShift\r\n\r\n LogicalShift\r\n = LogicalShift \"<<\" LogicalShift -- left\r\n | LogicalShift \">>\" LogicalShift -- right\r\n | AS \r\n\r\n // Addition or Subtraction\r\n AS\r\n = AS add MD -- addition\r\n | AS subtract MD -- subtraction\r\n | MD\r\n\r\n // Multiply or Divide\r\n MD\r\n = MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | MD modulo E -- modulo\r\n | E\r\n\r\n // Exponent\r\n E\r\n = P exponent E -- exponent\r\n | P\r\n\r\n // Parenthesis\r\n P\r\n = \"(\" Expression \")\" -- parenthesis\r\n | Primitive\r\n \r\n Primitive\r\n = \"+\" Primitive -- positive\r\n | \"-\" Primitive -- negative\r\n | constant\r\n | hex\r\n | number\r\n \r\n // Lexical Rules\r\n add \r\n \t= \"+\"\r\n | caseInsensitive<\"plus\">\r\n \t| caseInsensitive<\"add\">\r\n | caseInsensitive<\"and\">\r\n \r\n subtract \r\n = \"-\"\r\n | caseInsensitive<\"minus\">\r\n | caseInsensitive<\"subtract\">\r\n | caseInsensitive<\"remove\">\r\n | caseInsensitive<\"take\">\r\n \r\n multiply \r\n = \"*\"\r\n | \"\\\\*\" // Escaped e.g. \\* for markdown\r\n | \"\\u{00D7}\" // Multiplication Symbol ×\r\n | caseInsensitive<\"x\">\r\n | caseInsensitive<\"times by\">\r\n | caseInsensitive<\"times\">\r\n | caseInsensitive<\"multiply by\">\r\n | caseInsensitive<\"multiply\">\r\n \r\n divide\r\n = \"/\"\r\n | \"\\u{00F7}\" // Division Symbol ÷\r\n | caseInsensitive<\"divide by\">\r\n | caseInsensitive<\"divide\">\r\n\r\n modulo\r\n = \"%\"\r\n | caseInsensitive<\"modulo\">\r\n | caseInsensitive<\"mod\">\r\n\r\n exponent\r\n = \"^\"\r\n | caseInsensitive<\"to the power of\">\r\n | caseInsensitive<\"power of\">\r\n | caseInsensitive<\"exponent\">\r\n | caseInsensitive<\"prime\">\r\n\r\n constant \r\n \t= caseInsensitive<\"PI\"> \r\n | caseInsensitive<\"E\">\r\n\r\n number\r\n = digit* \".\" digit+ -- fract\r\n | digit+ -- whole\r\n \r\n hex\r\n = \"0x\" hexDigit+\r\n | hexDigit+ \"h\"\r\n}"},"BasicArithmetic",null,"Expression",{"Expression":["define",{"sourceInterval":[21,51]},null,[],["app",{"sourceInterval":[39,51]},"LogicalShift",[]]],"LogicalShift_left":["define",{"sourceInterval":[77,115]},null,[],["seq",{"sourceInterval":[77,107]},["app",{"sourceInterval":[77,89]},"LogicalShift",[]],["terminal",{"sourceInterval":[90,94]},"<<"],["app",{"sourceInterval":[95,107]},"LogicalShift",[]]]],"LogicalShift_right":["define",{"sourceInterval":[123,162]},null,[],["seq",{"sourceInterval":[123,153]},["app",{"sourceInterval":[123,135]},"LogicalShift",[]],["terminal",{"sourceInterval":[136,140]},">>"],["app",{"sourceInterval":[141,153]},"LogicalShift",[]]]],"LogicalShift":["define",{"sourceInterval":[57,172]},null,[],["alt",{"sourceInterval":[77,172]},["app",{"sourceInterval":[77,107]},"LogicalShift_left",[]],["app",{"sourceInterval":[123,153]},"LogicalShift_right",[]],["app",{"sourceInterval":[170,172]},"AS",[]]]],"AS_addition":["define",{"sourceInterval":[219,241]},null,[],["seq",{"sourceInterval":[219,228]},["app",{"sourceInterval":[219,221]},"AS",[]],["app",{"sourceInterval":[222,225]},"add",[]],["app",{"sourceInterval":[226,228]},"MD",[]]]],"AS_subtraction":["define",{"sourceInterval":[249,279]},null,[],["seq",{"sourceInterval":[249,263]},["app",{"sourceInterval":[249,251]},"AS",[]],["app",{"sourceInterval":[252,260]},"subtract",[]],["app",{"sourceInterval":[261,263]},"MD",[]]]],"AS":["define",{"sourceInterval":[209,289]},null,[],["alt",{"sourceInterval":[219,289]},["app",{"sourceInterval":[219,228]},"AS_addition",[]],["app",{"sourceInterval":[249,263]},"AS_subtraction",[]],["app",{"sourceInterval":[287,289]},"MD",[]]]],"MD_multiplication":["define",{"sourceInterval":[330,362]},null,[],["seq",{"sourceInterval":[330,343]},["app",{"sourceInterval":[330,332]},"MD",[]],["app",{"sourceInterval":[333,341]},"multiply",[]],["app",{"sourceInterval":[342,343]},"E",[]]]],"MD_division":["define",{"sourceInterval":[370,394]},null,[],["seq",{"sourceInterval":[370,381]},["app",{"sourceInterval":[370,372]},"MD",[]],["app",{"sourceInterval":[373,379]},"divide",[]],["app",{"sourceInterval":[380,381]},"E",[]]]],"MD_modulo":["define",{"sourceInterval":[402,424]},null,[],["seq",{"sourceInterval":[402,413]},["app",{"sourceInterval":[402,404]},"MD",[]],["app",{"sourceInterval":[405,411]},"modulo",[]],["app",{"sourceInterval":[412,413]},"E",[]]]],"MD":["define",{"sourceInterval":[320,433]},null,[],["alt",{"sourceInterval":[330,433]},["app",{"sourceInterval":[330,343]},"MD_multiplication",[]],["app",{"sourceInterval":[370,381]},"MD_division",[]],["app",{"sourceInterval":[402,413]},"MD_modulo",[]],["app",{"sourceInterval":[432,433]},"E",[]]]],"E_exponent":["define",{"sourceInterval":[463,488]},null,[],["seq",{"sourceInterval":[463,475]},["app",{"sourceInterval":[463,464]},"P",[]],["app",{"sourceInterval":[465,473]},"exponent",[]],["app",{"sourceInterval":[474,475]},"E",[]]]],"E":["define",{"sourceInterval":[454,497]},null,[],["alt",{"sourceInterval":[463,497]},["app",{"sourceInterval":[463,475]},"E_exponent",[]],["app",{"sourceInterval":[496,497]},"P",[]]]],"P_parenthesis":["define",{"sourceInterval":[530,564]},null,[],["seq",{"sourceInterval":[530,548]},["terminal",{"sourceInterval":[530,533]},"("],["app",{"sourceInterval":[534,544]},"Expression",[]],["terminal",{"sourceInterval":[545,548]},")"]]],"P":["define",{"sourceInterval":[521,581]},null,[],["alt",{"sourceInterval":[530,581]},["app",{"sourceInterval":[530,548]},"P_parenthesis",[]],["app",{"sourceInterval":[572,581]},"Primitive",[]]]],"Primitive_positive":["define",{"sourceInterval":[608,633]},null,[],["seq",{"sourceInterval":[608,621]},["terminal",{"sourceInterval":[608,611]},"+"],["app",{"sourceInterval":[612,621]},"Primitive",[]]]],"Primitive_negative":["define",{"sourceInterval":[641,666]},null,[],["seq",{"sourceInterval":[641,654]},["terminal",{"sourceInterval":[641,644]},"-"],["app",{"sourceInterval":[645,654]},"Primitive",[]]]],"Primitive":["define",{"sourceInterval":[591,707]},null,[],["alt",{"sourceInterval":[608,707]},["app",{"sourceInterval":[608,621]},"Primitive_positive",[]],["app",{"sourceInterval":[641,654]},"Primitive_negative",[]],["app",{"sourceInterval":[674,682]},"constant",[]],["app",{"sourceInterval":[690,693]},"hex",[]],["app",{"sourceInterval":[701,707]},"number",[]]]],"add":["define",{"sourceInterval":[734,838]},null,[],["alt",{"sourceInterval":[745,838]},["terminal",{"sourceInterval":[745,748]},"+"],["app",{"sourceInterval":[756,779]},"caseInsensitive",[["terminal",{"sourceInterval":[772,778]},"plus"]]],["app",{"sourceInterval":[786,808]},"caseInsensitive",[["terminal",{"sourceInterval":[802,807]},"add"]]],["app",{"sourceInterval":[816,838]},"caseInsensitive",[["terminal",{"sourceInterval":[832,837]},"and"]]]]],"subtract":["define",{"sourceInterval":[848,999]},null,[],["alt",{"sourceInterval":[865,999]},["terminal",{"sourceInterval":[865,868]},"-"],["app",{"sourceInterval":[876,900]},"caseInsensitive",[["terminal",{"sourceInterval":[892,899]},"minus"]]],["app",{"sourceInterval":[908,935]},"caseInsensitive",[["terminal",{"sourceInterval":[924,934]},"subtract"]]],["app",{"sourceInterval":[943,968]},"caseInsensitive",[["terminal",{"sourceInterval":[959,967]},"remove"]]],["app",{"sourceInterval":[976,999]},"caseInsensitive",[["terminal",{"sourceInterval":[992,998]},"take"]]]]],"multiply":["define",{"sourceInterval":[1011,1289]},null,[],["alt",{"sourceInterval":[1028,1289]},["terminal",{"sourceInterval":[1028,1031]},"*"],["terminal",{"sourceInterval":[1039,1044]},"\\*"],["terminal",{"sourceInterval":[1084,1094]},"×"],["app",{"sourceInterval":[1129,1149]},"caseInsensitive",[["terminal",{"sourceInterval":[1145,1148]},"x"]]],["app",{"sourceInterval":[1157,1184]},"caseInsensitive",[["terminal",{"sourceInterval":[1173,1183]},"times by"]]],["app",{"sourceInterval":[1192,1216]},"caseInsensitive",[["terminal",{"sourceInterval":[1208,1215]},"times"]]],["app",{"sourceInterval":[1224,1254]},"caseInsensitive",[["terminal",{"sourceInterval":[1240,1253]},"multiply by"]]],["app",{"sourceInterval":[1262,1289]},"caseInsensitive",[["terminal",{"sourceInterval":[1278,1288]},"multiply"]]]]],"divide":["define",{"sourceInterval":[1301,1426]},null,[],["alt",{"sourceInterval":[1315,1426]},["terminal",{"sourceInterval":[1315,1318]},"/"],["terminal",{"sourceInterval":[1326,1336]},"÷"],["app",{"sourceInterval":[1365,1393]},"caseInsensitive",[["terminal",{"sourceInterval":[1381,1392]},"divide by"]]],["app",{"sourceInterval":[1401,1426]},"caseInsensitive",[["terminal",{"sourceInterval":[1417,1425]},"divide"]]]]],"modulo":["define",{"sourceInterval":[1432,1512]},null,[],["alt",{"sourceInterval":[1446,1512]},["terminal",{"sourceInterval":[1446,1449]},"%"],["app",{"sourceInterval":[1457,1482]},"caseInsensitive",[["terminal",{"sourceInterval":[1473,1481]},"modulo"]]],["app",{"sourceInterval":[1490,1512]},"caseInsensitive",[["terminal",{"sourceInterval":[1506,1511]},"mod"]]]]],"exponent":["define",{"sourceInterval":[1518,1681]},null,[],["alt",{"sourceInterval":[1534,1681]},["terminal",{"sourceInterval":[1534,1537]},"^"],["app",{"sourceInterval":[1545,1579]},"caseInsensitive",[["terminal",{"sourceInterval":[1561,1578]},"to the power of"]]],["app",{"sourceInterval":[1587,1614]},"caseInsensitive",[["terminal",{"sourceInterval":[1603,1613]},"power of"]]],["app",{"sourceInterval":[1622,1649]},"caseInsensitive",[["terminal",{"sourceInterval":[1638,1648]},"exponent"]]],["app",{"sourceInterval":[1657,1681]},"caseInsensitive",[["terminal",{"sourceInterval":[1673,1680]},"prime"]]]]],"constant":["define",{"sourceInterval":[1687,1754]},null,[],["alt",{"sourceInterval":[1704,1754]},["app",{"sourceInterval":[1704,1725]},"caseInsensitive",[["terminal",{"sourceInterval":[1720,1724]},"PI"]]],["app",{"sourceInterval":[1734,1754]},"caseInsensitive",[["terminal",{"sourceInterval":[1750,1753]},"E"]]]]],"number_fract":["define",{"sourceInterval":[1774,1801]},null,[],["seq",{"sourceInterval":[1774,1791]},["star",{"sourceInterval":[1774,1780]},["app",{"sourceInterval":[1774,1779]},"digit",[]]],["terminal",{"sourceInterval":[1781,1784]},"."],["plus",{"sourceInterval":[1785,1791]},["app",{"sourceInterval":[1785,1790]},"digit",[]]]]],"number_whole":["define",{"sourceInterval":[1809,1836]},null,[],["plus",{"sourceInterval":[1809,1815]},["app",{"sourceInterval":[1809,1814]},"digit",[]]]],"number":["define",{"sourceInterval":[1760,1836]},null,[],["alt",{"sourceInterval":[1774,1836]},["app",{"sourceInterval":[1774,1791]},"number_fract",[]],["app",{"sourceInterval":[1809,1815]},"number_whole",[]]]],"hex":["define",{"sourceInterval":[1844,1890]},null,[],["alt",{"sourceInterval":[1855,1890]},["seq",{"sourceInterval":[1855,1869]},["terminal",{"sourceInterval":[1855,1859]},"0x"],["plus",{"sourceInterval":[1860,1869]},["app",{"sourceInterval":[1860,1868]},"hexDigit",[]]]],["seq",{"sourceInterval":[1877,1890]},["plus",{"sourceInterval":[1877,1886]},["app",{"sourceInterval":[1877,1885]},"hexDigit",[]]],["terminal",{"sourceInterval":[1887,1890]},"h"]]]]}]);result.FunctionArithmetic=makeRecipe(["grammar",{"source":"FunctionArithmetic <: BasicArithmetic {\r\n P\r\n := \"(\" Expression \")\" -- parenthesis\r\n | Function\r\n | Primitive\r\n\r\n Function\r\n = DegreesToRadians\r\n | RadiansToDegrees\r\n | LogBase\r\n | JavascriptMathObjectFunction\r\n\r\n LogBase \r\n = caseInsensitive<\"logb\"> \"(\" number \",\" number \")\"\r\n | caseInsensitive<\"logBase\"> \"(\" number \",\" number \")\"\r\n\r\n DegreesToRadians \r\n = caseInsensitive<\"degToRad\"> \"(\" number \")\"\r\n | caseInsensitive<\"degreesToRadians\"> \"(\" number \")\"\r\n | caseInsensitive<\"radians\"> \"(\" number \")\"\r\n | caseInsensitive<\"toRadians\"> \"(\" number \")\"\r\n\r\n RadiansToDegrees \r\n = caseInsensitive<\"radToDeg\"> \"(\" number \")\"\r\n | caseInsensitive<\"radiansToDegrees\"> \"(\" number \")\"\r\n | caseInsensitive<\"degrees\"> \"(\" number \")\"\r\n | caseInsensitive<\"toDegrees\"> \"(\" number \")\"\r\n\r\n // Pass-through for Math.* functions from JS\r\n JavascriptMathObjectFunction = mathJsName \"(\" ListOf \")\"\r\n\r\n mathJsName \r\n \t = caseInsensitive<\"sinh\">\r\n | caseInsensitive<\"sin\">\r\n | caseInsensitive<\"abs\">\r\n | caseInsensitive<\"acosh\">\r\n | caseInsensitive<\"acos\">\r\n | caseInsensitive<\"asinh\">\r\n | caseInsensitive<\"asin\">\r\n | caseInsensitive<\"atan2\">\r\n | caseInsensitive<\"atanh\">\r\n | caseInsensitive<\"atan\">\r\n | caseInsensitive<\"cbrt\">\r\n | caseInsensitive<\"ceil\">\r\n | caseInsensitive<\"clz32\">\r\n | caseInsensitive<\"cosh\">\r\n | caseInsensitive<\"cos\">\r\n | caseInsensitive<\"expm1\">\r\n | caseInsensitive<\"exp\">\r\n | caseInsensitive<\"floor\">\r\n | caseInsensitive<\"fround\">\r\n | caseInsensitive<\"hypot\">\r\n | caseInsensitive<\"imul\">\r\n | caseInsensitive<\"log10\">\r\n | caseInsensitive<\"log1p\">\r\n | caseInsensitive<\"log2\">\r\n | caseInsensitive<\"log\">\r\n | caseInsensitive<\"max\">\r\n | caseInsensitive<\"min\">\r\n | caseInsensitive<\"pow\">\r\n | caseInsensitive<\"random\">\r\n | caseInsensitive<\"round\">\r\n | caseInsensitive<\"sign\">\r\n | caseInsensitive<\"sqrt\">\r\n | caseInsensitive<\"tanh\">\r\n | caseInsensitive<\"tan\">\r\n | caseInsensitive<\"trunc\">\r\n}"},"FunctionArithmetic",result.BasicArithmetic,"Expression",{"P_parenthesis":["override",{"sourceInterval":[53,87]},null,[],["seq",{"sourceInterval":[53,71]},["terminal",{"sourceInterval":[53,56]},"("],["app",{"sourceInterval":[57,67]},"Expression",[]],["terminal",{"sourceInterval":[68,71]},")"]]],"P":["override",{"sourceInterval":[43,120]},null,[],["alt",{"sourceInterval":[53,120]},["app",{"sourceInterval":[53,71]},"P_parenthesis",[]],["app",{"sourceInterval":[95,103]},"Function",[]],["app",{"sourceInterval":[111,120]},"Primitive",[]]]],"Function":["define",{"sourceInterval":[126,233]},null,[],["alt",{"sourceInterval":[142,233]},["app",{"sourceInterval":[142,158]},"DegreesToRadians",[]],["app",{"sourceInterval":[166,182]},"RadiansToDegrees",[]],["app",{"sourceInterval":[190,197]},"LogBase",[]],["app",{"sourceInterval":[205,233]},"JavascriptMathObjectFunction",[]]]],"LogBase":["define",{"sourceInterval":[239,364]},null,[],["alt",{"sourceInterval":[255,364]},["seq",{"sourceInterval":[255,304]},["app",{"sourceInterval":[255,278]},"caseInsensitive",[["terminal",{"sourceInterval":[271,277]},"logb"]]],["terminal",{"sourceInterval":[279,282]},"("],["app",{"sourceInterval":[283,289]},"number",[]],["terminal",{"sourceInterval":[290,293]},","],["app",{"sourceInterval":[294,300]},"number",[]],["terminal",{"sourceInterval":[301,304]},")"]],["seq",{"sourceInterval":[312,364]},["app",{"sourceInterval":[312,338]},"caseInsensitive",[["terminal",{"sourceInterval":[328,337]},"logBase"]]],["terminal",{"sourceInterval":[339,342]},"("],["app",{"sourceInterval":[343,349]},"number",[]],["terminal",{"sourceInterval":[350,353]},","],["app",{"sourceInterval":[354,360]},"number",[]],["terminal",{"sourceInterval":[361,364]},")"]]]],"DegreesToRadians":["define",{"sourceInterval":[370,595]},null,[],["alt",{"sourceInterval":[395,595]},["seq",{"sourceInterval":[395,437]},["app",{"sourceInterval":[395,422]},"caseInsensitive",[["terminal",{"sourceInterval":[411,421]},"degToRad"]]],["terminal",{"sourceInterval":[423,426]},"("],["app",{"sourceInterval":[427,433]},"number",[]],["terminal",{"sourceInterval":[434,437]},")"]],["seq",{"sourceInterval":[445,495]},["app",{"sourceInterval":[445,480]},"caseInsensitive",[["terminal",{"sourceInterval":[461,479]},"degreesToRadians"]]],["terminal",{"sourceInterval":[481,484]},"("],["app",{"sourceInterval":[485,491]},"number",[]],["terminal",{"sourceInterval":[492,495]},")"]],["seq",{"sourceInterval":[503,544]},["app",{"sourceInterval":[503,529]},"caseInsensitive",[["terminal",{"sourceInterval":[519,528]},"radians"]]],["terminal",{"sourceInterval":[530,533]},"("],["app",{"sourceInterval":[534,540]},"number",[]],["terminal",{"sourceInterval":[541,544]},")"]],["seq",{"sourceInterval":[552,595]},["app",{"sourceInterval":[552,580]},"caseInsensitive",[["terminal",{"sourceInterval":[568,579]},"toRadians"]]],["terminal",{"sourceInterval":[581,584]},"("],["app",{"sourceInterval":[585,591]},"number",[]],["terminal",{"sourceInterval":[592,595]},")"]]]],"RadiansToDegrees":["define",{"sourceInterval":[601,826]},null,[],["alt",{"sourceInterval":[626,826]},["seq",{"sourceInterval":[626,668]},["app",{"sourceInterval":[626,653]},"caseInsensitive",[["terminal",{"sourceInterval":[642,652]},"radToDeg"]]],["terminal",{"sourceInterval":[654,657]},"("],["app",{"sourceInterval":[658,664]},"number",[]],["terminal",{"sourceInterval":[665,668]},")"]],["seq",{"sourceInterval":[676,726]},["app",{"sourceInterval":[676,711]},"caseInsensitive",[["terminal",{"sourceInterval":[692,710]},"radiansToDegrees"]]],["terminal",{"sourceInterval":[712,715]},"("],["app",{"sourceInterval":[716,722]},"number",[]],["terminal",{"sourceInterval":[723,726]},")"]],["seq",{"sourceInterval":[734,775]},["app",{"sourceInterval":[734,760]},"caseInsensitive",[["terminal",{"sourceInterval":[750,759]},"degrees"]]],["terminal",{"sourceInterval":[761,764]},"("],["app",{"sourceInterval":[765,771]},"number",[]],["terminal",{"sourceInterval":[772,775]},")"]],["seq",{"sourceInterval":[783,826]},["app",{"sourceInterval":[783,811]},"caseInsensitive",[["terminal",{"sourceInterval":[799,810]},"toDegrees"]]],["terminal",{"sourceInterval":[812,815]},"("],["app",{"sourceInterval":[816,822]},"number",[]],["terminal",{"sourceInterval":[823,826]},")"]]]],"JavascriptMathObjectFunction":["define",{"sourceInterval":[880,953]},null,[],["seq",{"sourceInterval":[911,953]},["app",{"sourceInterval":[911,921]},"mathJsName",[]],["terminal",{"sourceInterval":[922,925]},"("],["app",{"sourceInterval":[926,949]},"ListOf",[["app",{"sourceInterval":[933,943]},"Expression",[]],["terminal",{"sourceInterval":[945,948]},","]]],["terminal",{"sourceInterval":[950,953]},")"]]],"mathJsName":["define",{"sourceInterval":[959,2062]},null,[],["alt",{"sourceInterval":[978,2062]},["app",{"sourceInterval":[978,1001]},"caseInsensitive",[["terminal",{"sourceInterval":[994,1000]},"sinh"]]],["app",{"sourceInterval":[1009,1031]},"caseInsensitive",[["terminal",{"sourceInterval":[1025,1030]},"sin"]]],["app",{"sourceInterval":[1039,1061]},"caseInsensitive",[["terminal",{"sourceInterval":[1055,1060]},"abs"]]],["app",{"sourceInterval":[1069,1093]},"caseInsensitive",[["terminal",{"sourceInterval":[1085,1092]},"acosh"]]],["app",{"sourceInterval":[1101,1124]},"caseInsensitive",[["terminal",{"sourceInterval":[1117,1123]},"acos"]]],["app",{"sourceInterval":[1132,1156]},"caseInsensitive",[["terminal",{"sourceInterval":[1148,1155]},"asinh"]]],["app",{"sourceInterval":[1164,1187]},"caseInsensitive",[["terminal",{"sourceInterval":[1180,1186]},"asin"]]],["app",{"sourceInterval":[1195,1219]},"caseInsensitive",[["terminal",{"sourceInterval":[1211,1218]},"atan2"]]],["app",{"sourceInterval":[1227,1251]},"caseInsensitive",[["terminal",{"sourceInterval":[1243,1250]},"atanh"]]],["app",{"sourceInterval":[1259,1282]},"caseInsensitive",[["terminal",{"sourceInterval":[1275,1281]},"atan"]]],["app",{"sourceInterval":[1290,1313]},"caseInsensitive",[["terminal",{"sourceInterval":[1306,1312]},"cbrt"]]],["app",{"sourceInterval":[1321,1344]},"caseInsensitive",[["terminal",{"sourceInterval":[1337,1343]},"ceil"]]],["app",{"sourceInterval":[1352,1376]},"caseInsensitive",[["terminal",{"sourceInterval":[1368,1375]},"clz32"]]],["app",{"sourceInterval":[1384,1407]},"caseInsensitive",[["terminal",{"sourceInterval":[1400,1406]},"cosh"]]],["app",{"sourceInterval":[1415,1437]},"caseInsensitive",[["terminal",{"sourceInterval":[1431,1436]},"cos"]]],["app",{"sourceInterval":[1445,1469]},"caseInsensitive",[["terminal",{"sourceInterval":[1461,1468]},"expm1"]]],["app",{"sourceInterval":[1477,1499]},"caseInsensitive",[["terminal",{"sourceInterval":[1493,1498]},"exp"]]],["app",{"sourceInterval":[1507,1531]},"caseInsensitive",[["terminal",{"sourceInterval":[1523,1530]},"floor"]]],["app",{"sourceInterval":[1539,1564]},"caseInsensitive",[["terminal",{"sourceInterval":[1555,1563]},"fround"]]],["app",{"sourceInterval":[1572,1596]},"caseInsensitive",[["terminal",{"sourceInterval":[1588,1595]},"hypot"]]],["app",{"sourceInterval":[1604,1627]},"caseInsensitive",[["terminal",{"sourceInterval":[1620,1626]},"imul"]]],["app",{"sourceInterval":[1635,1659]},"caseInsensitive",[["terminal",{"sourceInterval":[1651,1658]},"log10"]]],["app",{"sourceInterval":[1667,1691]},"caseInsensitive",[["terminal",{"sourceInterval":[1683,1690]},"log1p"]]],["app",{"sourceInterval":[1699,1722]},"caseInsensitive",[["terminal",{"sourceInterval":[1715,1721]},"log2"]]],["app",{"sourceInterval":[1730,1752]},"caseInsensitive",[["terminal",{"sourceInterval":[1746,1751]},"log"]]],["app",{"sourceInterval":[1760,1782]},"caseInsensitive",[["terminal",{"sourceInterval":[1776,1781]},"max"]]],["app",{"sourceInterval":[1790,1812]},"caseInsensitive",[["terminal",{"sourceInterval":[1806,1811]},"min"]]],["app",{"sourceInterval":[1820,1842]},"caseInsensitive",[["terminal",{"sourceInterval":[1836,1841]},"pow"]]],["app",{"sourceInterval":[1850,1875]},"caseInsensitive",[["terminal",{"sourceInterval":[1866,1874]},"random"]]],["app",{"sourceInterval":[1883,1907]},"caseInsensitive",[["terminal",{"sourceInterval":[1899,1906]},"round"]]],["app",{"sourceInterval":[1915,1938]},"caseInsensitive",[["terminal",{"sourceInterval":[1931,1937]},"sign"]]],["app",{"sourceInterval":[1946,1969]},"caseInsensitive",[["terminal",{"sourceInterval":[1962,1968]},"sqrt"]]],["app",{"sourceInterval":[1977,2000]},"caseInsensitive",[["terminal",{"sourceInterval":[1993,1999]},"tanh"]]],["app",{"sourceInterval":[2008,2030]},"caseInsensitive",[["terminal",{"sourceInterval":[2024,2029]},"tan"]]],["app",{"sourceInterval":[2038,2062]},"caseInsensitive",[["terminal",{"sourceInterval":[2054,2061]},"trunc"]]]]]}]);module.exports=result; \ No newline at end of file +'use strict';const {makeRecipe}=require('ohm-js');const result={};result.BasicArithmetic=makeRecipe(["grammar",{"source":"BasicArithmetic {\r\n Expression\r\n = LogicalShift\r\n\r\n LogicalShift\r\n = LogicalShift \"<<\" LogicalShift -- left\r\n | LogicalShift \">>\" LogicalShift -- right\r\n | AS \r\n\r\n // Addition or Subtraction\r\n AS\r\n = AS add MD -- addition\r\n | AS subtract MD -- subtraction\r\n | MD\r\n\r\n // Multiply or Divide\r\n MD\r\n = MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | MD modulo E -- modulo\r\n | E\r\n\r\n // Exponent\r\n E\r\n = P exponent E -- exponent\r\n | P\r\n\r\n // Parenthesis\r\n P\r\n = \"(\" Expression \")\" -- parenthesis\r\n | Primitive\r\n \r\n Primitive\r\n = \"+\" Primitive -- positive\r\n | \"-\" Primitive -- negative\r\n | constant\r\n | hex\r\n | number\r\n \r\n // Lexical Rules\r\n add \r\n \t= \"+\"\r\n | caseInsensitive<\"plus\">\r\n \t| caseInsensitive<\"add\">\r\n | caseInsensitive<\"and\">\r\n \r\n subtract \r\n = \"-\"\r\n | caseInsensitive<\"minus\">\r\n | caseInsensitive<\"subtract\">\r\n | caseInsensitive<\"remove\">\r\n | caseInsensitive<\"take\">\r\n \r\n multiply \r\n = \"*\"\r\n | \"\\\\*\" // Escaped \\* for markdown\r\n | \"\\u{00D7}\" // ×\r\n | caseInsensitive<\"x\">\r\n | caseInsensitive<\"times by\">\r\n | caseInsensitive<\"times\">\r\n | caseInsensitive<\"multiply by\">\r\n | caseInsensitive<\"multiply\">\r\n \r\n divide\r\n = \"/\"\r\n | \"\\u{00F7}\" // ÷\r\n | caseInsensitive<\"divide by\">\r\n | caseInsensitive<\"divide\">\r\n\r\n modulo\r\n = \"%\"\r\n | caseInsensitive<\"modulo\">\r\n | caseInsensitive<\"mod\">\r\n\r\n exponent\r\n = \"^\"\r\n | caseInsensitive<\"to the power of\">\r\n | caseInsensitive<\"power of\">\r\n | caseInsensitive<\"exponent\">\r\n | caseInsensitive<\"prime\">\r\n\r\n constant \r\n \t= caseInsensitive<\"PI\"> \r\n | caseInsensitive<\"E\">\r\n\r\n number\r\n = digit* \".\" digit+ -- fract\r\n | digit+ -- whole\r\n \r\n hex\r\n = \"0x\" hexDigit+\r\n | hexDigit+ \"h\"\r\n}"},"BasicArithmetic",null,"Expression",{"Expression":["define",{"sourceInterval":[21,51]},null,[],["app",{"sourceInterval":[39,51]},"LogicalShift",[]]],"LogicalShift_left":["define",{"sourceInterval":[77,115]},null,[],["seq",{"sourceInterval":[77,107]},["app",{"sourceInterval":[77,89]},"LogicalShift",[]],["terminal",{"sourceInterval":[90,94]},"<<"],["app",{"sourceInterval":[95,107]},"LogicalShift",[]]]],"LogicalShift_right":["define",{"sourceInterval":[123,162]},null,[],["seq",{"sourceInterval":[123,153]},["app",{"sourceInterval":[123,135]},"LogicalShift",[]],["terminal",{"sourceInterval":[136,140]},">>"],["app",{"sourceInterval":[141,153]},"LogicalShift",[]]]],"LogicalShift":["define",{"sourceInterval":[57,172]},null,[],["alt",{"sourceInterval":[77,172]},["app",{"sourceInterval":[77,107]},"LogicalShift_left",[]],["app",{"sourceInterval":[123,153]},"LogicalShift_right",[]],["app",{"sourceInterval":[170,172]},"AS",[]]]],"AS_addition":["define",{"sourceInterval":[219,241]},null,[],["seq",{"sourceInterval":[219,228]},["app",{"sourceInterval":[219,221]},"AS",[]],["app",{"sourceInterval":[222,225]},"add",[]],["app",{"sourceInterval":[226,228]},"MD",[]]]],"AS_subtraction":["define",{"sourceInterval":[249,279]},null,[],["seq",{"sourceInterval":[249,263]},["app",{"sourceInterval":[249,251]},"AS",[]],["app",{"sourceInterval":[252,260]},"subtract",[]],["app",{"sourceInterval":[261,263]},"MD",[]]]],"AS":["define",{"sourceInterval":[209,289]},null,[],["alt",{"sourceInterval":[219,289]},["app",{"sourceInterval":[219,228]},"AS_addition",[]],["app",{"sourceInterval":[249,263]},"AS_subtraction",[]],["app",{"sourceInterval":[287,289]},"MD",[]]]],"MD_multiplication":["define",{"sourceInterval":[330,362]},null,[],["seq",{"sourceInterval":[330,343]},["app",{"sourceInterval":[330,332]},"MD",[]],["app",{"sourceInterval":[333,341]},"multiply",[]],["app",{"sourceInterval":[342,343]},"E",[]]]],"MD_division":["define",{"sourceInterval":[370,394]},null,[],["seq",{"sourceInterval":[370,381]},["app",{"sourceInterval":[370,372]},"MD",[]],["app",{"sourceInterval":[373,379]},"divide",[]],["app",{"sourceInterval":[380,381]},"E",[]]]],"MD_modulo":["define",{"sourceInterval":[402,424]},null,[],["seq",{"sourceInterval":[402,413]},["app",{"sourceInterval":[402,404]},"MD",[]],["app",{"sourceInterval":[405,411]},"modulo",[]],["app",{"sourceInterval":[412,413]},"E",[]]]],"MD":["define",{"sourceInterval":[320,433]},null,[],["alt",{"sourceInterval":[330,433]},["app",{"sourceInterval":[330,343]},"MD_multiplication",[]],["app",{"sourceInterval":[370,381]},"MD_division",[]],["app",{"sourceInterval":[402,413]},"MD_modulo",[]],["app",{"sourceInterval":[432,433]},"E",[]]]],"E_exponent":["define",{"sourceInterval":[463,488]},null,[],["seq",{"sourceInterval":[463,475]},["app",{"sourceInterval":[463,464]},"P",[]],["app",{"sourceInterval":[465,473]},"exponent",[]],["app",{"sourceInterval":[474,475]},"E",[]]]],"E":["define",{"sourceInterval":[454,497]},null,[],["alt",{"sourceInterval":[463,497]},["app",{"sourceInterval":[463,475]},"E_exponent",[]],["app",{"sourceInterval":[496,497]},"P",[]]]],"P_parenthesis":["define",{"sourceInterval":[530,564]},null,[],["seq",{"sourceInterval":[530,548]},["terminal",{"sourceInterval":[530,533]},"("],["app",{"sourceInterval":[534,544]},"Expression",[]],["terminal",{"sourceInterval":[545,548]},")"]]],"P":["define",{"sourceInterval":[521,581]},null,[],["alt",{"sourceInterval":[530,581]},["app",{"sourceInterval":[530,548]},"P_parenthesis",[]],["app",{"sourceInterval":[572,581]},"Primitive",[]]]],"Primitive_positive":["define",{"sourceInterval":[608,633]},null,[],["seq",{"sourceInterval":[608,621]},["terminal",{"sourceInterval":[608,611]},"+"],["app",{"sourceInterval":[612,621]},"Primitive",[]]]],"Primitive_negative":["define",{"sourceInterval":[641,666]},null,[],["seq",{"sourceInterval":[641,654]},["terminal",{"sourceInterval":[641,644]},"-"],["app",{"sourceInterval":[645,654]},"Primitive",[]]]],"Primitive":["define",{"sourceInterval":[591,707]},null,[],["alt",{"sourceInterval":[608,707]},["app",{"sourceInterval":[608,621]},"Primitive_positive",[]],["app",{"sourceInterval":[641,654]},"Primitive_negative",[]],["app",{"sourceInterval":[674,682]},"constant",[]],["app",{"sourceInterval":[690,693]},"hex",[]],["app",{"sourceInterval":[701,707]},"number",[]]]],"add":["define",{"sourceInterval":[734,838]},null,[],["alt",{"sourceInterval":[745,838]},["terminal",{"sourceInterval":[745,748]},"+"],["app",{"sourceInterval":[756,779]},"caseInsensitive",[["terminal",{"sourceInterval":[772,778]},"plus"]]],["app",{"sourceInterval":[786,808]},"caseInsensitive",[["terminal",{"sourceInterval":[802,807]},"add"]]],["app",{"sourceInterval":[816,838]},"caseInsensitive",[["terminal",{"sourceInterval":[832,837]},"and"]]]]],"subtract":["define",{"sourceInterval":[848,999]},null,[],["alt",{"sourceInterval":[865,999]},["terminal",{"sourceInterval":[865,868]},"-"],["app",{"sourceInterval":[876,900]},"caseInsensitive",[["terminal",{"sourceInterval":[892,899]},"minus"]]],["app",{"sourceInterval":[908,935]},"caseInsensitive",[["terminal",{"sourceInterval":[924,934]},"subtract"]]],["app",{"sourceInterval":[943,968]},"caseInsensitive",[["terminal",{"sourceInterval":[959,967]},"remove"]]],["app",{"sourceInterval":[976,999]},"caseInsensitive",[["terminal",{"sourceInterval":[992,998]},"take"]]]]],"multiply":["define",{"sourceInterval":[1011,1262]},null,[],["alt",{"sourceInterval":[1028,1262]},["terminal",{"sourceInterval":[1028,1031]},"*"],["terminal",{"sourceInterval":[1039,1044]},"\\*"],["terminal",{"sourceInterval":[1079,1089]},"×"],["app",{"sourceInterval":[1102,1122]},"caseInsensitive",[["terminal",{"sourceInterval":[1118,1121]},"x"]]],["app",{"sourceInterval":[1130,1157]},"caseInsensitive",[["terminal",{"sourceInterval":[1146,1156]},"times by"]]],["app",{"sourceInterval":[1165,1189]},"caseInsensitive",[["terminal",{"sourceInterval":[1181,1188]},"times"]]],["app",{"sourceInterval":[1197,1227]},"caseInsensitive",[["terminal",{"sourceInterval":[1213,1226]},"multiply by"]]],["app",{"sourceInterval":[1235,1262]},"caseInsensitive",[["terminal",{"sourceInterval":[1251,1261]},"multiply"]]]]],"divide":["define",{"sourceInterval":[1274,1383]},null,[],["alt",{"sourceInterval":[1288,1383]},["terminal",{"sourceInterval":[1288,1291]},"/"],["terminal",{"sourceInterval":[1299,1309]},"÷"],["app",{"sourceInterval":[1322,1350]},"caseInsensitive",[["terminal",{"sourceInterval":[1338,1349]},"divide by"]]],["app",{"sourceInterval":[1358,1383]},"caseInsensitive",[["terminal",{"sourceInterval":[1374,1382]},"divide"]]]]],"modulo":["define",{"sourceInterval":[1389,1469]},null,[],["alt",{"sourceInterval":[1403,1469]},["terminal",{"sourceInterval":[1403,1406]},"%"],["app",{"sourceInterval":[1414,1439]},"caseInsensitive",[["terminal",{"sourceInterval":[1430,1438]},"modulo"]]],["app",{"sourceInterval":[1447,1469]},"caseInsensitive",[["terminal",{"sourceInterval":[1463,1468]},"mod"]]]]],"exponent":["define",{"sourceInterval":[1475,1638]},null,[],["alt",{"sourceInterval":[1491,1638]},["terminal",{"sourceInterval":[1491,1494]},"^"],["app",{"sourceInterval":[1502,1536]},"caseInsensitive",[["terminal",{"sourceInterval":[1518,1535]},"to the power of"]]],["app",{"sourceInterval":[1544,1571]},"caseInsensitive",[["terminal",{"sourceInterval":[1560,1570]},"power of"]]],["app",{"sourceInterval":[1579,1606]},"caseInsensitive",[["terminal",{"sourceInterval":[1595,1605]},"exponent"]]],["app",{"sourceInterval":[1614,1638]},"caseInsensitive",[["terminal",{"sourceInterval":[1630,1637]},"prime"]]]]],"constant":["define",{"sourceInterval":[1644,1711]},null,[],["alt",{"sourceInterval":[1661,1711]},["app",{"sourceInterval":[1661,1682]},"caseInsensitive",[["terminal",{"sourceInterval":[1677,1681]},"PI"]]],["app",{"sourceInterval":[1691,1711]},"caseInsensitive",[["terminal",{"sourceInterval":[1707,1710]},"E"]]]]],"number_fract":["define",{"sourceInterval":[1731,1758]},null,[],["seq",{"sourceInterval":[1731,1748]},["star",{"sourceInterval":[1731,1737]},["app",{"sourceInterval":[1731,1736]},"digit",[]]],["terminal",{"sourceInterval":[1738,1741]},"."],["plus",{"sourceInterval":[1742,1748]},["app",{"sourceInterval":[1742,1747]},"digit",[]]]]],"number_whole":["define",{"sourceInterval":[1766,1793]},null,[],["plus",{"sourceInterval":[1766,1772]},["app",{"sourceInterval":[1766,1771]},"digit",[]]]],"number":["define",{"sourceInterval":[1717,1793]},null,[],["alt",{"sourceInterval":[1731,1793]},["app",{"sourceInterval":[1731,1748]},"number_fract",[]],["app",{"sourceInterval":[1766,1772]},"number_whole",[]]]],"hex":["define",{"sourceInterval":[1801,1847]},null,[],["alt",{"sourceInterval":[1812,1847]},["seq",{"sourceInterval":[1812,1826]},["terminal",{"sourceInterval":[1812,1816]},"0x"],["plus",{"sourceInterval":[1817,1826]},["app",{"sourceInterval":[1817,1825]},"hexDigit",[]]]],["seq",{"sourceInterval":[1834,1847]},["plus",{"sourceInterval":[1834,1843]},["app",{"sourceInterval":[1834,1842]},"hexDigit",[]]],["terminal",{"sourceInterval":[1844,1847]},"h"]]]]}]);result.FunctionArithmetic=makeRecipe(["grammar",{"source":"FunctionArithmetic <: BasicArithmetic {\r\n P\r\n := \"(\" Expression \")\" -- parenthesis\r\n | Function\r\n | Primitive\r\n\r\n Function\r\n = DegreesToRadians\r\n | RadiansToDegrees\r\n | LogBase\r\n | JavascriptMathObjectFunction\r\n\r\n LogBase \r\n = caseInsensitive<\"logb\"> \"(\" number \",\" number \")\"\r\n | caseInsensitive<\"logBase\"> \"(\" number \",\" number \")\"\r\n\r\n DegreesToRadians \r\n = caseInsensitive<\"degToRad\"> \"(\" number \")\"\r\n | caseInsensitive<\"degreesToRadians\"> \"(\" number \")\"\r\n | caseInsensitive<\"radians\"> \"(\" number \")\"\r\n | caseInsensitive<\"toRadians\"> \"(\" number \")\"\r\n\r\n RadiansToDegrees \r\n = caseInsensitive<\"radToDeg\"> \"(\" number \")\"\r\n | caseInsensitive<\"radiansToDegrees\"> \"(\" number \")\"\r\n | caseInsensitive<\"degrees\"> \"(\" number \")\"\r\n | caseInsensitive<\"toDegrees\"> \"(\" number \")\"\r\n\r\n // Pass-through for Math.* functions from JS\r\n JavascriptMathObjectFunction = mathJsName \"(\" ListOf \")\"\r\n\r\n mathJsName \r\n \t = caseInsensitive<\"sinh\">\r\n | caseInsensitive<\"sin\">\r\n | caseInsensitive<\"abs\">\r\n | caseInsensitive<\"acosh\">\r\n | caseInsensitive<\"acos\">\r\n | caseInsensitive<\"asinh\">\r\n | caseInsensitive<\"asin\">\r\n | caseInsensitive<\"atan2\">\r\n | caseInsensitive<\"atanh\">\r\n | caseInsensitive<\"atan\">\r\n | caseInsensitive<\"cbrt\">\r\n | caseInsensitive<\"ceil\">\r\n | caseInsensitive<\"clz32\">\r\n | caseInsensitive<\"cosh\">\r\n | caseInsensitive<\"cos\">\r\n | caseInsensitive<\"expm1\">\r\n | caseInsensitive<\"exp\">\r\n | caseInsensitive<\"floor\">\r\n | caseInsensitive<\"fround\">\r\n | caseInsensitive<\"hypot\">\r\n | caseInsensitive<\"imul\">\r\n | caseInsensitive<\"log10\">\r\n | caseInsensitive<\"log1p\">\r\n | caseInsensitive<\"log2\">\r\n | caseInsensitive<\"log\">\r\n | caseInsensitive<\"max\">\r\n | caseInsensitive<\"min\">\r\n | caseInsensitive<\"pow\">\r\n | caseInsensitive<\"random\">\r\n | caseInsensitive<\"round\">\r\n | caseInsensitive<\"sign\">\r\n | caseInsensitive<\"sqrt\">\r\n | caseInsensitive<\"tanh\">\r\n | caseInsensitive<\"tan\">\r\n | caseInsensitive<\"trunc\">\r\n}"},"FunctionArithmetic",result.BasicArithmetic,"Expression",{"P_parenthesis":["override",{"sourceInterval":[53,87]},null,[],["seq",{"sourceInterval":[53,71]},["terminal",{"sourceInterval":[53,56]},"("],["app",{"sourceInterval":[57,67]},"Expression",[]],["terminal",{"sourceInterval":[68,71]},")"]]],"P":["override",{"sourceInterval":[43,120]},null,[],["alt",{"sourceInterval":[53,120]},["app",{"sourceInterval":[53,71]},"P_parenthesis",[]],["app",{"sourceInterval":[95,103]},"Function",[]],["app",{"sourceInterval":[111,120]},"Primitive",[]]]],"Function":["define",{"sourceInterval":[126,233]},null,[],["alt",{"sourceInterval":[142,233]},["app",{"sourceInterval":[142,158]},"DegreesToRadians",[]],["app",{"sourceInterval":[166,182]},"RadiansToDegrees",[]],["app",{"sourceInterval":[190,197]},"LogBase",[]],["app",{"sourceInterval":[205,233]},"JavascriptMathObjectFunction",[]]]],"LogBase":["define",{"sourceInterval":[239,364]},null,[],["alt",{"sourceInterval":[255,364]},["seq",{"sourceInterval":[255,304]},["app",{"sourceInterval":[255,278]},"caseInsensitive",[["terminal",{"sourceInterval":[271,277]},"logb"]]],["terminal",{"sourceInterval":[279,282]},"("],["app",{"sourceInterval":[283,289]},"number",[]],["terminal",{"sourceInterval":[290,293]},","],["app",{"sourceInterval":[294,300]},"number",[]],["terminal",{"sourceInterval":[301,304]},")"]],["seq",{"sourceInterval":[312,364]},["app",{"sourceInterval":[312,338]},"caseInsensitive",[["terminal",{"sourceInterval":[328,337]},"logBase"]]],["terminal",{"sourceInterval":[339,342]},"("],["app",{"sourceInterval":[343,349]},"number",[]],["terminal",{"sourceInterval":[350,353]},","],["app",{"sourceInterval":[354,360]},"number",[]],["terminal",{"sourceInterval":[361,364]},")"]]]],"DegreesToRadians":["define",{"sourceInterval":[370,595]},null,[],["alt",{"sourceInterval":[395,595]},["seq",{"sourceInterval":[395,437]},["app",{"sourceInterval":[395,422]},"caseInsensitive",[["terminal",{"sourceInterval":[411,421]},"degToRad"]]],["terminal",{"sourceInterval":[423,426]},"("],["app",{"sourceInterval":[427,433]},"number",[]],["terminal",{"sourceInterval":[434,437]},")"]],["seq",{"sourceInterval":[445,495]},["app",{"sourceInterval":[445,480]},"caseInsensitive",[["terminal",{"sourceInterval":[461,479]},"degreesToRadians"]]],["terminal",{"sourceInterval":[481,484]},"("],["app",{"sourceInterval":[485,491]},"number",[]],["terminal",{"sourceInterval":[492,495]},")"]],["seq",{"sourceInterval":[503,544]},["app",{"sourceInterval":[503,529]},"caseInsensitive",[["terminal",{"sourceInterval":[519,528]},"radians"]]],["terminal",{"sourceInterval":[530,533]},"("],["app",{"sourceInterval":[534,540]},"number",[]],["terminal",{"sourceInterval":[541,544]},")"]],["seq",{"sourceInterval":[552,595]},["app",{"sourceInterval":[552,580]},"caseInsensitive",[["terminal",{"sourceInterval":[568,579]},"toRadians"]]],["terminal",{"sourceInterval":[581,584]},"("],["app",{"sourceInterval":[585,591]},"number",[]],["terminal",{"sourceInterval":[592,595]},")"]]]],"RadiansToDegrees":["define",{"sourceInterval":[601,826]},null,[],["alt",{"sourceInterval":[626,826]},["seq",{"sourceInterval":[626,668]},["app",{"sourceInterval":[626,653]},"caseInsensitive",[["terminal",{"sourceInterval":[642,652]},"radToDeg"]]],["terminal",{"sourceInterval":[654,657]},"("],["app",{"sourceInterval":[658,664]},"number",[]],["terminal",{"sourceInterval":[665,668]},")"]],["seq",{"sourceInterval":[676,726]},["app",{"sourceInterval":[676,711]},"caseInsensitive",[["terminal",{"sourceInterval":[692,710]},"radiansToDegrees"]]],["terminal",{"sourceInterval":[712,715]},"("],["app",{"sourceInterval":[716,722]},"number",[]],["terminal",{"sourceInterval":[723,726]},")"]],["seq",{"sourceInterval":[734,775]},["app",{"sourceInterval":[734,760]},"caseInsensitive",[["terminal",{"sourceInterval":[750,759]},"degrees"]]],["terminal",{"sourceInterval":[761,764]},"("],["app",{"sourceInterval":[765,771]},"number",[]],["terminal",{"sourceInterval":[772,775]},")"]],["seq",{"sourceInterval":[783,826]},["app",{"sourceInterval":[783,811]},"caseInsensitive",[["terminal",{"sourceInterval":[799,810]},"toDegrees"]]],["terminal",{"sourceInterval":[812,815]},"("],["app",{"sourceInterval":[816,822]},"number",[]],["terminal",{"sourceInterval":[823,826]},")"]]]],"JavascriptMathObjectFunction":["define",{"sourceInterval":[880,953]},null,[],["seq",{"sourceInterval":[911,953]},["app",{"sourceInterval":[911,921]},"mathJsName",[]],["terminal",{"sourceInterval":[922,925]},"("],["app",{"sourceInterval":[926,949]},"ListOf",[["app",{"sourceInterval":[933,943]},"Expression",[]],["terminal",{"sourceInterval":[945,948]},","]]],["terminal",{"sourceInterval":[950,953]},")"]]],"mathJsName":["define",{"sourceInterval":[959,2062]},null,[],["alt",{"sourceInterval":[978,2062]},["app",{"sourceInterval":[978,1001]},"caseInsensitive",[["terminal",{"sourceInterval":[994,1000]},"sinh"]]],["app",{"sourceInterval":[1009,1031]},"caseInsensitive",[["terminal",{"sourceInterval":[1025,1030]},"sin"]]],["app",{"sourceInterval":[1039,1061]},"caseInsensitive",[["terminal",{"sourceInterval":[1055,1060]},"abs"]]],["app",{"sourceInterval":[1069,1093]},"caseInsensitive",[["terminal",{"sourceInterval":[1085,1092]},"acosh"]]],["app",{"sourceInterval":[1101,1124]},"caseInsensitive",[["terminal",{"sourceInterval":[1117,1123]},"acos"]]],["app",{"sourceInterval":[1132,1156]},"caseInsensitive",[["terminal",{"sourceInterval":[1148,1155]},"asinh"]]],["app",{"sourceInterval":[1164,1187]},"caseInsensitive",[["terminal",{"sourceInterval":[1180,1186]},"asin"]]],["app",{"sourceInterval":[1195,1219]},"caseInsensitive",[["terminal",{"sourceInterval":[1211,1218]},"atan2"]]],["app",{"sourceInterval":[1227,1251]},"caseInsensitive",[["terminal",{"sourceInterval":[1243,1250]},"atanh"]]],["app",{"sourceInterval":[1259,1282]},"caseInsensitive",[["terminal",{"sourceInterval":[1275,1281]},"atan"]]],["app",{"sourceInterval":[1290,1313]},"caseInsensitive",[["terminal",{"sourceInterval":[1306,1312]},"cbrt"]]],["app",{"sourceInterval":[1321,1344]},"caseInsensitive",[["terminal",{"sourceInterval":[1337,1343]},"ceil"]]],["app",{"sourceInterval":[1352,1376]},"caseInsensitive",[["terminal",{"sourceInterval":[1368,1375]},"clz32"]]],["app",{"sourceInterval":[1384,1407]},"caseInsensitive",[["terminal",{"sourceInterval":[1400,1406]},"cosh"]]],["app",{"sourceInterval":[1415,1437]},"caseInsensitive",[["terminal",{"sourceInterval":[1431,1436]},"cos"]]],["app",{"sourceInterval":[1445,1469]},"caseInsensitive",[["terminal",{"sourceInterval":[1461,1468]},"expm1"]]],["app",{"sourceInterval":[1477,1499]},"caseInsensitive",[["terminal",{"sourceInterval":[1493,1498]},"exp"]]],["app",{"sourceInterval":[1507,1531]},"caseInsensitive",[["terminal",{"sourceInterval":[1523,1530]},"floor"]]],["app",{"sourceInterval":[1539,1564]},"caseInsensitive",[["terminal",{"sourceInterval":[1555,1563]},"fround"]]],["app",{"sourceInterval":[1572,1596]},"caseInsensitive",[["terminal",{"sourceInterval":[1588,1595]},"hypot"]]],["app",{"sourceInterval":[1604,1627]},"caseInsensitive",[["terminal",{"sourceInterval":[1620,1626]},"imul"]]],["app",{"sourceInterval":[1635,1659]},"caseInsensitive",[["terminal",{"sourceInterval":[1651,1658]},"log10"]]],["app",{"sourceInterval":[1667,1691]},"caseInsensitive",[["terminal",{"sourceInterval":[1683,1690]},"log1p"]]],["app",{"sourceInterval":[1699,1722]},"caseInsensitive",[["terminal",{"sourceInterval":[1715,1721]},"log2"]]],["app",{"sourceInterval":[1730,1752]},"caseInsensitive",[["terminal",{"sourceInterval":[1746,1751]},"log"]]],["app",{"sourceInterval":[1760,1782]},"caseInsensitive",[["terminal",{"sourceInterval":[1776,1781]},"max"]]],["app",{"sourceInterval":[1790,1812]},"caseInsensitive",[["terminal",{"sourceInterval":[1806,1811]},"min"]]],["app",{"sourceInterval":[1820,1842]},"caseInsensitive",[["terminal",{"sourceInterval":[1836,1841]},"pow"]]],["app",{"sourceInterval":[1850,1875]},"caseInsensitive",[["terminal",{"sourceInterval":[1866,1874]},"random"]]],["app",{"sourceInterval":[1883,1907]},"caseInsensitive",[["terminal",{"sourceInterval":[1899,1906]},"round"]]],["app",{"sourceInterval":[1915,1938]},"caseInsensitive",[["terminal",{"sourceInterval":[1931,1937]},"sign"]]],["app",{"sourceInterval":[1946,1969]},"caseInsensitive",[["terminal",{"sourceInterval":[1962,1968]},"sqrt"]]],["app",{"sourceInterval":[1977,2000]},"caseInsensitive",[["terminal",{"sourceInterval":[1993,1999]},"tanh"]]],["app",{"sourceInterval":[2008,2030]},"caseInsensitive",[["terminal",{"sourceInterval":[2024,2029]},"tan"]]],["app",{"sourceInterval":[2038,2062]},"caseInsensitive",[["terminal",{"sourceInterval":[2054,2061]},"trunc"]]]]]}]);module.exports=result; \ No newline at end of file diff --git a/src/grammars/percentage/PercentageArithmetic.ohm-bundle.js b/src/grammars/percentage/PercentageArithmetic.ohm-bundle.js index fe5f9b9..d707ed5 100644 --- a/src/grammars/percentage/PercentageArithmetic.ohm-bundle.js +++ b/src/grammars/percentage/PercentageArithmetic.ohm-bundle.js @@ -1 +1 @@ -'use strict';const {makeRecipe}=require('ohm-js');const result={};result.BasicArithmetic=makeRecipe(["grammar",{"source":"BasicArithmetic {\r\n Expression\r\n = LogicalShift\r\n\r\n LogicalShift\r\n = LogicalShift \"<<\" LogicalShift -- left\r\n | LogicalShift \">>\" LogicalShift -- right\r\n | AS \r\n\r\n // Addition or Subtraction\r\n AS\r\n = AS add MD -- addition\r\n | AS subtract MD -- subtraction\r\n | MD\r\n\r\n // Multiply or Divide\r\n MD\r\n = MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | MD modulo E -- modulo\r\n | E\r\n\r\n // Exponent\r\n E\r\n = P exponent E -- exponent\r\n | P\r\n\r\n // Parenthesis\r\n P\r\n = \"(\" Expression \")\" -- parenthesis\r\n | Primitive\r\n \r\n Primitive\r\n = \"+\" Primitive -- positive\r\n | \"-\" Primitive -- negative\r\n | constant\r\n | hex\r\n | number\r\n \r\n // Lexical Rules\r\n add \r\n \t= \"+\"\r\n | caseInsensitive<\"plus\">\r\n \t| caseInsensitive<\"add\">\r\n | caseInsensitive<\"and\">\r\n \r\n subtract \r\n = \"-\"\r\n | caseInsensitive<\"minus\">\r\n | caseInsensitive<\"subtract\">\r\n | caseInsensitive<\"remove\">\r\n | caseInsensitive<\"take\">\r\n \r\n multiply \r\n = \"*\"\r\n | \"\\\\*\" // Escaped e.g. \\* for markdown\r\n | \"\\u{00D7}\" // Multiplication Symbol ×\r\n | caseInsensitive<\"x\">\r\n | caseInsensitive<\"times by\">\r\n | caseInsensitive<\"times\">\r\n | caseInsensitive<\"multiply by\">\r\n | caseInsensitive<\"multiply\">\r\n \r\n divide\r\n = \"/\"\r\n | \"\\u{00F7}\" // Division Symbol ÷\r\n | caseInsensitive<\"divide by\">\r\n | caseInsensitive<\"divide\">\r\n\r\n modulo\r\n = \"%\"\r\n | caseInsensitive<\"modulo\">\r\n | caseInsensitive<\"mod\">\r\n\r\n exponent\r\n = \"^\"\r\n | caseInsensitive<\"to the power of\">\r\n | caseInsensitive<\"power of\">\r\n | caseInsensitive<\"exponent\">\r\n | caseInsensitive<\"prime\">\r\n\r\n constant \r\n \t= caseInsensitive<\"PI\"> \r\n | caseInsensitive<\"E\">\r\n\r\n number\r\n = digit* \".\" digit+ -- fract\r\n | digit+ -- whole\r\n \r\n hex\r\n = \"0x\" hexDigit+\r\n | hexDigit+ \"h\"\r\n}"},"BasicArithmetic",null,"Expression",{"Expression":["define",{"sourceInterval":[21,51]},null,[],["app",{"sourceInterval":[39,51]},"LogicalShift",[]]],"LogicalShift_left":["define",{"sourceInterval":[77,115]},null,[],["seq",{"sourceInterval":[77,107]},["app",{"sourceInterval":[77,89]},"LogicalShift",[]],["terminal",{"sourceInterval":[90,94]},"<<"],["app",{"sourceInterval":[95,107]},"LogicalShift",[]]]],"LogicalShift_right":["define",{"sourceInterval":[123,162]},null,[],["seq",{"sourceInterval":[123,153]},["app",{"sourceInterval":[123,135]},"LogicalShift",[]],["terminal",{"sourceInterval":[136,140]},">>"],["app",{"sourceInterval":[141,153]},"LogicalShift",[]]]],"LogicalShift":["define",{"sourceInterval":[57,172]},null,[],["alt",{"sourceInterval":[77,172]},["app",{"sourceInterval":[77,107]},"LogicalShift_left",[]],["app",{"sourceInterval":[123,153]},"LogicalShift_right",[]],["app",{"sourceInterval":[170,172]},"AS",[]]]],"AS_addition":["define",{"sourceInterval":[219,241]},null,[],["seq",{"sourceInterval":[219,228]},["app",{"sourceInterval":[219,221]},"AS",[]],["app",{"sourceInterval":[222,225]},"add",[]],["app",{"sourceInterval":[226,228]},"MD",[]]]],"AS_subtraction":["define",{"sourceInterval":[249,279]},null,[],["seq",{"sourceInterval":[249,263]},["app",{"sourceInterval":[249,251]},"AS",[]],["app",{"sourceInterval":[252,260]},"subtract",[]],["app",{"sourceInterval":[261,263]},"MD",[]]]],"AS":["define",{"sourceInterval":[209,289]},null,[],["alt",{"sourceInterval":[219,289]},["app",{"sourceInterval":[219,228]},"AS_addition",[]],["app",{"sourceInterval":[249,263]},"AS_subtraction",[]],["app",{"sourceInterval":[287,289]},"MD",[]]]],"MD_multiplication":["define",{"sourceInterval":[330,362]},null,[],["seq",{"sourceInterval":[330,343]},["app",{"sourceInterval":[330,332]},"MD",[]],["app",{"sourceInterval":[333,341]},"multiply",[]],["app",{"sourceInterval":[342,343]},"E",[]]]],"MD_division":["define",{"sourceInterval":[370,394]},null,[],["seq",{"sourceInterval":[370,381]},["app",{"sourceInterval":[370,372]},"MD",[]],["app",{"sourceInterval":[373,379]},"divide",[]],["app",{"sourceInterval":[380,381]},"E",[]]]],"MD_modulo":["define",{"sourceInterval":[402,424]},null,[],["seq",{"sourceInterval":[402,413]},["app",{"sourceInterval":[402,404]},"MD",[]],["app",{"sourceInterval":[405,411]},"modulo",[]],["app",{"sourceInterval":[412,413]},"E",[]]]],"MD":["define",{"sourceInterval":[320,433]},null,[],["alt",{"sourceInterval":[330,433]},["app",{"sourceInterval":[330,343]},"MD_multiplication",[]],["app",{"sourceInterval":[370,381]},"MD_division",[]],["app",{"sourceInterval":[402,413]},"MD_modulo",[]],["app",{"sourceInterval":[432,433]},"E",[]]]],"E_exponent":["define",{"sourceInterval":[463,488]},null,[],["seq",{"sourceInterval":[463,475]},["app",{"sourceInterval":[463,464]},"P",[]],["app",{"sourceInterval":[465,473]},"exponent",[]],["app",{"sourceInterval":[474,475]},"E",[]]]],"E":["define",{"sourceInterval":[454,497]},null,[],["alt",{"sourceInterval":[463,497]},["app",{"sourceInterval":[463,475]},"E_exponent",[]],["app",{"sourceInterval":[496,497]},"P",[]]]],"P_parenthesis":["define",{"sourceInterval":[530,564]},null,[],["seq",{"sourceInterval":[530,548]},["terminal",{"sourceInterval":[530,533]},"("],["app",{"sourceInterval":[534,544]},"Expression",[]],["terminal",{"sourceInterval":[545,548]},")"]]],"P":["define",{"sourceInterval":[521,581]},null,[],["alt",{"sourceInterval":[530,581]},["app",{"sourceInterval":[530,548]},"P_parenthesis",[]],["app",{"sourceInterval":[572,581]},"Primitive",[]]]],"Primitive_positive":["define",{"sourceInterval":[608,633]},null,[],["seq",{"sourceInterval":[608,621]},["terminal",{"sourceInterval":[608,611]},"+"],["app",{"sourceInterval":[612,621]},"Primitive",[]]]],"Primitive_negative":["define",{"sourceInterval":[641,666]},null,[],["seq",{"sourceInterval":[641,654]},["terminal",{"sourceInterval":[641,644]},"-"],["app",{"sourceInterval":[645,654]},"Primitive",[]]]],"Primitive":["define",{"sourceInterval":[591,707]},null,[],["alt",{"sourceInterval":[608,707]},["app",{"sourceInterval":[608,621]},"Primitive_positive",[]],["app",{"sourceInterval":[641,654]},"Primitive_negative",[]],["app",{"sourceInterval":[674,682]},"constant",[]],["app",{"sourceInterval":[690,693]},"hex",[]],["app",{"sourceInterval":[701,707]},"number",[]]]],"add":["define",{"sourceInterval":[734,838]},null,[],["alt",{"sourceInterval":[745,838]},["terminal",{"sourceInterval":[745,748]},"+"],["app",{"sourceInterval":[756,779]},"caseInsensitive",[["terminal",{"sourceInterval":[772,778]},"plus"]]],["app",{"sourceInterval":[786,808]},"caseInsensitive",[["terminal",{"sourceInterval":[802,807]},"add"]]],["app",{"sourceInterval":[816,838]},"caseInsensitive",[["terminal",{"sourceInterval":[832,837]},"and"]]]]],"subtract":["define",{"sourceInterval":[848,999]},null,[],["alt",{"sourceInterval":[865,999]},["terminal",{"sourceInterval":[865,868]},"-"],["app",{"sourceInterval":[876,900]},"caseInsensitive",[["terminal",{"sourceInterval":[892,899]},"minus"]]],["app",{"sourceInterval":[908,935]},"caseInsensitive",[["terminal",{"sourceInterval":[924,934]},"subtract"]]],["app",{"sourceInterval":[943,968]},"caseInsensitive",[["terminal",{"sourceInterval":[959,967]},"remove"]]],["app",{"sourceInterval":[976,999]},"caseInsensitive",[["terminal",{"sourceInterval":[992,998]},"take"]]]]],"multiply":["define",{"sourceInterval":[1011,1289]},null,[],["alt",{"sourceInterval":[1028,1289]},["terminal",{"sourceInterval":[1028,1031]},"*"],["terminal",{"sourceInterval":[1039,1044]},"\\*"],["terminal",{"sourceInterval":[1084,1094]},"×"],["app",{"sourceInterval":[1129,1149]},"caseInsensitive",[["terminal",{"sourceInterval":[1145,1148]},"x"]]],["app",{"sourceInterval":[1157,1184]},"caseInsensitive",[["terminal",{"sourceInterval":[1173,1183]},"times by"]]],["app",{"sourceInterval":[1192,1216]},"caseInsensitive",[["terminal",{"sourceInterval":[1208,1215]},"times"]]],["app",{"sourceInterval":[1224,1254]},"caseInsensitive",[["terminal",{"sourceInterval":[1240,1253]},"multiply by"]]],["app",{"sourceInterval":[1262,1289]},"caseInsensitive",[["terminal",{"sourceInterval":[1278,1288]},"multiply"]]]]],"divide":["define",{"sourceInterval":[1301,1426]},null,[],["alt",{"sourceInterval":[1315,1426]},["terminal",{"sourceInterval":[1315,1318]},"/"],["terminal",{"sourceInterval":[1326,1336]},"÷"],["app",{"sourceInterval":[1365,1393]},"caseInsensitive",[["terminal",{"sourceInterval":[1381,1392]},"divide by"]]],["app",{"sourceInterval":[1401,1426]},"caseInsensitive",[["terminal",{"sourceInterval":[1417,1425]},"divide"]]]]],"modulo":["define",{"sourceInterval":[1432,1512]},null,[],["alt",{"sourceInterval":[1446,1512]},["terminal",{"sourceInterval":[1446,1449]},"%"],["app",{"sourceInterval":[1457,1482]},"caseInsensitive",[["terminal",{"sourceInterval":[1473,1481]},"modulo"]]],["app",{"sourceInterval":[1490,1512]},"caseInsensitive",[["terminal",{"sourceInterval":[1506,1511]},"mod"]]]]],"exponent":["define",{"sourceInterval":[1518,1681]},null,[],["alt",{"sourceInterval":[1534,1681]},["terminal",{"sourceInterval":[1534,1537]},"^"],["app",{"sourceInterval":[1545,1579]},"caseInsensitive",[["terminal",{"sourceInterval":[1561,1578]},"to the power of"]]],["app",{"sourceInterval":[1587,1614]},"caseInsensitive",[["terminal",{"sourceInterval":[1603,1613]},"power of"]]],["app",{"sourceInterval":[1622,1649]},"caseInsensitive",[["terminal",{"sourceInterval":[1638,1648]},"exponent"]]],["app",{"sourceInterval":[1657,1681]},"caseInsensitive",[["terminal",{"sourceInterval":[1673,1680]},"prime"]]]]],"constant":["define",{"sourceInterval":[1687,1754]},null,[],["alt",{"sourceInterval":[1704,1754]},["app",{"sourceInterval":[1704,1725]},"caseInsensitive",[["terminal",{"sourceInterval":[1720,1724]},"PI"]]],["app",{"sourceInterval":[1734,1754]},"caseInsensitive",[["terminal",{"sourceInterval":[1750,1753]},"E"]]]]],"number_fract":["define",{"sourceInterval":[1774,1801]},null,[],["seq",{"sourceInterval":[1774,1791]},["star",{"sourceInterval":[1774,1780]},["app",{"sourceInterval":[1774,1779]},"digit",[]]],["terminal",{"sourceInterval":[1781,1784]},"."],["plus",{"sourceInterval":[1785,1791]},["app",{"sourceInterval":[1785,1790]},"digit",[]]]]],"number_whole":["define",{"sourceInterval":[1809,1836]},null,[],["plus",{"sourceInterval":[1809,1815]},["app",{"sourceInterval":[1809,1814]},"digit",[]]]],"number":["define",{"sourceInterval":[1760,1836]},null,[],["alt",{"sourceInterval":[1774,1836]},["app",{"sourceInterval":[1774,1791]},"number_fract",[]],["app",{"sourceInterval":[1809,1815]},"number_whole",[]]]],"hex":["define",{"sourceInterval":[1844,1890]},null,[],["alt",{"sourceInterval":[1855,1890]},["seq",{"sourceInterval":[1855,1869]},["terminal",{"sourceInterval":[1855,1859]},"0x"],["plus",{"sourceInterval":[1860,1869]},["app",{"sourceInterval":[1860,1868]},"hexDigit",[]]]],["seq",{"sourceInterval":[1877,1890]},["plus",{"sourceInterval":[1877,1886]},["app",{"sourceInterval":[1877,1885]},"hexDigit",[]]],["terminal",{"sourceInterval":[1887,1890]},"h"]]]]}]);result.PercentageArithmetic=makeRecipe(["grammar",{"source":"PercentageArithmetic <: BasicArithmetic {\r\n\tExpression\r\n \t:= PercentageOf\r\n | IncreaseBy\r\n | DecreaseBy\r\n | PercentageIncreaseOrDecrease\r\n\t\t| LogicalShift\r\n \r\n Primitive \r\n += percentage\r\n \r\n PercentageOf\r\n \t= percentage caseInsensitive<\"of\"> number \r\n \r\n \tIncreaseBy\r\n \t= caseInsensitive<\"increase\"> number caseInsensitive<\"by\"> percentage\r\n \r\n \tDecreaseBy\r\n \t= caseInsensitive<\"decrease\"> number caseInsensitive<\"by\"> percentage\r\n \r\n PercentageIncreaseOrDecrease\r\n = caseInsensitive<\"from\">? number caseInsensitive<\"to\"> number\r\n\r\n percentage = number \"%\"\r\n}"},"PercentageArithmetic",result.BasicArithmetic,"Expression",{"Expression":["override",{"sourceInterval":[44,179]},null,[],["alt",{"sourceInterval":[65,179]},["app",{"sourceInterval":[65,77]},"PercentageOf",[]],["app",{"sourceInterval":[89,99]},"IncreaseBy",[]],["app",{"sourceInterval":[111,121]},"DecreaseBy",[]],["app",{"sourceInterval":[133,161]},"PercentageIncreaseOrDecrease",[]],["app",{"sourceInterval":[167,179]},"LogicalShift",[]]]],"Primitive":["extend",{"sourceInterval":[195,228]},null,[],["app",{"sourceInterval":[218,228]},"percentage",[]]],"PercentageOf":["define",{"sourceInterval":[244,304]},null,[],["seq",{"sourceInterval":[265,304]},["app",{"sourceInterval":[265,275]},"percentage",[]],["app",{"sourceInterval":[276,297]},"caseInsensitive",[["terminal",{"sourceInterval":[292,296]},"of"]]],["app",{"sourceInterval":[298,304]},"number",[]]]],"IncreaseBy":["define",{"sourceInterval":[321,407]},null,[],["seq",{"sourceInterval":[340,407]},["app",{"sourceInterval":[340,367]},"caseInsensitive",[["terminal",{"sourceInterval":[356,366]},"increase"]]],["app",{"sourceInterval":[368,374]},"number",[]],["app",{"sourceInterval":[375,396]},"caseInsensitive",[["terminal",{"sourceInterval":[391,395]},"by"]]],["app",{"sourceInterval":[397,407]},"percentage",[]]]],"DecreaseBy":["define",{"sourceInterval":[423,509]},null,[],["seq",{"sourceInterval":[442,509]},["app",{"sourceInterval":[442,469]},"caseInsensitive",[["terminal",{"sourceInterval":[458,468]},"decrease"]]],["app",{"sourceInterval":[470,476]},"number",[]],["app",{"sourceInterval":[477,498]},"caseInsensitive",[["terminal",{"sourceInterval":[493,497]},"by"]]],["app",{"sourceInterval":[499,509]},"percentage",[]]]],"PercentageIncreaseOrDecrease":["define",{"sourceInterval":[521,621]},null,[],["seq",{"sourceInterval":[561,621]},["opt",{"sourceInterval":[561,585]},["app",{"sourceInterval":[561,584]},"caseInsensitive",[["terminal",{"sourceInterval":[577,583]},"from"]]]],["app",{"sourceInterval":[586,592]},"number",[]],["app",{"sourceInterval":[593,614]},"caseInsensitive",[["terminal",{"sourceInterval":[609,613]},"to"]]],["app",{"sourceInterval":[615,621]},"number",[]]]],"percentage":["define",{"sourceInterval":[629,652]},null,[],["seq",{"sourceInterval":[642,652]},["app",{"sourceInterval":[642,648]},"number",[]],["terminal",{"sourceInterval":[649,652]},"%"]]]}]);module.exports=result; \ No newline at end of file +'use strict';const {makeRecipe}=require('ohm-js');const result={};result.BasicArithmetic=makeRecipe(["grammar",{"source":"BasicArithmetic {\r\n Expression\r\n = LogicalShift\r\n\r\n LogicalShift\r\n = LogicalShift \"<<\" LogicalShift -- left\r\n | LogicalShift \">>\" LogicalShift -- right\r\n | AS \r\n\r\n // Addition or Subtraction\r\n AS\r\n = AS add MD -- addition\r\n | AS subtract MD -- subtraction\r\n | MD\r\n\r\n // Multiply or Divide\r\n MD\r\n = MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | MD modulo E -- modulo\r\n | E\r\n\r\n // Exponent\r\n E\r\n = P exponent E -- exponent\r\n | P\r\n\r\n // Parenthesis\r\n P\r\n = \"(\" Expression \")\" -- parenthesis\r\n | Primitive\r\n \r\n Primitive\r\n = \"+\" Primitive -- positive\r\n | \"-\" Primitive -- negative\r\n | constant\r\n | hex\r\n | number\r\n \r\n // Lexical Rules\r\n add \r\n \t= \"+\"\r\n | caseInsensitive<\"plus\">\r\n \t| caseInsensitive<\"add\">\r\n | caseInsensitive<\"and\">\r\n \r\n subtract \r\n = \"-\"\r\n | caseInsensitive<\"minus\">\r\n | caseInsensitive<\"subtract\">\r\n | caseInsensitive<\"remove\">\r\n | caseInsensitive<\"take\">\r\n \r\n multiply \r\n = \"*\"\r\n | \"\\\\*\" // Escaped \\* for markdown\r\n | \"\\u{00D7}\" // ×\r\n | caseInsensitive<\"x\">\r\n | caseInsensitive<\"times by\">\r\n | caseInsensitive<\"times\">\r\n | caseInsensitive<\"multiply by\">\r\n | caseInsensitive<\"multiply\">\r\n \r\n divide\r\n = \"/\"\r\n | \"\\u{00F7}\" // ÷\r\n | caseInsensitive<\"divide by\">\r\n | caseInsensitive<\"divide\">\r\n\r\n modulo\r\n = \"%\"\r\n | caseInsensitive<\"modulo\">\r\n | caseInsensitive<\"mod\">\r\n\r\n exponent\r\n = \"^\"\r\n | caseInsensitive<\"to the power of\">\r\n | caseInsensitive<\"power of\">\r\n | caseInsensitive<\"exponent\">\r\n | caseInsensitive<\"prime\">\r\n\r\n constant \r\n \t= caseInsensitive<\"PI\"> \r\n | caseInsensitive<\"E\">\r\n\r\n number\r\n = digit* \".\" digit+ -- fract\r\n | digit+ -- whole\r\n \r\n hex\r\n = \"0x\" hexDigit+\r\n | hexDigit+ \"h\"\r\n}"},"BasicArithmetic",null,"Expression",{"Expression":["define",{"sourceInterval":[21,51]},null,[],["app",{"sourceInterval":[39,51]},"LogicalShift",[]]],"LogicalShift_left":["define",{"sourceInterval":[77,115]},null,[],["seq",{"sourceInterval":[77,107]},["app",{"sourceInterval":[77,89]},"LogicalShift",[]],["terminal",{"sourceInterval":[90,94]},"<<"],["app",{"sourceInterval":[95,107]},"LogicalShift",[]]]],"LogicalShift_right":["define",{"sourceInterval":[123,162]},null,[],["seq",{"sourceInterval":[123,153]},["app",{"sourceInterval":[123,135]},"LogicalShift",[]],["terminal",{"sourceInterval":[136,140]},">>"],["app",{"sourceInterval":[141,153]},"LogicalShift",[]]]],"LogicalShift":["define",{"sourceInterval":[57,172]},null,[],["alt",{"sourceInterval":[77,172]},["app",{"sourceInterval":[77,107]},"LogicalShift_left",[]],["app",{"sourceInterval":[123,153]},"LogicalShift_right",[]],["app",{"sourceInterval":[170,172]},"AS",[]]]],"AS_addition":["define",{"sourceInterval":[219,241]},null,[],["seq",{"sourceInterval":[219,228]},["app",{"sourceInterval":[219,221]},"AS",[]],["app",{"sourceInterval":[222,225]},"add",[]],["app",{"sourceInterval":[226,228]},"MD",[]]]],"AS_subtraction":["define",{"sourceInterval":[249,279]},null,[],["seq",{"sourceInterval":[249,263]},["app",{"sourceInterval":[249,251]},"AS",[]],["app",{"sourceInterval":[252,260]},"subtract",[]],["app",{"sourceInterval":[261,263]},"MD",[]]]],"AS":["define",{"sourceInterval":[209,289]},null,[],["alt",{"sourceInterval":[219,289]},["app",{"sourceInterval":[219,228]},"AS_addition",[]],["app",{"sourceInterval":[249,263]},"AS_subtraction",[]],["app",{"sourceInterval":[287,289]},"MD",[]]]],"MD_multiplication":["define",{"sourceInterval":[330,362]},null,[],["seq",{"sourceInterval":[330,343]},["app",{"sourceInterval":[330,332]},"MD",[]],["app",{"sourceInterval":[333,341]},"multiply",[]],["app",{"sourceInterval":[342,343]},"E",[]]]],"MD_division":["define",{"sourceInterval":[370,394]},null,[],["seq",{"sourceInterval":[370,381]},["app",{"sourceInterval":[370,372]},"MD",[]],["app",{"sourceInterval":[373,379]},"divide",[]],["app",{"sourceInterval":[380,381]},"E",[]]]],"MD_modulo":["define",{"sourceInterval":[402,424]},null,[],["seq",{"sourceInterval":[402,413]},["app",{"sourceInterval":[402,404]},"MD",[]],["app",{"sourceInterval":[405,411]},"modulo",[]],["app",{"sourceInterval":[412,413]},"E",[]]]],"MD":["define",{"sourceInterval":[320,433]},null,[],["alt",{"sourceInterval":[330,433]},["app",{"sourceInterval":[330,343]},"MD_multiplication",[]],["app",{"sourceInterval":[370,381]},"MD_division",[]],["app",{"sourceInterval":[402,413]},"MD_modulo",[]],["app",{"sourceInterval":[432,433]},"E",[]]]],"E_exponent":["define",{"sourceInterval":[463,488]},null,[],["seq",{"sourceInterval":[463,475]},["app",{"sourceInterval":[463,464]},"P",[]],["app",{"sourceInterval":[465,473]},"exponent",[]],["app",{"sourceInterval":[474,475]},"E",[]]]],"E":["define",{"sourceInterval":[454,497]},null,[],["alt",{"sourceInterval":[463,497]},["app",{"sourceInterval":[463,475]},"E_exponent",[]],["app",{"sourceInterval":[496,497]},"P",[]]]],"P_parenthesis":["define",{"sourceInterval":[530,564]},null,[],["seq",{"sourceInterval":[530,548]},["terminal",{"sourceInterval":[530,533]},"("],["app",{"sourceInterval":[534,544]},"Expression",[]],["terminal",{"sourceInterval":[545,548]},")"]]],"P":["define",{"sourceInterval":[521,581]},null,[],["alt",{"sourceInterval":[530,581]},["app",{"sourceInterval":[530,548]},"P_parenthesis",[]],["app",{"sourceInterval":[572,581]},"Primitive",[]]]],"Primitive_positive":["define",{"sourceInterval":[608,633]},null,[],["seq",{"sourceInterval":[608,621]},["terminal",{"sourceInterval":[608,611]},"+"],["app",{"sourceInterval":[612,621]},"Primitive",[]]]],"Primitive_negative":["define",{"sourceInterval":[641,666]},null,[],["seq",{"sourceInterval":[641,654]},["terminal",{"sourceInterval":[641,644]},"-"],["app",{"sourceInterval":[645,654]},"Primitive",[]]]],"Primitive":["define",{"sourceInterval":[591,707]},null,[],["alt",{"sourceInterval":[608,707]},["app",{"sourceInterval":[608,621]},"Primitive_positive",[]],["app",{"sourceInterval":[641,654]},"Primitive_negative",[]],["app",{"sourceInterval":[674,682]},"constant",[]],["app",{"sourceInterval":[690,693]},"hex",[]],["app",{"sourceInterval":[701,707]},"number",[]]]],"add":["define",{"sourceInterval":[734,838]},null,[],["alt",{"sourceInterval":[745,838]},["terminal",{"sourceInterval":[745,748]},"+"],["app",{"sourceInterval":[756,779]},"caseInsensitive",[["terminal",{"sourceInterval":[772,778]},"plus"]]],["app",{"sourceInterval":[786,808]},"caseInsensitive",[["terminal",{"sourceInterval":[802,807]},"add"]]],["app",{"sourceInterval":[816,838]},"caseInsensitive",[["terminal",{"sourceInterval":[832,837]},"and"]]]]],"subtract":["define",{"sourceInterval":[848,999]},null,[],["alt",{"sourceInterval":[865,999]},["terminal",{"sourceInterval":[865,868]},"-"],["app",{"sourceInterval":[876,900]},"caseInsensitive",[["terminal",{"sourceInterval":[892,899]},"minus"]]],["app",{"sourceInterval":[908,935]},"caseInsensitive",[["terminal",{"sourceInterval":[924,934]},"subtract"]]],["app",{"sourceInterval":[943,968]},"caseInsensitive",[["terminal",{"sourceInterval":[959,967]},"remove"]]],["app",{"sourceInterval":[976,999]},"caseInsensitive",[["terminal",{"sourceInterval":[992,998]},"take"]]]]],"multiply":["define",{"sourceInterval":[1011,1262]},null,[],["alt",{"sourceInterval":[1028,1262]},["terminal",{"sourceInterval":[1028,1031]},"*"],["terminal",{"sourceInterval":[1039,1044]},"\\*"],["terminal",{"sourceInterval":[1079,1089]},"×"],["app",{"sourceInterval":[1102,1122]},"caseInsensitive",[["terminal",{"sourceInterval":[1118,1121]},"x"]]],["app",{"sourceInterval":[1130,1157]},"caseInsensitive",[["terminal",{"sourceInterval":[1146,1156]},"times by"]]],["app",{"sourceInterval":[1165,1189]},"caseInsensitive",[["terminal",{"sourceInterval":[1181,1188]},"times"]]],["app",{"sourceInterval":[1197,1227]},"caseInsensitive",[["terminal",{"sourceInterval":[1213,1226]},"multiply by"]]],["app",{"sourceInterval":[1235,1262]},"caseInsensitive",[["terminal",{"sourceInterval":[1251,1261]},"multiply"]]]]],"divide":["define",{"sourceInterval":[1274,1383]},null,[],["alt",{"sourceInterval":[1288,1383]},["terminal",{"sourceInterval":[1288,1291]},"/"],["terminal",{"sourceInterval":[1299,1309]},"÷"],["app",{"sourceInterval":[1322,1350]},"caseInsensitive",[["terminal",{"sourceInterval":[1338,1349]},"divide by"]]],["app",{"sourceInterval":[1358,1383]},"caseInsensitive",[["terminal",{"sourceInterval":[1374,1382]},"divide"]]]]],"modulo":["define",{"sourceInterval":[1389,1469]},null,[],["alt",{"sourceInterval":[1403,1469]},["terminal",{"sourceInterval":[1403,1406]},"%"],["app",{"sourceInterval":[1414,1439]},"caseInsensitive",[["terminal",{"sourceInterval":[1430,1438]},"modulo"]]],["app",{"sourceInterval":[1447,1469]},"caseInsensitive",[["terminal",{"sourceInterval":[1463,1468]},"mod"]]]]],"exponent":["define",{"sourceInterval":[1475,1638]},null,[],["alt",{"sourceInterval":[1491,1638]},["terminal",{"sourceInterval":[1491,1494]},"^"],["app",{"sourceInterval":[1502,1536]},"caseInsensitive",[["terminal",{"sourceInterval":[1518,1535]},"to the power of"]]],["app",{"sourceInterval":[1544,1571]},"caseInsensitive",[["terminal",{"sourceInterval":[1560,1570]},"power of"]]],["app",{"sourceInterval":[1579,1606]},"caseInsensitive",[["terminal",{"sourceInterval":[1595,1605]},"exponent"]]],["app",{"sourceInterval":[1614,1638]},"caseInsensitive",[["terminal",{"sourceInterval":[1630,1637]},"prime"]]]]],"constant":["define",{"sourceInterval":[1644,1711]},null,[],["alt",{"sourceInterval":[1661,1711]},["app",{"sourceInterval":[1661,1682]},"caseInsensitive",[["terminal",{"sourceInterval":[1677,1681]},"PI"]]],["app",{"sourceInterval":[1691,1711]},"caseInsensitive",[["terminal",{"sourceInterval":[1707,1710]},"E"]]]]],"number_fract":["define",{"sourceInterval":[1731,1758]},null,[],["seq",{"sourceInterval":[1731,1748]},["star",{"sourceInterval":[1731,1737]},["app",{"sourceInterval":[1731,1736]},"digit",[]]],["terminal",{"sourceInterval":[1738,1741]},"."],["plus",{"sourceInterval":[1742,1748]},["app",{"sourceInterval":[1742,1747]},"digit",[]]]]],"number_whole":["define",{"sourceInterval":[1766,1793]},null,[],["plus",{"sourceInterval":[1766,1772]},["app",{"sourceInterval":[1766,1771]},"digit",[]]]],"number":["define",{"sourceInterval":[1717,1793]},null,[],["alt",{"sourceInterval":[1731,1793]},["app",{"sourceInterval":[1731,1748]},"number_fract",[]],["app",{"sourceInterval":[1766,1772]},"number_whole",[]]]],"hex":["define",{"sourceInterval":[1801,1847]},null,[],["alt",{"sourceInterval":[1812,1847]},["seq",{"sourceInterval":[1812,1826]},["terminal",{"sourceInterval":[1812,1816]},"0x"],["plus",{"sourceInterval":[1817,1826]},["app",{"sourceInterval":[1817,1825]},"hexDigit",[]]]],["seq",{"sourceInterval":[1834,1847]},["plus",{"sourceInterval":[1834,1843]},["app",{"sourceInterval":[1834,1842]},"hexDigit",[]]],["terminal",{"sourceInterval":[1844,1847]},"h"]]]]}]);result.PercentageArithmetic=makeRecipe(["grammar",{"source":"PercentageArithmetic <: BasicArithmetic {\r\n\tExpression\r\n \t:= PercentageOf\r\n | IncreaseBy\r\n | DecreaseBy\r\n | PercentageIncreaseOrDecrease\r\n\t\t| LogicalShift\r\n \r\n Primitive \r\n += percentage\r\n \r\n PercentageOf\r\n \t= percentage caseInsensitive<\"of\"> number \r\n \r\n \tIncreaseBy\r\n \t= caseInsensitive<\"increase\"> number caseInsensitive<\"by\"> percentage\r\n \r\n \tDecreaseBy\r\n \t= caseInsensitive<\"decrease\"> number caseInsensitive<\"by\"> percentage\r\n \r\n PercentageIncreaseOrDecrease\r\n = caseInsensitive<\"from\">? number caseInsensitive<\"to\"> number\r\n\r\n percentage = number \"%\"\r\n}"},"PercentageArithmetic",result.BasicArithmetic,"Expression",{"Expression":["override",{"sourceInterval":[44,179]},null,[],["alt",{"sourceInterval":[65,179]},["app",{"sourceInterval":[65,77]},"PercentageOf",[]],["app",{"sourceInterval":[89,99]},"IncreaseBy",[]],["app",{"sourceInterval":[111,121]},"DecreaseBy",[]],["app",{"sourceInterval":[133,161]},"PercentageIncreaseOrDecrease",[]],["app",{"sourceInterval":[167,179]},"LogicalShift",[]]]],"Primitive":["extend",{"sourceInterval":[195,228]},null,[],["app",{"sourceInterval":[218,228]},"percentage",[]]],"PercentageOf":["define",{"sourceInterval":[244,304]},null,[],["seq",{"sourceInterval":[265,304]},["app",{"sourceInterval":[265,275]},"percentage",[]],["app",{"sourceInterval":[276,297]},"caseInsensitive",[["terminal",{"sourceInterval":[292,296]},"of"]]],["app",{"sourceInterval":[298,304]},"number",[]]]],"IncreaseBy":["define",{"sourceInterval":[321,407]},null,[],["seq",{"sourceInterval":[340,407]},["app",{"sourceInterval":[340,367]},"caseInsensitive",[["terminal",{"sourceInterval":[356,366]},"increase"]]],["app",{"sourceInterval":[368,374]},"number",[]],["app",{"sourceInterval":[375,396]},"caseInsensitive",[["terminal",{"sourceInterval":[391,395]},"by"]]],["app",{"sourceInterval":[397,407]},"percentage",[]]]],"DecreaseBy":["define",{"sourceInterval":[423,509]},null,[],["seq",{"sourceInterval":[442,509]},["app",{"sourceInterval":[442,469]},"caseInsensitive",[["terminal",{"sourceInterval":[458,468]},"decrease"]]],["app",{"sourceInterval":[470,476]},"number",[]],["app",{"sourceInterval":[477,498]},"caseInsensitive",[["terminal",{"sourceInterval":[493,497]},"by"]]],["app",{"sourceInterval":[499,509]},"percentage",[]]]],"PercentageIncreaseOrDecrease":["define",{"sourceInterval":[521,621]},null,[],["seq",{"sourceInterval":[561,621]},["opt",{"sourceInterval":[561,585]},["app",{"sourceInterval":[561,584]},"caseInsensitive",[["terminal",{"sourceInterval":[577,583]},"from"]]]],["app",{"sourceInterval":[586,592]},"number",[]],["app",{"sourceInterval":[593,614]},"caseInsensitive",[["terminal",{"sourceInterval":[609,613]},"to"]]],["app",{"sourceInterval":[615,621]},"number",[]]]],"percentage":["define",{"sourceInterval":[629,652]},null,[],["seq",{"sourceInterval":[642,652]},["app",{"sourceInterval":[642,648]},"number",[]],["terminal",{"sourceInterval":[649,652]},"%"]]]}]);module.exports=result; \ No newline at end of file diff --git a/src/grammars/uom/UnitsOfMeasurement.ohm b/src/grammars/uom/UnitsOfMeasurement.ohm index b2d1759..cd6769c 100644 --- a/src/grammars/uom/UnitsOfMeasurement.ohm +++ b/src/grammars/uom/UnitsOfMeasurement.ohm @@ -1,26 +1,31 @@ include '../arithmetic/BasicArithmetic.ohm' UnitsOfMeasurementArithmetic <: BasicArithmetic { - Expression - := Conversion + Expression + := + | Conversion | ConversionPossiblities | LogicalShift Primitive - += UoM + += uom | percentage Conversion - = caseInsensitive<"convert">? UoM caseInsensitive<"to"> caseInsensitive<"best"> -- best - | caseInsensitive<"convert">? UoM caseInsensitive<"to"> Unit -- convert + = caseInsensitive<"convert">? LogicalShift caseInsensitive<"to"> caseInsensitive<"best"> -- best + | caseInsensitive<"convert">? LogicalShift caseInsensitive<"to"> unit -- convert ConversionPossiblities - = caseInsensitive<"convert">? UoM caseInsensitive<"to"> "?"? + = caseInsensitive<"convert">? LogicalShift caseInsensitive<"to"> "?"? - UoM - = number Unit - - Unit + percentage + = number "%" + + // Important: The reason we include `~("to" space+)` is to prevent matching "t" or "torr" units when used in expression "convert 100g + 20 to g" + uom + = number spaces ~("to" ~"rr") spaces unit + + unit = "km3/s" | "yd3/h" | "yd3/min" @@ -191,7 +196,4 @@ UnitsOfMeasurementArithmetic <: BasicArithmetic { | "Gb" | "Mb" | "b" - - percentage - = number "%" } \ No newline at end of file diff --git a/src/grammars/uom/UnitsOfMeasurement.ohm-bundle.d.ts b/src/grammars/uom/UnitsOfMeasurement.ohm-bundle.d.ts index 4b64885..3319766 100644 --- a/src/grammars/uom/UnitsOfMeasurement.ohm-bundle.d.ts +++ b/src/grammars/uom/UnitsOfMeasurement.ohm-bundle.d.ts @@ -63,9 +63,9 @@ export interface UnitsOfMeasurementArithmeticActionDict extends BasicArithmet Conversion_convert?: (this: NonterminalNode, arg0: IterationNode, arg1: NonterminalNode, arg2: NonterminalNode, arg3: NonterminalNode) => T; Conversion?: (this: NonterminalNode, arg0: NonterminalNode) => T; ConversionPossiblities?: (this: NonterminalNode, arg0: IterationNode, arg1: NonterminalNode, arg2: NonterminalNode, arg3: IterationNode) => T; - UoM?: (this: NonterminalNode, arg0: NonterminalNode, arg1: NonterminalNode) => T; - Unit?: (this: NonterminalNode, arg0: TerminalNode) => T; percentage?: (this: NonterminalNode, arg0: NonterminalNode, arg1: TerminalNode) => T; + uom?: (this: NonterminalNode, arg0: NonterminalNode, arg1: NonterminalNode, arg2: NonterminalNode, arg3: NonterminalNode) => T; + unit?: (this: NonterminalNode, arg0: TerminalNode) => T; } export interface UnitsOfMeasurementArithmeticSemantics extends Semantics { diff --git a/src/grammars/uom/UnitsOfMeasurement.ohm-bundle.js b/src/grammars/uom/UnitsOfMeasurement.ohm-bundle.js index dd23b11..32cdc78 100644 --- a/src/grammars/uom/UnitsOfMeasurement.ohm-bundle.js +++ b/src/grammars/uom/UnitsOfMeasurement.ohm-bundle.js @@ -1 +1 @@ -'use strict';const {makeRecipe}=require('ohm-js');const result={};result.BasicArithmetic=makeRecipe(["grammar",{"source":"BasicArithmetic {\r\n Expression\r\n = LogicalShift\r\n\r\n LogicalShift\r\n = LogicalShift \"<<\" LogicalShift -- left\r\n | LogicalShift \">>\" LogicalShift -- right\r\n | AS \r\n\r\n // Addition or Subtraction\r\n AS\r\n = AS add MD -- addition\r\n | AS subtract MD -- subtraction\r\n | MD\r\n\r\n // Multiply or Divide\r\n MD\r\n = MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | MD modulo E -- modulo\r\n | E\r\n\r\n // Exponent\r\n E\r\n = P exponent E -- exponent\r\n | P\r\n\r\n // Parenthesis\r\n P\r\n = \"(\" Expression \")\" -- parenthesis\r\n | Primitive\r\n \r\n Primitive\r\n = \"+\" Primitive -- positive\r\n | \"-\" Primitive -- negative\r\n | constant\r\n | hex\r\n | number\r\n \r\n // Lexical Rules\r\n add \r\n \t= \"+\"\r\n | caseInsensitive<\"plus\">\r\n \t| caseInsensitive<\"add\">\r\n | caseInsensitive<\"and\">\r\n \r\n subtract \r\n = \"-\"\r\n | caseInsensitive<\"minus\">\r\n | caseInsensitive<\"subtract\">\r\n | caseInsensitive<\"remove\">\r\n | caseInsensitive<\"take\">\r\n \r\n multiply \r\n = \"*\"\r\n | \"\\\\*\" // Escaped e.g. \\* for markdown\r\n | \"\\u{00D7}\" // Multiplication Symbol ×\r\n | caseInsensitive<\"x\">\r\n | caseInsensitive<\"times by\">\r\n | caseInsensitive<\"times\">\r\n | caseInsensitive<\"multiply by\">\r\n | caseInsensitive<\"multiply\">\r\n \r\n divide\r\n = \"/\"\r\n | \"\\u{00F7}\" // Division Symbol ÷\r\n | caseInsensitive<\"divide by\">\r\n | caseInsensitive<\"divide\">\r\n\r\n modulo\r\n = \"%\"\r\n | caseInsensitive<\"modulo\">\r\n | caseInsensitive<\"mod\">\r\n\r\n exponent\r\n = \"^\"\r\n | caseInsensitive<\"to the power of\">\r\n | caseInsensitive<\"power of\">\r\n | caseInsensitive<\"exponent\">\r\n | caseInsensitive<\"prime\">\r\n\r\n constant \r\n \t= caseInsensitive<\"PI\"> \r\n | caseInsensitive<\"E\">\r\n\r\n number\r\n = digit* \".\" digit+ -- fract\r\n | digit+ -- whole\r\n \r\n hex\r\n = \"0x\" hexDigit+\r\n | hexDigit+ \"h\"\r\n}"},"BasicArithmetic",null,"Expression",{"Expression":["define",{"sourceInterval":[21,51]},null,[],["app",{"sourceInterval":[39,51]},"LogicalShift",[]]],"LogicalShift_left":["define",{"sourceInterval":[77,115]},null,[],["seq",{"sourceInterval":[77,107]},["app",{"sourceInterval":[77,89]},"LogicalShift",[]],["terminal",{"sourceInterval":[90,94]},"<<"],["app",{"sourceInterval":[95,107]},"LogicalShift",[]]]],"LogicalShift_right":["define",{"sourceInterval":[123,162]},null,[],["seq",{"sourceInterval":[123,153]},["app",{"sourceInterval":[123,135]},"LogicalShift",[]],["terminal",{"sourceInterval":[136,140]},">>"],["app",{"sourceInterval":[141,153]},"LogicalShift",[]]]],"LogicalShift":["define",{"sourceInterval":[57,172]},null,[],["alt",{"sourceInterval":[77,172]},["app",{"sourceInterval":[77,107]},"LogicalShift_left",[]],["app",{"sourceInterval":[123,153]},"LogicalShift_right",[]],["app",{"sourceInterval":[170,172]},"AS",[]]]],"AS_addition":["define",{"sourceInterval":[219,241]},null,[],["seq",{"sourceInterval":[219,228]},["app",{"sourceInterval":[219,221]},"AS",[]],["app",{"sourceInterval":[222,225]},"add",[]],["app",{"sourceInterval":[226,228]},"MD",[]]]],"AS_subtraction":["define",{"sourceInterval":[249,279]},null,[],["seq",{"sourceInterval":[249,263]},["app",{"sourceInterval":[249,251]},"AS",[]],["app",{"sourceInterval":[252,260]},"subtract",[]],["app",{"sourceInterval":[261,263]},"MD",[]]]],"AS":["define",{"sourceInterval":[209,289]},null,[],["alt",{"sourceInterval":[219,289]},["app",{"sourceInterval":[219,228]},"AS_addition",[]],["app",{"sourceInterval":[249,263]},"AS_subtraction",[]],["app",{"sourceInterval":[287,289]},"MD",[]]]],"MD_multiplication":["define",{"sourceInterval":[330,362]},null,[],["seq",{"sourceInterval":[330,343]},["app",{"sourceInterval":[330,332]},"MD",[]],["app",{"sourceInterval":[333,341]},"multiply",[]],["app",{"sourceInterval":[342,343]},"E",[]]]],"MD_division":["define",{"sourceInterval":[370,394]},null,[],["seq",{"sourceInterval":[370,381]},["app",{"sourceInterval":[370,372]},"MD",[]],["app",{"sourceInterval":[373,379]},"divide",[]],["app",{"sourceInterval":[380,381]},"E",[]]]],"MD_modulo":["define",{"sourceInterval":[402,424]},null,[],["seq",{"sourceInterval":[402,413]},["app",{"sourceInterval":[402,404]},"MD",[]],["app",{"sourceInterval":[405,411]},"modulo",[]],["app",{"sourceInterval":[412,413]},"E",[]]]],"MD":["define",{"sourceInterval":[320,433]},null,[],["alt",{"sourceInterval":[330,433]},["app",{"sourceInterval":[330,343]},"MD_multiplication",[]],["app",{"sourceInterval":[370,381]},"MD_division",[]],["app",{"sourceInterval":[402,413]},"MD_modulo",[]],["app",{"sourceInterval":[432,433]},"E",[]]]],"E_exponent":["define",{"sourceInterval":[463,488]},null,[],["seq",{"sourceInterval":[463,475]},["app",{"sourceInterval":[463,464]},"P",[]],["app",{"sourceInterval":[465,473]},"exponent",[]],["app",{"sourceInterval":[474,475]},"E",[]]]],"E":["define",{"sourceInterval":[454,497]},null,[],["alt",{"sourceInterval":[463,497]},["app",{"sourceInterval":[463,475]},"E_exponent",[]],["app",{"sourceInterval":[496,497]},"P",[]]]],"P_parenthesis":["define",{"sourceInterval":[530,564]},null,[],["seq",{"sourceInterval":[530,548]},["terminal",{"sourceInterval":[530,533]},"("],["app",{"sourceInterval":[534,544]},"Expression",[]],["terminal",{"sourceInterval":[545,548]},")"]]],"P":["define",{"sourceInterval":[521,581]},null,[],["alt",{"sourceInterval":[530,581]},["app",{"sourceInterval":[530,548]},"P_parenthesis",[]],["app",{"sourceInterval":[572,581]},"Primitive",[]]]],"Primitive_positive":["define",{"sourceInterval":[608,633]},null,[],["seq",{"sourceInterval":[608,621]},["terminal",{"sourceInterval":[608,611]},"+"],["app",{"sourceInterval":[612,621]},"Primitive",[]]]],"Primitive_negative":["define",{"sourceInterval":[641,666]},null,[],["seq",{"sourceInterval":[641,654]},["terminal",{"sourceInterval":[641,644]},"-"],["app",{"sourceInterval":[645,654]},"Primitive",[]]]],"Primitive":["define",{"sourceInterval":[591,707]},null,[],["alt",{"sourceInterval":[608,707]},["app",{"sourceInterval":[608,621]},"Primitive_positive",[]],["app",{"sourceInterval":[641,654]},"Primitive_negative",[]],["app",{"sourceInterval":[674,682]},"constant",[]],["app",{"sourceInterval":[690,693]},"hex",[]],["app",{"sourceInterval":[701,707]},"number",[]]]],"add":["define",{"sourceInterval":[734,838]},null,[],["alt",{"sourceInterval":[745,838]},["terminal",{"sourceInterval":[745,748]},"+"],["app",{"sourceInterval":[756,779]},"caseInsensitive",[["terminal",{"sourceInterval":[772,778]},"plus"]]],["app",{"sourceInterval":[786,808]},"caseInsensitive",[["terminal",{"sourceInterval":[802,807]},"add"]]],["app",{"sourceInterval":[816,838]},"caseInsensitive",[["terminal",{"sourceInterval":[832,837]},"and"]]]]],"subtract":["define",{"sourceInterval":[848,999]},null,[],["alt",{"sourceInterval":[865,999]},["terminal",{"sourceInterval":[865,868]},"-"],["app",{"sourceInterval":[876,900]},"caseInsensitive",[["terminal",{"sourceInterval":[892,899]},"minus"]]],["app",{"sourceInterval":[908,935]},"caseInsensitive",[["terminal",{"sourceInterval":[924,934]},"subtract"]]],["app",{"sourceInterval":[943,968]},"caseInsensitive",[["terminal",{"sourceInterval":[959,967]},"remove"]]],["app",{"sourceInterval":[976,999]},"caseInsensitive",[["terminal",{"sourceInterval":[992,998]},"take"]]]]],"multiply":["define",{"sourceInterval":[1011,1289]},null,[],["alt",{"sourceInterval":[1028,1289]},["terminal",{"sourceInterval":[1028,1031]},"*"],["terminal",{"sourceInterval":[1039,1044]},"\\*"],["terminal",{"sourceInterval":[1084,1094]},"×"],["app",{"sourceInterval":[1129,1149]},"caseInsensitive",[["terminal",{"sourceInterval":[1145,1148]},"x"]]],["app",{"sourceInterval":[1157,1184]},"caseInsensitive",[["terminal",{"sourceInterval":[1173,1183]},"times by"]]],["app",{"sourceInterval":[1192,1216]},"caseInsensitive",[["terminal",{"sourceInterval":[1208,1215]},"times"]]],["app",{"sourceInterval":[1224,1254]},"caseInsensitive",[["terminal",{"sourceInterval":[1240,1253]},"multiply by"]]],["app",{"sourceInterval":[1262,1289]},"caseInsensitive",[["terminal",{"sourceInterval":[1278,1288]},"multiply"]]]]],"divide":["define",{"sourceInterval":[1301,1426]},null,[],["alt",{"sourceInterval":[1315,1426]},["terminal",{"sourceInterval":[1315,1318]},"/"],["terminal",{"sourceInterval":[1326,1336]},"÷"],["app",{"sourceInterval":[1365,1393]},"caseInsensitive",[["terminal",{"sourceInterval":[1381,1392]},"divide by"]]],["app",{"sourceInterval":[1401,1426]},"caseInsensitive",[["terminal",{"sourceInterval":[1417,1425]},"divide"]]]]],"modulo":["define",{"sourceInterval":[1432,1512]},null,[],["alt",{"sourceInterval":[1446,1512]},["terminal",{"sourceInterval":[1446,1449]},"%"],["app",{"sourceInterval":[1457,1482]},"caseInsensitive",[["terminal",{"sourceInterval":[1473,1481]},"modulo"]]],["app",{"sourceInterval":[1490,1512]},"caseInsensitive",[["terminal",{"sourceInterval":[1506,1511]},"mod"]]]]],"exponent":["define",{"sourceInterval":[1518,1681]},null,[],["alt",{"sourceInterval":[1534,1681]},["terminal",{"sourceInterval":[1534,1537]},"^"],["app",{"sourceInterval":[1545,1579]},"caseInsensitive",[["terminal",{"sourceInterval":[1561,1578]},"to the power of"]]],["app",{"sourceInterval":[1587,1614]},"caseInsensitive",[["terminal",{"sourceInterval":[1603,1613]},"power of"]]],["app",{"sourceInterval":[1622,1649]},"caseInsensitive",[["terminal",{"sourceInterval":[1638,1648]},"exponent"]]],["app",{"sourceInterval":[1657,1681]},"caseInsensitive",[["terminal",{"sourceInterval":[1673,1680]},"prime"]]]]],"constant":["define",{"sourceInterval":[1687,1754]},null,[],["alt",{"sourceInterval":[1704,1754]},["app",{"sourceInterval":[1704,1725]},"caseInsensitive",[["terminal",{"sourceInterval":[1720,1724]},"PI"]]],["app",{"sourceInterval":[1734,1754]},"caseInsensitive",[["terminal",{"sourceInterval":[1750,1753]},"E"]]]]],"number_fract":["define",{"sourceInterval":[1774,1801]},null,[],["seq",{"sourceInterval":[1774,1791]},["star",{"sourceInterval":[1774,1780]},["app",{"sourceInterval":[1774,1779]},"digit",[]]],["terminal",{"sourceInterval":[1781,1784]},"."],["plus",{"sourceInterval":[1785,1791]},["app",{"sourceInterval":[1785,1790]},"digit",[]]]]],"number_whole":["define",{"sourceInterval":[1809,1836]},null,[],["plus",{"sourceInterval":[1809,1815]},["app",{"sourceInterval":[1809,1814]},"digit",[]]]],"number":["define",{"sourceInterval":[1760,1836]},null,[],["alt",{"sourceInterval":[1774,1836]},["app",{"sourceInterval":[1774,1791]},"number_fract",[]],["app",{"sourceInterval":[1809,1815]},"number_whole",[]]]],"hex":["define",{"sourceInterval":[1844,1890]},null,[],["alt",{"sourceInterval":[1855,1890]},["seq",{"sourceInterval":[1855,1869]},["terminal",{"sourceInterval":[1855,1859]},"0x"],["plus",{"sourceInterval":[1860,1869]},["app",{"sourceInterval":[1860,1868]},"hexDigit",[]]]],["seq",{"sourceInterval":[1877,1890]},["plus",{"sourceInterval":[1877,1886]},["app",{"sourceInterval":[1877,1885]},"hexDigit",[]]],["terminal",{"sourceInterval":[1887,1890]},"h"]]]]}]);result.UnitsOfMeasurementArithmetic=makeRecipe(["grammar",{"source":"UnitsOfMeasurementArithmetic <: BasicArithmetic {\r\n\tExpression\r\n \t:= Conversion\r\n | ConversionPossiblities\r\n\t\t| LogicalShift\r\n \r\n Primitive \r\n += UoM\r\n | percentage\r\n \r\n \tConversion\r\n \t= caseInsensitive<\"convert\">? UoM caseInsensitive<\"to\"> caseInsensitive<\"best\"> -- best\r\n | caseInsensitive<\"convert\">? UoM caseInsensitive<\"to\"> Unit -- convert\r\n \t\r\n ConversionPossiblities\r\n = caseInsensitive<\"convert\">? UoM caseInsensitive<\"to\"> \"?\"?\r\n \r\n UoM \r\n = number Unit\r\n\r\n Unit\r\n = \"km3/s\"\r\n | \"yd3/h\"\r\n | \"yd3/min\"\r\n | \"yd3/s\"\r\n | \"ft3/h\"\r\n | \"ft3/min\"\r\n | \"ft3/s\"\r\n | \"in3/h\"\r\n | \"in3/min\"\r\n | \"in3/s\"\r\n | \"mm3/s\"\r\n | \"cm3/s\"\r\n | \"fl-oz/h\"\r\n | \"fl-oz/min\"\r\n | \"fl-oz/s\"\r\n | \"gal/h\"\r\n | \"gal/min\"\r\n | \"gal/s\"\r\n | \"pnt/h\"\r\n | \"pnt/min\"\r\n | \"pnt/s\"\r\n | \"cup/s\"\r\n | \"Tbs/s\"\r\n | \"tsp/s\"\r\n | \"m3/h\"\r\n | \"m3/min\"\r\n | \"m3/s\"\r\n | \"kl/h\"\r\n | \"kl/min\"\r\n | \"kl/s\"\r\n | \"l/h\"\r\n | \"l/min\"\r\n | \"l/s\"\r\n | \"dl/s\"\r\n | \"cl/s\"\r\n | \"ml/s\"\r\n | \"min/km\"\r\n | \"s/ft\"\r\n | \"s/m\"\r\n | \"km/h\"\r\n | \"m/h\"\r\n | \"ft/s\"\r\n | \"m/s\"\r\n | \"knot\"\r\n | \"THz\"\r\n | \"GHz\"\r\n | \"MHz\"\r\n | \"kHz\"\r\n | \"mHz\"\r\n | \"Hz\"\r\n | \"rpm\"\r\n | \"rad/s\"\r\n | \"deg/s\"\r\n | \"km3\"\r\n | \"yd3\"\r\n | \"ft3\"\r\n | \"in3\"\r\n | \"mm3\"\r\n | \"cm3\"\r\n | \"m3\"\r\n | \"gal\"\r\n | \"qt\"\r\n | \"pnt\"\r\n | \"cup\"\r\n | \"fl-oz\"\r\n | \"Tbs\"\r\n | \"tsp\"\r\n | \"kl\"\r\n | \"lb\"\r\n | \"lx\"\r\n | \"l\"\r\n | \"ml\"\r\n | \"km2\"\r\n | \"mi2\"\r\n | \"mm2\"\r\n | \"cm2\"\r\n | \"m2\"\r\n | \"in2\"\r\n | \"ft2\"\r\n | \"ha\"\r\n | \"ac\"\r\n | \"GVARh\"\r\n | \"MVARh\"\r\n | \"kVARh\"\r\n | \"mVARh\"\r\n | \"VARh\"\r\n | \"GVAR\"\r\n | \"MVAR\"\r\n | \"kVAR\"\r\n | \"mVAR\"\r\n | \"VAR\"\r\n | \"GVA\"\r\n | \"MVA\"\r\n | \"kVA\"\r\n | \"mVA\"\r\n | \"VA\"\r\n | \"GWh\"\r\n | \"MWh\"\r\n | \"kWh\"\r\n | \"mWh\"\r\n | \"Wh\"\r\n | \"GW\"\r\n | \"MW\"\r\n | \"kW\"\r\n | \"mW\"\r\n | \"W\"\r\n | \"kJ\"\r\n | \"J\"\r\n | \"mcg\"\r\n | \"kg\"\r\n | \"grad\"\r\n | \"g\"\r\n | \"mg\"\r\n | \"oz\"\r\n | \"torr\"\r\n | \"t\"\r\n | \"mt\"\r\n | \"month\"\r\n | \"year\"\r\n | \"week\"\r\n | \"deg\"\r\n | \"d\"\r\n | \"hPa\"\r\n | \"h\"\r\n | \"min\"\r\n | \"s\"\r\n | \"ms\"\r\n | \"mu\"\r\n | \"ns\"\r\n | \"kPa\"\r\n | \"MPa\"\r\n | \"bar\"\r\n | \"psi\"\r\n | \"ksi\"\r\n | \"Pa\"\r\n | \"ft-cd\"\r\n | \"ppm\"\r\n | \"ppb\"\r\n | \"ppt\"\r\n | \"ppq\"\r\n | \"kV\"\r\n | \"V\"\r\n | \"mV\"\r\n | \"kA\"\r\n | \"A\"\r\n | \"mA\"\r\n | \"arcmin\"\r\n | \"arcsec\"\r\n | \"rad\"\r\n | \"ft-us\"\r\n | \"mi\"\r\n | \"mm\"\r\n | \"m\"\r\n | \"cm\"\r\n | \"ft\"\r\n | \"in\"\r\n | \"F\"\r\n | \"Kb\"\r\n | \"KB\"\r\n | \"K\"\r\n | \"C\"\r\n | \"R\"\r\n | \"TB\"\r\n | \"GB\"\r\n | \"MB\"\r\n | \"B\"\r\n | \"Tb\"\r\n | \"Gb\"\r\n | \"Mb\"\r\n | \"b\"\r\n\r\n percentage \r\n = number \"%\"\r\n}"},"UnitsOfMeasurementArithmetic",result.BasicArithmetic,"Expression",{"Expression":["override",{"sourceInterval":[52,135]},null,[],["alt",{"sourceInterval":[73,135]},["app",{"sourceInterval":[73,83]},"Conversion",[]],["app",{"sourceInterval":[95,117]},"ConversionPossiblities",[]],["app",{"sourceInterval":[123,135]},"LogicalShift",[]]]],"Primitive":["extend",{"sourceInterval":[151,199]},null,[],["alt",{"sourceInterval":[174,199]},["app",{"sourceInterval":[174,177]},"UoM",[]],["app",{"sourceInterval":[189,199]},"percentage",[]]]],"Conversion_best":["define",{"sourceInterval":[234,319]},null,[],["seq",{"sourceInterval":[234,311]},["opt",{"sourceInterval":[234,261]},["app",{"sourceInterval":[234,260]},"caseInsensitive",[["terminal",{"sourceInterval":[250,259]},"convert"]]]],["app",{"sourceInterval":[262,265]},"UoM",[]],["app",{"sourceInterval":[266,287]},"caseInsensitive",[["terminal",{"sourceInterval":[282,286]},"to"]]],["app",{"sourceInterval":[288,311]},"caseInsensitive",[["terminal",{"sourceInterval":[304,310]},"best"]]]]],"Conversion_convert":["define",{"sourceInterval":[331,400]},null,[],["seq",{"sourceInterval":[331,389]},["opt",{"sourceInterval":[331,358]},["app",{"sourceInterval":[331,357]},"caseInsensitive",[["terminal",{"sourceInterval":[347,356]},"convert"]]]],["app",{"sourceInterval":[359,362]},"UoM",[]],["app",{"sourceInterval":[363,384]},"caseInsensitive",[["terminal",{"sourceInterval":[379,383]},"to"]]],["app",{"sourceInterval":[385,389]},"Unit",[]]]],"Conversion":["define",{"sourceInterval":[215,400]},null,[],["alt",{"sourceInterval":[234,400]},["app",{"sourceInterval":[234,311]},"Conversion_best",[]],["app",{"sourceInterval":[331,389]},"Conversion_convert",[]]]],"ConversionPossiblities":["define",{"sourceInterval":[417,509]},null,[],["seq",{"sourceInterval":[451,509]},["opt",{"sourceInterval":[451,478]},["app",{"sourceInterval":[451,477]},"caseInsensitive",[["terminal",{"sourceInterval":[467,476]},"convert"]]]],["app",{"sourceInterval":[479,482]},"UoM",[]],["app",{"sourceInterval":[483,504]},"caseInsensitive",[["terminal",{"sourceInterval":[499,503]},"to"]]],["opt",{"sourceInterval":[505,509]},["terminal",{"sourceInterval":[505,508]},"?"]]]],"UoM":["define",{"sourceInterval":[521,548]},null,[],["seq",{"sourceInterval":[537,548]},["app",{"sourceInterval":[537,543]},"number",[]],["app",{"sourceInterval":[544,548]},"Unit",[]]]],"Unit":["define",{"sourceInterval":[556,3497]},null,[],["alt",{"sourceInterval":[572,3497]},["terminal",{"sourceInterval":[572,579]},"km3/s"],["terminal",{"sourceInterval":[591,598]},"yd3/h"],["terminal",{"sourceInterval":[610,619]},"yd3/min"],["terminal",{"sourceInterval":[631,638]},"yd3/s"],["terminal",{"sourceInterval":[650,657]},"ft3/h"],["terminal",{"sourceInterval":[669,678]},"ft3/min"],["terminal",{"sourceInterval":[690,697]},"ft3/s"],["terminal",{"sourceInterval":[709,716]},"in3/h"],["terminal",{"sourceInterval":[728,737]},"in3/min"],["terminal",{"sourceInterval":[749,756]},"in3/s"],["terminal",{"sourceInterval":[768,775]},"mm3/s"],["terminal",{"sourceInterval":[787,794]},"cm3/s"],["terminal",{"sourceInterval":[806,815]},"fl-oz/h"],["terminal",{"sourceInterval":[827,838]},"fl-oz/min"],["terminal",{"sourceInterval":[850,859]},"fl-oz/s"],["terminal",{"sourceInterval":[871,878]},"gal/h"],["terminal",{"sourceInterval":[890,899]},"gal/min"],["terminal",{"sourceInterval":[911,918]},"gal/s"],["terminal",{"sourceInterval":[930,937]},"pnt/h"],["terminal",{"sourceInterval":[949,958]},"pnt/min"],["terminal",{"sourceInterval":[970,977]},"pnt/s"],["terminal",{"sourceInterval":[989,996]},"cup/s"],["terminal",{"sourceInterval":[1008,1015]},"Tbs/s"],["terminal",{"sourceInterval":[1027,1034]},"tsp/s"],["terminal",{"sourceInterval":[1046,1052]},"m3/h"],["terminal",{"sourceInterval":[1064,1072]},"m3/min"],["terminal",{"sourceInterval":[1084,1090]},"m3/s"],["terminal",{"sourceInterval":[1102,1108]},"kl/h"],["terminal",{"sourceInterval":[1120,1128]},"kl/min"],["terminal",{"sourceInterval":[1140,1146]},"kl/s"],["terminal",{"sourceInterval":[1158,1163]},"l/h"],["terminal",{"sourceInterval":[1175,1182]},"l/min"],["terminal",{"sourceInterval":[1194,1199]},"l/s"],["terminal",{"sourceInterval":[1211,1217]},"dl/s"],["terminal",{"sourceInterval":[1229,1235]},"cl/s"],["terminal",{"sourceInterval":[1247,1253]},"ml/s"],["terminal",{"sourceInterval":[1265,1273]},"min/km"],["terminal",{"sourceInterval":[1285,1291]},"s/ft"],["terminal",{"sourceInterval":[1303,1308]},"s/m"],["terminal",{"sourceInterval":[1320,1326]},"km/h"],["terminal",{"sourceInterval":[1338,1343]},"m/h"],["terminal",{"sourceInterval":[1355,1361]},"ft/s"],["terminal",{"sourceInterval":[1373,1378]},"m/s"],["terminal",{"sourceInterval":[1390,1396]},"knot"],["terminal",{"sourceInterval":[1408,1413]},"THz"],["terminal",{"sourceInterval":[1425,1430]},"GHz"],["terminal",{"sourceInterval":[1442,1447]},"MHz"],["terminal",{"sourceInterval":[1459,1464]},"kHz"],["terminal",{"sourceInterval":[1476,1481]},"mHz"],["terminal",{"sourceInterval":[1493,1497]},"Hz"],["terminal",{"sourceInterval":[1509,1514]},"rpm"],["terminal",{"sourceInterval":[1526,1533]},"rad/s"],["terminal",{"sourceInterval":[1545,1552]},"deg/s"],["terminal",{"sourceInterval":[1564,1569]},"km3"],["terminal",{"sourceInterval":[1581,1586]},"yd3"],["terminal",{"sourceInterval":[1598,1603]},"ft3"],["terminal",{"sourceInterval":[1615,1620]},"in3"],["terminal",{"sourceInterval":[1632,1637]},"mm3"],["terminal",{"sourceInterval":[1649,1654]},"cm3"],["terminal",{"sourceInterval":[1666,1670]},"m3"],["terminal",{"sourceInterval":[1682,1687]},"gal"],["terminal",{"sourceInterval":[1699,1703]},"qt"],["terminal",{"sourceInterval":[1715,1720]},"pnt"],["terminal",{"sourceInterval":[1732,1737]},"cup"],["terminal",{"sourceInterval":[1749,1756]},"fl-oz"],["terminal",{"sourceInterval":[1768,1773]},"Tbs"],["terminal",{"sourceInterval":[1785,1790]},"tsp"],["terminal",{"sourceInterval":[1802,1806]},"kl"],["terminal",{"sourceInterval":[1818,1822]},"lb"],["terminal",{"sourceInterval":[1834,1838]},"lx"],["terminal",{"sourceInterval":[1850,1853]},"l"],["terminal",{"sourceInterval":[1865,1869]},"ml"],["terminal",{"sourceInterval":[1881,1886]},"km2"],["terminal",{"sourceInterval":[1898,1903]},"mi2"],["terminal",{"sourceInterval":[1915,1920]},"mm2"],["terminal",{"sourceInterval":[1932,1937]},"cm2"],["terminal",{"sourceInterval":[1949,1953]},"m2"],["terminal",{"sourceInterval":[1965,1970]},"in2"],["terminal",{"sourceInterval":[1982,1987]},"ft2"],["terminal",{"sourceInterval":[1999,2003]},"ha"],["terminal",{"sourceInterval":[2015,2019]},"ac"],["terminal",{"sourceInterval":[2031,2038]},"GVARh"],["terminal",{"sourceInterval":[2050,2057]},"MVARh"],["terminal",{"sourceInterval":[2069,2076]},"kVARh"],["terminal",{"sourceInterval":[2088,2095]},"mVARh"],["terminal",{"sourceInterval":[2107,2113]},"VARh"],["terminal",{"sourceInterval":[2125,2131]},"GVAR"],["terminal",{"sourceInterval":[2143,2149]},"MVAR"],["terminal",{"sourceInterval":[2161,2167]},"kVAR"],["terminal",{"sourceInterval":[2179,2185]},"mVAR"],["terminal",{"sourceInterval":[2197,2202]},"VAR"],["terminal",{"sourceInterval":[2214,2219]},"GVA"],["terminal",{"sourceInterval":[2231,2236]},"MVA"],["terminal",{"sourceInterval":[2248,2253]},"kVA"],["terminal",{"sourceInterval":[2265,2270]},"mVA"],["terminal",{"sourceInterval":[2282,2286]},"VA"],["terminal",{"sourceInterval":[2298,2303]},"GWh"],["terminal",{"sourceInterval":[2315,2320]},"MWh"],["terminal",{"sourceInterval":[2332,2337]},"kWh"],["terminal",{"sourceInterval":[2349,2354]},"mWh"],["terminal",{"sourceInterval":[2366,2370]},"Wh"],["terminal",{"sourceInterval":[2382,2386]},"GW"],["terminal",{"sourceInterval":[2398,2402]},"MW"],["terminal",{"sourceInterval":[2414,2418]},"kW"],["terminal",{"sourceInterval":[2430,2434]},"mW"],["terminal",{"sourceInterval":[2446,2449]},"W"],["terminal",{"sourceInterval":[2461,2465]},"kJ"],["terminal",{"sourceInterval":[2477,2480]},"J"],["terminal",{"sourceInterval":[2492,2497]},"mcg"],["terminal",{"sourceInterval":[2509,2513]},"kg"],["terminal",{"sourceInterval":[2525,2531]},"grad"],["terminal",{"sourceInterval":[2543,2546]},"g"],["terminal",{"sourceInterval":[2558,2562]},"mg"],["terminal",{"sourceInterval":[2574,2578]},"oz"],["terminal",{"sourceInterval":[2590,2596]},"torr"],["terminal",{"sourceInterval":[2608,2611]},"t"],["terminal",{"sourceInterval":[2623,2627]},"mt"],["terminal",{"sourceInterval":[2639,2646]},"month"],["terminal",{"sourceInterval":[2658,2664]},"year"],["terminal",{"sourceInterval":[2676,2682]},"week"],["terminal",{"sourceInterval":[2694,2699]},"deg"],["terminal",{"sourceInterval":[2711,2714]},"d"],["terminal",{"sourceInterval":[2726,2731]},"hPa"],["terminal",{"sourceInterval":[2743,2746]},"h"],["terminal",{"sourceInterval":[2758,2763]},"min"],["terminal",{"sourceInterval":[2775,2778]},"s"],["terminal",{"sourceInterval":[2790,2794]},"ms"],["terminal",{"sourceInterval":[2806,2810]},"mu"],["terminal",{"sourceInterval":[2822,2826]},"ns"],["terminal",{"sourceInterval":[2838,2843]},"kPa"],["terminal",{"sourceInterval":[2855,2860]},"MPa"],["terminal",{"sourceInterval":[2872,2877]},"bar"],["terminal",{"sourceInterval":[2889,2894]},"psi"],["terminal",{"sourceInterval":[2906,2911]},"ksi"],["terminal",{"sourceInterval":[2923,2927]},"Pa"],["terminal",{"sourceInterval":[2939,2946]},"ft-cd"],["terminal",{"sourceInterval":[2958,2963]},"ppm"],["terminal",{"sourceInterval":[2975,2980]},"ppb"],["terminal",{"sourceInterval":[2992,2997]},"ppt"],["terminal",{"sourceInterval":[3009,3014]},"ppq"],["terminal",{"sourceInterval":[3026,3030]},"kV"],["terminal",{"sourceInterval":[3042,3045]},"V"],["terminal",{"sourceInterval":[3057,3061]},"mV"],["terminal",{"sourceInterval":[3073,3077]},"kA"],["terminal",{"sourceInterval":[3089,3092]},"A"],["terminal",{"sourceInterval":[3104,3108]},"mA"],["terminal",{"sourceInterval":[3120,3128]},"arcmin"],["terminal",{"sourceInterval":[3140,3148]},"arcsec"],["terminal",{"sourceInterval":[3160,3165]},"rad"],["terminal",{"sourceInterval":[3177,3184]},"ft-us"],["terminal",{"sourceInterval":[3196,3200]},"mi"],["terminal",{"sourceInterval":[3212,3216]},"mm"],["terminal",{"sourceInterval":[3228,3231]},"m"],["terminal",{"sourceInterval":[3243,3247]},"cm"],["terminal",{"sourceInterval":[3259,3263]},"ft"],["terminal",{"sourceInterval":[3275,3279]},"in"],["terminal",{"sourceInterval":[3291,3294]},"F"],["terminal",{"sourceInterval":[3306,3310]},"Kb"],["terminal",{"sourceInterval":[3322,3326]},"KB"],["terminal",{"sourceInterval":[3338,3341]},"K"],["terminal",{"sourceInterval":[3353,3356]},"C"],["terminal",{"sourceInterval":[3368,3371]},"R"],["terminal",{"sourceInterval":[3383,3387]},"TB"],["terminal",{"sourceInterval":[3399,3403]},"GB"],["terminal",{"sourceInterval":[3415,3419]},"MB"],["terminal",{"sourceInterval":[3431,3434]},"B"],["terminal",{"sourceInterval":[3446,3450]},"Tb"],["terminal",{"sourceInterval":[3462,3466]},"Gb"],["terminal",{"sourceInterval":[3478,3482]},"Mb"],["terminal",{"sourceInterval":[3494,3497]},"b"]]],"percentage":["define",{"sourceInterval":[3505,3538]},null,[],["seq",{"sourceInterval":[3528,3538]},["app",{"sourceInterval":[3528,3534]},"number",[]],["terminal",{"sourceInterval":[3535,3538]},"%"]]]}]);module.exports=result; \ No newline at end of file +'use strict';const {makeRecipe}=require('ohm-js');const result={};result.BasicArithmetic=makeRecipe(["grammar",{"source":"BasicArithmetic {\r\n Expression\r\n = LogicalShift\r\n\r\n LogicalShift\r\n = LogicalShift \"<<\" LogicalShift -- left\r\n | LogicalShift \">>\" LogicalShift -- right\r\n | AS \r\n\r\n // Addition or Subtraction\r\n AS\r\n = AS add MD -- addition\r\n | AS subtract MD -- subtraction\r\n | MD\r\n\r\n // Multiply or Divide\r\n MD\r\n = MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | MD modulo E -- modulo\r\n | E\r\n\r\n // Exponent\r\n E\r\n = P exponent E -- exponent\r\n | P\r\n\r\n // Parenthesis\r\n P\r\n = \"(\" Expression \")\" -- parenthesis\r\n | Primitive\r\n \r\n Primitive\r\n = \"+\" Primitive -- positive\r\n | \"-\" Primitive -- negative\r\n | constant\r\n | hex\r\n | number\r\n \r\n // Lexical Rules\r\n add \r\n \t= \"+\"\r\n | caseInsensitive<\"plus\">\r\n \t| caseInsensitive<\"add\">\r\n | caseInsensitive<\"and\">\r\n \r\n subtract \r\n = \"-\"\r\n | caseInsensitive<\"minus\">\r\n | caseInsensitive<\"subtract\">\r\n | caseInsensitive<\"remove\">\r\n | caseInsensitive<\"take\">\r\n \r\n multiply \r\n = \"*\"\r\n | \"\\\\*\" // Escaped \\* for markdown\r\n | \"\\u{00D7}\" // ×\r\n | caseInsensitive<\"x\">\r\n | caseInsensitive<\"times by\">\r\n | caseInsensitive<\"times\">\r\n | caseInsensitive<\"multiply by\">\r\n | caseInsensitive<\"multiply\">\r\n \r\n divide\r\n = \"/\"\r\n | \"\\u{00F7}\" // ÷\r\n | caseInsensitive<\"divide by\">\r\n | caseInsensitive<\"divide\">\r\n\r\n modulo\r\n = \"%\"\r\n | caseInsensitive<\"modulo\">\r\n | caseInsensitive<\"mod\">\r\n\r\n exponent\r\n = \"^\"\r\n | caseInsensitive<\"to the power of\">\r\n | caseInsensitive<\"power of\">\r\n | caseInsensitive<\"exponent\">\r\n | caseInsensitive<\"prime\">\r\n\r\n constant \r\n \t= caseInsensitive<\"PI\"> \r\n | caseInsensitive<\"E\">\r\n\r\n number\r\n = digit* \".\" digit+ -- fract\r\n | digit+ -- whole\r\n \r\n hex\r\n = \"0x\" hexDigit+\r\n | hexDigit+ \"h\"\r\n}"},"BasicArithmetic",null,"Expression",{"Expression":["define",{"sourceInterval":[21,51]},null,[],["app",{"sourceInterval":[39,51]},"LogicalShift",[]]],"LogicalShift_left":["define",{"sourceInterval":[77,115]},null,[],["seq",{"sourceInterval":[77,107]},["app",{"sourceInterval":[77,89]},"LogicalShift",[]],["terminal",{"sourceInterval":[90,94]},"<<"],["app",{"sourceInterval":[95,107]},"LogicalShift",[]]]],"LogicalShift_right":["define",{"sourceInterval":[123,162]},null,[],["seq",{"sourceInterval":[123,153]},["app",{"sourceInterval":[123,135]},"LogicalShift",[]],["terminal",{"sourceInterval":[136,140]},">>"],["app",{"sourceInterval":[141,153]},"LogicalShift",[]]]],"LogicalShift":["define",{"sourceInterval":[57,172]},null,[],["alt",{"sourceInterval":[77,172]},["app",{"sourceInterval":[77,107]},"LogicalShift_left",[]],["app",{"sourceInterval":[123,153]},"LogicalShift_right",[]],["app",{"sourceInterval":[170,172]},"AS",[]]]],"AS_addition":["define",{"sourceInterval":[219,241]},null,[],["seq",{"sourceInterval":[219,228]},["app",{"sourceInterval":[219,221]},"AS",[]],["app",{"sourceInterval":[222,225]},"add",[]],["app",{"sourceInterval":[226,228]},"MD",[]]]],"AS_subtraction":["define",{"sourceInterval":[249,279]},null,[],["seq",{"sourceInterval":[249,263]},["app",{"sourceInterval":[249,251]},"AS",[]],["app",{"sourceInterval":[252,260]},"subtract",[]],["app",{"sourceInterval":[261,263]},"MD",[]]]],"AS":["define",{"sourceInterval":[209,289]},null,[],["alt",{"sourceInterval":[219,289]},["app",{"sourceInterval":[219,228]},"AS_addition",[]],["app",{"sourceInterval":[249,263]},"AS_subtraction",[]],["app",{"sourceInterval":[287,289]},"MD",[]]]],"MD_multiplication":["define",{"sourceInterval":[330,362]},null,[],["seq",{"sourceInterval":[330,343]},["app",{"sourceInterval":[330,332]},"MD",[]],["app",{"sourceInterval":[333,341]},"multiply",[]],["app",{"sourceInterval":[342,343]},"E",[]]]],"MD_division":["define",{"sourceInterval":[370,394]},null,[],["seq",{"sourceInterval":[370,381]},["app",{"sourceInterval":[370,372]},"MD",[]],["app",{"sourceInterval":[373,379]},"divide",[]],["app",{"sourceInterval":[380,381]},"E",[]]]],"MD_modulo":["define",{"sourceInterval":[402,424]},null,[],["seq",{"sourceInterval":[402,413]},["app",{"sourceInterval":[402,404]},"MD",[]],["app",{"sourceInterval":[405,411]},"modulo",[]],["app",{"sourceInterval":[412,413]},"E",[]]]],"MD":["define",{"sourceInterval":[320,433]},null,[],["alt",{"sourceInterval":[330,433]},["app",{"sourceInterval":[330,343]},"MD_multiplication",[]],["app",{"sourceInterval":[370,381]},"MD_division",[]],["app",{"sourceInterval":[402,413]},"MD_modulo",[]],["app",{"sourceInterval":[432,433]},"E",[]]]],"E_exponent":["define",{"sourceInterval":[463,488]},null,[],["seq",{"sourceInterval":[463,475]},["app",{"sourceInterval":[463,464]},"P",[]],["app",{"sourceInterval":[465,473]},"exponent",[]],["app",{"sourceInterval":[474,475]},"E",[]]]],"E":["define",{"sourceInterval":[454,497]},null,[],["alt",{"sourceInterval":[463,497]},["app",{"sourceInterval":[463,475]},"E_exponent",[]],["app",{"sourceInterval":[496,497]},"P",[]]]],"P_parenthesis":["define",{"sourceInterval":[530,564]},null,[],["seq",{"sourceInterval":[530,548]},["terminal",{"sourceInterval":[530,533]},"("],["app",{"sourceInterval":[534,544]},"Expression",[]],["terminal",{"sourceInterval":[545,548]},")"]]],"P":["define",{"sourceInterval":[521,581]},null,[],["alt",{"sourceInterval":[530,581]},["app",{"sourceInterval":[530,548]},"P_parenthesis",[]],["app",{"sourceInterval":[572,581]},"Primitive",[]]]],"Primitive_positive":["define",{"sourceInterval":[608,633]},null,[],["seq",{"sourceInterval":[608,621]},["terminal",{"sourceInterval":[608,611]},"+"],["app",{"sourceInterval":[612,621]},"Primitive",[]]]],"Primitive_negative":["define",{"sourceInterval":[641,666]},null,[],["seq",{"sourceInterval":[641,654]},["terminal",{"sourceInterval":[641,644]},"-"],["app",{"sourceInterval":[645,654]},"Primitive",[]]]],"Primitive":["define",{"sourceInterval":[591,707]},null,[],["alt",{"sourceInterval":[608,707]},["app",{"sourceInterval":[608,621]},"Primitive_positive",[]],["app",{"sourceInterval":[641,654]},"Primitive_negative",[]],["app",{"sourceInterval":[674,682]},"constant",[]],["app",{"sourceInterval":[690,693]},"hex",[]],["app",{"sourceInterval":[701,707]},"number",[]]]],"add":["define",{"sourceInterval":[734,838]},null,[],["alt",{"sourceInterval":[745,838]},["terminal",{"sourceInterval":[745,748]},"+"],["app",{"sourceInterval":[756,779]},"caseInsensitive",[["terminal",{"sourceInterval":[772,778]},"plus"]]],["app",{"sourceInterval":[786,808]},"caseInsensitive",[["terminal",{"sourceInterval":[802,807]},"add"]]],["app",{"sourceInterval":[816,838]},"caseInsensitive",[["terminal",{"sourceInterval":[832,837]},"and"]]]]],"subtract":["define",{"sourceInterval":[848,999]},null,[],["alt",{"sourceInterval":[865,999]},["terminal",{"sourceInterval":[865,868]},"-"],["app",{"sourceInterval":[876,900]},"caseInsensitive",[["terminal",{"sourceInterval":[892,899]},"minus"]]],["app",{"sourceInterval":[908,935]},"caseInsensitive",[["terminal",{"sourceInterval":[924,934]},"subtract"]]],["app",{"sourceInterval":[943,968]},"caseInsensitive",[["terminal",{"sourceInterval":[959,967]},"remove"]]],["app",{"sourceInterval":[976,999]},"caseInsensitive",[["terminal",{"sourceInterval":[992,998]},"take"]]]]],"multiply":["define",{"sourceInterval":[1011,1262]},null,[],["alt",{"sourceInterval":[1028,1262]},["terminal",{"sourceInterval":[1028,1031]},"*"],["terminal",{"sourceInterval":[1039,1044]},"\\*"],["terminal",{"sourceInterval":[1079,1089]},"×"],["app",{"sourceInterval":[1102,1122]},"caseInsensitive",[["terminal",{"sourceInterval":[1118,1121]},"x"]]],["app",{"sourceInterval":[1130,1157]},"caseInsensitive",[["terminal",{"sourceInterval":[1146,1156]},"times by"]]],["app",{"sourceInterval":[1165,1189]},"caseInsensitive",[["terminal",{"sourceInterval":[1181,1188]},"times"]]],["app",{"sourceInterval":[1197,1227]},"caseInsensitive",[["terminal",{"sourceInterval":[1213,1226]},"multiply by"]]],["app",{"sourceInterval":[1235,1262]},"caseInsensitive",[["terminal",{"sourceInterval":[1251,1261]},"multiply"]]]]],"divide":["define",{"sourceInterval":[1274,1383]},null,[],["alt",{"sourceInterval":[1288,1383]},["terminal",{"sourceInterval":[1288,1291]},"/"],["terminal",{"sourceInterval":[1299,1309]},"÷"],["app",{"sourceInterval":[1322,1350]},"caseInsensitive",[["terminal",{"sourceInterval":[1338,1349]},"divide by"]]],["app",{"sourceInterval":[1358,1383]},"caseInsensitive",[["terminal",{"sourceInterval":[1374,1382]},"divide"]]]]],"modulo":["define",{"sourceInterval":[1389,1469]},null,[],["alt",{"sourceInterval":[1403,1469]},["terminal",{"sourceInterval":[1403,1406]},"%"],["app",{"sourceInterval":[1414,1439]},"caseInsensitive",[["terminal",{"sourceInterval":[1430,1438]},"modulo"]]],["app",{"sourceInterval":[1447,1469]},"caseInsensitive",[["terminal",{"sourceInterval":[1463,1468]},"mod"]]]]],"exponent":["define",{"sourceInterval":[1475,1638]},null,[],["alt",{"sourceInterval":[1491,1638]},["terminal",{"sourceInterval":[1491,1494]},"^"],["app",{"sourceInterval":[1502,1536]},"caseInsensitive",[["terminal",{"sourceInterval":[1518,1535]},"to the power of"]]],["app",{"sourceInterval":[1544,1571]},"caseInsensitive",[["terminal",{"sourceInterval":[1560,1570]},"power of"]]],["app",{"sourceInterval":[1579,1606]},"caseInsensitive",[["terminal",{"sourceInterval":[1595,1605]},"exponent"]]],["app",{"sourceInterval":[1614,1638]},"caseInsensitive",[["terminal",{"sourceInterval":[1630,1637]},"prime"]]]]],"constant":["define",{"sourceInterval":[1644,1711]},null,[],["alt",{"sourceInterval":[1661,1711]},["app",{"sourceInterval":[1661,1682]},"caseInsensitive",[["terminal",{"sourceInterval":[1677,1681]},"PI"]]],["app",{"sourceInterval":[1691,1711]},"caseInsensitive",[["terminal",{"sourceInterval":[1707,1710]},"E"]]]]],"number_fract":["define",{"sourceInterval":[1731,1758]},null,[],["seq",{"sourceInterval":[1731,1748]},["star",{"sourceInterval":[1731,1737]},["app",{"sourceInterval":[1731,1736]},"digit",[]]],["terminal",{"sourceInterval":[1738,1741]},"."],["plus",{"sourceInterval":[1742,1748]},["app",{"sourceInterval":[1742,1747]},"digit",[]]]]],"number_whole":["define",{"sourceInterval":[1766,1793]},null,[],["plus",{"sourceInterval":[1766,1772]},["app",{"sourceInterval":[1766,1771]},"digit",[]]]],"number":["define",{"sourceInterval":[1717,1793]},null,[],["alt",{"sourceInterval":[1731,1793]},["app",{"sourceInterval":[1731,1748]},"number_fract",[]],["app",{"sourceInterval":[1766,1772]},"number_whole",[]]]],"hex":["define",{"sourceInterval":[1801,1847]},null,[],["alt",{"sourceInterval":[1812,1847]},["seq",{"sourceInterval":[1812,1826]},["terminal",{"sourceInterval":[1812,1816]},"0x"],["plus",{"sourceInterval":[1817,1826]},["app",{"sourceInterval":[1817,1825]},"hexDigit",[]]]],["seq",{"sourceInterval":[1834,1847]},["plus",{"sourceInterval":[1834,1843]},["app",{"sourceInterval":[1834,1842]},"hexDigit",[]]],["terminal",{"sourceInterval":[1844,1847]},"h"]]]]}]);result.UnitsOfMeasurementArithmetic=makeRecipe(["grammar",{"source":"UnitsOfMeasurementArithmetic <: BasicArithmetic {\r\n\t\tExpression\r\n \t:= \r\n | Conversion\r\n | ConversionPossiblities\r\n\t\t| LogicalShift\r\n \r\n Primitive \r\n += uom\r\n | percentage\r\n \r\n \tConversion\r\n \t= caseInsensitive<\"convert\">? LogicalShift caseInsensitive<\"to\"> caseInsensitive<\"best\"> -- best\r\n | caseInsensitive<\"convert\">? LogicalShift caseInsensitive<\"to\"> unit -- convert \r\n \t\r\n ConversionPossiblities\r\n = caseInsensitive<\"convert\">? LogicalShift caseInsensitive<\"to\"> \"?\"?\r\n \r\n percentage \r\n = number \"%\"\r\n \r\n // Important: The reason we include `~(\"to\" space+)` is to prevent matching \"t\" or \"torr\" units when used in expression \"convert 100g + 20 to g\"\r\n uom \r\n = number spaces ~(\"to\" ~\"rr\") spaces unit\r\n \r\n unit\r\n = \"km3/s\"\r\n | \"yd3/h\"\r\n | \"yd3/min\"\r\n | \"yd3/s\"\r\n | \"ft3/h\"\r\n | \"ft3/min\"\r\n | \"ft3/s\"\r\n | \"in3/h\"\r\n | \"in3/min\"\r\n | \"in3/s\"\r\n | \"mm3/s\"\r\n | \"cm3/s\"\r\n | \"fl-oz/h\"\r\n | \"fl-oz/min\"\r\n | \"fl-oz/s\"\r\n | \"gal/h\"\r\n | \"gal/min\"\r\n | \"gal/s\"\r\n | \"pnt/h\"\r\n | \"pnt/min\"\r\n | \"pnt/s\"\r\n | \"cup/s\"\r\n | \"Tbs/s\"\r\n | \"tsp/s\"\r\n | \"m3/h\"\r\n | \"m3/min\"\r\n | \"m3/s\"\r\n | \"kl/h\"\r\n | \"kl/min\"\r\n | \"kl/s\"\r\n | \"l/h\"\r\n | \"l/min\"\r\n | \"l/s\"\r\n | \"dl/s\"\r\n | \"cl/s\"\r\n | \"ml/s\"\r\n | \"min/km\"\r\n | \"s/ft\"\r\n | \"s/m\"\r\n | \"km/h\"\r\n | \"m/h\"\r\n | \"ft/s\"\r\n | \"m/s\"\r\n | \"knot\"\r\n | \"THz\"\r\n | \"GHz\"\r\n | \"MHz\"\r\n | \"kHz\"\r\n | \"mHz\"\r\n | \"Hz\"\r\n | \"rpm\"\r\n | \"rad/s\"\r\n | \"deg/s\"\r\n | \"km3\"\r\n | \"yd3\"\r\n | \"ft3\"\r\n | \"in3\"\r\n | \"mm3\"\r\n | \"cm3\"\r\n | \"m3\"\r\n | \"gal\"\r\n | \"qt\"\r\n | \"pnt\"\r\n | \"cup\"\r\n | \"fl-oz\"\r\n | \"Tbs\"\r\n | \"tsp\"\r\n | \"kl\"\r\n | \"lb\"\r\n | \"lx\"\r\n | \"l\"\r\n | \"ml\"\r\n | \"km2\"\r\n | \"mi2\"\r\n | \"mm2\"\r\n | \"cm2\"\r\n | \"m2\"\r\n | \"in2\"\r\n | \"ft2\"\r\n | \"ha\"\r\n | \"ac\"\r\n | \"GVARh\"\r\n | \"MVARh\"\r\n | \"kVARh\"\r\n | \"mVARh\"\r\n | \"VARh\"\r\n | \"GVAR\"\r\n | \"MVAR\"\r\n | \"kVAR\"\r\n | \"mVAR\"\r\n | \"VAR\"\r\n | \"GVA\"\r\n | \"MVA\"\r\n | \"kVA\"\r\n | \"mVA\"\r\n | \"VA\"\r\n | \"GWh\"\r\n | \"MWh\"\r\n | \"kWh\"\r\n | \"mWh\"\r\n | \"Wh\"\r\n | \"GW\"\r\n | \"MW\"\r\n | \"kW\"\r\n | \"mW\"\r\n | \"W\"\r\n | \"kJ\"\r\n | \"J\"\r\n | \"mcg\"\r\n | \"kg\"\r\n | \"grad\"\r\n | \"g\"\r\n | \"mg\"\r\n | \"oz\"\r\n | \"torr\"\r\n | \"t\"\r\n | \"mt\"\r\n | \"month\"\r\n | \"year\"\r\n | \"week\"\r\n | \"deg\"\r\n | \"d\"\r\n | \"hPa\"\r\n | \"h\"\r\n | \"min\"\r\n | \"s\"\r\n | \"ms\"\r\n | \"mu\"\r\n | \"ns\"\r\n | \"kPa\"\r\n | \"MPa\"\r\n | \"bar\"\r\n | \"psi\"\r\n | \"ksi\"\r\n | \"Pa\"\r\n | \"ft-cd\"\r\n | \"ppm\"\r\n | \"ppb\"\r\n | \"ppt\"\r\n | \"ppq\"\r\n | \"kV\"\r\n | \"V\"\r\n | \"mV\"\r\n | \"kA\"\r\n | \"A\"\r\n | \"mA\"\r\n | \"arcmin\"\r\n | \"arcsec\"\r\n | \"rad\"\r\n | \"ft-us\"\r\n | \"mi\"\r\n | \"mm\"\r\n | \"m\"\r\n | \"cm\"\r\n | \"ft\"\r\n | \"in\"\r\n | \"F\"\r\n | \"Kb\"\r\n | \"KB\"\r\n | \"K\"\r\n | \"C\"\r\n | \"R\"\r\n | \"TB\"\r\n | \"GB\"\r\n | \"MB\"\r\n | \"B\"\r\n | \"Tb\"\r\n | \"Gb\"\r\n | \"Mb\"\r\n | \"b\"\r\n}"},"UnitsOfMeasurementArithmetic",result.BasicArithmetic,"Expression",{"Expression":["override",{"sourceInterval":[53,148]},null,[],["alt",{"sourceInterval":[84,148]},["app",{"sourceInterval":[86,96]},"Conversion",[]],["app",{"sourceInterval":[108,130]},"ConversionPossiblities",[]],["app",{"sourceInterval":[136,148]},"LogicalShift",[]]]],"Primitive":["extend",{"sourceInterval":[164,212]},null,[],["alt",{"sourceInterval":[187,212]},["app",{"sourceInterval":[187,190]},"uom",[]],["app",{"sourceInterval":[202,212]},"percentage",[]]]],"Conversion_best":["define",{"sourceInterval":[247,341]},null,[],["seq",{"sourceInterval":[247,333]},["opt",{"sourceInterval":[247,274]},["app",{"sourceInterval":[247,273]},"caseInsensitive",[["terminal",{"sourceInterval":[263,272]},"convert"]]]],["app",{"sourceInterval":[275,287]},"LogicalShift",[]],["app",{"sourceInterval":[288,309]},"caseInsensitive",[["terminal",{"sourceInterval":[304,308]},"to"]]],["app",{"sourceInterval":[310,333]},"caseInsensitive",[["terminal",{"sourceInterval":[326,332]},"best"]]]]],"Conversion_convert":["define",{"sourceInterval":[353,431]},null,[],["seq",{"sourceInterval":[353,420]},["opt",{"sourceInterval":[353,380]},["app",{"sourceInterval":[353,379]},"caseInsensitive",[["terminal",{"sourceInterval":[369,378]},"convert"]]]],["app",{"sourceInterval":[381,393]},"LogicalShift",[]],["app",{"sourceInterval":[394,415]},"caseInsensitive",[["terminal",{"sourceInterval":[410,414]},"to"]]],["app",{"sourceInterval":[416,420]},"unit",[]]]],"Conversion":["define",{"sourceInterval":[228,431]},null,[],["alt",{"sourceInterval":[247,431]},["app",{"sourceInterval":[247,333]},"Conversion_best",[]],["app",{"sourceInterval":[353,420]},"Conversion_convert",[]]]],"ConversionPossiblities":["define",{"sourceInterval":[452,553]},null,[],["seq",{"sourceInterval":[486,553]},["opt",{"sourceInterval":[486,513]},["app",{"sourceInterval":[486,512]},"caseInsensitive",[["terminal",{"sourceInterval":[502,511]},"convert"]]]],["app",{"sourceInterval":[514,526]},"LogicalShift",[]],["app",{"sourceInterval":[527,548]},"caseInsensitive",[["terminal",{"sourceInterval":[543,547]},"to"]]],["opt",{"sourceInterval":[549,553]},["terminal",{"sourceInterval":[549,552]},"?"]]]],"percentage":["define",{"sourceInterval":[565,598]},null,[],["seq",{"sourceInterval":[588,598]},["app",{"sourceInterval":[588,594]},"number",[]],["terminal",{"sourceInterval":[595,598]},"%"]]],"uom":["define",{"sourceInterval":[760,815]},null,[],["seq",{"sourceInterval":[776,815]},["app",{"sourceInterval":[776,782]},"number",[]],["app",{"sourceInterval":[783,789]},"spaces",[]],["not",{"sourceInterval":[790,803]},["seq",{"sourceInterval":[792,802]},["terminal",{"sourceInterval":[792,796]},"to"],["not",{"sourceInterval":[797,802]},["terminal",{"sourceInterval":[798,802]},"rr"]]]],["app",{"sourceInterval":[804,810]},"spaces",[]],["app",{"sourceInterval":[811,815]},"unit",[]]]],"unit":["define",{"sourceInterval":[827,3768]},null,[],["alt",{"sourceInterval":[843,3768]},["terminal",{"sourceInterval":[843,850]},"km3/s"],["terminal",{"sourceInterval":[862,869]},"yd3/h"],["terminal",{"sourceInterval":[881,890]},"yd3/min"],["terminal",{"sourceInterval":[902,909]},"yd3/s"],["terminal",{"sourceInterval":[921,928]},"ft3/h"],["terminal",{"sourceInterval":[940,949]},"ft3/min"],["terminal",{"sourceInterval":[961,968]},"ft3/s"],["terminal",{"sourceInterval":[980,987]},"in3/h"],["terminal",{"sourceInterval":[999,1008]},"in3/min"],["terminal",{"sourceInterval":[1020,1027]},"in3/s"],["terminal",{"sourceInterval":[1039,1046]},"mm3/s"],["terminal",{"sourceInterval":[1058,1065]},"cm3/s"],["terminal",{"sourceInterval":[1077,1086]},"fl-oz/h"],["terminal",{"sourceInterval":[1098,1109]},"fl-oz/min"],["terminal",{"sourceInterval":[1121,1130]},"fl-oz/s"],["terminal",{"sourceInterval":[1142,1149]},"gal/h"],["terminal",{"sourceInterval":[1161,1170]},"gal/min"],["terminal",{"sourceInterval":[1182,1189]},"gal/s"],["terminal",{"sourceInterval":[1201,1208]},"pnt/h"],["terminal",{"sourceInterval":[1220,1229]},"pnt/min"],["terminal",{"sourceInterval":[1241,1248]},"pnt/s"],["terminal",{"sourceInterval":[1260,1267]},"cup/s"],["terminal",{"sourceInterval":[1279,1286]},"Tbs/s"],["terminal",{"sourceInterval":[1298,1305]},"tsp/s"],["terminal",{"sourceInterval":[1317,1323]},"m3/h"],["terminal",{"sourceInterval":[1335,1343]},"m3/min"],["terminal",{"sourceInterval":[1355,1361]},"m3/s"],["terminal",{"sourceInterval":[1373,1379]},"kl/h"],["terminal",{"sourceInterval":[1391,1399]},"kl/min"],["terminal",{"sourceInterval":[1411,1417]},"kl/s"],["terminal",{"sourceInterval":[1429,1434]},"l/h"],["terminal",{"sourceInterval":[1446,1453]},"l/min"],["terminal",{"sourceInterval":[1465,1470]},"l/s"],["terminal",{"sourceInterval":[1482,1488]},"dl/s"],["terminal",{"sourceInterval":[1500,1506]},"cl/s"],["terminal",{"sourceInterval":[1518,1524]},"ml/s"],["terminal",{"sourceInterval":[1536,1544]},"min/km"],["terminal",{"sourceInterval":[1556,1562]},"s/ft"],["terminal",{"sourceInterval":[1574,1579]},"s/m"],["terminal",{"sourceInterval":[1591,1597]},"km/h"],["terminal",{"sourceInterval":[1609,1614]},"m/h"],["terminal",{"sourceInterval":[1626,1632]},"ft/s"],["terminal",{"sourceInterval":[1644,1649]},"m/s"],["terminal",{"sourceInterval":[1661,1667]},"knot"],["terminal",{"sourceInterval":[1679,1684]},"THz"],["terminal",{"sourceInterval":[1696,1701]},"GHz"],["terminal",{"sourceInterval":[1713,1718]},"MHz"],["terminal",{"sourceInterval":[1730,1735]},"kHz"],["terminal",{"sourceInterval":[1747,1752]},"mHz"],["terminal",{"sourceInterval":[1764,1768]},"Hz"],["terminal",{"sourceInterval":[1780,1785]},"rpm"],["terminal",{"sourceInterval":[1797,1804]},"rad/s"],["terminal",{"sourceInterval":[1816,1823]},"deg/s"],["terminal",{"sourceInterval":[1835,1840]},"km3"],["terminal",{"sourceInterval":[1852,1857]},"yd3"],["terminal",{"sourceInterval":[1869,1874]},"ft3"],["terminal",{"sourceInterval":[1886,1891]},"in3"],["terminal",{"sourceInterval":[1903,1908]},"mm3"],["terminal",{"sourceInterval":[1920,1925]},"cm3"],["terminal",{"sourceInterval":[1937,1941]},"m3"],["terminal",{"sourceInterval":[1953,1958]},"gal"],["terminal",{"sourceInterval":[1970,1974]},"qt"],["terminal",{"sourceInterval":[1986,1991]},"pnt"],["terminal",{"sourceInterval":[2003,2008]},"cup"],["terminal",{"sourceInterval":[2020,2027]},"fl-oz"],["terminal",{"sourceInterval":[2039,2044]},"Tbs"],["terminal",{"sourceInterval":[2056,2061]},"tsp"],["terminal",{"sourceInterval":[2073,2077]},"kl"],["terminal",{"sourceInterval":[2089,2093]},"lb"],["terminal",{"sourceInterval":[2105,2109]},"lx"],["terminal",{"sourceInterval":[2121,2124]},"l"],["terminal",{"sourceInterval":[2136,2140]},"ml"],["terminal",{"sourceInterval":[2152,2157]},"km2"],["terminal",{"sourceInterval":[2169,2174]},"mi2"],["terminal",{"sourceInterval":[2186,2191]},"mm2"],["terminal",{"sourceInterval":[2203,2208]},"cm2"],["terminal",{"sourceInterval":[2220,2224]},"m2"],["terminal",{"sourceInterval":[2236,2241]},"in2"],["terminal",{"sourceInterval":[2253,2258]},"ft2"],["terminal",{"sourceInterval":[2270,2274]},"ha"],["terminal",{"sourceInterval":[2286,2290]},"ac"],["terminal",{"sourceInterval":[2302,2309]},"GVARh"],["terminal",{"sourceInterval":[2321,2328]},"MVARh"],["terminal",{"sourceInterval":[2340,2347]},"kVARh"],["terminal",{"sourceInterval":[2359,2366]},"mVARh"],["terminal",{"sourceInterval":[2378,2384]},"VARh"],["terminal",{"sourceInterval":[2396,2402]},"GVAR"],["terminal",{"sourceInterval":[2414,2420]},"MVAR"],["terminal",{"sourceInterval":[2432,2438]},"kVAR"],["terminal",{"sourceInterval":[2450,2456]},"mVAR"],["terminal",{"sourceInterval":[2468,2473]},"VAR"],["terminal",{"sourceInterval":[2485,2490]},"GVA"],["terminal",{"sourceInterval":[2502,2507]},"MVA"],["terminal",{"sourceInterval":[2519,2524]},"kVA"],["terminal",{"sourceInterval":[2536,2541]},"mVA"],["terminal",{"sourceInterval":[2553,2557]},"VA"],["terminal",{"sourceInterval":[2569,2574]},"GWh"],["terminal",{"sourceInterval":[2586,2591]},"MWh"],["terminal",{"sourceInterval":[2603,2608]},"kWh"],["terminal",{"sourceInterval":[2620,2625]},"mWh"],["terminal",{"sourceInterval":[2637,2641]},"Wh"],["terminal",{"sourceInterval":[2653,2657]},"GW"],["terminal",{"sourceInterval":[2669,2673]},"MW"],["terminal",{"sourceInterval":[2685,2689]},"kW"],["terminal",{"sourceInterval":[2701,2705]},"mW"],["terminal",{"sourceInterval":[2717,2720]},"W"],["terminal",{"sourceInterval":[2732,2736]},"kJ"],["terminal",{"sourceInterval":[2748,2751]},"J"],["terminal",{"sourceInterval":[2763,2768]},"mcg"],["terminal",{"sourceInterval":[2780,2784]},"kg"],["terminal",{"sourceInterval":[2796,2802]},"grad"],["terminal",{"sourceInterval":[2814,2817]},"g"],["terminal",{"sourceInterval":[2829,2833]},"mg"],["terminal",{"sourceInterval":[2845,2849]},"oz"],["terminal",{"sourceInterval":[2861,2867]},"torr"],["terminal",{"sourceInterval":[2879,2882]},"t"],["terminal",{"sourceInterval":[2894,2898]},"mt"],["terminal",{"sourceInterval":[2910,2917]},"month"],["terminal",{"sourceInterval":[2929,2935]},"year"],["terminal",{"sourceInterval":[2947,2953]},"week"],["terminal",{"sourceInterval":[2965,2970]},"deg"],["terminal",{"sourceInterval":[2982,2985]},"d"],["terminal",{"sourceInterval":[2997,3002]},"hPa"],["terminal",{"sourceInterval":[3014,3017]},"h"],["terminal",{"sourceInterval":[3029,3034]},"min"],["terminal",{"sourceInterval":[3046,3049]},"s"],["terminal",{"sourceInterval":[3061,3065]},"ms"],["terminal",{"sourceInterval":[3077,3081]},"mu"],["terminal",{"sourceInterval":[3093,3097]},"ns"],["terminal",{"sourceInterval":[3109,3114]},"kPa"],["terminal",{"sourceInterval":[3126,3131]},"MPa"],["terminal",{"sourceInterval":[3143,3148]},"bar"],["terminal",{"sourceInterval":[3160,3165]},"psi"],["terminal",{"sourceInterval":[3177,3182]},"ksi"],["terminal",{"sourceInterval":[3194,3198]},"Pa"],["terminal",{"sourceInterval":[3210,3217]},"ft-cd"],["terminal",{"sourceInterval":[3229,3234]},"ppm"],["terminal",{"sourceInterval":[3246,3251]},"ppb"],["terminal",{"sourceInterval":[3263,3268]},"ppt"],["terminal",{"sourceInterval":[3280,3285]},"ppq"],["terminal",{"sourceInterval":[3297,3301]},"kV"],["terminal",{"sourceInterval":[3313,3316]},"V"],["terminal",{"sourceInterval":[3328,3332]},"mV"],["terminal",{"sourceInterval":[3344,3348]},"kA"],["terminal",{"sourceInterval":[3360,3363]},"A"],["terminal",{"sourceInterval":[3375,3379]},"mA"],["terminal",{"sourceInterval":[3391,3399]},"arcmin"],["terminal",{"sourceInterval":[3411,3419]},"arcsec"],["terminal",{"sourceInterval":[3431,3436]},"rad"],["terminal",{"sourceInterval":[3448,3455]},"ft-us"],["terminal",{"sourceInterval":[3467,3471]},"mi"],["terminal",{"sourceInterval":[3483,3487]},"mm"],["terminal",{"sourceInterval":[3499,3502]},"m"],["terminal",{"sourceInterval":[3514,3518]},"cm"],["terminal",{"sourceInterval":[3530,3534]},"ft"],["terminal",{"sourceInterval":[3546,3550]},"in"],["terminal",{"sourceInterval":[3562,3565]},"F"],["terminal",{"sourceInterval":[3577,3581]},"Kb"],["terminal",{"sourceInterval":[3593,3597]},"KB"],["terminal",{"sourceInterval":[3609,3612]},"K"],["terminal",{"sourceInterval":[3624,3627]},"C"],["terminal",{"sourceInterval":[3639,3642]},"R"],["terminal",{"sourceInterval":[3654,3658]},"TB"],["terminal",{"sourceInterval":[3670,3674]},"GB"],["terminal",{"sourceInterval":[3686,3690]},"MB"],["terminal",{"sourceInterval":[3702,3705]},"B"],["terminal",{"sourceInterval":[3717,3721]},"Tb"],["terminal",{"sourceInterval":[3733,3737]},"Gb"],["terminal",{"sourceInterval":[3749,3753]},"Mb"],["terminal",{"sourceInterval":[3765,3768]},"b"]]]}]);module.exports=result; \ No newline at end of file diff --git a/src/grammars/vector/Vector2Arithmetic.ohm-bundle.js b/src/grammars/vector/Vector2Arithmetic.ohm-bundle.js index 0e5d04e..4fea834 100644 --- a/src/grammars/vector/Vector2Arithmetic.ohm-bundle.js +++ b/src/grammars/vector/Vector2Arithmetic.ohm-bundle.js @@ -1 +1 @@ -'use strict';const {makeRecipe}=require('ohm-js');const result={};result.BasicArithmetic=makeRecipe(["grammar",{"source":"BasicArithmetic {\r\n Expression\r\n = LogicalShift\r\n\r\n LogicalShift\r\n = LogicalShift \"<<\" LogicalShift -- left\r\n | LogicalShift \">>\" LogicalShift -- right\r\n | AS \r\n\r\n // Addition or Subtraction\r\n AS\r\n = AS add MD -- addition\r\n | AS subtract MD -- subtraction\r\n | MD\r\n\r\n // Multiply or Divide\r\n MD\r\n = MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | MD modulo E -- modulo\r\n | E\r\n\r\n // Exponent\r\n E\r\n = P exponent E -- exponent\r\n | P\r\n\r\n // Parenthesis\r\n P\r\n = \"(\" Expression \")\" -- parenthesis\r\n | Primitive\r\n \r\n Primitive\r\n = \"+\" Primitive -- positive\r\n | \"-\" Primitive -- negative\r\n | constant\r\n | hex\r\n | number\r\n \r\n // Lexical Rules\r\n add \r\n \t= \"+\"\r\n | caseInsensitive<\"plus\">\r\n \t| caseInsensitive<\"add\">\r\n | caseInsensitive<\"and\">\r\n \r\n subtract \r\n = \"-\"\r\n | caseInsensitive<\"minus\">\r\n | caseInsensitive<\"subtract\">\r\n | caseInsensitive<\"remove\">\r\n | caseInsensitive<\"take\">\r\n \r\n multiply \r\n = \"*\"\r\n | \"\\\\*\" // Escaped e.g. \\* for markdown\r\n | \"\\u{00D7}\" // Multiplication Symbol ×\r\n | caseInsensitive<\"x\">\r\n | caseInsensitive<\"times by\">\r\n | caseInsensitive<\"times\">\r\n | caseInsensitive<\"multiply by\">\r\n | caseInsensitive<\"multiply\">\r\n \r\n divide\r\n = \"/\"\r\n | \"\\u{00F7}\" // Division Symbol ÷\r\n | caseInsensitive<\"divide by\">\r\n | caseInsensitive<\"divide\">\r\n\r\n modulo\r\n = \"%\"\r\n | caseInsensitive<\"modulo\">\r\n | caseInsensitive<\"mod\">\r\n\r\n exponent\r\n = \"^\"\r\n | caseInsensitive<\"to the power of\">\r\n | caseInsensitive<\"power of\">\r\n | caseInsensitive<\"exponent\">\r\n | caseInsensitive<\"prime\">\r\n\r\n constant \r\n \t= caseInsensitive<\"PI\"> \r\n | caseInsensitive<\"E\">\r\n\r\n number\r\n = digit* \".\" digit+ -- fract\r\n | digit+ -- whole\r\n \r\n hex\r\n = \"0x\" hexDigit+\r\n | hexDigit+ \"h\"\r\n}"},"BasicArithmetic",null,"Expression",{"Expression":["define",{"sourceInterval":[21,51]},null,[],["app",{"sourceInterval":[39,51]},"LogicalShift",[]]],"LogicalShift_left":["define",{"sourceInterval":[77,115]},null,[],["seq",{"sourceInterval":[77,107]},["app",{"sourceInterval":[77,89]},"LogicalShift",[]],["terminal",{"sourceInterval":[90,94]},"<<"],["app",{"sourceInterval":[95,107]},"LogicalShift",[]]]],"LogicalShift_right":["define",{"sourceInterval":[123,162]},null,[],["seq",{"sourceInterval":[123,153]},["app",{"sourceInterval":[123,135]},"LogicalShift",[]],["terminal",{"sourceInterval":[136,140]},">>"],["app",{"sourceInterval":[141,153]},"LogicalShift",[]]]],"LogicalShift":["define",{"sourceInterval":[57,172]},null,[],["alt",{"sourceInterval":[77,172]},["app",{"sourceInterval":[77,107]},"LogicalShift_left",[]],["app",{"sourceInterval":[123,153]},"LogicalShift_right",[]],["app",{"sourceInterval":[170,172]},"AS",[]]]],"AS_addition":["define",{"sourceInterval":[219,241]},null,[],["seq",{"sourceInterval":[219,228]},["app",{"sourceInterval":[219,221]},"AS",[]],["app",{"sourceInterval":[222,225]},"add",[]],["app",{"sourceInterval":[226,228]},"MD",[]]]],"AS_subtraction":["define",{"sourceInterval":[249,279]},null,[],["seq",{"sourceInterval":[249,263]},["app",{"sourceInterval":[249,251]},"AS",[]],["app",{"sourceInterval":[252,260]},"subtract",[]],["app",{"sourceInterval":[261,263]},"MD",[]]]],"AS":["define",{"sourceInterval":[209,289]},null,[],["alt",{"sourceInterval":[219,289]},["app",{"sourceInterval":[219,228]},"AS_addition",[]],["app",{"sourceInterval":[249,263]},"AS_subtraction",[]],["app",{"sourceInterval":[287,289]},"MD",[]]]],"MD_multiplication":["define",{"sourceInterval":[330,362]},null,[],["seq",{"sourceInterval":[330,343]},["app",{"sourceInterval":[330,332]},"MD",[]],["app",{"sourceInterval":[333,341]},"multiply",[]],["app",{"sourceInterval":[342,343]},"E",[]]]],"MD_division":["define",{"sourceInterval":[370,394]},null,[],["seq",{"sourceInterval":[370,381]},["app",{"sourceInterval":[370,372]},"MD",[]],["app",{"sourceInterval":[373,379]},"divide",[]],["app",{"sourceInterval":[380,381]},"E",[]]]],"MD_modulo":["define",{"sourceInterval":[402,424]},null,[],["seq",{"sourceInterval":[402,413]},["app",{"sourceInterval":[402,404]},"MD",[]],["app",{"sourceInterval":[405,411]},"modulo",[]],["app",{"sourceInterval":[412,413]},"E",[]]]],"MD":["define",{"sourceInterval":[320,433]},null,[],["alt",{"sourceInterval":[330,433]},["app",{"sourceInterval":[330,343]},"MD_multiplication",[]],["app",{"sourceInterval":[370,381]},"MD_division",[]],["app",{"sourceInterval":[402,413]},"MD_modulo",[]],["app",{"sourceInterval":[432,433]},"E",[]]]],"E_exponent":["define",{"sourceInterval":[463,488]},null,[],["seq",{"sourceInterval":[463,475]},["app",{"sourceInterval":[463,464]},"P",[]],["app",{"sourceInterval":[465,473]},"exponent",[]],["app",{"sourceInterval":[474,475]},"E",[]]]],"E":["define",{"sourceInterval":[454,497]},null,[],["alt",{"sourceInterval":[463,497]},["app",{"sourceInterval":[463,475]},"E_exponent",[]],["app",{"sourceInterval":[496,497]},"P",[]]]],"P_parenthesis":["define",{"sourceInterval":[530,564]},null,[],["seq",{"sourceInterval":[530,548]},["terminal",{"sourceInterval":[530,533]},"("],["app",{"sourceInterval":[534,544]},"Expression",[]],["terminal",{"sourceInterval":[545,548]},")"]]],"P":["define",{"sourceInterval":[521,581]},null,[],["alt",{"sourceInterval":[530,581]},["app",{"sourceInterval":[530,548]},"P_parenthesis",[]],["app",{"sourceInterval":[572,581]},"Primitive",[]]]],"Primitive_positive":["define",{"sourceInterval":[608,633]},null,[],["seq",{"sourceInterval":[608,621]},["terminal",{"sourceInterval":[608,611]},"+"],["app",{"sourceInterval":[612,621]},"Primitive",[]]]],"Primitive_negative":["define",{"sourceInterval":[641,666]},null,[],["seq",{"sourceInterval":[641,654]},["terminal",{"sourceInterval":[641,644]},"-"],["app",{"sourceInterval":[645,654]},"Primitive",[]]]],"Primitive":["define",{"sourceInterval":[591,707]},null,[],["alt",{"sourceInterval":[608,707]},["app",{"sourceInterval":[608,621]},"Primitive_positive",[]],["app",{"sourceInterval":[641,654]},"Primitive_negative",[]],["app",{"sourceInterval":[674,682]},"constant",[]],["app",{"sourceInterval":[690,693]},"hex",[]],["app",{"sourceInterval":[701,707]},"number",[]]]],"add":["define",{"sourceInterval":[734,838]},null,[],["alt",{"sourceInterval":[745,838]},["terminal",{"sourceInterval":[745,748]},"+"],["app",{"sourceInterval":[756,779]},"caseInsensitive",[["terminal",{"sourceInterval":[772,778]},"plus"]]],["app",{"sourceInterval":[786,808]},"caseInsensitive",[["terminal",{"sourceInterval":[802,807]},"add"]]],["app",{"sourceInterval":[816,838]},"caseInsensitive",[["terminal",{"sourceInterval":[832,837]},"and"]]]]],"subtract":["define",{"sourceInterval":[848,999]},null,[],["alt",{"sourceInterval":[865,999]},["terminal",{"sourceInterval":[865,868]},"-"],["app",{"sourceInterval":[876,900]},"caseInsensitive",[["terminal",{"sourceInterval":[892,899]},"minus"]]],["app",{"sourceInterval":[908,935]},"caseInsensitive",[["terminal",{"sourceInterval":[924,934]},"subtract"]]],["app",{"sourceInterval":[943,968]},"caseInsensitive",[["terminal",{"sourceInterval":[959,967]},"remove"]]],["app",{"sourceInterval":[976,999]},"caseInsensitive",[["terminal",{"sourceInterval":[992,998]},"take"]]]]],"multiply":["define",{"sourceInterval":[1011,1289]},null,[],["alt",{"sourceInterval":[1028,1289]},["terminal",{"sourceInterval":[1028,1031]},"*"],["terminal",{"sourceInterval":[1039,1044]},"\\*"],["terminal",{"sourceInterval":[1084,1094]},"×"],["app",{"sourceInterval":[1129,1149]},"caseInsensitive",[["terminal",{"sourceInterval":[1145,1148]},"x"]]],["app",{"sourceInterval":[1157,1184]},"caseInsensitive",[["terminal",{"sourceInterval":[1173,1183]},"times by"]]],["app",{"sourceInterval":[1192,1216]},"caseInsensitive",[["terminal",{"sourceInterval":[1208,1215]},"times"]]],["app",{"sourceInterval":[1224,1254]},"caseInsensitive",[["terminal",{"sourceInterval":[1240,1253]},"multiply by"]]],["app",{"sourceInterval":[1262,1289]},"caseInsensitive",[["terminal",{"sourceInterval":[1278,1288]},"multiply"]]]]],"divide":["define",{"sourceInterval":[1301,1426]},null,[],["alt",{"sourceInterval":[1315,1426]},["terminal",{"sourceInterval":[1315,1318]},"/"],["terminal",{"sourceInterval":[1326,1336]},"÷"],["app",{"sourceInterval":[1365,1393]},"caseInsensitive",[["terminal",{"sourceInterval":[1381,1392]},"divide by"]]],["app",{"sourceInterval":[1401,1426]},"caseInsensitive",[["terminal",{"sourceInterval":[1417,1425]},"divide"]]]]],"modulo":["define",{"sourceInterval":[1432,1512]},null,[],["alt",{"sourceInterval":[1446,1512]},["terminal",{"sourceInterval":[1446,1449]},"%"],["app",{"sourceInterval":[1457,1482]},"caseInsensitive",[["terminal",{"sourceInterval":[1473,1481]},"modulo"]]],["app",{"sourceInterval":[1490,1512]},"caseInsensitive",[["terminal",{"sourceInterval":[1506,1511]},"mod"]]]]],"exponent":["define",{"sourceInterval":[1518,1681]},null,[],["alt",{"sourceInterval":[1534,1681]},["terminal",{"sourceInterval":[1534,1537]},"^"],["app",{"sourceInterval":[1545,1579]},"caseInsensitive",[["terminal",{"sourceInterval":[1561,1578]},"to the power of"]]],["app",{"sourceInterval":[1587,1614]},"caseInsensitive",[["terminal",{"sourceInterval":[1603,1613]},"power of"]]],["app",{"sourceInterval":[1622,1649]},"caseInsensitive",[["terminal",{"sourceInterval":[1638,1648]},"exponent"]]],["app",{"sourceInterval":[1657,1681]},"caseInsensitive",[["terminal",{"sourceInterval":[1673,1680]},"prime"]]]]],"constant":["define",{"sourceInterval":[1687,1754]},null,[],["alt",{"sourceInterval":[1704,1754]},["app",{"sourceInterval":[1704,1725]},"caseInsensitive",[["terminal",{"sourceInterval":[1720,1724]},"PI"]]],["app",{"sourceInterval":[1734,1754]},"caseInsensitive",[["terminal",{"sourceInterval":[1750,1753]},"E"]]]]],"number_fract":["define",{"sourceInterval":[1774,1801]},null,[],["seq",{"sourceInterval":[1774,1791]},["star",{"sourceInterval":[1774,1780]},["app",{"sourceInterval":[1774,1779]},"digit",[]]],["terminal",{"sourceInterval":[1781,1784]},"."],["plus",{"sourceInterval":[1785,1791]},["app",{"sourceInterval":[1785,1790]},"digit",[]]]]],"number_whole":["define",{"sourceInterval":[1809,1836]},null,[],["plus",{"sourceInterval":[1809,1815]},["app",{"sourceInterval":[1809,1814]},"digit",[]]]],"number":["define",{"sourceInterval":[1760,1836]},null,[],["alt",{"sourceInterval":[1774,1836]},["app",{"sourceInterval":[1774,1791]},"number_fract",[]],["app",{"sourceInterval":[1809,1815]},"number_whole",[]]]],"hex":["define",{"sourceInterval":[1844,1890]},null,[],["alt",{"sourceInterval":[1855,1890]},["seq",{"sourceInterval":[1855,1869]},["terminal",{"sourceInterval":[1855,1859]},"0x"],["plus",{"sourceInterval":[1860,1869]},["app",{"sourceInterval":[1860,1868]},"hexDigit",[]]]],["seq",{"sourceInterval":[1877,1890]},["plus",{"sourceInterval":[1877,1886]},["app",{"sourceInterval":[1877,1885]},"hexDigit",[]]],["terminal",{"sourceInterval":[1887,1890]},"h"]]]]}]);result.Vector2Arithmetic=makeRecipe(["grammar",{"source":"Vector2Arithmetic <: BasicArithmetic {\r\n // Remove support for logical shift\r\n Expression \r\n \t:= AS\r\n\r\n P\r\n := \"(\" Expression \")\" -- parenthesis\r\n | Vector2\r\n | Function\r\n | Primitive\r\n\r\n // Remove modulo support for vector\r\n MD\r\n := MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | E\r\n\r\n Vector2\r\n = vector2? \"(\" Expression \",\" Expression \")\" -- parse\r\n\r\n Function\r\n = LengthSq\r\n | DistanceSq\r\n | Length\r\n | Distance\r\n | Normalise\r\n | Dot\r\n | AngleBetween\r\n | Cross\r\n | Lerp\r\n\r\n LengthSq = lengthSq \"(\" Vector2 \")\" -- function\r\n DistanceSq = distanceSq \"(\" Vector2 \",\" Vector2 \")\" -- function\r\n Length = length \"(\" Vector2 \")\" -- function\r\n Distance = distance \"(\" Vector2 \",\" Vector2 \")\" -- function\r\n Normalise = normalise \"(\" Vector2 \")\" -- function\r\n Dot = dot \"(\" Vector2 \",\" Vector2 \")\" -- function\r\n AngleBetween = angleBetween \"(\" Vector2 \",\" Vector2 \")\" -- function\r\n Cross = cross \"(\" Vector2 \",\" Vector2 \")\" -- function\r\n Lerp = lerp \"(\" Vector2 \",\" Vector2 \",\" number \")\" -- function\r\n\r\n vector2 \r\n \t = caseInsensitive<\"Vector2\">\r\n | caseInsensitive<\"Vec2\">\r\n\r\n lengthSq \r\n \t = caseInsensitive<\"lengthSq\">\r\n | caseInsensitive<\"magnitudeSq\">\r\n\r\n distanceSq\r\n = caseInsensitive<\"distanceSq\">\r\n\r\n length\r\n \t = caseInsensitive<\"length\">\r\n | caseInsensitive<\"magnitude\">\r\n\r\n distance\r\n = caseInsensitive<\"distance\">\r\n\r\n normalise \r\n \t = caseInsensitive<\"normalise\">\r\n \t | caseInsensitive<\"normalize\">\r\n\r\n dot\r\n = caseInsensitive<\"dotproduct\">\r\n | caseInsensitive<\"dot\">\r\n\r\n angleBetween\r\n = caseInsensitive<\"angleBetween\">\r\n\r\n cross\r\n = caseInsensitive<\"crossproduct\">\r\n | caseInsensitive<\"cross\">\r\n\r\n lerp\r\n = caseInsensitive<\"lerp\">\r\n}"},"Vector2Arithmetic",result.BasicArithmetic,"Expression",{"Expression":["override",{"sourceInterval":[81,103]},null,[],["app",{"sourceInterval":[101,103]},"AS",[]]],"P_parenthesis":["override",{"sourceInterval":[119,153]},null,[],["seq",{"sourceInterval":[119,137]},["terminal",{"sourceInterval":[119,122]},"("],["app",{"sourceInterval":[123,133]},"Expression",[]],["terminal",{"sourceInterval":[134,137]},")"]]],"P":["override",{"sourceInterval":[109,201]},null,[],["alt",{"sourceInterval":[119,201]},["app",{"sourceInterval":[119,137]},"P_parenthesis",[]],["app",{"sourceInterval":[161,168]},"Vector2",[]],["app",{"sourceInterval":[176,184]},"Function",[]],["app",{"sourceInterval":[192,201]},"Primitive",[]]]],"MD_multiplication":["override",{"sourceInterval":[257,289]},null,[],["seq",{"sourceInterval":[257,270]},["app",{"sourceInterval":[257,259]},"MD",[]],["app",{"sourceInterval":[260,268]},"multiply",[]],["app",{"sourceInterval":[269,270]},"E",[]]]],"MD_division":["override",{"sourceInterval":[297,321]},null,[],["seq",{"sourceInterval":[297,308]},["app",{"sourceInterval":[297,299]},"MD",[]],["app",{"sourceInterval":[300,306]},"divide",[]],["app",{"sourceInterval":[307,308]},"E",[]]]],"MD":["override",{"sourceInterval":[246,330]},null,[],["alt",{"sourceInterval":[257,330]},["app",{"sourceInterval":[257,270]},"MD_multiplication",[]],["app",{"sourceInterval":[297,308]},"MD_division",[]],["app",{"sourceInterval":[329,330]},"E",[]]]],"Vector2_parse":["define",{"sourceInterval":[351,402]},null,[],["seq",{"sourceInterval":[351,393]},["opt",{"sourceInterval":[351,359]},["app",{"sourceInterval":[351,358]},"vector2",[]]],["terminal",{"sourceInterval":[360,363]},"("],["app",{"sourceInterval":[364,374]},"Expression",[]],["terminal",{"sourceInterval":[375,378]},","],["app",{"sourceInterval":[379,389]},"Expression",[]],["terminal",{"sourceInterval":[390,393]},")"]]],"Vector2":["define",{"sourceInterval":[336,402]},null,[],["app",{"sourceInterval":[351,402]},"Vector2_parse",[]]],"Function":["define",{"sourceInterval":[408,544]},null,[],["alt",{"sourceInterval":[423,544]},["app",{"sourceInterval":[423,431]},"LengthSq",[]],["app",{"sourceInterval":[438,448]},"DistanceSq",[]],["app",{"sourceInterval":[455,461]},"Length",[]],["app",{"sourceInterval":[468,476]},"Distance",[]],["app",{"sourceInterval":[483,492]},"Normalise",[]],["app",{"sourceInterval":[499,502]},"Dot",[]],["app",{"sourceInterval":[509,521]},"AngleBetween",[]],["app",{"sourceInterval":[528,533]},"Cross",[]],["app",{"sourceInterval":[540,544]},"Lerp",[]]]],"LengthSq_function":["define",{"sourceInterval":[562,598]},null,[],["seq",{"sourceInterval":[562,586]},["app",{"sourceInterval":[562,570]},"lengthSq",[]],["terminal",{"sourceInterval":[571,574]},"("],["app",{"sourceInterval":[575,582]},"Vector2",[]],["terminal",{"sourceInterval":[583,586]},")"]]],"LengthSq":["define",{"sourceInterval":[550,598]},null,[],["app",{"sourceInterval":[562,598]},"LengthSq_function",[]]],"DistanceSq_function":["define",{"sourceInterval":[616,666]},null,[],["seq",{"sourceInterval":[616,654]},["app",{"sourceInterval":[616,626]},"distanceSq",[]],["terminal",{"sourceInterval":[627,630]},"("],["app",{"sourceInterval":[631,638]},"Vector2",[]],["terminal",{"sourceInterval":[639,642]},","],["app",{"sourceInterval":[643,650]},"Vector2",[]],["terminal",{"sourceInterval":[651,654]},")"]]],"DistanceSq":["define",{"sourceInterval":[602,666]},null,[],["app",{"sourceInterval":[616,666]},"DistanceSq_function",[]]],"Length_function":["define",{"sourceInterval":[680,714]},null,[],["seq",{"sourceInterval":[680,702]},["app",{"sourceInterval":[680,686]},"length",[]],["terminal",{"sourceInterval":[687,690]},"("],["app",{"sourceInterval":[691,698]},"Vector2",[]],["terminal",{"sourceInterval":[699,702]},")"]]],"Length":["define",{"sourceInterval":[670,714]},null,[],["app",{"sourceInterval":[680,714]},"Length_function",[]]],"Distance_function":["define",{"sourceInterval":[730,778]},null,[],["seq",{"sourceInterval":[730,766]},["app",{"sourceInterval":[730,738]},"distance",[]],["terminal",{"sourceInterval":[739,742]},"("],["app",{"sourceInterval":[743,750]},"Vector2",[]],["terminal",{"sourceInterval":[751,754]},","],["app",{"sourceInterval":[755,762]},"Vector2",[]],["terminal",{"sourceInterval":[763,766]},")"]]],"Distance":["define",{"sourceInterval":[718,778]},null,[],["app",{"sourceInterval":[730,778]},"Distance_function",[]]],"Normalise_function":["define",{"sourceInterval":[794,831]},null,[],["seq",{"sourceInterval":[794,819]},["app",{"sourceInterval":[794,803]},"normalise",[]],["terminal",{"sourceInterval":[804,807]},"("],["app",{"sourceInterval":[808,815]},"Vector2",[]],["terminal",{"sourceInterval":[816,819]},")"]]],"Normalise":["define",{"sourceInterval":[782,831]},null,[],["app",{"sourceInterval":[794,831]},"Normalise_function",[]]],"Dot_function":["define",{"sourceInterval":[841,884]},null,[],["seq",{"sourceInterval":[841,872]},["app",{"sourceInterval":[841,844]},"dot",[]],["terminal",{"sourceInterval":[845,848]},"("],["app",{"sourceInterval":[849,856]},"Vector2",[]],["terminal",{"sourceInterval":[857,860]},","],["app",{"sourceInterval":[861,868]},"Vector2",[]],["terminal",{"sourceInterval":[869,872]},")"]]],"Dot":["define",{"sourceInterval":[835,884]},null,[],["app",{"sourceInterval":[841,884]},"Dot_function",[]]],"AngleBetween_function":["define",{"sourceInterval":[903,955]},null,[],["seq",{"sourceInterval":[903,943]},["app",{"sourceInterval":[903,915]},"angleBetween",[]],["terminal",{"sourceInterval":[916,919]},"("],["app",{"sourceInterval":[920,927]},"Vector2",[]],["terminal",{"sourceInterval":[928,931]},","],["app",{"sourceInterval":[932,939]},"Vector2",[]],["terminal",{"sourceInterval":[940,943]},")"]]],"AngleBetween":["define",{"sourceInterval":[888,955]},null,[],["app",{"sourceInterval":[903,955]},"AngleBetween_function",[]]],"Cross_function":["define",{"sourceInterval":[967,1012]},null,[],["seq",{"sourceInterval":[967,1000]},["app",{"sourceInterval":[967,972]},"cross",[]],["terminal",{"sourceInterval":[973,976]},"("],["app",{"sourceInterval":[977,984]},"Vector2",[]],["terminal",{"sourceInterval":[985,988]},","],["app",{"sourceInterval":[989,996]},"Vector2",[]],["terminal",{"sourceInterval":[997,1000]},")"]]],"Cross":["define",{"sourceInterval":[959,1012]},null,[],["app",{"sourceInterval":[967,1012]},"Cross_function",[]]],"Lerp_function":["define",{"sourceInterval":[1023,1078]},null,[],["seq",{"sourceInterval":[1023,1066]},["app",{"sourceInterval":[1023,1027]},"lerp",[]],["terminal",{"sourceInterval":[1028,1031]},"("],["app",{"sourceInterval":[1032,1039]},"Vector2",[]],["terminal",{"sourceInterval":[1040,1043]},","],["app",{"sourceInterval":[1044,1051]},"Vector2",[]],["terminal",{"sourceInterval":[1052,1055]},","],["app",{"sourceInterval":[1056,1062]},"number",[]],["terminal",{"sourceInterval":[1063,1066]},")"]]],"Lerp":["define",{"sourceInterval":[1016,1078]},null,[],["app",{"sourceInterval":[1023,1078]},"Lerp_function",[]]],"vector2":["define",{"sourceInterval":[1084,1157]},null,[],["alt",{"sourceInterval":[1100,1157]},["app",{"sourceInterval":[1100,1126]},"caseInsensitive",[["terminal",{"sourceInterval":[1116,1125]},"Vector2"]]],["app",{"sourceInterval":[1134,1157]},"caseInsensitive",[["terminal",{"sourceInterval":[1150,1156]},"Vec2"]]]]],"lengthSq":["define",{"sourceInterval":[1163,1245]},null,[],["alt",{"sourceInterval":[1180,1245]},["app",{"sourceInterval":[1180,1207]},"caseInsensitive",[["terminal",{"sourceInterval":[1196,1206]},"lengthSq"]]],["app",{"sourceInterval":[1215,1245]},"caseInsensitive",[["terminal",{"sourceInterval":[1231,1244]},"magnitudeSq"]]]]],"distanceSq":["define",{"sourceInterval":[1251,1298]},null,[],["app",{"sourceInterval":[1269,1298]},"caseInsensitive",[["terminal",{"sourceInterval":[1285,1297]},"distanceSq"]]]],"length":["define",{"sourceInterval":[1304,1379]},null,[],["alt",{"sourceInterval":[1318,1379]},["app",{"sourceInterval":[1318,1343]},"caseInsensitive",[["terminal",{"sourceInterval":[1334,1342]},"length"]]],["app",{"sourceInterval":[1351,1379]},"caseInsensitive",[["terminal",{"sourceInterval":[1367,1378]},"magnitude"]]]]],"distance":["define",{"sourceInterval":[1385,1428]},null,[],["app",{"sourceInterval":[1401,1428]},"caseInsensitive",[["terminal",{"sourceInterval":[1417,1427]},"distance"]]]],"normalise":["define",{"sourceInterval":[1434,1516]},null,[],["alt",{"sourceInterval":[1452,1516]},["app",{"sourceInterval":[1452,1480]},"caseInsensitive",[["terminal",{"sourceInterval":[1468,1479]},"normalise"]]],["app",{"sourceInterval":[1488,1516]},"caseInsensitive",[["terminal",{"sourceInterval":[1504,1515]},"normalize"]]]]],"dot":["define",{"sourceInterval":[1522,1592]},null,[],["alt",{"sourceInterval":[1533,1592]},["app",{"sourceInterval":[1533,1562]},"caseInsensitive",[["terminal",{"sourceInterval":[1549,1561]},"dotproduct"]]],["app",{"sourceInterval":[1570,1592]},"caseInsensitive",[["terminal",{"sourceInterval":[1586,1591]},"dot"]]]]],"angleBetween":["define",{"sourceInterval":[1598,1649]},null,[],["app",{"sourceInterval":[1618,1649]},"caseInsensitive",[["terminal",{"sourceInterval":[1634,1648]},"angleBetween"]]]],"cross":["define",{"sourceInterval":[1655,1731]},null,[],["alt",{"sourceInterval":[1668,1731]},["app",{"sourceInterval":[1668,1699]},"caseInsensitive",[["terminal",{"sourceInterval":[1684,1698]},"crossproduct"]]],["app",{"sourceInterval":[1707,1731]},"caseInsensitive",[["terminal",{"sourceInterval":[1723,1730]},"cross"]]]]],"lerp":["define",{"sourceInterval":[1737,1772]},null,[],["app",{"sourceInterval":[1749,1772]},"caseInsensitive",[["terminal",{"sourceInterval":[1765,1771]},"lerp"]]]]}]);module.exports=result; \ No newline at end of file +'use strict';const {makeRecipe}=require('ohm-js');const result={};result.BasicArithmetic=makeRecipe(["grammar",{"source":"BasicArithmetic {\r\n Expression\r\n = LogicalShift\r\n\r\n LogicalShift\r\n = LogicalShift \"<<\" LogicalShift -- left\r\n | LogicalShift \">>\" LogicalShift -- right\r\n | AS \r\n\r\n // Addition or Subtraction\r\n AS\r\n = AS add MD -- addition\r\n | AS subtract MD -- subtraction\r\n | MD\r\n\r\n // Multiply or Divide\r\n MD\r\n = MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | MD modulo E -- modulo\r\n | E\r\n\r\n // Exponent\r\n E\r\n = P exponent E -- exponent\r\n | P\r\n\r\n // Parenthesis\r\n P\r\n = \"(\" Expression \")\" -- parenthesis\r\n | Primitive\r\n \r\n Primitive\r\n = \"+\" Primitive -- positive\r\n | \"-\" Primitive -- negative\r\n | constant\r\n | hex\r\n | number\r\n \r\n // Lexical Rules\r\n add \r\n \t= \"+\"\r\n | caseInsensitive<\"plus\">\r\n \t| caseInsensitive<\"add\">\r\n | caseInsensitive<\"and\">\r\n \r\n subtract \r\n = \"-\"\r\n | caseInsensitive<\"minus\">\r\n | caseInsensitive<\"subtract\">\r\n | caseInsensitive<\"remove\">\r\n | caseInsensitive<\"take\">\r\n \r\n multiply \r\n = \"*\"\r\n | \"\\\\*\" // Escaped \\* for markdown\r\n | \"\\u{00D7}\" // ×\r\n | caseInsensitive<\"x\">\r\n | caseInsensitive<\"times by\">\r\n | caseInsensitive<\"times\">\r\n | caseInsensitive<\"multiply by\">\r\n | caseInsensitive<\"multiply\">\r\n \r\n divide\r\n = \"/\"\r\n | \"\\u{00F7}\" // ÷\r\n | caseInsensitive<\"divide by\">\r\n | caseInsensitive<\"divide\">\r\n\r\n modulo\r\n = \"%\"\r\n | caseInsensitive<\"modulo\">\r\n | caseInsensitive<\"mod\">\r\n\r\n exponent\r\n = \"^\"\r\n | caseInsensitive<\"to the power of\">\r\n | caseInsensitive<\"power of\">\r\n | caseInsensitive<\"exponent\">\r\n | caseInsensitive<\"prime\">\r\n\r\n constant \r\n \t= caseInsensitive<\"PI\"> \r\n | caseInsensitive<\"E\">\r\n\r\n number\r\n = digit* \".\" digit+ -- fract\r\n | digit+ -- whole\r\n \r\n hex\r\n = \"0x\" hexDigit+\r\n | hexDigit+ \"h\"\r\n}"},"BasicArithmetic",null,"Expression",{"Expression":["define",{"sourceInterval":[21,51]},null,[],["app",{"sourceInterval":[39,51]},"LogicalShift",[]]],"LogicalShift_left":["define",{"sourceInterval":[77,115]},null,[],["seq",{"sourceInterval":[77,107]},["app",{"sourceInterval":[77,89]},"LogicalShift",[]],["terminal",{"sourceInterval":[90,94]},"<<"],["app",{"sourceInterval":[95,107]},"LogicalShift",[]]]],"LogicalShift_right":["define",{"sourceInterval":[123,162]},null,[],["seq",{"sourceInterval":[123,153]},["app",{"sourceInterval":[123,135]},"LogicalShift",[]],["terminal",{"sourceInterval":[136,140]},">>"],["app",{"sourceInterval":[141,153]},"LogicalShift",[]]]],"LogicalShift":["define",{"sourceInterval":[57,172]},null,[],["alt",{"sourceInterval":[77,172]},["app",{"sourceInterval":[77,107]},"LogicalShift_left",[]],["app",{"sourceInterval":[123,153]},"LogicalShift_right",[]],["app",{"sourceInterval":[170,172]},"AS",[]]]],"AS_addition":["define",{"sourceInterval":[219,241]},null,[],["seq",{"sourceInterval":[219,228]},["app",{"sourceInterval":[219,221]},"AS",[]],["app",{"sourceInterval":[222,225]},"add",[]],["app",{"sourceInterval":[226,228]},"MD",[]]]],"AS_subtraction":["define",{"sourceInterval":[249,279]},null,[],["seq",{"sourceInterval":[249,263]},["app",{"sourceInterval":[249,251]},"AS",[]],["app",{"sourceInterval":[252,260]},"subtract",[]],["app",{"sourceInterval":[261,263]},"MD",[]]]],"AS":["define",{"sourceInterval":[209,289]},null,[],["alt",{"sourceInterval":[219,289]},["app",{"sourceInterval":[219,228]},"AS_addition",[]],["app",{"sourceInterval":[249,263]},"AS_subtraction",[]],["app",{"sourceInterval":[287,289]},"MD",[]]]],"MD_multiplication":["define",{"sourceInterval":[330,362]},null,[],["seq",{"sourceInterval":[330,343]},["app",{"sourceInterval":[330,332]},"MD",[]],["app",{"sourceInterval":[333,341]},"multiply",[]],["app",{"sourceInterval":[342,343]},"E",[]]]],"MD_division":["define",{"sourceInterval":[370,394]},null,[],["seq",{"sourceInterval":[370,381]},["app",{"sourceInterval":[370,372]},"MD",[]],["app",{"sourceInterval":[373,379]},"divide",[]],["app",{"sourceInterval":[380,381]},"E",[]]]],"MD_modulo":["define",{"sourceInterval":[402,424]},null,[],["seq",{"sourceInterval":[402,413]},["app",{"sourceInterval":[402,404]},"MD",[]],["app",{"sourceInterval":[405,411]},"modulo",[]],["app",{"sourceInterval":[412,413]},"E",[]]]],"MD":["define",{"sourceInterval":[320,433]},null,[],["alt",{"sourceInterval":[330,433]},["app",{"sourceInterval":[330,343]},"MD_multiplication",[]],["app",{"sourceInterval":[370,381]},"MD_division",[]],["app",{"sourceInterval":[402,413]},"MD_modulo",[]],["app",{"sourceInterval":[432,433]},"E",[]]]],"E_exponent":["define",{"sourceInterval":[463,488]},null,[],["seq",{"sourceInterval":[463,475]},["app",{"sourceInterval":[463,464]},"P",[]],["app",{"sourceInterval":[465,473]},"exponent",[]],["app",{"sourceInterval":[474,475]},"E",[]]]],"E":["define",{"sourceInterval":[454,497]},null,[],["alt",{"sourceInterval":[463,497]},["app",{"sourceInterval":[463,475]},"E_exponent",[]],["app",{"sourceInterval":[496,497]},"P",[]]]],"P_parenthesis":["define",{"sourceInterval":[530,564]},null,[],["seq",{"sourceInterval":[530,548]},["terminal",{"sourceInterval":[530,533]},"("],["app",{"sourceInterval":[534,544]},"Expression",[]],["terminal",{"sourceInterval":[545,548]},")"]]],"P":["define",{"sourceInterval":[521,581]},null,[],["alt",{"sourceInterval":[530,581]},["app",{"sourceInterval":[530,548]},"P_parenthesis",[]],["app",{"sourceInterval":[572,581]},"Primitive",[]]]],"Primitive_positive":["define",{"sourceInterval":[608,633]},null,[],["seq",{"sourceInterval":[608,621]},["terminal",{"sourceInterval":[608,611]},"+"],["app",{"sourceInterval":[612,621]},"Primitive",[]]]],"Primitive_negative":["define",{"sourceInterval":[641,666]},null,[],["seq",{"sourceInterval":[641,654]},["terminal",{"sourceInterval":[641,644]},"-"],["app",{"sourceInterval":[645,654]},"Primitive",[]]]],"Primitive":["define",{"sourceInterval":[591,707]},null,[],["alt",{"sourceInterval":[608,707]},["app",{"sourceInterval":[608,621]},"Primitive_positive",[]],["app",{"sourceInterval":[641,654]},"Primitive_negative",[]],["app",{"sourceInterval":[674,682]},"constant",[]],["app",{"sourceInterval":[690,693]},"hex",[]],["app",{"sourceInterval":[701,707]},"number",[]]]],"add":["define",{"sourceInterval":[734,838]},null,[],["alt",{"sourceInterval":[745,838]},["terminal",{"sourceInterval":[745,748]},"+"],["app",{"sourceInterval":[756,779]},"caseInsensitive",[["terminal",{"sourceInterval":[772,778]},"plus"]]],["app",{"sourceInterval":[786,808]},"caseInsensitive",[["terminal",{"sourceInterval":[802,807]},"add"]]],["app",{"sourceInterval":[816,838]},"caseInsensitive",[["terminal",{"sourceInterval":[832,837]},"and"]]]]],"subtract":["define",{"sourceInterval":[848,999]},null,[],["alt",{"sourceInterval":[865,999]},["terminal",{"sourceInterval":[865,868]},"-"],["app",{"sourceInterval":[876,900]},"caseInsensitive",[["terminal",{"sourceInterval":[892,899]},"minus"]]],["app",{"sourceInterval":[908,935]},"caseInsensitive",[["terminal",{"sourceInterval":[924,934]},"subtract"]]],["app",{"sourceInterval":[943,968]},"caseInsensitive",[["terminal",{"sourceInterval":[959,967]},"remove"]]],["app",{"sourceInterval":[976,999]},"caseInsensitive",[["terminal",{"sourceInterval":[992,998]},"take"]]]]],"multiply":["define",{"sourceInterval":[1011,1262]},null,[],["alt",{"sourceInterval":[1028,1262]},["terminal",{"sourceInterval":[1028,1031]},"*"],["terminal",{"sourceInterval":[1039,1044]},"\\*"],["terminal",{"sourceInterval":[1079,1089]},"×"],["app",{"sourceInterval":[1102,1122]},"caseInsensitive",[["terminal",{"sourceInterval":[1118,1121]},"x"]]],["app",{"sourceInterval":[1130,1157]},"caseInsensitive",[["terminal",{"sourceInterval":[1146,1156]},"times by"]]],["app",{"sourceInterval":[1165,1189]},"caseInsensitive",[["terminal",{"sourceInterval":[1181,1188]},"times"]]],["app",{"sourceInterval":[1197,1227]},"caseInsensitive",[["terminal",{"sourceInterval":[1213,1226]},"multiply by"]]],["app",{"sourceInterval":[1235,1262]},"caseInsensitive",[["terminal",{"sourceInterval":[1251,1261]},"multiply"]]]]],"divide":["define",{"sourceInterval":[1274,1383]},null,[],["alt",{"sourceInterval":[1288,1383]},["terminal",{"sourceInterval":[1288,1291]},"/"],["terminal",{"sourceInterval":[1299,1309]},"÷"],["app",{"sourceInterval":[1322,1350]},"caseInsensitive",[["terminal",{"sourceInterval":[1338,1349]},"divide by"]]],["app",{"sourceInterval":[1358,1383]},"caseInsensitive",[["terminal",{"sourceInterval":[1374,1382]},"divide"]]]]],"modulo":["define",{"sourceInterval":[1389,1469]},null,[],["alt",{"sourceInterval":[1403,1469]},["terminal",{"sourceInterval":[1403,1406]},"%"],["app",{"sourceInterval":[1414,1439]},"caseInsensitive",[["terminal",{"sourceInterval":[1430,1438]},"modulo"]]],["app",{"sourceInterval":[1447,1469]},"caseInsensitive",[["terminal",{"sourceInterval":[1463,1468]},"mod"]]]]],"exponent":["define",{"sourceInterval":[1475,1638]},null,[],["alt",{"sourceInterval":[1491,1638]},["terminal",{"sourceInterval":[1491,1494]},"^"],["app",{"sourceInterval":[1502,1536]},"caseInsensitive",[["terminal",{"sourceInterval":[1518,1535]},"to the power of"]]],["app",{"sourceInterval":[1544,1571]},"caseInsensitive",[["terminal",{"sourceInterval":[1560,1570]},"power of"]]],["app",{"sourceInterval":[1579,1606]},"caseInsensitive",[["terminal",{"sourceInterval":[1595,1605]},"exponent"]]],["app",{"sourceInterval":[1614,1638]},"caseInsensitive",[["terminal",{"sourceInterval":[1630,1637]},"prime"]]]]],"constant":["define",{"sourceInterval":[1644,1711]},null,[],["alt",{"sourceInterval":[1661,1711]},["app",{"sourceInterval":[1661,1682]},"caseInsensitive",[["terminal",{"sourceInterval":[1677,1681]},"PI"]]],["app",{"sourceInterval":[1691,1711]},"caseInsensitive",[["terminal",{"sourceInterval":[1707,1710]},"E"]]]]],"number_fract":["define",{"sourceInterval":[1731,1758]},null,[],["seq",{"sourceInterval":[1731,1748]},["star",{"sourceInterval":[1731,1737]},["app",{"sourceInterval":[1731,1736]},"digit",[]]],["terminal",{"sourceInterval":[1738,1741]},"."],["plus",{"sourceInterval":[1742,1748]},["app",{"sourceInterval":[1742,1747]},"digit",[]]]]],"number_whole":["define",{"sourceInterval":[1766,1793]},null,[],["plus",{"sourceInterval":[1766,1772]},["app",{"sourceInterval":[1766,1771]},"digit",[]]]],"number":["define",{"sourceInterval":[1717,1793]},null,[],["alt",{"sourceInterval":[1731,1793]},["app",{"sourceInterval":[1731,1748]},"number_fract",[]],["app",{"sourceInterval":[1766,1772]},"number_whole",[]]]],"hex":["define",{"sourceInterval":[1801,1847]},null,[],["alt",{"sourceInterval":[1812,1847]},["seq",{"sourceInterval":[1812,1826]},["terminal",{"sourceInterval":[1812,1816]},"0x"],["plus",{"sourceInterval":[1817,1826]},["app",{"sourceInterval":[1817,1825]},"hexDigit",[]]]],["seq",{"sourceInterval":[1834,1847]},["plus",{"sourceInterval":[1834,1843]},["app",{"sourceInterval":[1834,1842]},"hexDigit",[]]],["terminal",{"sourceInterval":[1844,1847]},"h"]]]]}]);result.Vector2Arithmetic=makeRecipe(["grammar",{"source":"Vector2Arithmetic <: BasicArithmetic {\r\n // Remove support for logical shift\r\n Expression \r\n \t:= AS\r\n\r\n P\r\n := \"(\" Expression \")\" -- parenthesis\r\n | Vector2\r\n | Function\r\n | Primitive\r\n\r\n // Remove modulo support for vector\r\n MD\r\n := MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | E\r\n\r\n Vector2\r\n = vector2? \"(\" Expression \",\" Expression \")\" -- parse\r\n\r\n Function\r\n = LengthSq\r\n | DistanceSq\r\n | Length\r\n | Distance\r\n | Normalise\r\n | Dot\r\n | AngleBetween\r\n | Cross\r\n | Lerp\r\n\r\n LengthSq = lengthSq \"(\" Vector2 \")\" -- function\r\n DistanceSq = distanceSq \"(\" Vector2 \",\" Vector2 \")\" -- function\r\n Length = length \"(\" Vector2 \")\" -- function\r\n Distance = distance \"(\" Vector2 \",\" Vector2 \")\" -- function\r\n Normalise = normalise \"(\" Vector2 \")\" -- function\r\n Dot = dot \"(\" Vector2 \",\" Vector2 \")\" -- function\r\n AngleBetween = angleBetween \"(\" Vector2 \",\" Vector2 \")\" -- function\r\n Cross = cross \"(\" Vector2 \",\" Vector2 \")\" -- function\r\n Lerp = lerp \"(\" Vector2 \",\" Vector2 \",\" number \")\" -- function\r\n\r\n vector2 \r\n \t = caseInsensitive<\"Vector2\">\r\n | caseInsensitive<\"Vec2\">\r\n\r\n lengthSq \r\n \t = caseInsensitive<\"lengthSq\">\r\n | caseInsensitive<\"magnitudeSq\">\r\n\r\n distanceSq\r\n = caseInsensitive<\"distanceSq\">\r\n\r\n length\r\n \t = caseInsensitive<\"length\">\r\n | caseInsensitive<\"magnitude\">\r\n\r\n distance\r\n = caseInsensitive<\"distance\">\r\n\r\n normalise \r\n \t = caseInsensitive<\"normalise\">\r\n \t | caseInsensitive<\"normalize\">\r\n\r\n dot\r\n = caseInsensitive<\"dotproduct\">\r\n | caseInsensitive<\"dot\">\r\n\r\n angleBetween\r\n = caseInsensitive<\"angleBetween\">\r\n\r\n cross\r\n = caseInsensitive<\"crossproduct\">\r\n | caseInsensitive<\"cross\">\r\n\r\n lerp\r\n = caseInsensitive<\"lerp\">\r\n}"},"Vector2Arithmetic",result.BasicArithmetic,"Expression",{"Expression":["override",{"sourceInterval":[81,103]},null,[],["app",{"sourceInterval":[101,103]},"AS",[]]],"P_parenthesis":["override",{"sourceInterval":[119,153]},null,[],["seq",{"sourceInterval":[119,137]},["terminal",{"sourceInterval":[119,122]},"("],["app",{"sourceInterval":[123,133]},"Expression",[]],["terminal",{"sourceInterval":[134,137]},")"]]],"P":["override",{"sourceInterval":[109,201]},null,[],["alt",{"sourceInterval":[119,201]},["app",{"sourceInterval":[119,137]},"P_parenthesis",[]],["app",{"sourceInterval":[161,168]},"Vector2",[]],["app",{"sourceInterval":[176,184]},"Function",[]],["app",{"sourceInterval":[192,201]},"Primitive",[]]]],"MD_multiplication":["override",{"sourceInterval":[257,289]},null,[],["seq",{"sourceInterval":[257,270]},["app",{"sourceInterval":[257,259]},"MD",[]],["app",{"sourceInterval":[260,268]},"multiply",[]],["app",{"sourceInterval":[269,270]},"E",[]]]],"MD_division":["override",{"sourceInterval":[297,321]},null,[],["seq",{"sourceInterval":[297,308]},["app",{"sourceInterval":[297,299]},"MD",[]],["app",{"sourceInterval":[300,306]},"divide",[]],["app",{"sourceInterval":[307,308]},"E",[]]]],"MD":["override",{"sourceInterval":[246,330]},null,[],["alt",{"sourceInterval":[257,330]},["app",{"sourceInterval":[257,270]},"MD_multiplication",[]],["app",{"sourceInterval":[297,308]},"MD_division",[]],["app",{"sourceInterval":[329,330]},"E",[]]]],"Vector2_parse":["define",{"sourceInterval":[351,402]},null,[],["seq",{"sourceInterval":[351,393]},["opt",{"sourceInterval":[351,359]},["app",{"sourceInterval":[351,358]},"vector2",[]]],["terminal",{"sourceInterval":[360,363]},"("],["app",{"sourceInterval":[364,374]},"Expression",[]],["terminal",{"sourceInterval":[375,378]},","],["app",{"sourceInterval":[379,389]},"Expression",[]],["terminal",{"sourceInterval":[390,393]},")"]]],"Vector2":["define",{"sourceInterval":[336,402]},null,[],["app",{"sourceInterval":[351,402]},"Vector2_parse",[]]],"Function":["define",{"sourceInterval":[408,544]},null,[],["alt",{"sourceInterval":[423,544]},["app",{"sourceInterval":[423,431]},"LengthSq",[]],["app",{"sourceInterval":[438,448]},"DistanceSq",[]],["app",{"sourceInterval":[455,461]},"Length",[]],["app",{"sourceInterval":[468,476]},"Distance",[]],["app",{"sourceInterval":[483,492]},"Normalise",[]],["app",{"sourceInterval":[499,502]},"Dot",[]],["app",{"sourceInterval":[509,521]},"AngleBetween",[]],["app",{"sourceInterval":[528,533]},"Cross",[]],["app",{"sourceInterval":[540,544]},"Lerp",[]]]],"LengthSq_function":["define",{"sourceInterval":[562,598]},null,[],["seq",{"sourceInterval":[562,586]},["app",{"sourceInterval":[562,570]},"lengthSq",[]],["terminal",{"sourceInterval":[571,574]},"("],["app",{"sourceInterval":[575,582]},"Vector2",[]],["terminal",{"sourceInterval":[583,586]},")"]]],"LengthSq":["define",{"sourceInterval":[550,598]},null,[],["app",{"sourceInterval":[562,598]},"LengthSq_function",[]]],"DistanceSq_function":["define",{"sourceInterval":[616,666]},null,[],["seq",{"sourceInterval":[616,654]},["app",{"sourceInterval":[616,626]},"distanceSq",[]],["terminal",{"sourceInterval":[627,630]},"("],["app",{"sourceInterval":[631,638]},"Vector2",[]],["terminal",{"sourceInterval":[639,642]},","],["app",{"sourceInterval":[643,650]},"Vector2",[]],["terminal",{"sourceInterval":[651,654]},")"]]],"DistanceSq":["define",{"sourceInterval":[602,666]},null,[],["app",{"sourceInterval":[616,666]},"DistanceSq_function",[]]],"Length_function":["define",{"sourceInterval":[680,714]},null,[],["seq",{"sourceInterval":[680,702]},["app",{"sourceInterval":[680,686]},"length",[]],["terminal",{"sourceInterval":[687,690]},"("],["app",{"sourceInterval":[691,698]},"Vector2",[]],["terminal",{"sourceInterval":[699,702]},")"]]],"Length":["define",{"sourceInterval":[670,714]},null,[],["app",{"sourceInterval":[680,714]},"Length_function",[]]],"Distance_function":["define",{"sourceInterval":[730,778]},null,[],["seq",{"sourceInterval":[730,766]},["app",{"sourceInterval":[730,738]},"distance",[]],["terminal",{"sourceInterval":[739,742]},"("],["app",{"sourceInterval":[743,750]},"Vector2",[]],["terminal",{"sourceInterval":[751,754]},","],["app",{"sourceInterval":[755,762]},"Vector2",[]],["terminal",{"sourceInterval":[763,766]},")"]]],"Distance":["define",{"sourceInterval":[718,778]},null,[],["app",{"sourceInterval":[730,778]},"Distance_function",[]]],"Normalise_function":["define",{"sourceInterval":[794,831]},null,[],["seq",{"sourceInterval":[794,819]},["app",{"sourceInterval":[794,803]},"normalise",[]],["terminal",{"sourceInterval":[804,807]},"("],["app",{"sourceInterval":[808,815]},"Vector2",[]],["terminal",{"sourceInterval":[816,819]},")"]]],"Normalise":["define",{"sourceInterval":[782,831]},null,[],["app",{"sourceInterval":[794,831]},"Normalise_function",[]]],"Dot_function":["define",{"sourceInterval":[841,884]},null,[],["seq",{"sourceInterval":[841,872]},["app",{"sourceInterval":[841,844]},"dot",[]],["terminal",{"sourceInterval":[845,848]},"("],["app",{"sourceInterval":[849,856]},"Vector2",[]],["terminal",{"sourceInterval":[857,860]},","],["app",{"sourceInterval":[861,868]},"Vector2",[]],["terminal",{"sourceInterval":[869,872]},")"]]],"Dot":["define",{"sourceInterval":[835,884]},null,[],["app",{"sourceInterval":[841,884]},"Dot_function",[]]],"AngleBetween_function":["define",{"sourceInterval":[903,955]},null,[],["seq",{"sourceInterval":[903,943]},["app",{"sourceInterval":[903,915]},"angleBetween",[]],["terminal",{"sourceInterval":[916,919]},"("],["app",{"sourceInterval":[920,927]},"Vector2",[]],["terminal",{"sourceInterval":[928,931]},","],["app",{"sourceInterval":[932,939]},"Vector2",[]],["terminal",{"sourceInterval":[940,943]},")"]]],"AngleBetween":["define",{"sourceInterval":[888,955]},null,[],["app",{"sourceInterval":[903,955]},"AngleBetween_function",[]]],"Cross_function":["define",{"sourceInterval":[967,1012]},null,[],["seq",{"sourceInterval":[967,1000]},["app",{"sourceInterval":[967,972]},"cross",[]],["terminal",{"sourceInterval":[973,976]},"("],["app",{"sourceInterval":[977,984]},"Vector2",[]],["terminal",{"sourceInterval":[985,988]},","],["app",{"sourceInterval":[989,996]},"Vector2",[]],["terminal",{"sourceInterval":[997,1000]},")"]]],"Cross":["define",{"sourceInterval":[959,1012]},null,[],["app",{"sourceInterval":[967,1012]},"Cross_function",[]]],"Lerp_function":["define",{"sourceInterval":[1023,1078]},null,[],["seq",{"sourceInterval":[1023,1066]},["app",{"sourceInterval":[1023,1027]},"lerp",[]],["terminal",{"sourceInterval":[1028,1031]},"("],["app",{"sourceInterval":[1032,1039]},"Vector2",[]],["terminal",{"sourceInterval":[1040,1043]},","],["app",{"sourceInterval":[1044,1051]},"Vector2",[]],["terminal",{"sourceInterval":[1052,1055]},","],["app",{"sourceInterval":[1056,1062]},"number",[]],["terminal",{"sourceInterval":[1063,1066]},")"]]],"Lerp":["define",{"sourceInterval":[1016,1078]},null,[],["app",{"sourceInterval":[1023,1078]},"Lerp_function",[]]],"vector2":["define",{"sourceInterval":[1084,1157]},null,[],["alt",{"sourceInterval":[1100,1157]},["app",{"sourceInterval":[1100,1126]},"caseInsensitive",[["terminal",{"sourceInterval":[1116,1125]},"Vector2"]]],["app",{"sourceInterval":[1134,1157]},"caseInsensitive",[["terminal",{"sourceInterval":[1150,1156]},"Vec2"]]]]],"lengthSq":["define",{"sourceInterval":[1163,1245]},null,[],["alt",{"sourceInterval":[1180,1245]},["app",{"sourceInterval":[1180,1207]},"caseInsensitive",[["terminal",{"sourceInterval":[1196,1206]},"lengthSq"]]],["app",{"sourceInterval":[1215,1245]},"caseInsensitive",[["terminal",{"sourceInterval":[1231,1244]},"magnitudeSq"]]]]],"distanceSq":["define",{"sourceInterval":[1251,1298]},null,[],["app",{"sourceInterval":[1269,1298]},"caseInsensitive",[["terminal",{"sourceInterval":[1285,1297]},"distanceSq"]]]],"length":["define",{"sourceInterval":[1304,1379]},null,[],["alt",{"sourceInterval":[1318,1379]},["app",{"sourceInterval":[1318,1343]},"caseInsensitive",[["terminal",{"sourceInterval":[1334,1342]},"length"]]],["app",{"sourceInterval":[1351,1379]},"caseInsensitive",[["terminal",{"sourceInterval":[1367,1378]},"magnitude"]]]]],"distance":["define",{"sourceInterval":[1385,1428]},null,[],["app",{"sourceInterval":[1401,1428]},"caseInsensitive",[["terminal",{"sourceInterval":[1417,1427]},"distance"]]]],"normalise":["define",{"sourceInterval":[1434,1516]},null,[],["alt",{"sourceInterval":[1452,1516]},["app",{"sourceInterval":[1452,1480]},"caseInsensitive",[["terminal",{"sourceInterval":[1468,1479]},"normalise"]]],["app",{"sourceInterval":[1488,1516]},"caseInsensitive",[["terminal",{"sourceInterval":[1504,1515]},"normalize"]]]]],"dot":["define",{"sourceInterval":[1522,1592]},null,[],["alt",{"sourceInterval":[1533,1592]},["app",{"sourceInterval":[1533,1562]},"caseInsensitive",[["terminal",{"sourceInterval":[1549,1561]},"dotproduct"]]],["app",{"sourceInterval":[1570,1592]},"caseInsensitive",[["terminal",{"sourceInterval":[1586,1591]},"dot"]]]]],"angleBetween":["define",{"sourceInterval":[1598,1649]},null,[],["app",{"sourceInterval":[1618,1649]},"caseInsensitive",[["terminal",{"sourceInterval":[1634,1648]},"angleBetween"]]]],"cross":["define",{"sourceInterval":[1655,1731]},null,[],["alt",{"sourceInterval":[1668,1731]},["app",{"sourceInterval":[1668,1699]},"caseInsensitive",[["terminal",{"sourceInterval":[1684,1698]},"crossproduct"]]],["app",{"sourceInterval":[1707,1731]},"caseInsensitive",[["terminal",{"sourceInterval":[1723,1730]},"cross"]]]]],"lerp":["define",{"sourceInterval":[1737,1772]},null,[],["app",{"sourceInterval":[1749,1772]},"caseInsensitive",[["terminal",{"sourceInterval":[1765,1771]},"lerp"]]]]}]);module.exports=result; \ No newline at end of file diff --git a/src/grammars/vector/Vector3Arithmetic.ohm-bundle.js b/src/grammars/vector/Vector3Arithmetic.ohm-bundle.js index 8c63aeb..e2c8dc1 100644 --- a/src/grammars/vector/Vector3Arithmetic.ohm-bundle.js +++ b/src/grammars/vector/Vector3Arithmetic.ohm-bundle.js @@ -1 +1 @@ -'use strict';const {makeRecipe}=require('ohm-js');const result={};result.BasicArithmetic=makeRecipe(["grammar",{"source":"BasicArithmetic {\r\n Expression\r\n = LogicalShift\r\n\r\n LogicalShift\r\n = LogicalShift \"<<\" LogicalShift -- left\r\n | LogicalShift \">>\" LogicalShift -- right\r\n | AS \r\n\r\n // Addition or Subtraction\r\n AS\r\n = AS add MD -- addition\r\n | AS subtract MD -- subtraction\r\n | MD\r\n\r\n // Multiply or Divide\r\n MD\r\n = MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | MD modulo E -- modulo\r\n | E\r\n\r\n // Exponent\r\n E\r\n = P exponent E -- exponent\r\n | P\r\n\r\n // Parenthesis\r\n P\r\n = \"(\" Expression \")\" -- parenthesis\r\n | Primitive\r\n \r\n Primitive\r\n = \"+\" Primitive -- positive\r\n | \"-\" Primitive -- negative\r\n | constant\r\n | hex\r\n | number\r\n \r\n // Lexical Rules\r\n add \r\n \t= \"+\"\r\n | caseInsensitive<\"plus\">\r\n \t| caseInsensitive<\"add\">\r\n | caseInsensitive<\"and\">\r\n \r\n subtract \r\n = \"-\"\r\n | caseInsensitive<\"minus\">\r\n | caseInsensitive<\"subtract\">\r\n | caseInsensitive<\"remove\">\r\n | caseInsensitive<\"take\">\r\n \r\n multiply \r\n = \"*\"\r\n | \"\\\\*\" // Escaped e.g. \\* for markdown\r\n | \"\\u{00D7}\" // Multiplication Symbol ×\r\n | caseInsensitive<\"x\">\r\n | caseInsensitive<\"times by\">\r\n | caseInsensitive<\"times\">\r\n | caseInsensitive<\"multiply by\">\r\n | caseInsensitive<\"multiply\">\r\n \r\n divide\r\n = \"/\"\r\n | \"\\u{00F7}\" // Division Symbol ÷\r\n | caseInsensitive<\"divide by\">\r\n | caseInsensitive<\"divide\">\r\n\r\n modulo\r\n = \"%\"\r\n | caseInsensitive<\"modulo\">\r\n | caseInsensitive<\"mod\">\r\n\r\n exponent\r\n = \"^\"\r\n | caseInsensitive<\"to the power of\">\r\n | caseInsensitive<\"power of\">\r\n | caseInsensitive<\"exponent\">\r\n | caseInsensitive<\"prime\">\r\n\r\n constant \r\n \t= caseInsensitive<\"PI\"> \r\n | caseInsensitive<\"E\">\r\n\r\n number\r\n = digit* \".\" digit+ -- fract\r\n | digit+ -- whole\r\n \r\n hex\r\n = \"0x\" hexDigit+\r\n | hexDigit+ \"h\"\r\n}"},"BasicArithmetic",null,"Expression",{"Expression":["define",{"sourceInterval":[21,51]},null,[],["app",{"sourceInterval":[39,51]},"LogicalShift",[]]],"LogicalShift_left":["define",{"sourceInterval":[77,115]},null,[],["seq",{"sourceInterval":[77,107]},["app",{"sourceInterval":[77,89]},"LogicalShift",[]],["terminal",{"sourceInterval":[90,94]},"<<"],["app",{"sourceInterval":[95,107]},"LogicalShift",[]]]],"LogicalShift_right":["define",{"sourceInterval":[123,162]},null,[],["seq",{"sourceInterval":[123,153]},["app",{"sourceInterval":[123,135]},"LogicalShift",[]],["terminal",{"sourceInterval":[136,140]},">>"],["app",{"sourceInterval":[141,153]},"LogicalShift",[]]]],"LogicalShift":["define",{"sourceInterval":[57,172]},null,[],["alt",{"sourceInterval":[77,172]},["app",{"sourceInterval":[77,107]},"LogicalShift_left",[]],["app",{"sourceInterval":[123,153]},"LogicalShift_right",[]],["app",{"sourceInterval":[170,172]},"AS",[]]]],"AS_addition":["define",{"sourceInterval":[219,241]},null,[],["seq",{"sourceInterval":[219,228]},["app",{"sourceInterval":[219,221]},"AS",[]],["app",{"sourceInterval":[222,225]},"add",[]],["app",{"sourceInterval":[226,228]},"MD",[]]]],"AS_subtraction":["define",{"sourceInterval":[249,279]},null,[],["seq",{"sourceInterval":[249,263]},["app",{"sourceInterval":[249,251]},"AS",[]],["app",{"sourceInterval":[252,260]},"subtract",[]],["app",{"sourceInterval":[261,263]},"MD",[]]]],"AS":["define",{"sourceInterval":[209,289]},null,[],["alt",{"sourceInterval":[219,289]},["app",{"sourceInterval":[219,228]},"AS_addition",[]],["app",{"sourceInterval":[249,263]},"AS_subtraction",[]],["app",{"sourceInterval":[287,289]},"MD",[]]]],"MD_multiplication":["define",{"sourceInterval":[330,362]},null,[],["seq",{"sourceInterval":[330,343]},["app",{"sourceInterval":[330,332]},"MD",[]],["app",{"sourceInterval":[333,341]},"multiply",[]],["app",{"sourceInterval":[342,343]},"E",[]]]],"MD_division":["define",{"sourceInterval":[370,394]},null,[],["seq",{"sourceInterval":[370,381]},["app",{"sourceInterval":[370,372]},"MD",[]],["app",{"sourceInterval":[373,379]},"divide",[]],["app",{"sourceInterval":[380,381]},"E",[]]]],"MD_modulo":["define",{"sourceInterval":[402,424]},null,[],["seq",{"sourceInterval":[402,413]},["app",{"sourceInterval":[402,404]},"MD",[]],["app",{"sourceInterval":[405,411]},"modulo",[]],["app",{"sourceInterval":[412,413]},"E",[]]]],"MD":["define",{"sourceInterval":[320,433]},null,[],["alt",{"sourceInterval":[330,433]},["app",{"sourceInterval":[330,343]},"MD_multiplication",[]],["app",{"sourceInterval":[370,381]},"MD_division",[]],["app",{"sourceInterval":[402,413]},"MD_modulo",[]],["app",{"sourceInterval":[432,433]},"E",[]]]],"E_exponent":["define",{"sourceInterval":[463,488]},null,[],["seq",{"sourceInterval":[463,475]},["app",{"sourceInterval":[463,464]},"P",[]],["app",{"sourceInterval":[465,473]},"exponent",[]],["app",{"sourceInterval":[474,475]},"E",[]]]],"E":["define",{"sourceInterval":[454,497]},null,[],["alt",{"sourceInterval":[463,497]},["app",{"sourceInterval":[463,475]},"E_exponent",[]],["app",{"sourceInterval":[496,497]},"P",[]]]],"P_parenthesis":["define",{"sourceInterval":[530,564]},null,[],["seq",{"sourceInterval":[530,548]},["terminal",{"sourceInterval":[530,533]},"("],["app",{"sourceInterval":[534,544]},"Expression",[]],["terminal",{"sourceInterval":[545,548]},")"]]],"P":["define",{"sourceInterval":[521,581]},null,[],["alt",{"sourceInterval":[530,581]},["app",{"sourceInterval":[530,548]},"P_parenthesis",[]],["app",{"sourceInterval":[572,581]},"Primitive",[]]]],"Primitive_positive":["define",{"sourceInterval":[608,633]},null,[],["seq",{"sourceInterval":[608,621]},["terminal",{"sourceInterval":[608,611]},"+"],["app",{"sourceInterval":[612,621]},"Primitive",[]]]],"Primitive_negative":["define",{"sourceInterval":[641,666]},null,[],["seq",{"sourceInterval":[641,654]},["terminal",{"sourceInterval":[641,644]},"-"],["app",{"sourceInterval":[645,654]},"Primitive",[]]]],"Primitive":["define",{"sourceInterval":[591,707]},null,[],["alt",{"sourceInterval":[608,707]},["app",{"sourceInterval":[608,621]},"Primitive_positive",[]],["app",{"sourceInterval":[641,654]},"Primitive_negative",[]],["app",{"sourceInterval":[674,682]},"constant",[]],["app",{"sourceInterval":[690,693]},"hex",[]],["app",{"sourceInterval":[701,707]},"number",[]]]],"add":["define",{"sourceInterval":[734,838]},null,[],["alt",{"sourceInterval":[745,838]},["terminal",{"sourceInterval":[745,748]},"+"],["app",{"sourceInterval":[756,779]},"caseInsensitive",[["terminal",{"sourceInterval":[772,778]},"plus"]]],["app",{"sourceInterval":[786,808]},"caseInsensitive",[["terminal",{"sourceInterval":[802,807]},"add"]]],["app",{"sourceInterval":[816,838]},"caseInsensitive",[["terminal",{"sourceInterval":[832,837]},"and"]]]]],"subtract":["define",{"sourceInterval":[848,999]},null,[],["alt",{"sourceInterval":[865,999]},["terminal",{"sourceInterval":[865,868]},"-"],["app",{"sourceInterval":[876,900]},"caseInsensitive",[["terminal",{"sourceInterval":[892,899]},"minus"]]],["app",{"sourceInterval":[908,935]},"caseInsensitive",[["terminal",{"sourceInterval":[924,934]},"subtract"]]],["app",{"sourceInterval":[943,968]},"caseInsensitive",[["terminal",{"sourceInterval":[959,967]},"remove"]]],["app",{"sourceInterval":[976,999]},"caseInsensitive",[["terminal",{"sourceInterval":[992,998]},"take"]]]]],"multiply":["define",{"sourceInterval":[1011,1289]},null,[],["alt",{"sourceInterval":[1028,1289]},["terminal",{"sourceInterval":[1028,1031]},"*"],["terminal",{"sourceInterval":[1039,1044]},"\\*"],["terminal",{"sourceInterval":[1084,1094]},"×"],["app",{"sourceInterval":[1129,1149]},"caseInsensitive",[["terminal",{"sourceInterval":[1145,1148]},"x"]]],["app",{"sourceInterval":[1157,1184]},"caseInsensitive",[["terminal",{"sourceInterval":[1173,1183]},"times by"]]],["app",{"sourceInterval":[1192,1216]},"caseInsensitive",[["terminal",{"sourceInterval":[1208,1215]},"times"]]],["app",{"sourceInterval":[1224,1254]},"caseInsensitive",[["terminal",{"sourceInterval":[1240,1253]},"multiply by"]]],["app",{"sourceInterval":[1262,1289]},"caseInsensitive",[["terminal",{"sourceInterval":[1278,1288]},"multiply"]]]]],"divide":["define",{"sourceInterval":[1301,1426]},null,[],["alt",{"sourceInterval":[1315,1426]},["terminal",{"sourceInterval":[1315,1318]},"/"],["terminal",{"sourceInterval":[1326,1336]},"÷"],["app",{"sourceInterval":[1365,1393]},"caseInsensitive",[["terminal",{"sourceInterval":[1381,1392]},"divide by"]]],["app",{"sourceInterval":[1401,1426]},"caseInsensitive",[["terminal",{"sourceInterval":[1417,1425]},"divide"]]]]],"modulo":["define",{"sourceInterval":[1432,1512]},null,[],["alt",{"sourceInterval":[1446,1512]},["terminal",{"sourceInterval":[1446,1449]},"%"],["app",{"sourceInterval":[1457,1482]},"caseInsensitive",[["terminal",{"sourceInterval":[1473,1481]},"modulo"]]],["app",{"sourceInterval":[1490,1512]},"caseInsensitive",[["terminal",{"sourceInterval":[1506,1511]},"mod"]]]]],"exponent":["define",{"sourceInterval":[1518,1681]},null,[],["alt",{"sourceInterval":[1534,1681]},["terminal",{"sourceInterval":[1534,1537]},"^"],["app",{"sourceInterval":[1545,1579]},"caseInsensitive",[["terminal",{"sourceInterval":[1561,1578]},"to the power of"]]],["app",{"sourceInterval":[1587,1614]},"caseInsensitive",[["terminal",{"sourceInterval":[1603,1613]},"power of"]]],["app",{"sourceInterval":[1622,1649]},"caseInsensitive",[["terminal",{"sourceInterval":[1638,1648]},"exponent"]]],["app",{"sourceInterval":[1657,1681]},"caseInsensitive",[["terminal",{"sourceInterval":[1673,1680]},"prime"]]]]],"constant":["define",{"sourceInterval":[1687,1754]},null,[],["alt",{"sourceInterval":[1704,1754]},["app",{"sourceInterval":[1704,1725]},"caseInsensitive",[["terminal",{"sourceInterval":[1720,1724]},"PI"]]],["app",{"sourceInterval":[1734,1754]},"caseInsensitive",[["terminal",{"sourceInterval":[1750,1753]},"E"]]]]],"number_fract":["define",{"sourceInterval":[1774,1801]},null,[],["seq",{"sourceInterval":[1774,1791]},["star",{"sourceInterval":[1774,1780]},["app",{"sourceInterval":[1774,1779]},"digit",[]]],["terminal",{"sourceInterval":[1781,1784]},"."],["plus",{"sourceInterval":[1785,1791]},["app",{"sourceInterval":[1785,1790]},"digit",[]]]]],"number_whole":["define",{"sourceInterval":[1809,1836]},null,[],["plus",{"sourceInterval":[1809,1815]},["app",{"sourceInterval":[1809,1814]},"digit",[]]]],"number":["define",{"sourceInterval":[1760,1836]},null,[],["alt",{"sourceInterval":[1774,1836]},["app",{"sourceInterval":[1774,1791]},"number_fract",[]],["app",{"sourceInterval":[1809,1815]},"number_whole",[]]]],"hex":["define",{"sourceInterval":[1844,1890]},null,[],["alt",{"sourceInterval":[1855,1890]},["seq",{"sourceInterval":[1855,1869]},["terminal",{"sourceInterval":[1855,1859]},"0x"],["plus",{"sourceInterval":[1860,1869]},["app",{"sourceInterval":[1860,1868]},"hexDigit",[]]]],["seq",{"sourceInterval":[1877,1890]},["plus",{"sourceInterval":[1877,1886]},["app",{"sourceInterval":[1877,1885]},"hexDigit",[]]],["terminal",{"sourceInterval":[1887,1890]},"h"]]]]}]);result.Vector3Arithmetic=makeRecipe(["grammar",{"source":"Vector3Arithmetic <: BasicArithmetic {\r\n // Remove support for logical shift\r\n Expression \r\n \t:= AS\r\n\r\n P\r\n := \"(\" Expression \")\" -- parenthesis\r\n | Vector3\r\n | Function\r\n | Primitive\r\n\r\n // Remove modulo support for vector\r\n MD\r\n := MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | E\r\n\r\n Vector3\r\n = vector3? \"(\" Expression \",\" Expression \",\" Expression \")\" -- parse\r\n\r\n Function\r\n = LengthSq\r\n | DistanceSq\r\n | Length\r\n | Distance\r\n | Normalise\r\n | Dot\r\n | AngleBetween\r\n | Cross\r\n | Lerp\r\n\r\n LengthSq = lengthSq \"(\" Vector3 \")\" -- function\r\n DistanceSq = distanceSq \"(\" Vector3 \",\" Vector3 \")\" -- function\r\n Length = length \"(\" Vector3 \")\" -- function\r\n Distance = distance \"(\" Vector3 \",\" Vector3 \")\" -- function\r\n Normalise = normalise \"(\" Vector3 \")\" -- function\r\n Dot = dot \"(\" Vector3 \",\" Vector3 \")\" -- function\r\n AngleBetween = angleBetween \"(\" Vector3 \",\" Vector3 \")\" -- function\r\n Cross = cross \"(\" Vector3 \",\" Vector3 \")\" -- function\r\n Lerp = lerp \"(\" Vector3 \",\" Vector3 \",\" number \")\" -- function\r\n\r\n vector3 \r\n \t = caseInsensitive<\"Vector3\">\r\n | caseInsensitive<\"Vec3\">\r\n\r\n lengthSq \r\n \t = caseInsensitive<\"lengthSq\">\r\n | caseInsensitive<\"magnitudeSq\">\r\n\r\n distanceSq\r\n = caseInsensitive<\"distanceSq\">\r\n\r\n length\r\n \t = caseInsensitive<\"length\">\r\n | caseInsensitive<\"magnitude\">\r\n\r\n distance\r\n = caseInsensitive<\"distance\">\r\n\r\n normalise \r\n \t = caseInsensitive<\"normalise\">\r\n \t | caseInsensitive<\"normalize\">\r\n\r\n dot\r\n = caseInsensitive<\"dotproduct\">\r\n | caseInsensitive<\"dot\">\r\n\r\n angleBetween\r\n = caseInsensitive<\"angleBetween\">\r\n\r\n cross\r\n = caseInsensitive<\"crossproduct\">\r\n | caseInsensitive<\"cross\">\r\n\r\n lerp\r\n = caseInsensitive<\"lerp\">\r\n}"},"Vector3Arithmetic",result.BasicArithmetic,"Expression",{"Expression":["override",{"sourceInterval":[81,103]},null,[],["app",{"sourceInterval":[101,103]},"AS",[]]],"P_parenthesis":["override",{"sourceInterval":[119,153]},null,[],["seq",{"sourceInterval":[119,137]},["terminal",{"sourceInterval":[119,122]},"("],["app",{"sourceInterval":[123,133]},"Expression",[]],["terminal",{"sourceInterval":[134,137]},")"]]],"P":["override",{"sourceInterval":[109,201]},null,[],["alt",{"sourceInterval":[119,201]},["app",{"sourceInterval":[119,137]},"P_parenthesis",[]],["app",{"sourceInterval":[161,168]},"Vector3",[]],["app",{"sourceInterval":[176,184]},"Function",[]],["app",{"sourceInterval":[192,201]},"Primitive",[]]]],"MD_multiplication":["override",{"sourceInterval":[257,289]},null,[],["seq",{"sourceInterval":[257,270]},["app",{"sourceInterval":[257,259]},"MD",[]],["app",{"sourceInterval":[260,268]},"multiply",[]],["app",{"sourceInterval":[269,270]},"E",[]]]],"MD_division":["override",{"sourceInterval":[297,321]},null,[],["seq",{"sourceInterval":[297,308]},["app",{"sourceInterval":[297,299]},"MD",[]],["app",{"sourceInterval":[300,306]},"divide",[]],["app",{"sourceInterval":[307,308]},"E",[]]]],"MD":["override",{"sourceInterval":[246,330]},null,[],["alt",{"sourceInterval":[257,330]},["app",{"sourceInterval":[257,270]},"MD_multiplication",[]],["app",{"sourceInterval":[297,308]},"MD_division",[]],["app",{"sourceInterval":[329,330]},"E",[]]]],"Vector3_parse":["define",{"sourceInterval":[351,417]},null,[],["seq",{"sourceInterval":[351,408]},["opt",{"sourceInterval":[351,359]},["app",{"sourceInterval":[351,358]},"vector3",[]]],["terminal",{"sourceInterval":[360,363]},"("],["app",{"sourceInterval":[364,374]},"Expression",[]],["terminal",{"sourceInterval":[375,378]},","],["app",{"sourceInterval":[379,389]},"Expression",[]],["terminal",{"sourceInterval":[390,393]},","],["app",{"sourceInterval":[394,404]},"Expression",[]],["terminal",{"sourceInterval":[405,408]},")"]]],"Vector3":["define",{"sourceInterval":[336,417]},null,[],["app",{"sourceInterval":[351,417]},"Vector3_parse",[]]],"Function":["define",{"sourceInterval":[423,559]},null,[],["alt",{"sourceInterval":[438,559]},["app",{"sourceInterval":[438,446]},"LengthSq",[]],["app",{"sourceInterval":[453,463]},"DistanceSq",[]],["app",{"sourceInterval":[470,476]},"Length",[]],["app",{"sourceInterval":[483,491]},"Distance",[]],["app",{"sourceInterval":[498,507]},"Normalise",[]],["app",{"sourceInterval":[514,517]},"Dot",[]],["app",{"sourceInterval":[524,536]},"AngleBetween",[]],["app",{"sourceInterval":[543,548]},"Cross",[]],["app",{"sourceInterval":[555,559]},"Lerp",[]]]],"LengthSq_function":["define",{"sourceInterval":[577,613]},null,[],["seq",{"sourceInterval":[577,601]},["app",{"sourceInterval":[577,585]},"lengthSq",[]],["terminal",{"sourceInterval":[586,589]},"("],["app",{"sourceInterval":[590,597]},"Vector3",[]],["terminal",{"sourceInterval":[598,601]},")"]]],"LengthSq":["define",{"sourceInterval":[565,613]},null,[],["app",{"sourceInterval":[577,613]},"LengthSq_function",[]]],"DistanceSq_function":["define",{"sourceInterval":[631,681]},null,[],["seq",{"sourceInterval":[631,669]},["app",{"sourceInterval":[631,641]},"distanceSq",[]],["terminal",{"sourceInterval":[642,645]},"("],["app",{"sourceInterval":[646,653]},"Vector3",[]],["terminal",{"sourceInterval":[654,657]},","],["app",{"sourceInterval":[658,665]},"Vector3",[]],["terminal",{"sourceInterval":[666,669]},")"]]],"DistanceSq":["define",{"sourceInterval":[617,681]},null,[],["app",{"sourceInterval":[631,681]},"DistanceSq_function",[]]],"Length_function":["define",{"sourceInterval":[695,729]},null,[],["seq",{"sourceInterval":[695,717]},["app",{"sourceInterval":[695,701]},"length",[]],["terminal",{"sourceInterval":[702,705]},"("],["app",{"sourceInterval":[706,713]},"Vector3",[]],["terminal",{"sourceInterval":[714,717]},")"]]],"Length":["define",{"sourceInterval":[685,729]},null,[],["app",{"sourceInterval":[695,729]},"Length_function",[]]],"Distance_function":["define",{"sourceInterval":[745,793]},null,[],["seq",{"sourceInterval":[745,781]},["app",{"sourceInterval":[745,753]},"distance",[]],["terminal",{"sourceInterval":[754,757]},"("],["app",{"sourceInterval":[758,765]},"Vector3",[]],["terminal",{"sourceInterval":[766,769]},","],["app",{"sourceInterval":[770,777]},"Vector3",[]],["terminal",{"sourceInterval":[778,781]},")"]]],"Distance":["define",{"sourceInterval":[733,793]},null,[],["app",{"sourceInterval":[745,793]},"Distance_function",[]]],"Normalise_function":["define",{"sourceInterval":[809,846]},null,[],["seq",{"sourceInterval":[809,834]},["app",{"sourceInterval":[809,818]},"normalise",[]],["terminal",{"sourceInterval":[819,822]},"("],["app",{"sourceInterval":[823,830]},"Vector3",[]],["terminal",{"sourceInterval":[831,834]},")"]]],"Normalise":["define",{"sourceInterval":[797,846]},null,[],["app",{"sourceInterval":[809,846]},"Normalise_function",[]]],"Dot_function":["define",{"sourceInterval":[856,899]},null,[],["seq",{"sourceInterval":[856,887]},["app",{"sourceInterval":[856,859]},"dot",[]],["terminal",{"sourceInterval":[860,863]},"("],["app",{"sourceInterval":[864,871]},"Vector3",[]],["terminal",{"sourceInterval":[872,875]},","],["app",{"sourceInterval":[876,883]},"Vector3",[]],["terminal",{"sourceInterval":[884,887]},")"]]],"Dot":["define",{"sourceInterval":[850,899]},null,[],["app",{"sourceInterval":[856,899]},"Dot_function",[]]],"AngleBetween_function":["define",{"sourceInterval":[918,970]},null,[],["seq",{"sourceInterval":[918,958]},["app",{"sourceInterval":[918,930]},"angleBetween",[]],["terminal",{"sourceInterval":[931,934]},"("],["app",{"sourceInterval":[935,942]},"Vector3",[]],["terminal",{"sourceInterval":[943,946]},","],["app",{"sourceInterval":[947,954]},"Vector3",[]],["terminal",{"sourceInterval":[955,958]},")"]]],"AngleBetween":["define",{"sourceInterval":[903,970]},null,[],["app",{"sourceInterval":[918,970]},"AngleBetween_function",[]]],"Cross_function":["define",{"sourceInterval":[982,1027]},null,[],["seq",{"sourceInterval":[982,1015]},["app",{"sourceInterval":[982,987]},"cross",[]],["terminal",{"sourceInterval":[988,991]},"("],["app",{"sourceInterval":[992,999]},"Vector3",[]],["terminal",{"sourceInterval":[1000,1003]},","],["app",{"sourceInterval":[1004,1011]},"Vector3",[]],["terminal",{"sourceInterval":[1012,1015]},")"]]],"Cross":["define",{"sourceInterval":[974,1027]},null,[],["app",{"sourceInterval":[982,1027]},"Cross_function",[]]],"Lerp_function":["define",{"sourceInterval":[1038,1093]},null,[],["seq",{"sourceInterval":[1038,1081]},["app",{"sourceInterval":[1038,1042]},"lerp",[]],["terminal",{"sourceInterval":[1043,1046]},"("],["app",{"sourceInterval":[1047,1054]},"Vector3",[]],["terminal",{"sourceInterval":[1055,1058]},","],["app",{"sourceInterval":[1059,1066]},"Vector3",[]],["terminal",{"sourceInterval":[1067,1070]},","],["app",{"sourceInterval":[1071,1077]},"number",[]],["terminal",{"sourceInterval":[1078,1081]},")"]]],"Lerp":["define",{"sourceInterval":[1031,1093]},null,[],["app",{"sourceInterval":[1038,1093]},"Lerp_function",[]]],"vector3":["define",{"sourceInterval":[1099,1172]},null,[],["alt",{"sourceInterval":[1115,1172]},["app",{"sourceInterval":[1115,1141]},"caseInsensitive",[["terminal",{"sourceInterval":[1131,1140]},"Vector3"]]],["app",{"sourceInterval":[1149,1172]},"caseInsensitive",[["terminal",{"sourceInterval":[1165,1171]},"Vec3"]]]]],"lengthSq":["define",{"sourceInterval":[1178,1260]},null,[],["alt",{"sourceInterval":[1195,1260]},["app",{"sourceInterval":[1195,1222]},"caseInsensitive",[["terminal",{"sourceInterval":[1211,1221]},"lengthSq"]]],["app",{"sourceInterval":[1230,1260]},"caseInsensitive",[["terminal",{"sourceInterval":[1246,1259]},"magnitudeSq"]]]]],"distanceSq":["define",{"sourceInterval":[1266,1313]},null,[],["app",{"sourceInterval":[1284,1313]},"caseInsensitive",[["terminal",{"sourceInterval":[1300,1312]},"distanceSq"]]]],"length":["define",{"sourceInterval":[1319,1394]},null,[],["alt",{"sourceInterval":[1333,1394]},["app",{"sourceInterval":[1333,1358]},"caseInsensitive",[["terminal",{"sourceInterval":[1349,1357]},"length"]]],["app",{"sourceInterval":[1366,1394]},"caseInsensitive",[["terminal",{"sourceInterval":[1382,1393]},"magnitude"]]]]],"distance":["define",{"sourceInterval":[1400,1443]},null,[],["app",{"sourceInterval":[1416,1443]},"caseInsensitive",[["terminal",{"sourceInterval":[1432,1442]},"distance"]]]],"normalise":["define",{"sourceInterval":[1449,1531]},null,[],["alt",{"sourceInterval":[1467,1531]},["app",{"sourceInterval":[1467,1495]},"caseInsensitive",[["terminal",{"sourceInterval":[1483,1494]},"normalise"]]],["app",{"sourceInterval":[1503,1531]},"caseInsensitive",[["terminal",{"sourceInterval":[1519,1530]},"normalize"]]]]],"dot":["define",{"sourceInterval":[1537,1607]},null,[],["alt",{"sourceInterval":[1548,1607]},["app",{"sourceInterval":[1548,1577]},"caseInsensitive",[["terminal",{"sourceInterval":[1564,1576]},"dotproduct"]]],["app",{"sourceInterval":[1585,1607]},"caseInsensitive",[["terminal",{"sourceInterval":[1601,1606]},"dot"]]]]],"angleBetween":["define",{"sourceInterval":[1613,1664]},null,[],["app",{"sourceInterval":[1633,1664]},"caseInsensitive",[["terminal",{"sourceInterval":[1649,1663]},"angleBetween"]]]],"cross":["define",{"sourceInterval":[1670,1746]},null,[],["alt",{"sourceInterval":[1683,1746]},["app",{"sourceInterval":[1683,1714]},"caseInsensitive",[["terminal",{"sourceInterval":[1699,1713]},"crossproduct"]]],["app",{"sourceInterval":[1722,1746]},"caseInsensitive",[["terminal",{"sourceInterval":[1738,1745]},"cross"]]]]],"lerp":["define",{"sourceInterval":[1752,1787]},null,[],["app",{"sourceInterval":[1764,1787]},"caseInsensitive",[["terminal",{"sourceInterval":[1780,1786]},"lerp"]]]]}]);module.exports=result; \ No newline at end of file +'use strict';const {makeRecipe}=require('ohm-js');const result={};result.BasicArithmetic=makeRecipe(["grammar",{"source":"BasicArithmetic {\r\n Expression\r\n = LogicalShift\r\n\r\n LogicalShift\r\n = LogicalShift \"<<\" LogicalShift -- left\r\n | LogicalShift \">>\" LogicalShift -- right\r\n | AS \r\n\r\n // Addition or Subtraction\r\n AS\r\n = AS add MD -- addition\r\n | AS subtract MD -- subtraction\r\n | MD\r\n\r\n // Multiply or Divide\r\n MD\r\n = MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | MD modulo E -- modulo\r\n | E\r\n\r\n // Exponent\r\n E\r\n = P exponent E -- exponent\r\n | P\r\n\r\n // Parenthesis\r\n P\r\n = \"(\" Expression \")\" -- parenthesis\r\n | Primitive\r\n \r\n Primitive\r\n = \"+\" Primitive -- positive\r\n | \"-\" Primitive -- negative\r\n | constant\r\n | hex\r\n | number\r\n \r\n // Lexical Rules\r\n add \r\n \t= \"+\"\r\n | caseInsensitive<\"plus\">\r\n \t| caseInsensitive<\"add\">\r\n | caseInsensitive<\"and\">\r\n \r\n subtract \r\n = \"-\"\r\n | caseInsensitive<\"minus\">\r\n | caseInsensitive<\"subtract\">\r\n | caseInsensitive<\"remove\">\r\n | caseInsensitive<\"take\">\r\n \r\n multiply \r\n = \"*\"\r\n | \"\\\\*\" // Escaped \\* for markdown\r\n | \"\\u{00D7}\" // ×\r\n | caseInsensitive<\"x\">\r\n | caseInsensitive<\"times by\">\r\n | caseInsensitive<\"times\">\r\n | caseInsensitive<\"multiply by\">\r\n | caseInsensitive<\"multiply\">\r\n \r\n divide\r\n = \"/\"\r\n | \"\\u{00F7}\" // ÷\r\n | caseInsensitive<\"divide by\">\r\n | caseInsensitive<\"divide\">\r\n\r\n modulo\r\n = \"%\"\r\n | caseInsensitive<\"modulo\">\r\n | caseInsensitive<\"mod\">\r\n\r\n exponent\r\n = \"^\"\r\n | caseInsensitive<\"to the power of\">\r\n | caseInsensitive<\"power of\">\r\n | caseInsensitive<\"exponent\">\r\n | caseInsensitive<\"prime\">\r\n\r\n constant \r\n \t= caseInsensitive<\"PI\"> \r\n | caseInsensitive<\"E\">\r\n\r\n number\r\n = digit* \".\" digit+ -- fract\r\n | digit+ -- whole\r\n \r\n hex\r\n = \"0x\" hexDigit+\r\n | hexDigit+ \"h\"\r\n}"},"BasicArithmetic",null,"Expression",{"Expression":["define",{"sourceInterval":[21,51]},null,[],["app",{"sourceInterval":[39,51]},"LogicalShift",[]]],"LogicalShift_left":["define",{"sourceInterval":[77,115]},null,[],["seq",{"sourceInterval":[77,107]},["app",{"sourceInterval":[77,89]},"LogicalShift",[]],["terminal",{"sourceInterval":[90,94]},"<<"],["app",{"sourceInterval":[95,107]},"LogicalShift",[]]]],"LogicalShift_right":["define",{"sourceInterval":[123,162]},null,[],["seq",{"sourceInterval":[123,153]},["app",{"sourceInterval":[123,135]},"LogicalShift",[]],["terminal",{"sourceInterval":[136,140]},">>"],["app",{"sourceInterval":[141,153]},"LogicalShift",[]]]],"LogicalShift":["define",{"sourceInterval":[57,172]},null,[],["alt",{"sourceInterval":[77,172]},["app",{"sourceInterval":[77,107]},"LogicalShift_left",[]],["app",{"sourceInterval":[123,153]},"LogicalShift_right",[]],["app",{"sourceInterval":[170,172]},"AS",[]]]],"AS_addition":["define",{"sourceInterval":[219,241]},null,[],["seq",{"sourceInterval":[219,228]},["app",{"sourceInterval":[219,221]},"AS",[]],["app",{"sourceInterval":[222,225]},"add",[]],["app",{"sourceInterval":[226,228]},"MD",[]]]],"AS_subtraction":["define",{"sourceInterval":[249,279]},null,[],["seq",{"sourceInterval":[249,263]},["app",{"sourceInterval":[249,251]},"AS",[]],["app",{"sourceInterval":[252,260]},"subtract",[]],["app",{"sourceInterval":[261,263]},"MD",[]]]],"AS":["define",{"sourceInterval":[209,289]},null,[],["alt",{"sourceInterval":[219,289]},["app",{"sourceInterval":[219,228]},"AS_addition",[]],["app",{"sourceInterval":[249,263]},"AS_subtraction",[]],["app",{"sourceInterval":[287,289]},"MD",[]]]],"MD_multiplication":["define",{"sourceInterval":[330,362]},null,[],["seq",{"sourceInterval":[330,343]},["app",{"sourceInterval":[330,332]},"MD",[]],["app",{"sourceInterval":[333,341]},"multiply",[]],["app",{"sourceInterval":[342,343]},"E",[]]]],"MD_division":["define",{"sourceInterval":[370,394]},null,[],["seq",{"sourceInterval":[370,381]},["app",{"sourceInterval":[370,372]},"MD",[]],["app",{"sourceInterval":[373,379]},"divide",[]],["app",{"sourceInterval":[380,381]},"E",[]]]],"MD_modulo":["define",{"sourceInterval":[402,424]},null,[],["seq",{"sourceInterval":[402,413]},["app",{"sourceInterval":[402,404]},"MD",[]],["app",{"sourceInterval":[405,411]},"modulo",[]],["app",{"sourceInterval":[412,413]},"E",[]]]],"MD":["define",{"sourceInterval":[320,433]},null,[],["alt",{"sourceInterval":[330,433]},["app",{"sourceInterval":[330,343]},"MD_multiplication",[]],["app",{"sourceInterval":[370,381]},"MD_division",[]],["app",{"sourceInterval":[402,413]},"MD_modulo",[]],["app",{"sourceInterval":[432,433]},"E",[]]]],"E_exponent":["define",{"sourceInterval":[463,488]},null,[],["seq",{"sourceInterval":[463,475]},["app",{"sourceInterval":[463,464]},"P",[]],["app",{"sourceInterval":[465,473]},"exponent",[]],["app",{"sourceInterval":[474,475]},"E",[]]]],"E":["define",{"sourceInterval":[454,497]},null,[],["alt",{"sourceInterval":[463,497]},["app",{"sourceInterval":[463,475]},"E_exponent",[]],["app",{"sourceInterval":[496,497]},"P",[]]]],"P_parenthesis":["define",{"sourceInterval":[530,564]},null,[],["seq",{"sourceInterval":[530,548]},["terminal",{"sourceInterval":[530,533]},"("],["app",{"sourceInterval":[534,544]},"Expression",[]],["terminal",{"sourceInterval":[545,548]},")"]]],"P":["define",{"sourceInterval":[521,581]},null,[],["alt",{"sourceInterval":[530,581]},["app",{"sourceInterval":[530,548]},"P_parenthesis",[]],["app",{"sourceInterval":[572,581]},"Primitive",[]]]],"Primitive_positive":["define",{"sourceInterval":[608,633]},null,[],["seq",{"sourceInterval":[608,621]},["terminal",{"sourceInterval":[608,611]},"+"],["app",{"sourceInterval":[612,621]},"Primitive",[]]]],"Primitive_negative":["define",{"sourceInterval":[641,666]},null,[],["seq",{"sourceInterval":[641,654]},["terminal",{"sourceInterval":[641,644]},"-"],["app",{"sourceInterval":[645,654]},"Primitive",[]]]],"Primitive":["define",{"sourceInterval":[591,707]},null,[],["alt",{"sourceInterval":[608,707]},["app",{"sourceInterval":[608,621]},"Primitive_positive",[]],["app",{"sourceInterval":[641,654]},"Primitive_negative",[]],["app",{"sourceInterval":[674,682]},"constant",[]],["app",{"sourceInterval":[690,693]},"hex",[]],["app",{"sourceInterval":[701,707]},"number",[]]]],"add":["define",{"sourceInterval":[734,838]},null,[],["alt",{"sourceInterval":[745,838]},["terminal",{"sourceInterval":[745,748]},"+"],["app",{"sourceInterval":[756,779]},"caseInsensitive",[["terminal",{"sourceInterval":[772,778]},"plus"]]],["app",{"sourceInterval":[786,808]},"caseInsensitive",[["terminal",{"sourceInterval":[802,807]},"add"]]],["app",{"sourceInterval":[816,838]},"caseInsensitive",[["terminal",{"sourceInterval":[832,837]},"and"]]]]],"subtract":["define",{"sourceInterval":[848,999]},null,[],["alt",{"sourceInterval":[865,999]},["terminal",{"sourceInterval":[865,868]},"-"],["app",{"sourceInterval":[876,900]},"caseInsensitive",[["terminal",{"sourceInterval":[892,899]},"minus"]]],["app",{"sourceInterval":[908,935]},"caseInsensitive",[["terminal",{"sourceInterval":[924,934]},"subtract"]]],["app",{"sourceInterval":[943,968]},"caseInsensitive",[["terminal",{"sourceInterval":[959,967]},"remove"]]],["app",{"sourceInterval":[976,999]},"caseInsensitive",[["terminal",{"sourceInterval":[992,998]},"take"]]]]],"multiply":["define",{"sourceInterval":[1011,1262]},null,[],["alt",{"sourceInterval":[1028,1262]},["terminal",{"sourceInterval":[1028,1031]},"*"],["terminal",{"sourceInterval":[1039,1044]},"\\*"],["terminal",{"sourceInterval":[1079,1089]},"×"],["app",{"sourceInterval":[1102,1122]},"caseInsensitive",[["terminal",{"sourceInterval":[1118,1121]},"x"]]],["app",{"sourceInterval":[1130,1157]},"caseInsensitive",[["terminal",{"sourceInterval":[1146,1156]},"times by"]]],["app",{"sourceInterval":[1165,1189]},"caseInsensitive",[["terminal",{"sourceInterval":[1181,1188]},"times"]]],["app",{"sourceInterval":[1197,1227]},"caseInsensitive",[["terminal",{"sourceInterval":[1213,1226]},"multiply by"]]],["app",{"sourceInterval":[1235,1262]},"caseInsensitive",[["terminal",{"sourceInterval":[1251,1261]},"multiply"]]]]],"divide":["define",{"sourceInterval":[1274,1383]},null,[],["alt",{"sourceInterval":[1288,1383]},["terminal",{"sourceInterval":[1288,1291]},"/"],["terminal",{"sourceInterval":[1299,1309]},"÷"],["app",{"sourceInterval":[1322,1350]},"caseInsensitive",[["terminal",{"sourceInterval":[1338,1349]},"divide by"]]],["app",{"sourceInterval":[1358,1383]},"caseInsensitive",[["terminal",{"sourceInterval":[1374,1382]},"divide"]]]]],"modulo":["define",{"sourceInterval":[1389,1469]},null,[],["alt",{"sourceInterval":[1403,1469]},["terminal",{"sourceInterval":[1403,1406]},"%"],["app",{"sourceInterval":[1414,1439]},"caseInsensitive",[["terminal",{"sourceInterval":[1430,1438]},"modulo"]]],["app",{"sourceInterval":[1447,1469]},"caseInsensitive",[["terminal",{"sourceInterval":[1463,1468]},"mod"]]]]],"exponent":["define",{"sourceInterval":[1475,1638]},null,[],["alt",{"sourceInterval":[1491,1638]},["terminal",{"sourceInterval":[1491,1494]},"^"],["app",{"sourceInterval":[1502,1536]},"caseInsensitive",[["terminal",{"sourceInterval":[1518,1535]},"to the power of"]]],["app",{"sourceInterval":[1544,1571]},"caseInsensitive",[["terminal",{"sourceInterval":[1560,1570]},"power of"]]],["app",{"sourceInterval":[1579,1606]},"caseInsensitive",[["terminal",{"sourceInterval":[1595,1605]},"exponent"]]],["app",{"sourceInterval":[1614,1638]},"caseInsensitive",[["terminal",{"sourceInterval":[1630,1637]},"prime"]]]]],"constant":["define",{"sourceInterval":[1644,1711]},null,[],["alt",{"sourceInterval":[1661,1711]},["app",{"sourceInterval":[1661,1682]},"caseInsensitive",[["terminal",{"sourceInterval":[1677,1681]},"PI"]]],["app",{"sourceInterval":[1691,1711]},"caseInsensitive",[["terminal",{"sourceInterval":[1707,1710]},"E"]]]]],"number_fract":["define",{"sourceInterval":[1731,1758]},null,[],["seq",{"sourceInterval":[1731,1748]},["star",{"sourceInterval":[1731,1737]},["app",{"sourceInterval":[1731,1736]},"digit",[]]],["terminal",{"sourceInterval":[1738,1741]},"."],["plus",{"sourceInterval":[1742,1748]},["app",{"sourceInterval":[1742,1747]},"digit",[]]]]],"number_whole":["define",{"sourceInterval":[1766,1793]},null,[],["plus",{"sourceInterval":[1766,1772]},["app",{"sourceInterval":[1766,1771]},"digit",[]]]],"number":["define",{"sourceInterval":[1717,1793]},null,[],["alt",{"sourceInterval":[1731,1793]},["app",{"sourceInterval":[1731,1748]},"number_fract",[]],["app",{"sourceInterval":[1766,1772]},"number_whole",[]]]],"hex":["define",{"sourceInterval":[1801,1847]},null,[],["alt",{"sourceInterval":[1812,1847]},["seq",{"sourceInterval":[1812,1826]},["terminal",{"sourceInterval":[1812,1816]},"0x"],["plus",{"sourceInterval":[1817,1826]},["app",{"sourceInterval":[1817,1825]},"hexDigit",[]]]],["seq",{"sourceInterval":[1834,1847]},["plus",{"sourceInterval":[1834,1843]},["app",{"sourceInterval":[1834,1842]},"hexDigit",[]]],["terminal",{"sourceInterval":[1844,1847]},"h"]]]]}]);result.Vector3Arithmetic=makeRecipe(["grammar",{"source":"Vector3Arithmetic <: BasicArithmetic {\r\n // Remove support for logical shift\r\n Expression \r\n \t:= AS\r\n\r\n P\r\n := \"(\" Expression \")\" -- parenthesis\r\n | Vector3\r\n | Function\r\n | Primitive\r\n\r\n // Remove modulo support for vector\r\n MD\r\n := MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | E\r\n\r\n Vector3\r\n = vector3? \"(\" Expression \",\" Expression \",\" Expression \")\" -- parse\r\n\r\n Function\r\n = LengthSq\r\n | DistanceSq\r\n | Length\r\n | Distance\r\n | Normalise\r\n | Dot\r\n | AngleBetween\r\n | Cross\r\n | Lerp\r\n\r\n LengthSq = lengthSq \"(\" Vector3 \")\" -- function\r\n DistanceSq = distanceSq \"(\" Vector3 \",\" Vector3 \")\" -- function\r\n Length = length \"(\" Vector3 \")\" -- function\r\n Distance = distance \"(\" Vector3 \",\" Vector3 \")\" -- function\r\n Normalise = normalise \"(\" Vector3 \")\" -- function\r\n Dot = dot \"(\" Vector3 \",\" Vector3 \")\" -- function\r\n AngleBetween = angleBetween \"(\" Vector3 \",\" Vector3 \")\" -- function\r\n Cross = cross \"(\" Vector3 \",\" Vector3 \")\" -- function\r\n Lerp = lerp \"(\" Vector3 \",\" Vector3 \",\" number \")\" -- function\r\n\r\n vector3 \r\n \t = caseInsensitive<\"Vector3\">\r\n | caseInsensitive<\"Vec3\">\r\n\r\n lengthSq \r\n \t = caseInsensitive<\"lengthSq\">\r\n | caseInsensitive<\"magnitudeSq\">\r\n\r\n distanceSq\r\n = caseInsensitive<\"distanceSq\">\r\n\r\n length\r\n \t = caseInsensitive<\"length\">\r\n | caseInsensitive<\"magnitude\">\r\n\r\n distance\r\n = caseInsensitive<\"distance\">\r\n\r\n normalise \r\n \t = caseInsensitive<\"normalise\">\r\n \t | caseInsensitive<\"normalize\">\r\n\r\n dot\r\n = caseInsensitive<\"dotproduct\">\r\n | caseInsensitive<\"dot\">\r\n\r\n angleBetween\r\n = caseInsensitive<\"angleBetween\">\r\n\r\n cross\r\n = caseInsensitive<\"crossproduct\">\r\n | caseInsensitive<\"cross\">\r\n\r\n lerp\r\n = caseInsensitive<\"lerp\">\r\n}"},"Vector3Arithmetic",result.BasicArithmetic,"Expression",{"Expression":["override",{"sourceInterval":[81,103]},null,[],["app",{"sourceInterval":[101,103]},"AS",[]]],"P_parenthesis":["override",{"sourceInterval":[119,153]},null,[],["seq",{"sourceInterval":[119,137]},["terminal",{"sourceInterval":[119,122]},"("],["app",{"sourceInterval":[123,133]},"Expression",[]],["terminal",{"sourceInterval":[134,137]},")"]]],"P":["override",{"sourceInterval":[109,201]},null,[],["alt",{"sourceInterval":[119,201]},["app",{"sourceInterval":[119,137]},"P_parenthesis",[]],["app",{"sourceInterval":[161,168]},"Vector3",[]],["app",{"sourceInterval":[176,184]},"Function",[]],["app",{"sourceInterval":[192,201]},"Primitive",[]]]],"MD_multiplication":["override",{"sourceInterval":[257,289]},null,[],["seq",{"sourceInterval":[257,270]},["app",{"sourceInterval":[257,259]},"MD",[]],["app",{"sourceInterval":[260,268]},"multiply",[]],["app",{"sourceInterval":[269,270]},"E",[]]]],"MD_division":["override",{"sourceInterval":[297,321]},null,[],["seq",{"sourceInterval":[297,308]},["app",{"sourceInterval":[297,299]},"MD",[]],["app",{"sourceInterval":[300,306]},"divide",[]],["app",{"sourceInterval":[307,308]},"E",[]]]],"MD":["override",{"sourceInterval":[246,330]},null,[],["alt",{"sourceInterval":[257,330]},["app",{"sourceInterval":[257,270]},"MD_multiplication",[]],["app",{"sourceInterval":[297,308]},"MD_division",[]],["app",{"sourceInterval":[329,330]},"E",[]]]],"Vector3_parse":["define",{"sourceInterval":[351,417]},null,[],["seq",{"sourceInterval":[351,408]},["opt",{"sourceInterval":[351,359]},["app",{"sourceInterval":[351,358]},"vector3",[]]],["terminal",{"sourceInterval":[360,363]},"("],["app",{"sourceInterval":[364,374]},"Expression",[]],["terminal",{"sourceInterval":[375,378]},","],["app",{"sourceInterval":[379,389]},"Expression",[]],["terminal",{"sourceInterval":[390,393]},","],["app",{"sourceInterval":[394,404]},"Expression",[]],["terminal",{"sourceInterval":[405,408]},")"]]],"Vector3":["define",{"sourceInterval":[336,417]},null,[],["app",{"sourceInterval":[351,417]},"Vector3_parse",[]]],"Function":["define",{"sourceInterval":[423,559]},null,[],["alt",{"sourceInterval":[438,559]},["app",{"sourceInterval":[438,446]},"LengthSq",[]],["app",{"sourceInterval":[453,463]},"DistanceSq",[]],["app",{"sourceInterval":[470,476]},"Length",[]],["app",{"sourceInterval":[483,491]},"Distance",[]],["app",{"sourceInterval":[498,507]},"Normalise",[]],["app",{"sourceInterval":[514,517]},"Dot",[]],["app",{"sourceInterval":[524,536]},"AngleBetween",[]],["app",{"sourceInterval":[543,548]},"Cross",[]],["app",{"sourceInterval":[555,559]},"Lerp",[]]]],"LengthSq_function":["define",{"sourceInterval":[577,613]},null,[],["seq",{"sourceInterval":[577,601]},["app",{"sourceInterval":[577,585]},"lengthSq",[]],["terminal",{"sourceInterval":[586,589]},"("],["app",{"sourceInterval":[590,597]},"Vector3",[]],["terminal",{"sourceInterval":[598,601]},")"]]],"LengthSq":["define",{"sourceInterval":[565,613]},null,[],["app",{"sourceInterval":[577,613]},"LengthSq_function",[]]],"DistanceSq_function":["define",{"sourceInterval":[631,681]},null,[],["seq",{"sourceInterval":[631,669]},["app",{"sourceInterval":[631,641]},"distanceSq",[]],["terminal",{"sourceInterval":[642,645]},"("],["app",{"sourceInterval":[646,653]},"Vector3",[]],["terminal",{"sourceInterval":[654,657]},","],["app",{"sourceInterval":[658,665]},"Vector3",[]],["terminal",{"sourceInterval":[666,669]},")"]]],"DistanceSq":["define",{"sourceInterval":[617,681]},null,[],["app",{"sourceInterval":[631,681]},"DistanceSq_function",[]]],"Length_function":["define",{"sourceInterval":[695,729]},null,[],["seq",{"sourceInterval":[695,717]},["app",{"sourceInterval":[695,701]},"length",[]],["terminal",{"sourceInterval":[702,705]},"("],["app",{"sourceInterval":[706,713]},"Vector3",[]],["terminal",{"sourceInterval":[714,717]},")"]]],"Length":["define",{"sourceInterval":[685,729]},null,[],["app",{"sourceInterval":[695,729]},"Length_function",[]]],"Distance_function":["define",{"sourceInterval":[745,793]},null,[],["seq",{"sourceInterval":[745,781]},["app",{"sourceInterval":[745,753]},"distance",[]],["terminal",{"sourceInterval":[754,757]},"("],["app",{"sourceInterval":[758,765]},"Vector3",[]],["terminal",{"sourceInterval":[766,769]},","],["app",{"sourceInterval":[770,777]},"Vector3",[]],["terminal",{"sourceInterval":[778,781]},")"]]],"Distance":["define",{"sourceInterval":[733,793]},null,[],["app",{"sourceInterval":[745,793]},"Distance_function",[]]],"Normalise_function":["define",{"sourceInterval":[809,846]},null,[],["seq",{"sourceInterval":[809,834]},["app",{"sourceInterval":[809,818]},"normalise",[]],["terminal",{"sourceInterval":[819,822]},"("],["app",{"sourceInterval":[823,830]},"Vector3",[]],["terminal",{"sourceInterval":[831,834]},")"]]],"Normalise":["define",{"sourceInterval":[797,846]},null,[],["app",{"sourceInterval":[809,846]},"Normalise_function",[]]],"Dot_function":["define",{"sourceInterval":[856,899]},null,[],["seq",{"sourceInterval":[856,887]},["app",{"sourceInterval":[856,859]},"dot",[]],["terminal",{"sourceInterval":[860,863]},"("],["app",{"sourceInterval":[864,871]},"Vector3",[]],["terminal",{"sourceInterval":[872,875]},","],["app",{"sourceInterval":[876,883]},"Vector3",[]],["terminal",{"sourceInterval":[884,887]},")"]]],"Dot":["define",{"sourceInterval":[850,899]},null,[],["app",{"sourceInterval":[856,899]},"Dot_function",[]]],"AngleBetween_function":["define",{"sourceInterval":[918,970]},null,[],["seq",{"sourceInterval":[918,958]},["app",{"sourceInterval":[918,930]},"angleBetween",[]],["terminal",{"sourceInterval":[931,934]},"("],["app",{"sourceInterval":[935,942]},"Vector3",[]],["terminal",{"sourceInterval":[943,946]},","],["app",{"sourceInterval":[947,954]},"Vector3",[]],["terminal",{"sourceInterval":[955,958]},")"]]],"AngleBetween":["define",{"sourceInterval":[903,970]},null,[],["app",{"sourceInterval":[918,970]},"AngleBetween_function",[]]],"Cross_function":["define",{"sourceInterval":[982,1027]},null,[],["seq",{"sourceInterval":[982,1015]},["app",{"sourceInterval":[982,987]},"cross",[]],["terminal",{"sourceInterval":[988,991]},"("],["app",{"sourceInterval":[992,999]},"Vector3",[]],["terminal",{"sourceInterval":[1000,1003]},","],["app",{"sourceInterval":[1004,1011]},"Vector3",[]],["terminal",{"sourceInterval":[1012,1015]},")"]]],"Cross":["define",{"sourceInterval":[974,1027]},null,[],["app",{"sourceInterval":[982,1027]},"Cross_function",[]]],"Lerp_function":["define",{"sourceInterval":[1038,1093]},null,[],["seq",{"sourceInterval":[1038,1081]},["app",{"sourceInterval":[1038,1042]},"lerp",[]],["terminal",{"sourceInterval":[1043,1046]},"("],["app",{"sourceInterval":[1047,1054]},"Vector3",[]],["terminal",{"sourceInterval":[1055,1058]},","],["app",{"sourceInterval":[1059,1066]},"Vector3",[]],["terminal",{"sourceInterval":[1067,1070]},","],["app",{"sourceInterval":[1071,1077]},"number",[]],["terminal",{"sourceInterval":[1078,1081]},")"]]],"Lerp":["define",{"sourceInterval":[1031,1093]},null,[],["app",{"sourceInterval":[1038,1093]},"Lerp_function",[]]],"vector3":["define",{"sourceInterval":[1099,1172]},null,[],["alt",{"sourceInterval":[1115,1172]},["app",{"sourceInterval":[1115,1141]},"caseInsensitive",[["terminal",{"sourceInterval":[1131,1140]},"Vector3"]]],["app",{"sourceInterval":[1149,1172]},"caseInsensitive",[["terminal",{"sourceInterval":[1165,1171]},"Vec3"]]]]],"lengthSq":["define",{"sourceInterval":[1178,1260]},null,[],["alt",{"sourceInterval":[1195,1260]},["app",{"sourceInterval":[1195,1222]},"caseInsensitive",[["terminal",{"sourceInterval":[1211,1221]},"lengthSq"]]],["app",{"sourceInterval":[1230,1260]},"caseInsensitive",[["terminal",{"sourceInterval":[1246,1259]},"magnitudeSq"]]]]],"distanceSq":["define",{"sourceInterval":[1266,1313]},null,[],["app",{"sourceInterval":[1284,1313]},"caseInsensitive",[["terminal",{"sourceInterval":[1300,1312]},"distanceSq"]]]],"length":["define",{"sourceInterval":[1319,1394]},null,[],["alt",{"sourceInterval":[1333,1394]},["app",{"sourceInterval":[1333,1358]},"caseInsensitive",[["terminal",{"sourceInterval":[1349,1357]},"length"]]],["app",{"sourceInterval":[1366,1394]},"caseInsensitive",[["terminal",{"sourceInterval":[1382,1393]},"magnitude"]]]]],"distance":["define",{"sourceInterval":[1400,1443]},null,[],["app",{"sourceInterval":[1416,1443]},"caseInsensitive",[["terminal",{"sourceInterval":[1432,1442]},"distance"]]]],"normalise":["define",{"sourceInterval":[1449,1531]},null,[],["alt",{"sourceInterval":[1467,1531]},["app",{"sourceInterval":[1467,1495]},"caseInsensitive",[["terminal",{"sourceInterval":[1483,1494]},"normalise"]]],["app",{"sourceInterval":[1503,1531]},"caseInsensitive",[["terminal",{"sourceInterval":[1519,1530]},"normalize"]]]]],"dot":["define",{"sourceInterval":[1537,1607]},null,[],["alt",{"sourceInterval":[1548,1607]},["app",{"sourceInterval":[1548,1577]},"caseInsensitive",[["terminal",{"sourceInterval":[1564,1576]},"dotproduct"]]],["app",{"sourceInterval":[1585,1607]},"caseInsensitive",[["terminal",{"sourceInterval":[1601,1606]},"dot"]]]]],"angleBetween":["define",{"sourceInterval":[1613,1664]},null,[],["app",{"sourceInterval":[1633,1664]},"caseInsensitive",[["terminal",{"sourceInterval":[1649,1663]},"angleBetween"]]]],"cross":["define",{"sourceInterval":[1670,1746]},null,[],["alt",{"sourceInterval":[1683,1746]},["app",{"sourceInterval":[1683,1714]},"caseInsensitive",[["terminal",{"sourceInterval":[1699,1713]},"crossproduct"]]],["app",{"sourceInterval":[1722,1746]},"caseInsensitive",[["terminal",{"sourceInterval":[1738,1745]},"cross"]]]]],"lerp":["define",{"sourceInterval":[1752,1787]},null,[],["app",{"sourceInterval":[1764,1787]},"caseInsensitive",[["terminal",{"sourceInterval":[1780,1786]},"lerp"]]]]}]);module.exports=result; \ No newline at end of file diff --git a/src/grammars/vector/Vector4Arithmetic.ohm-bundle.js b/src/grammars/vector/Vector4Arithmetic.ohm-bundle.js index 3d75a67..6248c32 100644 --- a/src/grammars/vector/Vector4Arithmetic.ohm-bundle.js +++ b/src/grammars/vector/Vector4Arithmetic.ohm-bundle.js @@ -1 +1 @@ -'use strict';const {makeRecipe}=require('ohm-js');const result={};result.BasicArithmetic=makeRecipe(["grammar",{"source":"BasicArithmetic {\r\n Expression\r\n = LogicalShift\r\n\r\n LogicalShift\r\n = LogicalShift \"<<\" LogicalShift -- left\r\n | LogicalShift \">>\" LogicalShift -- right\r\n | AS \r\n\r\n // Addition or Subtraction\r\n AS\r\n = AS add MD -- addition\r\n | AS subtract MD -- subtraction\r\n | MD\r\n\r\n // Multiply or Divide\r\n MD\r\n = MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | MD modulo E -- modulo\r\n | E\r\n\r\n // Exponent\r\n E\r\n = P exponent E -- exponent\r\n | P\r\n\r\n // Parenthesis\r\n P\r\n = \"(\" Expression \")\" -- parenthesis\r\n | Primitive\r\n \r\n Primitive\r\n = \"+\" Primitive -- positive\r\n | \"-\" Primitive -- negative\r\n | constant\r\n | hex\r\n | number\r\n \r\n // Lexical Rules\r\n add \r\n \t= \"+\"\r\n | caseInsensitive<\"plus\">\r\n \t| caseInsensitive<\"add\">\r\n | caseInsensitive<\"and\">\r\n \r\n subtract \r\n = \"-\"\r\n | caseInsensitive<\"minus\">\r\n | caseInsensitive<\"subtract\">\r\n | caseInsensitive<\"remove\">\r\n | caseInsensitive<\"take\">\r\n \r\n multiply \r\n = \"*\"\r\n | \"\\\\*\" // Escaped e.g. \\* for markdown\r\n | \"\\u{00D7}\" // Multiplication Symbol ×\r\n | caseInsensitive<\"x\">\r\n | caseInsensitive<\"times by\">\r\n | caseInsensitive<\"times\">\r\n | caseInsensitive<\"multiply by\">\r\n | caseInsensitive<\"multiply\">\r\n \r\n divide\r\n = \"/\"\r\n | \"\\u{00F7}\" // Division Symbol ÷\r\n | caseInsensitive<\"divide by\">\r\n | caseInsensitive<\"divide\">\r\n\r\n modulo\r\n = \"%\"\r\n | caseInsensitive<\"modulo\">\r\n | caseInsensitive<\"mod\">\r\n\r\n exponent\r\n = \"^\"\r\n | caseInsensitive<\"to the power of\">\r\n | caseInsensitive<\"power of\">\r\n | caseInsensitive<\"exponent\">\r\n | caseInsensitive<\"prime\">\r\n\r\n constant \r\n \t= caseInsensitive<\"PI\"> \r\n | caseInsensitive<\"E\">\r\n\r\n number\r\n = digit* \".\" digit+ -- fract\r\n | digit+ -- whole\r\n \r\n hex\r\n = \"0x\" hexDigit+\r\n | hexDigit+ \"h\"\r\n}"},"BasicArithmetic",null,"Expression",{"Expression":["define",{"sourceInterval":[21,51]},null,[],["app",{"sourceInterval":[39,51]},"LogicalShift",[]]],"LogicalShift_left":["define",{"sourceInterval":[77,115]},null,[],["seq",{"sourceInterval":[77,107]},["app",{"sourceInterval":[77,89]},"LogicalShift",[]],["terminal",{"sourceInterval":[90,94]},"<<"],["app",{"sourceInterval":[95,107]},"LogicalShift",[]]]],"LogicalShift_right":["define",{"sourceInterval":[123,162]},null,[],["seq",{"sourceInterval":[123,153]},["app",{"sourceInterval":[123,135]},"LogicalShift",[]],["terminal",{"sourceInterval":[136,140]},">>"],["app",{"sourceInterval":[141,153]},"LogicalShift",[]]]],"LogicalShift":["define",{"sourceInterval":[57,172]},null,[],["alt",{"sourceInterval":[77,172]},["app",{"sourceInterval":[77,107]},"LogicalShift_left",[]],["app",{"sourceInterval":[123,153]},"LogicalShift_right",[]],["app",{"sourceInterval":[170,172]},"AS",[]]]],"AS_addition":["define",{"sourceInterval":[219,241]},null,[],["seq",{"sourceInterval":[219,228]},["app",{"sourceInterval":[219,221]},"AS",[]],["app",{"sourceInterval":[222,225]},"add",[]],["app",{"sourceInterval":[226,228]},"MD",[]]]],"AS_subtraction":["define",{"sourceInterval":[249,279]},null,[],["seq",{"sourceInterval":[249,263]},["app",{"sourceInterval":[249,251]},"AS",[]],["app",{"sourceInterval":[252,260]},"subtract",[]],["app",{"sourceInterval":[261,263]},"MD",[]]]],"AS":["define",{"sourceInterval":[209,289]},null,[],["alt",{"sourceInterval":[219,289]},["app",{"sourceInterval":[219,228]},"AS_addition",[]],["app",{"sourceInterval":[249,263]},"AS_subtraction",[]],["app",{"sourceInterval":[287,289]},"MD",[]]]],"MD_multiplication":["define",{"sourceInterval":[330,362]},null,[],["seq",{"sourceInterval":[330,343]},["app",{"sourceInterval":[330,332]},"MD",[]],["app",{"sourceInterval":[333,341]},"multiply",[]],["app",{"sourceInterval":[342,343]},"E",[]]]],"MD_division":["define",{"sourceInterval":[370,394]},null,[],["seq",{"sourceInterval":[370,381]},["app",{"sourceInterval":[370,372]},"MD",[]],["app",{"sourceInterval":[373,379]},"divide",[]],["app",{"sourceInterval":[380,381]},"E",[]]]],"MD_modulo":["define",{"sourceInterval":[402,424]},null,[],["seq",{"sourceInterval":[402,413]},["app",{"sourceInterval":[402,404]},"MD",[]],["app",{"sourceInterval":[405,411]},"modulo",[]],["app",{"sourceInterval":[412,413]},"E",[]]]],"MD":["define",{"sourceInterval":[320,433]},null,[],["alt",{"sourceInterval":[330,433]},["app",{"sourceInterval":[330,343]},"MD_multiplication",[]],["app",{"sourceInterval":[370,381]},"MD_division",[]],["app",{"sourceInterval":[402,413]},"MD_modulo",[]],["app",{"sourceInterval":[432,433]},"E",[]]]],"E_exponent":["define",{"sourceInterval":[463,488]},null,[],["seq",{"sourceInterval":[463,475]},["app",{"sourceInterval":[463,464]},"P",[]],["app",{"sourceInterval":[465,473]},"exponent",[]],["app",{"sourceInterval":[474,475]},"E",[]]]],"E":["define",{"sourceInterval":[454,497]},null,[],["alt",{"sourceInterval":[463,497]},["app",{"sourceInterval":[463,475]},"E_exponent",[]],["app",{"sourceInterval":[496,497]},"P",[]]]],"P_parenthesis":["define",{"sourceInterval":[530,564]},null,[],["seq",{"sourceInterval":[530,548]},["terminal",{"sourceInterval":[530,533]},"("],["app",{"sourceInterval":[534,544]},"Expression",[]],["terminal",{"sourceInterval":[545,548]},")"]]],"P":["define",{"sourceInterval":[521,581]},null,[],["alt",{"sourceInterval":[530,581]},["app",{"sourceInterval":[530,548]},"P_parenthesis",[]],["app",{"sourceInterval":[572,581]},"Primitive",[]]]],"Primitive_positive":["define",{"sourceInterval":[608,633]},null,[],["seq",{"sourceInterval":[608,621]},["terminal",{"sourceInterval":[608,611]},"+"],["app",{"sourceInterval":[612,621]},"Primitive",[]]]],"Primitive_negative":["define",{"sourceInterval":[641,666]},null,[],["seq",{"sourceInterval":[641,654]},["terminal",{"sourceInterval":[641,644]},"-"],["app",{"sourceInterval":[645,654]},"Primitive",[]]]],"Primitive":["define",{"sourceInterval":[591,707]},null,[],["alt",{"sourceInterval":[608,707]},["app",{"sourceInterval":[608,621]},"Primitive_positive",[]],["app",{"sourceInterval":[641,654]},"Primitive_negative",[]],["app",{"sourceInterval":[674,682]},"constant",[]],["app",{"sourceInterval":[690,693]},"hex",[]],["app",{"sourceInterval":[701,707]},"number",[]]]],"add":["define",{"sourceInterval":[734,838]},null,[],["alt",{"sourceInterval":[745,838]},["terminal",{"sourceInterval":[745,748]},"+"],["app",{"sourceInterval":[756,779]},"caseInsensitive",[["terminal",{"sourceInterval":[772,778]},"plus"]]],["app",{"sourceInterval":[786,808]},"caseInsensitive",[["terminal",{"sourceInterval":[802,807]},"add"]]],["app",{"sourceInterval":[816,838]},"caseInsensitive",[["terminal",{"sourceInterval":[832,837]},"and"]]]]],"subtract":["define",{"sourceInterval":[848,999]},null,[],["alt",{"sourceInterval":[865,999]},["terminal",{"sourceInterval":[865,868]},"-"],["app",{"sourceInterval":[876,900]},"caseInsensitive",[["terminal",{"sourceInterval":[892,899]},"minus"]]],["app",{"sourceInterval":[908,935]},"caseInsensitive",[["terminal",{"sourceInterval":[924,934]},"subtract"]]],["app",{"sourceInterval":[943,968]},"caseInsensitive",[["terminal",{"sourceInterval":[959,967]},"remove"]]],["app",{"sourceInterval":[976,999]},"caseInsensitive",[["terminal",{"sourceInterval":[992,998]},"take"]]]]],"multiply":["define",{"sourceInterval":[1011,1289]},null,[],["alt",{"sourceInterval":[1028,1289]},["terminal",{"sourceInterval":[1028,1031]},"*"],["terminal",{"sourceInterval":[1039,1044]},"\\*"],["terminal",{"sourceInterval":[1084,1094]},"×"],["app",{"sourceInterval":[1129,1149]},"caseInsensitive",[["terminal",{"sourceInterval":[1145,1148]},"x"]]],["app",{"sourceInterval":[1157,1184]},"caseInsensitive",[["terminal",{"sourceInterval":[1173,1183]},"times by"]]],["app",{"sourceInterval":[1192,1216]},"caseInsensitive",[["terminal",{"sourceInterval":[1208,1215]},"times"]]],["app",{"sourceInterval":[1224,1254]},"caseInsensitive",[["terminal",{"sourceInterval":[1240,1253]},"multiply by"]]],["app",{"sourceInterval":[1262,1289]},"caseInsensitive",[["terminal",{"sourceInterval":[1278,1288]},"multiply"]]]]],"divide":["define",{"sourceInterval":[1301,1426]},null,[],["alt",{"sourceInterval":[1315,1426]},["terminal",{"sourceInterval":[1315,1318]},"/"],["terminal",{"sourceInterval":[1326,1336]},"÷"],["app",{"sourceInterval":[1365,1393]},"caseInsensitive",[["terminal",{"sourceInterval":[1381,1392]},"divide by"]]],["app",{"sourceInterval":[1401,1426]},"caseInsensitive",[["terminal",{"sourceInterval":[1417,1425]},"divide"]]]]],"modulo":["define",{"sourceInterval":[1432,1512]},null,[],["alt",{"sourceInterval":[1446,1512]},["terminal",{"sourceInterval":[1446,1449]},"%"],["app",{"sourceInterval":[1457,1482]},"caseInsensitive",[["terminal",{"sourceInterval":[1473,1481]},"modulo"]]],["app",{"sourceInterval":[1490,1512]},"caseInsensitive",[["terminal",{"sourceInterval":[1506,1511]},"mod"]]]]],"exponent":["define",{"sourceInterval":[1518,1681]},null,[],["alt",{"sourceInterval":[1534,1681]},["terminal",{"sourceInterval":[1534,1537]},"^"],["app",{"sourceInterval":[1545,1579]},"caseInsensitive",[["terminal",{"sourceInterval":[1561,1578]},"to the power of"]]],["app",{"sourceInterval":[1587,1614]},"caseInsensitive",[["terminal",{"sourceInterval":[1603,1613]},"power of"]]],["app",{"sourceInterval":[1622,1649]},"caseInsensitive",[["terminal",{"sourceInterval":[1638,1648]},"exponent"]]],["app",{"sourceInterval":[1657,1681]},"caseInsensitive",[["terminal",{"sourceInterval":[1673,1680]},"prime"]]]]],"constant":["define",{"sourceInterval":[1687,1754]},null,[],["alt",{"sourceInterval":[1704,1754]},["app",{"sourceInterval":[1704,1725]},"caseInsensitive",[["terminal",{"sourceInterval":[1720,1724]},"PI"]]],["app",{"sourceInterval":[1734,1754]},"caseInsensitive",[["terminal",{"sourceInterval":[1750,1753]},"E"]]]]],"number_fract":["define",{"sourceInterval":[1774,1801]},null,[],["seq",{"sourceInterval":[1774,1791]},["star",{"sourceInterval":[1774,1780]},["app",{"sourceInterval":[1774,1779]},"digit",[]]],["terminal",{"sourceInterval":[1781,1784]},"."],["plus",{"sourceInterval":[1785,1791]},["app",{"sourceInterval":[1785,1790]},"digit",[]]]]],"number_whole":["define",{"sourceInterval":[1809,1836]},null,[],["plus",{"sourceInterval":[1809,1815]},["app",{"sourceInterval":[1809,1814]},"digit",[]]]],"number":["define",{"sourceInterval":[1760,1836]},null,[],["alt",{"sourceInterval":[1774,1836]},["app",{"sourceInterval":[1774,1791]},"number_fract",[]],["app",{"sourceInterval":[1809,1815]},"number_whole",[]]]],"hex":["define",{"sourceInterval":[1844,1890]},null,[],["alt",{"sourceInterval":[1855,1890]},["seq",{"sourceInterval":[1855,1869]},["terminal",{"sourceInterval":[1855,1859]},"0x"],["plus",{"sourceInterval":[1860,1869]},["app",{"sourceInterval":[1860,1868]},"hexDigit",[]]]],["seq",{"sourceInterval":[1877,1890]},["plus",{"sourceInterval":[1877,1886]},["app",{"sourceInterval":[1877,1885]},"hexDigit",[]]],["terminal",{"sourceInterval":[1887,1890]},"h"]]]]}]);result.Vector4Arithmetic=makeRecipe(["grammar",{"source":"Vector4Arithmetic <: BasicArithmetic {\r\n // Remove support for logical shift\r\n Expression \r\n \t:= AS\r\n\r\n P\r\n := \"(\" Expression \")\" -- parenthesis\r\n | Vector4\r\n | Function\r\n | Primitive\r\n\r\n // Remove modulo support for vector\r\n MD\r\n := MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | E\r\n\r\n Vector4\r\n = vector4? \"(\" Expression \",\" Expression \",\" Expression \",\" Expression \")\" -- parse\r\n\r\n Function\r\n = LengthSq\r\n | DistanceSq\r\n | Length\r\n | Distance\r\n | Normalise\r\n | Dot\r\n | AngleBetween\r\n | Lerp\r\n\r\n LengthSq = lengthSq \"(\" Vector4 \")\" -- function\r\n DistanceSq = distanceSq \"(\" Vector4 \",\" Vector4 \")\" -- function\r\n Length = length \"(\" Vector4 \")\" -- function\r\n Distance = distance \"(\" Vector4 \",\" Vector4 \")\" -- function\r\n Normalise = normalise \"(\" Vector4 \")\" -- function\r\n Dot = dot \"(\" Vector4 \",\" Vector4 \")\" -- function\r\n AngleBetween = angleBetween \"(\" Vector4 \",\" Vector4 \")\" -- function\r\n Lerp = lerp \"(\" Vector4 \",\" Vector4 \",\" number \")\" -- function\r\n\r\n vector4 \r\n \t = caseInsensitive<\"Vector4\">\r\n | caseInsensitive<\"Vec4\">\r\n\r\n lengthSq \r\n \t = caseInsensitive<\"lengthSq\">\r\n | caseInsensitive<\"magnitudeSq\">\r\n\r\n distanceSq\r\n = caseInsensitive<\"distanceSq\">\r\n\r\n length\r\n \t = caseInsensitive<\"length\">\r\n | caseInsensitive<\"magnitude\">\r\n\r\n distance\r\n = caseInsensitive<\"distance\">\r\n\r\n normalise \r\n \t = caseInsensitive<\"normalise\">\r\n \t | caseInsensitive<\"normalize\">\r\n\r\n dot\r\n = caseInsensitive<\"dotproduct\">\r\n | caseInsensitive<\"dot\">\r\n\r\n angleBetween\r\n = caseInsensitive<\"angleBetween\">\r\n\r\n lerp\r\n = caseInsensitive<\"lerp\">\r\n}"},"Vector4Arithmetic",result.BasicArithmetic,"Expression",{"Expression":["override",{"sourceInterval":[81,103]},null,[],["app",{"sourceInterval":[101,103]},"AS",[]]],"P_parenthesis":["override",{"sourceInterval":[119,153]},null,[],["seq",{"sourceInterval":[119,137]},["terminal",{"sourceInterval":[119,122]},"("],["app",{"sourceInterval":[123,133]},"Expression",[]],["terminal",{"sourceInterval":[134,137]},")"]]],"P":["override",{"sourceInterval":[109,201]},null,[],["alt",{"sourceInterval":[119,201]},["app",{"sourceInterval":[119,137]},"P_parenthesis",[]],["app",{"sourceInterval":[161,168]},"Vector4",[]],["app",{"sourceInterval":[176,184]},"Function",[]],["app",{"sourceInterval":[192,201]},"Primitive",[]]]],"MD_multiplication":["override",{"sourceInterval":[257,289]},null,[],["seq",{"sourceInterval":[257,270]},["app",{"sourceInterval":[257,259]},"MD",[]],["app",{"sourceInterval":[260,268]},"multiply",[]],["app",{"sourceInterval":[269,270]},"E",[]]]],"MD_division":["override",{"sourceInterval":[297,321]},null,[],["seq",{"sourceInterval":[297,308]},["app",{"sourceInterval":[297,299]},"MD",[]],["app",{"sourceInterval":[300,306]},"divide",[]],["app",{"sourceInterval":[307,308]},"E",[]]]],"MD":["override",{"sourceInterval":[246,330]},null,[],["alt",{"sourceInterval":[257,330]},["app",{"sourceInterval":[257,270]},"MD_multiplication",[]],["app",{"sourceInterval":[297,308]},"MD_division",[]],["app",{"sourceInterval":[329,330]},"E",[]]]],"Vector4_parse":["define",{"sourceInterval":[351,432]},null,[],["seq",{"sourceInterval":[351,423]},["opt",{"sourceInterval":[351,359]},["app",{"sourceInterval":[351,358]},"vector4",[]]],["terminal",{"sourceInterval":[360,363]},"("],["app",{"sourceInterval":[364,374]},"Expression",[]],["terminal",{"sourceInterval":[375,378]},","],["app",{"sourceInterval":[379,389]},"Expression",[]],["terminal",{"sourceInterval":[390,393]},","],["app",{"sourceInterval":[394,404]},"Expression",[]],["terminal",{"sourceInterval":[405,408]},","],["app",{"sourceInterval":[409,419]},"Expression",[]],["terminal",{"sourceInterval":[420,423]},")"]]],"Vector4":["define",{"sourceInterval":[336,432]},null,[],["app",{"sourceInterval":[351,432]},"Vector4_parse",[]]],"Function":["define",{"sourceInterval":[438,562]},null,[],["alt",{"sourceInterval":[453,562]},["app",{"sourceInterval":[453,461]},"LengthSq",[]],["app",{"sourceInterval":[468,478]},"DistanceSq",[]],["app",{"sourceInterval":[485,491]},"Length",[]],["app",{"sourceInterval":[498,506]},"Distance",[]],["app",{"sourceInterval":[513,522]},"Normalise",[]],["app",{"sourceInterval":[529,532]},"Dot",[]],["app",{"sourceInterval":[539,551]},"AngleBetween",[]],["app",{"sourceInterval":[558,562]},"Lerp",[]]]],"LengthSq_function":["define",{"sourceInterval":[580,616]},null,[],["seq",{"sourceInterval":[580,604]},["app",{"sourceInterval":[580,588]},"lengthSq",[]],["terminal",{"sourceInterval":[589,592]},"("],["app",{"sourceInterval":[593,600]},"Vector4",[]],["terminal",{"sourceInterval":[601,604]},")"]]],"LengthSq":["define",{"sourceInterval":[568,616]},null,[],["app",{"sourceInterval":[580,616]},"LengthSq_function",[]]],"DistanceSq_function":["define",{"sourceInterval":[634,684]},null,[],["seq",{"sourceInterval":[634,672]},["app",{"sourceInterval":[634,644]},"distanceSq",[]],["terminal",{"sourceInterval":[645,648]},"("],["app",{"sourceInterval":[649,656]},"Vector4",[]],["terminal",{"sourceInterval":[657,660]},","],["app",{"sourceInterval":[661,668]},"Vector4",[]],["terminal",{"sourceInterval":[669,672]},")"]]],"DistanceSq":["define",{"sourceInterval":[620,684]},null,[],["app",{"sourceInterval":[634,684]},"DistanceSq_function",[]]],"Length_function":["define",{"sourceInterval":[698,732]},null,[],["seq",{"sourceInterval":[698,720]},["app",{"sourceInterval":[698,704]},"length",[]],["terminal",{"sourceInterval":[705,708]},"("],["app",{"sourceInterval":[709,716]},"Vector4",[]],["terminal",{"sourceInterval":[717,720]},")"]]],"Length":["define",{"sourceInterval":[688,732]},null,[],["app",{"sourceInterval":[698,732]},"Length_function",[]]],"Distance_function":["define",{"sourceInterval":[748,796]},null,[],["seq",{"sourceInterval":[748,784]},["app",{"sourceInterval":[748,756]},"distance",[]],["terminal",{"sourceInterval":[757,760]},"("],["app",{"sourceInterval":[761,768]},"Vector4",[]],["terminal",{"sourceInterval":[769,772]},","],["app",{"sourceInterval":[773,780]},"Vector4",[]],["terminal",{"sourceInterval":[781,784]},")"]]],"Distance":["define",{"sourceInterval":[736,796]},null,[],["app",{"sourceInterval":[748,796]},"Distance_function",[]]],"Normalise_function":["define",{"sourceInterval":[812,849]},null,[],["seq",{"sourceInterval":[812,837]},["app",{"sourceInterval":[812,821]},"normalise",[]],["terminal",{"sourceInterval":[822,825]},"("],["app",{"sourceInterval":[826,833]},"Vector4",[]],["terminal",{"sourceInterval":[834,837]},")"]]],"Normalise":["define",{"sourceInterval":[800,849]},null,[],["app",{"sourceInterval":[812,849]},"Normalise_function",[]]],"Dot_function":["define",{"sourceInterval":[859,902]},null,[],["seq",{"sourceInterval":[859,890]},["app",{"sourceInterval":[859,862]},"dot",[]],["terminal",{"sourceInterval":[863,866]},"("],["app",{"sourceInterval":[867,874]},"Vector4",[]],["terminal",{"sourceInterval":[875,878]},","],["app",{"sourceInterval":[879,886]},"Vector4",[]],["terminal",{"sourceInterval":[887,890]},")"]]],"Dot":["define",{"sourceInterval":[853,902]},null,[],["app",{"sourceInterval":[859,902]},"Dot_function",[]]],"AngleBetween_function":["define",{"sourceInterval":[921,973]},null,[],["seq",{"sourceInterval":[921,961]},["app",{"sourceInterval":[921,933]},"angleBetween",[]],["terminal",{"sourceInterval":[934,937]},"("],["app",{"sourceInterval":[938,945]},"Vector4",[]],["terminal",{"sourceInterval":[946,949]},","],["app",{"sourceInterval":[950,957]},"Vector4",[]],["terminal",{"sourceInterval":[958,961]},")"]]],"AngleBetween":["define",{"sourceInterval":[906,973]},null,[],["app",{"sourceInterval":[921,973]},"AngleBetween_function",[]]],"Lerp_function":["define",{"sourceInterval":[984,1039]},null,[],["seq",{"sourceInterval":[984,1027]},["app",{"sourceInterval":[984,988]},"lerp",[]],["terminal",{"sourceInterval":[989,992]},"("],["app",{"sourceInterval":[993,1000]},"Vector4",[]],["terminal",{"sourceInterval":[1001,1004]},","],["app",{"sourceInterval":[1005,1012]},"Vector4",[]],["terminal",{"sourceInterval":[1013,1016]},","],["app",{"sourceInterval":[1017,1023]},"number",[]],["terminal",{"sourceInterval":[1024,1027]},")"]]],"Lerp":["define",{"sourceInterval":[977,1039]},null,[],["app",{"sourceInterval":[984,1039]},"Lerp_function",[]]],"vector4":["define",{"sourceInterval":[1045,1118]},null,[],["alt",{"sourceInterval":[1061,1118]},["app",{"sourceInterval":[1061,1087]},"caseInsensitive",[["terminal",{"sourceInterval":[1077,1086]},"Vector4"]]],["app",{"sourceInterval":[1095,1118]},"caseInsensitive",[["terminal",{"sourceInterval":[1111,1117]},"Vec4"]]]]],"lengthSq":["define",{"sourceInterval":[1124,1206]},null,[],["alt",{"sourceInterval":[1141,1206]},["app",{"sourceInterval":[1141,1168]},"caseInsensitive",[["terminal",{"sourceInterval":[1157,1167]},"lengthSq"]]],["app",{"sourceInterval":[1176,1206]},"caseInsensitive",[["terminal",{"sourceInterval":[1192,1205]},"magnitudeSq"]]]]],"distanceSq":["define",{"sourceInterval":[1212,1259]},null,[],["app",{"sourceInterval":[1230,1259]},"caseInsensitive",[["terminal",{"sourceInterval":[1246,1258]},"distanceSq"]]]],"length":["define",{"sourceInterval":[1265,1340]},null,[],["alt",{"sourceInterval":[1279,1340]},["app",{"sourceInterval":[1279,1304]},"caseInsensitive",[["terminal",{"sourceInterval":[1295,1303]},"length"]]],["app",{"sourceInterval":[1312,1340]},"caseInsensitive",[["terminal",{"sourceInterval":[1328,1339]},"magnitude"]]]]],"distance":["define",{"sourceInterval":[1346,1389]},null,[],["app",{"sourceInterval":[1362,1389]},"caseInsensitive",[["terminal",{"sourceInterval":[1378,1388]},"distance"]]]],"normalise":["define",{"sourceInterval":[1395,1477]},null,[],["alt",{"sourceInterval":[1413,1477]},["app",{"sourceInterval":[1413,1441]},"caseInsensitive",[["terminal",{"sourceInterval":[1429,1440]},"normalise"]]],["app",{"sourceInterval":[1449,1477]},"caseInsensitive",[["terminal",{"sourceInterval":[1465,1476]},"normalize"]]]]],"dot":["define",{"sourceInterval":[1483,1553]},null,[],["alt",{"sourceInterval":[1494,1553]},["app",{"sourceInterval":[1494,1523]},"caseInsensitive",[["terminal",{"sourceInterval":[1510,1522]},"dotproduct"]]],["app",{"sourceInterval":[1531,1553]},"caseInsensitive",[["terminal",{"sourceInterval":[1547,1552]},"dot"]]]]],"angleBetween":["define",{"sourceInterval":[1559,1610]},null,[],["app",{"sourceInterval":[1579,1610]},"caseInsensitive",[["terminal",{"sourceInterval":[1595,1609]},"angleBetween"]]]],"lerp":["define",{"sourceInterval":[1616,1651]},null,[],["app",{"sourceInterval":[1628,1651]},"caseInsensitive",[["terminal",{"sourceInterval":[1644,1650]},"lerp"]]]]}]);module.exports=result; \ No newline at end of file +'use strict';const {makeRecipe}=require('ohm-js');const result={};result.BasicArithmetic=makeRecipe(["grammar",{"source":"BasicArithmetic {\r\n Expression\r\n = LogicalShift\r\n\r\n LogicalShift\r\n = LogicalShift \"<<\" LogicalShift -- left\r\n | LogicalShift \">>\" LogicalShift -- right\r\n | AS \r\n\r\n // Addition or Subtraction\r\n AS\r\n = AS add MD -- addition\r\n | AS subtract MD -- subtraction\r\n | MD\r\n\r\n // Multiply or Divide\r\n MD\r\n = MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | MD modulo E -- modulo\r\n | E\r\n\r\n // Exponent\r\n E\r\n = P exponent E -- exponent\r\n | P\r\n\r\n // Parenthesis\r\n P\r\n = \"(\" Expression \")\" -- parenthesis\r\n | Primitive\r\n \r\n Primitive\r\n = \"+\" Primitive -- positive\r\n | \"-\" Primitive -- negative\r\n | constant\r\n | hex\r\n | number\r\n \r\n // Lexical Rules\r\n add \r\n \t= \"+\"\r\n | caseInsensitive<\"plus\">\r\n \t| caseInsensitive<\"add\">\r\n | caseInsensitive<\"and\">\r\n \r\n subtract \r\n = \"-\"\r\n | caseInsensitive<\"minus\">\r\n | caseInsensitive<\"subtract\">\r\n | caseInsensitive<\"remove\">\r\n | caseInsensitive<\"take\">\r\n \r\n multiply \r\n = \"*\"\r\n | \"\\\\*\" // Escaped \\* for markdown\r\n | \"\\u{00D7}\" // ×\r\n | caseInsensitive<\"x\">\r\n | caseInsensitive<\"times by\">\r\n | caseInsensitive<\"times\">\r\n | caseInsensitive<\"multiply by\">\r\n | caseInsensitive<\"multiply\">\r\n \r\n divide\r\n = \"/\"\r\n | \"\\u{00F7}\" // ÷\r\n | caseInsensitive<\"divide by\">\r\n | caseInsensitive<\"divide\">\r\n\r\n modulo\r\n = \"%\"\r\n | caseInsensitive<\"modulo\">\r\n | caseInsensitive<\"mod\">\r\n\r\n exponent\r\n = \"^\"\r\n | caseInsensitive<\"to the power of\">\r\n | caseInsensitive<\"power of\">\r\n | caseInsensitive<\"exponent\">\r\n | caseInsensitive<\"prime\">\r\n\r\n constant \r\n \t= caseInsensitive<\"PI\"> \r\n | caseInsensitive<\"E\">\r\n\r\n number\r\n = digit* \".\" digit+ -- fract\r\n | digit+ -- whole\r\n \r\n hex\r\n = \"0x\" hexDigit+\r\n | hexDigit+ \"h\"\r\n}"},"BasicArithmetic",null,"Expression",{"Expression":["define",{"sourceInterval":[21,51]},null,[],["app",{"sourceInterval":[39,51]},"LogicalShift",[]]],"LogicalShift_left":["define",{"sourceInterval":[77,115]},null,[],["seq",{"sourceInterval":[77,107]},["app",{"sourceInterval":[77,89]},"LogicalShift",[]],["terminal",{"sourceInterval":[90,94]},"<<"],["app",{"sourceInterval":[95,107]},"LogicalShift",[]]]],"LogicalShift_right":["define",{"sourceInterval":[123,162]},null,[],["seq",{"sourceInterval":[123,153]},["app",{"sourceInterval":[123,135]},"LogicalShift",[]],["terminal",{"sourceInterval":[136,140]},">>"],["app",{"sourceInterval":[141,153]},"LogicalShift",[]]]],"LogicalShift":["define",{"sourceInterval":[57,172]},null,[],["alt",{"sourceInterval":[77,172]},["app",{"sourceInterval":[77,107]},"LogicalShift_left",[]],["app",{"sourceInterval":[123,153]},"LogicalShift_right",[]],["app",{"sourceInterval":[170,172]},"AS",[]]]],"AS_addition":["define",{"sourceInterval":[219,241]},null,[],["seq",{"sourceInterval":[219,228]},["app",{"sourceInterval":[219,221]},"AS",[]],["app",{"sourceInterval":[222,225]},"add",[]],["app",{"sourceInterval":[226,228]},"MD",[]]]],"AS_subtraction":["define",{"sourceInterval":[249,279]},null,[],["seq",{"sourceInterval":[249,263]},["app",{"sourceInterval":[249,251]},"AS",[]],["app",{"sourceInterval":[252,260]},"subtract",[]],["app",{"sourceInterval":[261,263]},"MD",[]]]],"AS":["define",{"sourceInterval":[209,289]},null,[],["alt",{"sourceInterval":[219,289]},["app",{"sourceInterval":[219,228]},"AS_addition",[]],["app",{"sourceInterval":[249,263]},"AS_subtraction",[]],["app",{"sourceInterval":[287,289]},"MD",[]]]],"MD_multiplication":["define",{"sourceInterval":[330,362]},null,[],["seq",{"sourceInterval":[330,343]},["app",{"sourceInterval":[330,332]},"MD",[]],["app",{"sourceInterval":[333,341]},"multiply",[]],["app",{"sourceInterval":[342,343]},"E",[]]]],"MD_division":["define",{"sourceInterval":[370,394]},null,[],["seq",{"sourceInterval":[370,381]},["app",{"sourceInterval":[370,372]},"MD",[]],["app",{"sourceInterval":[373,379]},"divide",[]],["app",{"sourceInterval":[380,381]},"E",[]]]],"MD_modulo":["define",{"sourceInterval":[402,424]},null,[],["seq",{"sourceInterval":[402,413]},["app",{"sourceInterval":[402,404]},"MD",[]],["app",{"sourceInterval":[405,411]},"modulo",[]],["app",{"sourceInterval":[412,413]},"E",[]]]],"MD":["define",{"sourceInterval":[320,433]},null,[],["alt",{"sourceInterval":[330,433]},["app",{"sourceInterval":[330,343]},"MD_multiplication",[]],["app",{"sourceInterval":[370,381]},"MD_division",[]],["app",{"sourceInterval":[402,413]},"MD_modulo",[]],["app",{"sourceInterval":[432,433]},"E",[]]]],"E_exponent":["define",{"sourceInterval":[463,488]},null,[],["seq",{"sourceInterval":[463,475]},["app",{"sourceInterval":[463,464]},"P",[]],["app",{"sourceInterval":[465,473]},"exponent",[]],["app",{"sourceInterval":[474,475]},"E",[]]]],"E":["define",{"sourceInterval":[454,497]},null,[],["alt",{"sourceInterval":[463,497]},["app",{"sourceInterval":[463,475]},"E_exponent",[]],["app",{"sourceInterval":[496,497]},"P",[]]]],"P_parenthesis":["define",{"sourceInterval":[530,564]},null,[],["seq",{"sourceInterval":[530,548]},["terminal",{"sourceInterval":[530,533]},"("],["app",{"sourceInterval":[534,544]},"Expression",[]],["terminal",{"sourceInterval":[545,548]},")"]]],"P":["define",{"sourceInterval":[521,581]},null,[],["alt",{"sourceInterval":[530,581]},["app",{"sourceInterval":[530,548]},"P_parenthesis",[]],["app",{"sourceInterval":[572,581]},"Primitive",[]]]],"Primitive_positive":["define",{"sourceInterval":[608,633]},null,[],["seq",{"sourceInterval":[608,621]},["terminal",{"sourceInterval":[608,611]},"+"],["app",{"sourceInterval":[612,621]},"Primitive",[]]]],"Primitive_negative":["define",{"sourceInterval":[641,666]},null,[],["seq",{"sourceInterval":[641,654]},["terminal",{"sourceInterval":[641,644]},"-"],["app",{"sourceInterval":[645,654]},"Primitive",[]]]],"Primitive":["define",{"sourceInterval":[591,707]},null,[],["alt",{"sourceInterval":[608,707]},["app",{"sourceInterval":[608,621]},"Primitive_positive",[]],["app",{"sourceInterval":[641,654]},"Primitive_negative",[]],["app",{"sourceInterval":[674,682]},"constant",[]],["app",{"sourceInterval":[690,693]},"hex",[]],["app",{"sourceInterval":[701,707]},"number",[]]]],"add":["define",{"sourceInterval":[734,838]},null,[],["alt",{"sourceInterval":[745,838]},["terminal",{"sourceInterval":[745,748]},"+"],["app",{"sourceInterval":[756,779]},"caseInsensitive",[["terminal",{"sourceInterval":[772,778]},"plus"]]],["app",{"sourceInterval":[786,808]},"caseInsensitive",[["terminal",{"sourceInterval":[802,807]},"add"]]],["app",{"sourceInterval":[816,838]},"caseInsensitive",[["terminal",{"sourceInterval":[832,837]},"and"]]]]],"subtract":["define",{"sourceInterval":[848,999]},null,[],["alt",{"sourceInterval":[865,999]},["terminal",{"sourceInterval":[865,868]},"-"],["app",{"sourceInterval":[876,900]},"caseInsensitive",[["terminal",{"sourceInterval":[892,899]},"minus"]]],["app",{"sourceInterval":[908,935]},"caseInsensitive",[["terminal",{"sourceInterval":[924,934]},"subtract"]]],["app",{"sourceInterval":[943,968]},"caseInsensitive",[["terminal",{"sourceInterval":[959,967]},"remove"]]],["app",{"sourceInterval":[976,999]},"caseInsensitive",[["terminal",{"sourceInterval":[992,998]},"take"]]]]],"multiply":["define",{"sourceInterval":[1011,1262]},null,[],["alt",{"sourceInterval":[1028,1262]},["terminal",{"sourceInterval":[1028,1031]},"*"],["terminal",{"sourceInterval":[1039,1044]},"\\*"],["terminal",{"sourceInterval":[1079,1089]},"×"],["app",{"sourceInterval":[1102,1122]},"caseInsensitive",[["terminal",{"sourceInterval":[1118,1121]},"x"]]],["app",{"sourceInterval":[1130,1157]},"caseInsensitive",[["terminal",{"sourceInterval":[1146,1156]},"times by"]]],["app",{"sourceInterval":[1165,1189]},"caseInsensitive",[["terminal",{"sourceInterval":[1181,1188]},"times"]]],["app",{"sourceInterval":[1197,1227]},"caseInsensitive",[["terminal",{"sourceInterval":[1213,1226]},"multiply by"]]],["app",{"sourceInterval":[1235,1262]},"caseInsensitive",[["terminal",{"sourceInterval":[1251,1261]},"multiply"]]]]],"divide":["define",{"sourceInterval":[1274,1383]},null,[],["alt",{"sourceInterval":[1288,1383]},["terminal",{"sourceInterval":[1288,1291]},"/"],["terminal",{"sourceInterval":[1299,1309]},"÷"],["app",{"sourceInterval":[1322,1350]},"caseInsensitive",[["terminal",{"sourceInterval":[1338,1349]},"divide by"]]],["app",{"sourceInterval":[1358,1383]},"caseInsensitive",[["terminal",{"sourceInterval":[1374,1382]},"divide"]]]]],"modulo":["define",{"sourceInterval":[1389,1469]},null,[],["alt",{"sourceInterval":[1403,1469]},["terminal",{"sourceInterval":[1403,1406]},"%"],["app",{"sourceInterval":[1414,1439]},"caseInsensitive",[["terminal",{"sourceInterval":[1430,1438]},"modulo"]]],["app",{"sourceInterval":[1447,1469]},"caseInsensitive",[["terminal",{"sourceInterval":[1463,1468]},"mod"]]]]],"exponent":["define",{"sourceInterval":[1475,1638]},null,[],["alt",{"sourceInterval":[1491,1638]},["terminal",{"sourceInterval":[1491,1494]},"^"],["app",{"sourceInterval":[1502,1536]},"caseInsensitive",[["terminal",{"sourceInterval":[1518,1535]},"to the power of"]]],["app",{"sourceInterval":[1544,1571]},"caseInsensitive",[["terminal",{"sourceInterval":[1560,1570]},"power of"]]],["app",{"sourceInterval":[1579,1606]},"caseInsensitive",[["terminal",{"sourceInterval":[1595,1605]},"exponent"]]],["app",{"sourceInterval":[1614,1638]},"caseInsensitive",[["terminal",{"sourceInterval":[1630,1637]},"prime"]]]]],"constant":["define",{"sourceInterval":[1644,1711]},null,[],["alt",{"sourceInterval":[1661,1711]},["app",{"sourceInterval":[1661,1682]},"caseInsensitive",[["terminal",{"sourceInterval":[1677,1681]},"PI"]]],["app",{"sourceInterval":[1691,1711]},"caseInsensitive",[["terminal",{"sourceInterval":[1707,1710]},"E"]]]]],"number_fract":["define",{"sourceInterval":[1731,1758]},null,[],["seq",{"sourceInterval":[1731,1748]},["star",{"sourceInterval":[1731,1737]},["app",{"sourceInterval":[1731,1736]},"digit",[]]],["terminal",{"sourceInterval":[1738,1741]},"."],["plus",{"sourceInterval":[1742,1748]},["app",{"sourceInterval":[1742,1747]},"digit",[]]]]],"number_whole":["define",{"sourceInterval":[1766,1793]},null,[],["plus",{"sourceInterval":[1766,1772]},["app",{"sourceInterval":[1766,1771]},"digit",[]]]],"number":["define",{"sourceInterval":[1717,1793]},null,[],["alt",{"sourceInterval":[1731,1793]},["app",{"sourceInterval":[1731,1748]},"number_fract",[]],["app",{"sourceInterval":[1766,1772]},"number_whole",[]]]],"hex":["define",{"sourceInterval":[1801,1847]},null,[],["alt",{"sourceInterval":[1812,1847]},["seq",{"sourceInterval":[1812,1826]},["terminal",{"sourceInterval":[1812,1816]},"0x"],["plus",{"sourceInterval":[1817,1826]},["app",{"sourceInterval":[1817,1825]},"hexDigit",[]]]],["seq",{"sourceInterval":[1834,1847]},["plus",{"sourceInterval":[1834,1843]},["app",{"sourceInterval":[1834,1842]},"hexDigit",[]]],["terminal",{"sourceInterval":[1844,1847]},"h"]]]]}]);result.Vector4Arithmetic=makeRecipe(["grammar",{"source":"Vector4Arithmetic <: BasicArithmetic {\r\n // Remove support for logical shift\r\n Expression \r\n \t:= AS\r\n\r\n P\r\n := \"(\" Expression \")\" -- parenthesis\r\n | Vector4\r\n | Function\r\n | Primitive\r\n\r\n // Remove modulo support for vector\r\n MD\r\n := MD multiply E -- multiplication\r\n | MD divide E -- division\r\n | E\r\n\r\n Vector4\r\n = vector4? \"(\" Expression \",\" Expression \",\" Expression \",\" Expression \")\" -- parse\r\n\r\n Function\r\n = LengthSq\r\n | DistanceSq\r\n | Length\r\n | Distance\r\n | Normalise\r\n | Dot\r\n | AngleBetween\r\n | Lerp\r\n\r\n LengthSq = lengthSq \"(\" Vector4 \")\" -- function\r\n DistanceSq = distanceSq \"(\" Vector4 \",\" Vector4 \")\" -- function\r\n Length = length \"(\" Vector4 \")\" -- function\r\n Distance = distance \"(\" Vector4 \",\" Vector4 \")\" -- function\r\n Normalise = normalise \"(\" Vector4 \")\" -- function\r\n Dot = dot \"(\" Vector4 \",\" Vector4 \")\" -- function\r\n AngleBetween = angleBetween \"(\" Vector4 \",\" Vector4 \")\" -- function\r\n Lerp = lerp \"(\" Vector4 \",\" Vector4 \",\" number \")\" -- function\r\n\r\n vector4 \r\n \t = caseInsensitive<\"Vector4\">\r\n | caseInsensitive<\"Vec4\">\r\n\r\n lengthSq \r\n \t = caseInsensitive<\"lengthSq\">\r\n | caseInsensitive<\"magnitudeSq\">\r\n\r\n distanceSq\r\n = caseInsensitive<\"distanceSq\">\r\n\r\n length\r\n \t = caseInsensitive<\"length\">\r\n | caseInsensitive<\"magnitude\">\r\n\r\n distance\r\n = caseInsensitive<\"distance\">\r\n\r\n normalise \r\n \t = caseInsensitive<\"normalise\">\r\n \t | caseInsensitive<\"normalize\">\r\n\r\n dot\r\n = caseInsensitive<\"dotproduct\">\r\n | caseInsensitive<\"dot\">\r\n\r\n angleBetween\r\n = caseInsensitive<\"angleBetween\">\r\n\r\n lerp\r\n = caseInsensitive<\"lerp\">\r\n}"},"Vector4Arithmetic",result.BasicArithmetic,"Expression",{"Expression":["override",{"sourceInterval":[81,103]},null,[],["app",{"sourceInterval":[101,103]},"AS",[]]],"P_parenthesis":["override",{"sourceInterval":[119,153]},null,[],["seq",{"sourceInterval":[119,137]},["terminal",{"sourceInterval":[119,122]},"("],["app",{"sourceInterval":[123,133]},"Expression",[]],["terminal",{"sourceInterval":[134,137]},")"]]],"P":["override",{"sourceInterval":[109,201]},null,[],["alt",{"sourceInterval":[119,201]},["app",{"sourceInterval":[119,137]},"P_parenthesis",[]],["app",{"sourceInterval":[161,168]},"Vector4",[]],["app",{"sourceInterval":[176,184]},"Function",[]],["app",{"sourceInterval":[192,201]},"Primitive",[]]]],"MD_multiplication":["override",{"sourceInterval":[257,289]},null,[],["seq",{"sourceInterval":[257,270]},["app",{"sourceInterval":[257,259]},"MD",[]],["app",{"sourceInterval":[260,268]},"multiply",[]],["app",{"sourceInterval":[269,270]},"E",[]]]],"MD_division":["override",{"sourceInterval":[297,321]},null,[],["seq",{"sourceInterval":[297,308]},["app",{"sourceInterval":[297,299]},"MD",[]],["app",{"sourceInterval":[300,306]},"divide",[]],["app",{"sourceInterval":[307,308]},"E",[]]]],"MD":["override",{"sourceInterval":[246,330]},null,[],["alt",{"sourceInterval":[257,330]},["app",{"sourceInterval":[257,270]},"MD_multiplication",[]],["app",{"sourceInterval":[297,308]},"MD_division",[]],["app",{"sourceInterval":[329,330]},"E",[]]]],"Vector4_parse":["define",{"sourceInterval":[351,432]},null,[],["seq",{"sourceInterval":[351,423]},["opt",{"sourceInterval":[351,359]},["app",{"sourceInterval":[351,358]},"vector4",[]]],["terminal",{"sourceInterval":[360,363]},"("],["app",{"sourceInterval":[364,374]},"Expression",[]],["terminal",{"sourceInterval":[375,378]},","],["app",{"sourceInterval":[379,389]},"Expression",[]],["terminal",{"sourceInterval":[390,393]},","],["app",{"sourceInterval":[394,404]},"Expression",[]],["terminal",{"sourceInterval":[405,408]},","],["app",{"sourceInterval":[409,419]},"Expression",[]],["terminal",{"sourceInterval":[420,423]},")"]]],"Vector4":["define",{"sourceInterval":[336,432]},null,[],["app",{"sourceInterval":[351,432]},"Vector4_parse",[]]],"Function":["define",{"sourceInterval":[438,562]},null,[],["alt",{"sourceInterval":[453,562]},["app",{"sourceInterval":[453,461]},"LengthSq",[]],["app",{"sourceInterval":[468,478]},"DistanceSq",[]],["app",{"sourceInterval":[485,491]},"Length",[]],["app",{"sourceInterval":[498,506]},"Distance",[]],["app",{"sourceInterval":[513,522]},"Normalise",[]],["app",{"sourceInterval":[529,532]},"Dot",[]],["app",{"sourceInterval":[539,551]},"AngleBetween",[]],["app",{"sourceInterval":[558,562]},"Lerp",[]]]],"LengthSq_function":["define",{"sourceInterval":[580,616]},null,[],["seq",{"sourceInterval":[580,604]},["app",{"sourceInterval":[580,588]},"lengthSq",[]],["terminal",{"sourceInterval":[589,592]},"("],["app",{"sourceInterval":[593,600]},"Vector4",[]],["terminal",{"sourceInterval":[601,604]},")"]]],"LengthSq":["define",{"sourceInterval":[568,616]},null,[],["app",{"sourceInterval":[580,616]},"LengthSq_function",[]]],"DistanceSq_function":["define",{"sourceInterval":[634,684]},null,[],["seq",{"sourceInterval":[634,672]},["app",{"sourceInterval":[634,644]},"distanceSq",[]],["terminal",{"sourceInterval":[645,648]},"("],["app",{"sourceInterval":[649,656]},"Vector4",[]],["terminal",{"sourceInterval":[657,660]},","],["app",{"sourceInterval":[661,668]},"Vector4",[]],["terminal",{"sourceInterval":[669,672]},")"]]],"DistanceSq":["define",{"sourceInterval":[620,684]},null,[],["app",{"sourceInterval":[634,684]},"DistanceSq_function",[]]],"Length_function":["define",{"sourceInterval":[698,732]},null,[],["seq",{"sourceInterval":[698,720]},["app",{"sourceInterval":[698,704]},"length",[]],["terminal",{"sourceInterval":[705,708]},"("],["app",{"sourceInterval":[709,716]},"Vector4",[]],["terminal",{"sourceInterval":[717,720]},")"]]],"Length":["define",{"sourceInterval":[688,732]},null,[],["app",{"sourceInterval":[698,732]},"Length_function",[]]],"Distance_function":["define",{"sourceInterval":[748,796]},null,[],["seq",{"sourceInterval":[748,784]},["app",{"sourceInterval":[748,756]},"distance",[]],["terminal",{"sourceInterval":[757,760]},"("],["app",{"sourceInterval":[761,768]},"Vector4",[]],["terminal",{"sourceInterval":[769,772]},","],["app",{"sourceInterval":[773,780]},"Vector4",[]],["terminal",{"sourceInterval":[781,784]},")"]]],"Distance":["define",{"sourceInterval":[736,796]},null,[],["app",{"sourceInterval":[748,796]},"Distance_function",[]]],"Normalise_function":["define",{"sourceInterval":[812,849]},null,[],["seq",{"sourceInterval":[812,837]},["app",{"sourceInterval":[812,821]},"normalise",[]],["terminal",{"sourceInterval":[822,825]},"("],["app",{"sourceInterval":[826,833]},"Vector4",[]],["terminal",{"sourceInterval":[834,837]},")"]]],"Normalise":["define",{"sourceInterval":[800,849]},null,[],["app",{"sourceInterval":[812,849]},"Normalise_function",[]]],"Dot_function":["define",{"sourceInterval":[859,902]},null,[],["seq",{"sourceInterval":[859,890]},["app",{"sourceInterval":[859,862]},"dot",[]],["terminal",{"sourceInterval":[863,866]},"("],["app",{"sourceInterval":[867,874]},"Vector4",[]],["terminal",{"sourceInterval":[875,878]},","],["app",{"sourceInterval":[879,886]},"Vector4",[]],["terminal",{"sourceInterval":[887,890]},")"]]],"Dot":["define",{"sourceInterval":[853,902]},null,[],["app",{"sourceInterval":[859,902]},"Dot_function",[]]],"AngleBetween_function":["define",{"sourceInterval":[921,973]},null,[],["seq",{"sourceInterval":[921,961]},["app",{"sourceInterval":[921,933]},"angleBetween",[]],["terminal",{"sourceInterval":[934,937]},"("],["app",{"sourceInterval":[938,945]},"Vector4",[]],["terminal",{"sourceInterval":[946,949]},","],["app",{"sourceInterval":[950,957]},"Vector4",[]],["terminal",{"sourceInterval":[958,961]},")"]]],"AngleBetween":["define",{"sourceInterval":[906,973]},null,[],["app",{"sourceInterval":[921,973]},"AngleBetween_function",[]]],"Lerp_function":["define",{"sourceInterval":[984,1039]},null,[],["seq",{"sourceInterval":[984,1027]},["app",{"sourceInterval":[984,988]},"lerp",[]],["terminal",{"sourceInterval":[989,992]},"("],["app",{"sourceInterval":[993,1000]},"Vector4",[]],["terminal",{"sourceInterval":[1001,1004]},","],["app",{"sourceInterval":[1005,1012]},"Vector4",[]],["terminal",{"sourceInterval":[1013,1016]},","],["app",{"sourceInterval":[1017,1023]},"number",[]],["terminal",{"sourceInterval":[1024,1027]},")"]]],"Lerp":["define",{"sourceInterval":[977,1039]},null,[],["app",{"sourceInterval":[984,1039]},"Lerp_function",[]]],"vector4":["define",{"sourceInterval":[1045,1118]},null,[],["alt",{"sourceInterval":[1061,1118]},["app",{"sourceInterval":[1061,1087]},"caseInsensitive",[["terminal",{"sourceInterval":[1077,1086]},"Vector4"]]],["app",{"sourceInterval":[1095,1118]},"caseInsensitive",[["terminal",{"sourceInterval":[1111,1117]},"Vec4"]]]]],"lengthSq":["define",{"sourceInterval":[1124,1206]},null,[],["alt",{"sourceInterval":[1141,1206]},["app",{"sourceInterval":[1141,1168]},"caseInsensitive",[["terminal",{"sourceInterval":[1157,1167]},"lengthSq"]]],["app",{"sourceInterval":[1176,1206]},"caseInsensitive",[["terminal",{"sourceInterval":[1192,1205]},"magnitudeSq"]]]]],"distanceSq":["define",{"sourceInterval":[1212,1259]},null,[],["app",{"sourceInterval":[1230,1259]},"caseInsensitive",[["terminal",{"sourceInterval":[1246,1258]},"distanceSq"]]]],"length":["define",{"sourceInterval":[1265,1340]},null,[],["alt",{"sourceInterval":[1279,1340]},["app",{"sourceInterval":[1279,1304]},"caseInsensitive",[["terminal",{"sourceInterval":[1295,1303]},"length"]]],["app",{"sourceInterval":[1312,1340]},"caseInsensitive",[["terminal",{"sourceInterval":[1328,1339]},"magnitude"]]]]],"distance":["define",{"sourceInterval":[1346,1389]},null,[],["app",{"sourceInterval":[1362,1389]},"caseInsensitive",[["terminal",{"sourceInterval":[1378,1388]},"distance"]]]],"normalise":["define",{"sourceInterval":[1395,1477]},null,[],["alt",{"sourceInterval":[1413,1477]},["app",{"sourceInterval":[1413,1441]},"caseInsensitive",[["terminal",{"sourceInterval":[1429,1440]},"normalise"]]],["app",{"sourceInterval":[1449,1477]},"caseInsensitive",[["terminal",{"sourceInterval":[1465,1476]},"normalize"]]]]],"dot":["define",{"sourceInterval":[1483,1553]},null,[],["alt",{"sourceInterval":[1494,1553]},["app",{"sourceInterval":[1494,1523]},"caseInsensitive",[["terminal",{"sourceInterval":[1510,1522]},"dotproduct"]]],["app",{"sourceInterval":[1531,1553]},"caseInsensitive",[["terminal",{"sourceInterval":[1547,1552]},"dot"]]]]],"angleBetween":["define",{"sourceInterval":[1559,1610]},null,[],["app",{"sourceInterval":[1579,1610]},"caseInsensitive",[["terminal",{"sourceInterval":[1595,1609]},"angleBetween"]]]],"lerp":["define",{"sourceInterval":[1616,1651]},null,[],["app",{"sourceInterval":[1628,1651]},"caseInsensitive",[["terminal",{"sourceInterval":[1644,1650]},"lerp"]]]]}]);module.exports=result; \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index ef7a44d..aecdb39 100644 --- a/src/main.ts +++ b/src/main.ts @@ -178,6 +178,43 @@ export default class SolvePlugin extends Plugin { } }, }); + + this.addCommand({ + id: "commit-result-selection-visible", + name: "Commit results in selection", + editorCallback(editor, ctx) { + const selectionStart = editor.getCursor("from"); + const selectionEnd = editor.getCursor("to"); + + if ( + selectionStart.line === selectionEnd.line && + selectionStart.ch === selectionEnd.ch + ) { + new Notice("Solve: Failed to commit, no text selected."); + return; + } + + const { containerEl } = editor as any; + + if (!containerEl) { + return; + } + + for ( + let i = selectionStart.line + 1; + i < selectionEnd.line + 1; + i++ + ) { + const resultElement = ( + containerEl as HTMLElement + ).querySelector(`#osr-${i + 1}`); + + if (resultElement) { + resultElement.click(); + } + } + }, + }); } public async setStatusBarCompanionVisibility(visible: boolean) { diff --git a/src/pipelines/stages/PreviousResultSubstitutionStage.ts b/src/pipelines/stages/PreviousResultSubstitutionStage.ts new file mode 100644 index 0000000..57aca91 --- /dev/null +++ b/src/pipelines/stages/PreviousResultSubstitutionStage.ts @@ -0,0 +1,52 @@ +import { BasePipelineStage } from "@/pipelines/definition/stages/BasePipelineStage"; +import { IResult } from "@/results/definition/IResult"; +import { ResultSubstitutionFormatVisitor } from "@/visitors/format/VariableSubstitutionFormatVisitor"; + +// Important: Since this stage is stateful it can not be used in a shared context. +export class PreviousResultSubstitutionStage extends BasePipelineStage { + private previousResultSubstitutionRegex = new RegExp(/\$prev/gi); + private resultSubstitutionVisitor: ResultSubstitutionFormatVisitor; + + // TODO: We want to switch to passing around IResult as opposed a string as this is more re-usable. + private previousResult: IResult; + private previousResultString: string; + + constructor() { + super(); + this.resultSubstitutionVisitor = new ResultSubstitutionFormatVisitor(); + } + + protected execute(request: string): string { + // Substitute previous solve into the expression + // if (this.previousResult) { + // console.log( + // "PREVIOUS SOLVE", + // this.previousResult, + // "EXPRESSION", + // request + // ); + + // request = request.replace( + // this.previousResultSubstitutionRegex, + // this.resultSubstitutionVisitor.visit(this.previousResult) + // ); + // } + + if (this.previousResultString) { + return request.replace( + this.previousResultSubstitutionRegex, + this.previousResultString + ); + } + + return request; + } + + public setPreviousResult(result: IResult) { + this.previousResult = result; + } + + public setPreviousResultString(string: string) { + this.previousResultString = string; + } +} diff --git a/src/pipelines/stages/VariableProcessingStage.ts b/src/pipelines/stages/VariableProcessingStage.ts index 2cc9c0d..8b2e0ed 100644 --- a/src/pipelines/stages/VariableProcessingStage.ts +++ b/src/pipelines/stages/VariableProcessingStage.ts @@ -1,11 +1,14 @@ import { BasePipelineStage } from "@/pipelines/definition/stages/BasePipelineStage"; import { solveProviderManager } from "@/providers/ProviderManager"; import { IResult } from "@/results/definition/IResult"; +import { ResultSubstitutionFormatVisitor } from "@/visitors/format/VariableSubstitutionFormatVisitor"; // Important: Since this stage is stateful it can not be used in a shared context. export class VariableProcessingStage extends BasePipelineStage { private variableAssignmentRegex = new RegExp(/^(\$\w+)\s+=/); private variableSubstitutionRegex = new RegExp(/(\$\w+)/g); + private resultSubstitutionVisitor = new ResultSubstitutionFormatVisitor(); + private variableMap = new Map>(); protected execute(request: string): string { @@ -43,14 +46,20 @@ export class VariableProcessingStage extends BasePipelineStage { ); if (result !== undefined) { + // Save the mapping to the variable name to result map table this.variableMap.set(variableName, result as any as IResult); } } private substituteVariables(expression: string): string { return expression.replace(this.variableSubstitutionRegex, (match) => { - const variableValue = this.variableMap.get(match)?.value; - return variableValue !== undefined ? variableValue : match; + const variableResult = this.variableMap.get(match); + + if (typeof variableResult === "undefined") { + return match; + } + + return this.resultSubstitutionVisitor.visit(variableResult); }); } } diff --git a/src/providers/ProviderManager.ts b/src/providers/ProviderManager.ts index 8589eee..88a5ad7 100644 --- a/src/providers/ProviderManager.ts +++ b/src/providers/ProviderManager.ts @@ -25,10 +25,10 @@ class ProviderManager { this.providersMap.set(fastHash(provider.name), provider); } - public provideFirst( + public provideFirst( sentence: string, raw: boolean = false - ): string | undefined { + ): T | undefined { for (const [, provider] of this.providersMap) { try { // Skip providers that are not enabled @@ -40,7 +40,7 @@ class ProviderManager { if (result !== undefined) { if (raw) { - return result; + return result as T; } if ( @@ -50,9 +50,11 @@ class ProviderManager { result = `= ${result}`; } - return this._debugMode - ? `${result} [${provider.name}]` - : `${result}`; + return ( + this._debugMode + ? `${result} [${provider.name}]` + : `${result}` + ) as T; } } catch (error) { logger.error(error); diff --git a/src/providers/uom/UnitsOfMeasurementProvider.ts b/src/providers/uom/UnitsOfMeasurementProvider.ts index 7309293..3f8eeb9 100644 --- a/src/providers/uom/UnitsOfMeasurementProvider.ts +++ b/src/providers/uom/UnitsOfMeasurementProvider.ts @@ -57,13 +57,13 @@ export class UnitsOfMeasurementProvider extends SemanticProviderBase +{ + private settings: UserSettings; + + constructor() { + this.settings = UserSettings.getInstance(); + } + + visit(visited: IResult): string { + if (visited instanceof NumberResult) { + return this.visitNumberResult(visited); + } + + if (visited instanceof HexResult) { + return this.visitHexResult(visited); + } + + if (visited instanceof PercentageResult) { + return this.visitPercentageResult(visited); + } + + if (visited instanceof DatetimeResult) { + return this.visitDatetimeResult(visited); + } + + if (visited instanceof StringResult) { + return this.visitStringResult(visited); + } + + if (visited instanceof Vector2Result) { + return this.visitVector2Result(visited); + } + + if (visited instanceof Vector3Result) { + return this.visitVector3Result(visited); + } + + if (visited instanceof Vector4Result) { + return this.visitVector4Result(visited); + } + + if (visited instanceof UnitOfMeasurementResult) { + return this.visitUnitOfMeasurementResult(visited); + } + + throw new UnsupportedVisitorOperationError(); + } + + visitNumberResult(result: NumberResult): string { + return autoFormatIntegerOrFloat( + result.value, + this.settings.floatResult.decimalPlaces + ).toString(); + } + + visitHexResult(result: HexResult): string { + const isNegative = result.value < 0; + const hexString = Math.abs(result.value) + .toString(16) + .toUpperCase() + .padStart( + this.settings.hexResult.enablePadding + ? this.settings.hexResult.paddingZeros + : 0, + "0" + ); + return isNegative ? `-0x${hexString}` : `0x${hexString}`; + } + + visitPercentageResult(result: PercentageResult): string { + return `${result.value.toFixed( + this.settings.percentageResult.decimalPlaces + )}%`; + } + + visitDatetimeResult(result: IDatetimeResult): string { + return result.value.format(this.settings.datetimeResult.format); + } + + visitStringResult(result: IStringResult): string { + return result.value; + } + + visitVector2Result(result: IVector2Result): string { + const x = result.value.x.toFixed( + this.settings.floatResult.decimalPlaces + ); + + const y = result.value.y.toFixed( + this.settings.floatResult.decimalPlaces + ); + + return `(${x}, ${y})`; + } + + visitVector3Result(result: IVector3Result): string { + const x = result.value.x.toFixed( + this.settings.floatResult.decimalPlaces + ); + + const y = result.value.y.toFixed( + this.settings.floatResult.decimalPlaces + ); + + const z = result.value.z.toFixed( + this.settings.floatResult.decimalPlaces + ); + + return `(${x}, ${y}, ${z})`; + } + + visitVector4Result(result: IVector4Result): string { + const x = result.value.x.toFixed( + this.settings.floatResult.decimalPlaces + ); + + const y = result.value.y.toFixed( + this.settings.floatResult.decimalPlaces + ); + + const z = result.value.z.toFixed( + this.settings.floatResult.decimalPlaces + ); + + const w = result.value.w.toFixed( + this.settings.floatResult.decimalPlaces + ); + + return `(${x}, ${y}, ${z}, ${w})`; + } + + visitUnitOfMeasurementResult(result: UnitOfMeasurementResult): string { + const decimalPlaces = + this.settings.unitOfMeasurementResult.decimalPlaces; + + const value = Number.isInteger(result.value) + ? result.value + : result.value.toFixed(decimalPlaces); + + let unit = result.unit; + + if (this.settings.unitOfMeasurementResult.unitNames) { + const unitData = convert().describe(result.unit as Unit); + + unit = + Math.abs(result.value) > 1 + ? unitData.plural + : unitData.singular; + } + + return `${value} ${unit}`; + } +} diff --git a/test/pipeline/stages/PreviousResultSubstitutionStage.spec.ts b/test/pipeline/stages/PreviousResultSubstitutionStage.spec.ts new file mode 100644 index 0000000..44305d1 --- /dev/null +++ b/test/pipeline/stages/PreviousResultSubstitutionStage.spec.ts @@ -0,0 +1,47 @@ +import { PreviousResultSubstitutionStage } from "@/pipelines/stages/PreviousResultSubstitutionStage"; +import { beforeAll, describe, expect, test } from "@jest/globals"; + +let stage: PreviousResultSubstitutionStage; + +beforeAll(() => { + stage = new PreviousResultSubstitutionStage(); +}); + +describe("Previous Result Substitution", () => { + test("Single Previous Substitutation", () => { + stage.setPreviousResultString("100"); + + const substituted = stage.process("12 + $prev"); + + expect(substituted).toBeDefined(); + + expect(substituted).toEqual("12 + 100"); + }); + + test("Multiple Previous Substitutation", () => { + stage.setPreviousResultString("34"); + + const substituted = stage.process("$prev + 12 + $prev"); + + expect(substituted).toBeDefined(); + + expect(substituted).toEqual("34 + 12 + 34"); + }); + + test("Multiple Line Previous Substitutations", () => { + stage.setPreviousResultString("34"); + const line1 = stage.process("$prev + 12"); + expect(line1).toBeDefined(); + expect(line1).toEqual("34 + 12"); + + stage.setPreviousResultString("24"); + const line2 = stage.process("$prev + 12"); + expect(line2).toBeDefined(); + expect(line2).toEqual("24 + 12"); + + stage.setPreviousResultString("12"); + const line3 = stage.process("$prev + 12"); + expect(line3).toBeDefined(); + expect(line3).toEqual("12 + 12"); + }); +}); diff --git a/test/providers/uom/UnitOfMeasurementProvider.test.ts b/test/providers/uom/UnitOfMeasurementProvider.test.ts index 3b83788..b05a95a 100644 --- a/test/providers/uom/UnitOfMeasurementProvider.test.ts +++ b/test/providers/uom/UnitOfMeasurementProvider.test.ts @@ -358,3 +358,26 @@ describe("Conversion", () => { ); }); }); + +describe("Negative Lookahead", () => { + test("100 kg + 2 to g", () => { + expectProviderResultAndType( + provider, + "100 kg + 2 to g", + new UnitOfMeasurementResult( + convert(100 + 2) + .from("kg") + .to("g"), + "g" + ) + ); + }); + + test("convert 1 torr to Pa", () => { + expectProviderResultAndType( + provider, + "convert 1 torr to Pa", + new UnitOfMeasurementResult(convert(1).from("torr").to("Pa"), "Pa") + ); + }); +}); diff --git a/versions.json b/versions.json index 34d6cbe..591b987 100644 --- a/versions.json +++ b/versions.json @@ -11,5 +11,6 @@ "0.7.0": "0.15.0", "0.8.0": "0.15.0", "0.8.1": "0.15.0", - "0.8.2": "0.15.0" + "0.8.2": "0.15.0", + "0.9.0": "0.15.0" } \ No newline at end of file