clarity-pattern-parser
Version:
Parsing Library for Typescript and Javascript.
24 lines (19 loc) • 548 B
text/typescript
import { Sequence } from "../../patterns/Sequence";
import { Literal } from "../../patterns/Literal";
import { Options } from "../../patterns/Options";
import { Regex } from "../../patterns/Regex";
const e = new Options("e", [
new Literal("e", "e"),
new Literal("e", "E")
]);
const optionalSign = new Options("sign", [
new Literal("plus", "+"),
new Literal("minus", "-")
], true);
const digit = new Regex("digit", "\\d+");
const exponent = new Sequence("exponent", [
e,
optionalSign,
digit,
]);
export { exponent };