Lawtext syntax

Lawtext syntax

Detailed syntax

Please refer to the comments in the source code referred from the following documents for the detailed syntax of Lawtext.

How to try

Try it out here

  1. On this page, open the browser console (for Chrome, press Ctrl+Shift+J (Windows/Linux) or Cmd+Opt+J (Mac))..
  2. Run the following command in the browser console:
    lawtext.run({
        input: { elaws: "405AC0000000088" },
        outtypes: ["lawtext"],
    })
        .then(r => {
            console.log("Lawtext:");
            console.log(r.lawtext);
            return lawtext.run({
                input: { lawtext: r.lawtext },
                outtypes: ["json"],
                controlel: true,
            });
        })
        .then(r => {
            console.log("\u{2705} Parsed VirtualLines:");
            console.log(r.virtuallines);
            console.table(r.virtuallines.map(v => ({
                "VirtualLine.type": v.type,
                ...Object.fromEntries(v.line?.rangeTexts().map(([, t, d], i) => [`rangeTexts()[${i}]`, t]) ?? []),
            })));
            console.log("\u{2705} Parsed StdEL (JsonEL):");
            console.log(r.json);
            console.log(JSON.stringify(r.json, undefined, 2));
        });

Hint: run console.log(lawtext.run.help) to show the help.

Try using the CLI

Please see CLI usage and run CLI with a lawtext input and json output with controlel option (and virtuallinesout option when running in Node.js) to get the parsed VirtualLines and the parsed StdEL (JsonEL) representation.

Try using the Visual Studio Code extension