unist-formula-ast
v1.4.1
Published
Excel formula ast to implement unist specification
Downloads
20
Maintainers
Readme
unist-formula-ast
Excel formula ast to implement unist specification.
unist-formula-ast is a specification for representing Excel Formula in a syntax tree.
If you want to know how to use unist-formula-ast directly, read Getting Started!
Introduction
This document defines a format for abstract syntax tree. Development of unist-formula-ast started in May 2024. This specification is written in a ~~Web IDL-like~~ TypeScript grammar.
Where this specification fits
Types
If you are using TypeScript, you can use the unist types by installing them with npm:
npm install unist-formula-ast
Nodes(abstract)
BasicNode
interface IBasicNode {
type: BasicNodeType | BasicCalculationNodeType
value?: string | number
position: IBasicNodePosition
children?: IBasicNode[]
}
Nodes
BasicCalculationNode
type BasicCalculationNodeType =
| "Addition"
| "Subtraction"
| "Multiplication"
| "Division"
interface IBasicCalculationNode extends IBasicNode {
type: BasicCalculationNodeType
children: IBasicNode[]
}
NumberNode
interface INumberNode extends IBasicNode {
type: "Number"
value: number
}
VariableNode
interface IVariableNode extends IBasicNode {
type: "Variable"
value: string
}
FuntionCallNode
interface IFuntionCallNode extends IBasicNode {
type: "Function"
value: string
children: FuntionCallArgumentType[]
}
Want to know more definitions for unist-formula-ast, see src/types.ts
References
- Peggy: The parser of unist-formula-ast is generated by this project.
- unist: The specification of unist-formula-ast is based on this project.
LICENSE
MIT © Herbert He