import { Some, None, type Option } from "@tsus/runtime";// Regex literals full of the characters a hand-written scanner trips on:// braces, quotes, a backtick, and text that looks like a match block.const braces = /[{}]+/g;const quotes = /["'`]/g;const decoy = /match \(x\) \{ Some\(y\) => y \}/;const half = 10 / 2 / 1;const clean = (raw: string): Option<string> => raw.length === 0 ? None : Some(raw.replace(braces, "").replace(quotes, ""));const show = (raw: string): string => match (clean(raw)) { Some(s) => `${s} (${/[{"]/.test(raw) ? "had junk" : "clean"})`, None => "empty", };console.log(show(`{"a"}`));console.log(show("plain"));console.log(show(""));console.log(decoy.test("match (x) { Some(y) => y }"));console.log(half);