UNPKG

ebnf-railroad-visualizer

Version:
443 lines (442 loc) 14.1 kB
export default funcs; export namespace Options { let DEBUG: boolean; let VS: number; let AR: number; let DIAGRAM_CLASS: string; let STROKE_ODD_PIXEL_LENGTH: boolean; let INTERNAL_ALIGNMENT: string; let CHAR_WIDTH: number; let COMMENT_CHAR_WIDTH: number; let ESCAPE_HTML: boolean; } export const defaultCSS: "\n\tsvg {\n\t\tbackground-color: hsl(30,20%,95%);\n\t}\n\tpath {\n\t\tstroke-width: 3;\n\t\tstroke: black;\n\t\tfill: rgba(0,0,0,0);\n\t}\n\ttext {\n\t\tfont: bold 14px monospace;\n\t\ttext-anchor: middle;\n\t\twhite-space: pre;\n\t}\n\ttext.diagram-text {\n\t\tfont-size: 12px;\n\t}\n\ttext.diagram-arrow {\n\t\tfont-size: 16px;\n\t}\n\ttext.label {\n\t\ttext-anchor: start;\n\t}\n\ttext.comment {\n\t\tfont: italic 12px monospace;\n\t}\n\tg.non-terminal text {\n\t\t/*font-style: italic;*/\n\t}\n\trect {\n\t\tstroke-width: 3;\n\t\tstroke: black;\n\t\tfill: hsl(120,100%,90%);\n\t}\n\trect.group-box {\n\t\tstroke: gray;\n\t\tstroke-dasharray: 10 5;\n\t\tfill: none;\n\t}\n\tpath.diagram-text {\n\t\tstroke-width: 3;\n\t\tstroke: black;\n\t\tfill: white;\n\t\tcursor: help;\n\t}\n\tg.diagram-text:hover path.diagram-text {\n\t\tfill: #eee;\n\t}"; export class FakeSVG { constructor(tagName: any, attrs: any, text: any); children: any; tagName: any; attrs: any; format(x: any, y: any, width: any): void; addTo(parent: any): any; toSVG(): any; toString(): string; toTextDiagram(): TextDiagram; toText(): string; walk(cb: any): void; } export class Path extends FakeSVG { constructor(x: any, y: any); m(x: any, y: any): this; h(val: any): this; right(val: any): this; left(val: any): this; v(val: any): this; down(val: any): this; up(val: any): this; arc(sweep: any): this; arc_8(start: any, dir: any): this; l(x: any, y: any): this; format(): this; } export class DiagramMultiContainer extends FakeSVG { constructor(tagName: any, items: any, attrs: any, text: any); items: any; } export class Diagram extends DiagramMultiContainer { constructor(...items: any[]); up: number; down: number; height: number; width: number; formatted: boolean; format(paddingt: any, paddingr: any, paddingb: any, paddingl: any): this; toStandalone(style: any): string; toTextDiagram(): any; } export class ComplexDiagram extends FakeSVG { constructor(...items: any[]); } export class Sequence extends DiagramMultiContainer { constructor(...items: any[]); needsSpace: boolean; up: number; down: number; height: number; width: number; format(x: any, y: any, width: any): this; } export class Stack extends DiagramMultiContainer { constructor(...items: any[]); width: number; needsSpace: boolean; up: any; down: any; height: number; format(x: any, y: any, width: any): this; } export class OptionalSequence extends DiagramMultiContainer { constructor(...items: any[]); needsSpace: boolean | undefined; width: number | undefined; up: number | undefined; height: any; down: any; format(x: any, y: any, width: any): this; } export class AlternatingSequence extends DiagramMultiContainer { constructor(...items: any[]); needsSpace: boolean | undefined; up: any; down: any; height: number | undefined; width: number | undefined; format(x: any, y: any, width: any): this; toTextDiagram(): any; } export class Choice extends DiagramMultiContainer { constructor(normal: any, ...items: any[]); normal: number; width: number; separators: number[]; up: number; height: any; down: number; format(x: any, y: any, width: any): this; } export class HorizontalChoice extends DiagramMultiContainer { constructor(...items: any[]); needsSpace: boolean | undefined; width: number | undefined; height: number | undefined; _upperTrack: number | undefined; up: number | undefined; _lowerTrack: number | undefined; down: number | undefined; format(x: any, y: any, width: any): this; } export class MultipleChoice extends DiagramMultiContainer { constructor(normal: any, type: any, ...items: any[]); normal: number; type: any; needsSpace: boolean; innerWidth: number; width: number; up: any; down: any; height: any; format(x: any, y: any, width: any): this; } export class Optional extends FakeSVG { constructor(item: any, skip: any); } export class OneOrMore extends FakeSVG { constructor(item: any, rep: any); item: FakeSVG; rep: FakeSVG; width: number; height: any; up: any; down: number; needsSpace: boolean; format(x: any, y: any, width: any): this; } export class ZeroOrMore extends FakeSVG { } export class Group extends FakeSVG { item: FakeSVG; label: FakeSVG | undefined; width: number; height: any; boxUp: number; up: number; down: number; needsSpace: boolean; format(x: any, y: any, width: any): this; } export class Start extends FakeSVG { constructor({ type, label }?: { type?: string | undefined; }); width: number; height: number; up: number; down: number; type: string; label: string | undefined; format(x: any, y: any): this; } export class End extends FakeSVG { constructor({ type }?: { type?: string | undefined; }); width: number; height: number; up: number; down: number; type: string; format(x: any, y: any): this; } export class Terminal extends FakeSVG { constructor(text: any, { href, title, cls }?: {}); text: string; href: any; title: any; cls: any; width: number; height: number; up: number; down: number; needsSpace: boolean; format(x: any, y: any, width: any): this; } export class NonTerminal extends FakeSVG { constructor(text: any, { href, title, cls }?: { cls?: string | undefined; }); text: string; href: any; title: any; cls: string; width: number; height: number; up: number; down: number; needsSpace: boolean; format(x: any, y: any, width: any): this; } export class Comment extends FakeSVG { constructor(text: any, { href, title, cls }?: { cls?: string | undefined; }); text: string; href: any; title: any; cls: string; width: number; height: number; up: number; down: number; needsSpace: boolean; format(x: any, y: any, width: any): this; } export class Skip extends FakeSVG { constructor(); width: number; height: number; up: number; down: number; needsSpace: boolean; format(x: any, y: any, width: any): this; } export class Block extends FakeSVG { constructor({ width, up, height, down, needsSpace }?: { width?: number | undefined; up?: number | undefined; height?: number | undefined; down?: number | undefined; needsSpace?: boolean | undefined; }); width: number; height: number; up: number; down: number; needsSpace: boolean; format(x: any, y: any, width: any): this; } export class TextDiagram { static rect(item: any, dashed?: boolean): TextDiagram; static roundrect(item: any, dashed?: boolean): TextDiagram; static setFormatting(characters?: null, defaults?: null): void; static _encloseLines(lines: any, lefts: any, rights: any): any[]; static _gaps(outerWidth: any, innerWidth: any): number[]; static _getParts(partNames: any): any[]; static _maxWidth(...args: any[]): number; static _padL(string: any, width: any, pad: any): any; static _padR(string: any, width: any, pad: any): any; static _rectish(rectType: any, data: any, dashed?: boolean): TextDiagram; static PARTS_UNICODE: { cross_diag: string; corner_bot_left: string; corner_bot_right: string; corner_top_left: string; corner_top_right: string; cross: string; left: string; line: string; line_vertical: string; multi_repeat: string; rect_bot: string; rect_bot_dashed: string; rect_bot_left: string; rect_bot_right: string; rect_left: string; rect_left_dashed: string; rect_right: string; rect_right_dashed: string; rect_top: string; rect_top_dashed: string; rect_top_left: string; rect_top_right: string; repeat_bot_left: string; repeat_bot_right: string; repeat_left: string; repeat_right: string; repeat_top_left: string; repeat_top_right: string; right: string; roundcorner_bot_left: string; roundcorner_bot_right: string; roundcorner_top_left: string; roundcorner_top_right: string; roundrect_bot: string; roundrect_bot_dashed: string; roundrect_bot_left: string; roundrect_bot_right: string; roundrect_left: string; roundrect_left_dashed: string; roundrect_right: string; roundrect_right_dashed: string; roundrect_top: string; roundrect_top_dashed: string; roundrect_top_left: string; roundrect_top_right: string; separator: string; tee_left: string; tee_right: string; }; static PARTS_ASCII: { cross_diag: string; corner_bot_left: string; corner_bot_right: string; corner_top_left: string; corner_top_right: string; cross: string; left: string; line: string; line_vertical: string; multi_repeat: string; rect_bot: string; rect_bot_dashed: string; rect_bot_left: string; rect_bot_right: string; rect_left: string; rect_left_dashed: string; rect_right: string; rect_right_dashed: string; rect_top_dashed: string; rect_top: string; rect_top_left: string; rect_top_right: string; repeat_bot_left: string; repeat_bot_right: string; repeat_left: string; repeat_right: string; repeat_top_left: string; repeat_top_right: string; right: string; roundcorner_bot_left: string; roundcorner_bot_right: string; roundcorner_top_left: string; roundcorner_top_right: string; roundrect_bot: string; roundrect_bot_dashed: string; roundrect_bot_left: string; roundrect_bot_right: string; roundrect_left: string; roundrect_left_dashed: string; roundrect_right: string; roundrect_right_dashed: string; roundrect_top: string; roundrect_top_dashed: string; roundrect_top_left: string; roundrect_top_right: string; separator: string; tee_left: string; tee_right: string; }; static parts: { cross_diag: string; corner_bot_left: string; corner_bot_right: string; corner_top_left: string; corner_top_right: string; cross: string; left: string; line: string; line_vertical: string; multi_repeat: string; rect_bot: string; rect_bot_dashed: string; rect_bot_left: string; rect_bot_right: string; rect_left: string; rect_left_dashed: string; rect_right: string; rect_right_dashed: string; rect_top: string; rect_top_dashed: string; rect_top_left: string; rect_top_right: string; repeat_bot_left: string; repeat_bot_right: string; repeat_left: string; repeat_right: string; repeat_top_left: string; repeat_top_right: string; right: string; roundcorner_bot_left: string; roundcorner_bot_right: string; roundcorner_top_left: string; roundcorner_top_right: string; roundrect_bot: string; roundrect_bot_dashed: string; roundrect_bot_left: string; roundrect_bot_right: string; roundrect_left: string; roundrect_left_dashed: string; roundrect_right: string; roundrect_right_dashed: string; roundrect_top: string; roundrect_top_dashed: string; roundrect_top_left: string; roundrect_top_right: string; separator: string; tee_left: string; tee_right: string; }; constructor(entry: any, exit: any, lines: any); entry: any; exit: any; height: any; lines: any[]; width: any; alter(entry?: null, exit?: null, lines?: null): TextDiagram; appendBelow(item: any, linesBetween: any, moveEntry?: boolean, moveExit?: boolean): TextDiagram; appendRight(item: any, charsBetween: any): TextDiagram; center(width: any, pad: any): TextDiagram; copy(): TextDiagram; expand(left: any, right: any, top: any, bottom: any): TextDiagram; _dump(show?: boolean): string; } declare namespace funcs { function Diagram(...args: any[]): Diagram; function ComplexDiagram(...args: any[]): ComplexDiagram; function Sequence(...args: any[]): Sequence; function Stack(...args: any[]): Stack; function OptionalSequence(...args: any[]): OptionalSequence; function AlternatingSequence(...args: any[]): AlternatingSequence; function Choice(...args: any[]): Choice; function HorizontalChoice(...args: any[]): HorizontalChoice; function MultipleChoice(...args: any[]): MultipleChoice; function Optional(...args: any[]): Optional; function OneOrMore(...args: any[]): OneOrMore; function ZeroOrMore(...args: any[]): ZeroOrMore; function Group(...args: any[]): Group; function Start(...args: any[]): Start; function End(...args: any[]): End; function Terminal(...args: any[]): Terminal; function NonTerminal(...args: any[]): NonTerminal; function Comment(...args: any[]): Comment; function Skip(...args: any[]): Skip; function Block(...args: any[]): Block; }