1 | export interface MathExpression {
|
2 | type: 'MathExpression';
|
3 | right: CalcNode;
|
4 | left: CalcNode;
|
5 | operator: '*' | '+' | '-' | '/';
|
6 | }
|
7 |
|
8 | export interface ParenthesizedExpression {
|
9 | type: 'ParenthesizedExpression';
|
10 | content: CalcNode;
|
11 | }
|
12 |
|
13 | export interface DimensionExpression {
|
14 | type:
|
15 | | 'LengthValue'
|
16 | | 'AngleValue'
|
17 | | 'TimeValue'
|
18 | | 'FrequencyValue'
|
19 | | 'PercentageValue'
|
20 | | 'ResolutionValue'
|
21 | | 'EmValue'
|
22 | | 'ExValue'
|
23 | | 'ChValue'
|
24 | | 'RemValue'
|
25 | | 'VhValue'
|
26 | | 'VwValue'
|
27 | | 'VminValue'
|
28 | | 'VmaxValue';
|
29 | value: number;
|
30 | unit: string;
|
31 | }
|
32 |
|
33 | export interface NumberExpression {
|
34 | type: 'Number';
|
35 | value: number;
|
36 | }
|
37 |
|
38 | export interface FunctionExpression {
|
39 | type: 'Function';
|
40 | value: string;
|
41 | }
|
42 |
|
43 | export type ValueExpression = DimensionExpression | NumberExpression;
|
44 |
|
45 | export type CalcNode = MathExpression | ValueExpression | FunctionExpression | ParenthesizedExpression;
|
46 |
|
47 | export interface Parser {
|
48 | parse: (arg: string) => CalcNode;
|
49 | }
|
50 |
|
51 | export const parser: Parser;
|