Using data types for expressions
Fields of the spreadsheet can contain expressions, that can be calculated. To calculate these values, the input of the user must be converted to a data structure, which can then be used to calculate the result of that field.
These expressions can contain constants, operations, references to other fields or a parenthesized expression:
- Constants:
0
,42
,10.2
,4e6
,7.5e8
- Unary expression:
-expression
,expression!
- Binary expression:
expression + expression
,expression / expression
- References:
3:1
(third column, first row) - Parenthesized expression:
(expression)
We will create these types in lib/model/expression.ts
. First we ...
Get TypeScript: Modern JavaScript Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.