import { escapeHtml } from "./helpers"; import { AtLeast, Choose, End, Pattern, Peek, Regex, Sequence, Use, } from "./peg"; import { InterpolatedPiece, Script, ScriptPiece, SimplifyWord, TextWord, Word as WordType, } from "./words"; const Comment = Regex(/#[^\n]*/y) .expects("#") .map(() => []); const PreWordWhitespace = Regex(/[^\S\n;]+/y).expects("whitespace"); const BackslashEscape = Regex(/\\(.)/y) .expects("\\") .map(([, char]) => ({ text: char })); const BARE_WORD_CHAR = /[^\s\\;\[]+/y; const BARE_BRACKET_WORD_CHAR = /[^\s\\;\[\]]+/y; let BracketScript: Pattern