How to use the railroad-diagrams.Comment function in railroad-diagrams

To help you get started, we’ve selected a few railroad-diagrams examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kach / nearley / bin / nearley-railroad.js View on Github external
} else if (tok.ebnf) {
                switch (tok.modifier) {
                case ":+":
                    return new rr.OneOrMore(renderTok(tok.ebnf));
                    break;
                case ":*":
                    return new rr.ZeroOrMore(renderTok(tok.ebnf));
                    break;
                case ":?":
                    return new rr.Optional(renderTok(tok.ebnf));
                    break;
                }
            } else if (tok.literal) {
                return new rr.Terminal(JSON.stringify(tok.literal));
            } else if (tok.mixin) {
                return new rr.Comment("Pas implementé.");
            } else if (tok.macrocall) {
                return new rr.Comment("Pas implementé.");
            } else if (tok.tokens) {
                return new rr.Sequence(tok.tokens.map(renderTok));
            } else if (typeof(tok) === 'string') {
                return new rr.NonTerminal(tok);
            } else if (tok.constructor === RegExp) {
                return new rr.Terminal(tok.toString());
            } else if (tok.token) {
                return new rr.Terminal(tok.token);
            } else {
                return new rr.Comment("[Unimplemented]");
            }
        }
github kach / nearley / bin / nearley-railroad.js View on Github external
} else if (tok.literal) {
                return new rr.Terminal(JSON.stringify(tok.literal));
            } else if (tok.mixin) {
                return new rr.Comment("Pas implementé.");
            } else if (tok.macrocall) {
                return new rr.Comment("Pas implementé.");
            } else if (tok.tokens) {
                return new rr.Sequence(tok.tokens.map(renderTok));
            } else if (typeof(tok) === 'string') {
                return new rr.NonTerminal(tok);
            } else if (tok.constructor === RegExp) {
                return new rr.Terminal(tok.toString());
            } else if (tok.token) {
                return new rr.Terminal(tok.token);
            } else {
                return new rr.Comment("[Unimplemented]");
            }
        }
github matthijsgroen / ebnf2railroad / src / report-builder.js View on Github external
if (production.repetition && production.amount !== undefined) {
    return OneOrMore(
      productionToDiagram(production.repetition, options),
      Comment(`${production.amount} ×`, {})
    );
  }
  if (production.optional) {
    return Choice(1, Skip(), productionToDiagram(production.optional, options));
  }
  if (production.comment) {
    return production.group
      ? Sequence(
          productionToDiagram(production.group, options),
          Comment(production.comment, {})
        )
      : Comment(production.comment, {});
  }
  if (production.group) {
    return productionToDiagram(production.group, options);
  }
  if (production.exceptNonTerminal) {
    return NonTerminal(
      `${production.include} - ${production.exceptNonTerminal}`,
      {}
    );
  }
  if (production.exceptTerminal) {
    return NonTerminal(
      `${production.include} - ${production.exceptTerminal}`,
      {}
    );
  }
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
'(', NonTerminal('select'), ')',
																					Sequence('AS', NonTerminal('alias'))
																			)
																	),
																	',',
															),
													),

													OneOrMore(
															Choice(
																	0,
																	Skip(),
																	Sequence(
																			Choice(
																					0,
																					Sequence(',', Comment('old syntax for cross join')),
																					Sequence(Choice(0, 'CROSS', 'NATURAL'), 'JOIN'),
																					Sequence(
																							Choice(
																									0,
																									Sequence(Optional('INNER'), 'JOIN'),
																									Sequence(Choice(0, 'LEFT', 'RIGHT', 'FULL'), Optional('OUTER'), 'JOIN')
																							),
																							Choice(
																									0,
																									Sequence('ON', NonTerminal('condition')),
																									Sequence('USING', '(', OneOrMore(NonTerminal('join_column'), ','), ')'),
																									Sequence('NATURAL')
																							)
																					)
																			),
																			Choice(
github kach / nearley / bin / nearley-railroad.js View on Github external
case ":+":
                    return new rr.OneOrMore(renderTok(tok.ebnf));
                    break;
                case ":*":
                    return new rr.ZeroOrMore(renderTok(tok.ebnf));
                    break;
                case ":?":
                    return new rr.Optional(renderTok(tok.ebnf));
                    break;
                }
            } else if (tok.literal) {
                return new rr.Terminal(JSON.stringify(tok.literal));
            } else if (tok.mixin) {
                return new rr.Comment("Pas implementé.");
            } else if (tok.macrocall) {
                return new rr.Comment("Pas implementé.");
            } else if (tok.tokens) {
                return new rr.Sequence(tok.tokens.map(renderTok));
            } else if (typeof(tok) === 'string') {
                return new rr.NonTerminal(tok);
            } else if (tok.constructor === RegExp) {
                return new rr.Terminal(tok.toString());
            } else if (tok.token) {
                return new rr.Terminal(tok.token);
            } else {
                return new rr.Comment("[Unimplemented]");
            }
        }