Urara-Blog/node_modules/.pnpm-store/v3/files/e3/7eb90682c4637d9c6e402fcac345d40ec2f37b688728844f63da297815581572b7b36e70f9386b845d0ba74fdefded7fc328f4efd1870dbaec7ab2a59a7d46
2022-08-14 01:14:53 +08:00

51 lines
1,004 B
Text

export interface MathExpression {
type: 'MathExpression';
right: CalcNode;
left: CalcNode;
operator: '*' | '+' | '-' | '/';
}
export interface ParenthesizedExpression {
type: 'ParenthesizedExpression';
content: CalcNode;
}
export interface DimensionExpression {
type:
| 'LengthValue'
| 'AngleValue'
| 'TimeValue'
| 'FrequencyValue'
| 'PercentageValue'
| 'ResolutionValue'
| 'EmValue'
| 'ExValue'
| 'ChValue'
| 'RemValue'
| 'VhValue'
| 'VwValue'
| 'VminValue'
| 'VmaxValue';
value: number;
unit: string;
}
export interface NumberExpression {
type: 'Number';
value: number;
}
export interface FunctionExpression {
type: 'Function';
value: string;
}
export type ValueExpression = DimensionExpression | NumberExpression;
export type CalcNode = MathExpression | ValueExpression | FunctionExpression | ParenthesizedExpression;
export interface Parser {
parse: (arg: string) => CalcNode;
}
export const parser: Parser;