1.4.1 • Published 1 year ago

unist-formula-ast v1.4.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

unist-formula-ast

version download

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

1.4.1

1 year ago

1.4.0

1 year ago

1.3.0

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago