Typescript all the parser things

This commit is contained in:
Thaum Rystra
2024-02-20 23:21:12 +02:00
parent 3ea492ee78
commit ac15512bc5
86 changed files with 926 additions and 718 deletions

View File

@@ -0,0 +1,11 @@
import ParseNode from '/imports/parser/parseTree/ParseNode';
import { ConstantValueType } from '/imports/parser/parseTree/constant';
import toString from './toString';
export default function toPrimitiveOrString(node: ParseNode): ConstantValueType {
if (!node) return '';
if (node.parseType === 'constant') return node.value;
if (node.parseType === 'error') return undefined;
return toString(node);
}