{"_id":"excel-formula-ast","_rev":"8-9700a7d6ee91ad3cd9b523a95f5fe552","name":"excel-formula-ast","description":"Abstract syntax tree for excel formulas","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"excel-formula-ast","version":"1.0.0","description":"Abstract syntax tree for excel formulas.","main":"index.js","scripts":{"test":"mocha 'test/*-test.js'"},"keywords":[],"author":"","license":"ISC","peerDependencies":{},"dependencies":{},"devDependencies":{"excel-formula-tokenizer":"^2.0.1","mocha":"^3.3.0"},"gitHead":"848a3ccffda38276f2ce3b971ad48dc797c62ea9","_id":"excel-formula-ast@1.0.0","_shasum":"9ca2556dc3a87991058e1eb06e440599b05bd261","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.2","_npmUser":{"name":"psalaets","email":"psalaets@gmail.com"},"dist":{"shasum":"9ca2556dc3a87991058e1eb06e440599b05bd261","tarball":"https://registry.npmjs.org/excel-formula-ast/-/excel-formula-ast-1.0.0.tgz","integrity":"sha512-X5ISUcKa/XMMJ3fHLse8onGbcbt4gi/jkHeaI8VughehpAoxXBh8tlUj5bWSLoVu5jqgdWR/9FWGlRSpf4k8uw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC5yIHRT65n2z89UgPqpWoJvtnsYmg4/ttAqTXfLfYLrAiEAklcQIxi0OyYeGNvFqOqaA00PmHYGNHmHpYJkka4uQKA="}]},"maintainers":[{"name":"psalaets","email":"psalaets@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/excel-formula-ast-1.0.0.tgz_1495313244472_0.013512333389371634"}},"1.0.1":{"name":"excel-formula-ast","version":"1.0.1","description":"Abstract syntax tree for excel formulas","main":"index.js","scripts":{"test":"mocha 'test/*-test.js'"},"keywords":["excel","formula","parse","ast"],"author":{"name":"Paul Salaets","email":"psalaets@gmail.com"},"homepage":"https://github.com/psalaets/excel-formula-ast","repository":{"type":"git","url":"git+https://github.com/psalaets/excel-formula-ast.git"},"license":"MIT","peerDependencies":{},"dependencies":{},"devDependencies":{"excel-formula-tokenizer":"^2.0.1","mocha":"^3.3.0"},"gitHead":"31c96c0fa00f69319d83c22625d746a57ee07a8d","bugs":{"url":"https://github.com/psalaets/excel-formula-ast/issues"},"_id":"excel-formula-ast@1.0.1","_shasum":"90ba969b9c35ed2513cb7db14263271d72f02b72","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.2","_npmUser":{"name":"psalaets","email":"psalaets@gmail.com"},"dist":{"shasum":"90ba969b9c35ed2513cb7db14263271d72f02b72","tarball":"https://registry.npmjs.org/excel-formula-ast/-/excel-formula-ast-1.0.1.tgz","integrity":"sha512-cUi8uAt+Nq22kIIHGJ3IumBcGYaQaVeDpm+lJmh1CwwHpmYw0dWexytRctatQvP8X8t7DaJoGu8wWv8SJqlJfw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAzeRg4ut5ndDlsfZR3GlWnOTQrxaw2iwkBVqAza0QCTAiEAyJQ2MNqGscA2xLVQigJBgjPyzp9FPcPYJvaFk/NbGZc="}]},"maintainers":[{"name":"psalaets","email":"psalaets@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/excel-formula-ast-1.0.1.tgz_1495313762675_0.7750177518464625"}},"1.0.2":{"name":"excel-formula-ast","version":"1.0.2","description":"Abstract syntax tree for excel formulas","main":"index.js","scripts":{"test":"mocha 'test/*-test.js'"},"keywords":["excel","formula","parse","ast"],"author":{"name":"Paul Salaets","email":"psalaets@gmail.com"},"homepage":"https://github.com/psalaets/excel-formula-ast","repository":{"type":"git","url":"git+https://github.com/psalaets/excel-formula-ast.git"},"license":"MIT","peerDependencies":{},"dependencies":{},"devDependencies":{"excel-formula-tokenizer":"^2.0.1","mocha":"^3.3.0"},"gitHead":"d282597f072b4c661a5d0e8476af70a4e94ec6c6","bugs":{"url":"https://github.com/psalaets/excel-formula-ast/issues"},"_id":"excel-formula-ast@1.0.2","_shasum":"3094b80d8c639d7420a266e26f3037650600a1c0","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.2","_npmUser":{"name":"psalaets","email":"psalaets@gmail.com"},"dist":{"shasum":"3094b80d8c639d7420a266e26f3037650600a1c0","tarball":"https://registry.npmjs.org/excel-formula-ast/-/excel-formula-ast-1.0.2.tgz","integrity":"sha512-kLpQCaA39brDfw96IfnCYhvZtqSr0Z/Y2sc+RYJoZt1N/uef6BpkBwESfFDL1wOzT7EOZkPv4UeLpwpGUDTaNA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCTQYdXejQdSS+4AvQij4P3ZxVMf2rnFEhjOauAu92HLQIhANsGDHSAs0PELuCFew/ME2VLfjzIpeqtBlO+EQtLnuMH"}]},"maintainers":[{"name":"psalaets","email":"psalaets@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/excel-formula-ast-1.0.2.tgz_1495391356918_0.8165147583931684"}},"1.0.3":{"name":"excel-formula-ast","version":"1.0.3","description":"Abstract syntax tree for excel formulas","main":"index.js","scripts":{"test":"mocha 'test/*-test.js'"},"keywords":["excel","formula","parse","ast"],"author":{"name":"Paul Salaets","email":"psalaets@gmail.com"},"homepage":"https://github.com/psalaets/excel-formula-ast","repository":{"type":"git","url":"git+https://github.com/psalaets/excel-formula-ast.git"},"license":"MIT","peerDependencies":{},"dependencies":{},"devDependencies":{"excel-formula-tokenizer":"^2.0.1","mocha":"^3.3.0"},"gitHead":"c1ba4c71f08c050f413e192b38cbd097e4780125","bugs":{"url":"https://github.com/psalaets/excel-formula-ast/issues"},"_id":"excel-formula-ast@1.0.3","_shasum":"968296590401f609c13208f9a8f3c7d8a58eb1d6","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.2","_npmUser":{"name":"psalaets","email":"psalaets@gmail.com"},"dist":{"shasum":"968296590401f609c13208f9a8f3c7d8a58eb1d6","tarball":"https://registry.npmjs.org/excel-formula-ast/-/excel-formula-ast-1.0.3.tgz","integrity":"sha512-5Qd5OjfYpOA8EJ8NFq7xi6N7B/DHT8zV5zYC5/GYWhmcAzw6cbXMHzddfOBA3VHPY5ga3SqFp1Gv8xnPbkUvUg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAnvIDngatwWDCbl4kvezqQ/lmDzQtrqG5LgcfgSpVE5AiAq7twA6nm86AkvZu9thDO37pY16aplBGFwPYHtey4rtg=="}]},"maintainers":[{"name":"psalaets","email":"psalaets@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/excel-formula-ast-1.0.3.tgz_1495393537213_0.6321153284516186"}},"1.1.0":{"name":"excel-formula-ast","version":"1.1.0","description":"Abstract syntax tree for excel formulas","main":"index.js","typings":"index.d.ts","scripts":{"test":"mocha 'test/*-test.js'"},"keywords":["excel","formula","parse","ast"],"author":{"name":"Paul Salaets","email":"psalaets@gmail.com"},"homepage":"https://github.com/psalaets/excel-formula-ast","repository":{"type":"git","url":"git+https://github.com/psalaets/excel-formula-ast.git"},"license":"MIT","peerDependencies":{},"dependencies":{},"devDependencies":{"excel-formula-tokenizer":"^2.2.0","mocha":"^3.3.0"},"gitHead":"2663576a694afc2c82291d9cc6025e4956bab4e7","bugs":{"url":"https://github.com/psalaets/excel-formula-ast/issues"},"_id":"excel-formula-ast@1.1.0","_npmVersion":"5.3.0","_nodeVersion":"8.1.3","_npmUser":{"name":"psalaets","email":"psalaets@gmail.com"},"dist":{"integrity":"sha512-eBWDZGAmiriAVyTQBfLgoabUdIPwZPp30BnRxG13KWwo0VgPkSWH5Sv4ypI20vLF7fgyw6mXllEJEcThnXeC/w==","shasum":"1372105caca6028b8d9fbe83f1261faa04febb66","tarball":"https://registry.npmjs.org/excel-formula-ast/-/excel-formula-ast-1.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDhAB5j6H3f93BMyceAdZ3niFEj+CdTTP8RnBJtgurdpAIhAKjHGiin1Wok5JlWJuV7jR4Ig8FwfTIVi6qIzv6Jck/B"}]},"maintainers":[{"name":"psalaets","email":"psalaets@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/excel-formula-ast-1.1.0.tgz_1504135609636_0.2508928677998483"}},"1.1.1":{"name":"excel-formula-ast","version":"1.1.1","description":"Abstract syntax tree for excel formulas","main":"index.js","typings":"index.d.ts","scripts":{"test":"mocha"},"keywords":["excel","formula","parse","ast"],"author":{"name":"Paul Salaets","email":"psalaets@gmail.com"},"homepage":"https://github.com/psalaets/excel-formula-ast","repository":{"type":"git","url":"git+https://github.com/psalaets/excel-formula-ast.git"},"license":"MIT","peerDependencies":{},"dependencies":{},"devDependencies":{"excel-formula-tokenizer":"^2.2.0","mocha":"^3.3.0"},"gitHead":"152af993a4fadf5e1c9ffbfa51bd1d814d07181b","bugs":{"url":"https://github.com/psalaets/excel-formula-ast/issues"},"_id":"excel-formula-ast@1.1.1","_npmVersion":"5.4.1","_nodeVersion":"8.1.3","_npmUser":{"name":"psalaets","email":"psalaets@gmail.com"},"dist":{"integrity":"sha512-DWVBtdSge+m4ickkAgljS/ub+RoPy1kz9XxkWUObEWHYGTge9NdzyUKri8OSZZlS+PoG6RcC7eoaRrwe3gzBUQ==","shasum":"44dd1379ae70e620691ad8063080ae62c1c2e944","tarball":"https://registry.npmjs.org/excel-formula-ast/-/excel-formula-ast-1.1.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDz3JS5C3IdD6CZquZW0koTMwsTzT9iAIfuJHvS3S83gQIhAIAPohNieQ2njaLOjTI5aKNnZY0ZBxQEuFyHlvJoQLv/"}]},"maintainers":[{"name":"psalaets","email":"psalaets@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/excel-formula-ast-1.1.1.tgz_1504921892165_0.2531633807811886"}}},"readme":"# excel-formula-ast\n\nAbstract syntax tree for excel formulas.\n\n## Install\n\n`npm install excel-formula-ast -S`\n\nor\n\n`yarn add excel-formula-ast`\n\n## Usage\n\n```js\nconst {tokenize} = require('excel-formula-tokenizer');\nconst {buildTree, visit} = require('excel-formula-ast');\n\nconst formula = 'SUM(1, 2)';\nconst tokens = tokenize(formula);\n\n// build tree\nconst tree = buildTree(tokens);\n\n// create visitor for parts of tree you're interested in\nconst visitor = {\n  enterFunction(functionNode) {\n    console.log(`function is ${functionNode.name}`);\n  },\n  enterNumber(numberNode) {\n    console.log(`number is ${numberNode.value}`)\n  }\n};\n\n// send visitor through tree\nvisit(tree, visitor);\n\n// prints:\n// function is SUM\n// number is 1\n// number is 2\n```\n\n## API\n\n```js\nconst {buildTree, visit} = require('excel-formula-ast');\n```\n\n### buildTree(tokens)\n\nBuild expression tree from tokens.\n\n- tokens: Array of objects - Tokens from `excel-formula-tokenizer` ([github](https://github.com/psalaets/excel-formula-tokenizer) | [npm](https://www.npmjs.com/package/excel-formula-tokenizer))\n\nReturns: [ast node](https://github.com/psalaets/excel-formula-ast#node-types)\n\n### visit(tree, visitor)\n\nSend a visitor through the tree nodes.\n\n- tree: [ast node](https://github.com/psalaets/excel-formula-ast#node-types)\n- visitor: object\n\n#### visitor\n\nVisitor is an object with any of these function properties:\n\n```js\n{\n  enterCell(node) {},\n  exitCell(node) {},\n\n  enterCellRange(node) {},\n  exitCellRange(node) {},\n\n  enterFunction(node) {},\n  exitFunction(node) {},\n\n  enterNumber(node) {},\n  exitNumber(node) {},\n\n  enterText(node) {},\n  exitText(node) {},\n\n  enterLogical(node) {},\n  exitLogical(node) {},\n\n  enterBinaryExpression(node) {},\n  exitBinaryExpression(node) {},\n\n  enterUnaryExpression(node) {},\n  exitUnaryExpression(node) {}\n}\n```\n\nFor any node type Foo\n\n- `enterFoo()` is called when the visitor gets to a Foo node.\n- `exitFoo()` is called when the visitor has visited all of the Foo's child nodes (if any) and is leaving the Foo.\n\n## Node Types\n\n### cell\n\nPassed to visitor methods: `enterCell`, `exitCell`\n\nProperties:\n\n- type: string - `'cell'`\n- key: string - Excel cell number. Example: `'A1'`\n- refType: string - `'relative' | 'mixed' | 'absolute'`\n\n### cell range\n\nPassed to visitor methods: `enterCellRange`, `exitCellRange`\n\nProperties:\n\n- type: string - `'cell-range'`\n- left: cell node\n- right: cell node\n\n### function\n\nPassed to visitor methods: `enterFunction`, `exitFunction`\n\nProperties:\n\n- type: string - `'function'`\n- name: string - function name\n- arguments: Array of node\n\n### number\n\nPassed to visitor methods: `enterNumber`, `exitNumber`\n\nProperties:\n\n- type: string - `'number'`\n- value: number\n\n### text\n\nPassed to visitor methods: `enterText`, `exitText`\n\nProperties:\n\n- type: string - `'text'`\n- value: string\n\n### logical\n\nPassed to visitor methods `enterLogical`, `exitLogical`\n\nProperties:\n\n- type: string - `'logical'`\n- value: boolean\n\n### binary expression\n\nPassed to visitor methods: `enterBinaryExpression`, `exitBinaryExpression`\n\nProperties:\n\n- type: string - `binary-expression`\n- operator: string\n- left: node\n- right: node\n\n### unary expression\n\nPassed to visitor methods: `enterUnaryExpression`, `exitUnaryExpression`\n\nProperties:\n\n- type: string - `'unary-expression'`\n- operator: string\n- operand: node\n\n##  License\n\nMIT\n","maintainers":[{"name":"psalaets","email":"psalaets@gmail.com"}],"time":{"modified":"2022-06-17T21:48:24.648Z","created":"2017-05-20T20:47:25.420Z","1.0.0":"2017-05-20T20:47:25.420Z","1.0.1":"2017-05-20T20:56:03.588Z","1.0.2":"2017-05-21T18:29:17.955Z","1.0.3":"2017-05-21T19:05:38.186Z","1.1.0":"2017-08-30T23:26:50.591Z","1.1.1":"2017-09-09T01:51:33.141Z"},"keywords":["excel","formula","parse","ast"],"license":"MIT","readmeFilename":"README.md","homepage":"https://github.com/psalaets/excel-formula-ast","repository":{"type":"git","url":"git+https://github.com/psalaets/excel-formula-ast.git"},"author":{"name":"Paul Salaets","email":"psalaets@gmail.com"},"bugs":{"url":"https://github.com/psalaets/excel-formula-ast/issues"}}