import { CrochetValue } from "../../../vm"; import { unreachable } from "../../../utils/utils"; import { Repr, ReprTag } from "./ast"; import { value_to_repr } from "./value"; import * as React from "react"; import { Column, Grid, GridColumn, GridRow, Style } from "../ui/basic"; import { Foldable, MaybeFoldable } from "../ui/folds"; export class HTMLRenderer { render(x: Repr): React.ReactNode { switch (x.tag) { case ReprTag.TEXT: return ; case ReprTag.NUMBER: return ; case ReprTag.KEYWORD: return ; case ReprTag.LIST: return ( ))} ); case ReprTag.MAP: return ( ); case ReprTag.INTERPOLATION: return ( ))} ); case ReprTag.STATIC_TEXT: return ; case ReprTag.FLOW: return ( ); case ReprTag.BLOCK: return ; case ReprTag.STACK: return ( ))} ); case ReprTag.CIRCULAR: // FIXME: allow clicking to expand return ; case ReprTag.TYPED: return ( ); case ReprTag.TAGGED: return ( ); case ReprTag.SPACE: return " "; case ReprTag.SECRET: return ( ); default: throw unreachable(x, "Value"); } } render_value(x: CrochetValue) { return this.render(value_to_repr(x, new Set())); } } export const html = new HTMLRenderer();