How to use the railroad-diagrams.OneOrMore 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
function renderTok(tok) {
            // ctx translated to correct position already
            if (tok.subexpression) {
                return new rr.Choice(0, tok.subexpression.map(renderTok));
            } 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));
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
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(
																					0,
																					Sequence(
																							NonTerminal('table_name'),
																							Optional(Sequence('AS', NonTerminal('alias')))
																					),
																					Sequence(
																							'(', NonTerminal('select'), ')',
																							Sequence('AS', NonTerminal('alias'))
																					)
																			)
																	),
github matthijsgroen / ebnf2railroad / src / report-builder.js View on Github external
Sequence(
            ...subSequence.map(elem => productionToDiagram(elem, options))
          )
        )
      );
    }

    return Sequence(
      ...production.sequence.map(elem => productionToDiagram(elem, options))
    );
  }
  if (production.repetition && production.skippable === true) {
    return Choice(
      1,
      Skip(),
      OneOrMore(productionToDiagram(production.repetition, options))
    );
  }
  if (production.repetition && production.skippable === false) {
    return production.repeater
      ? OneOrMore(
          productionToDiagram(production.repetition, options),
          productionToDiagram(production.repeater, options)
        )
      : OneOrMore(productionToDiagram(production.repetition, options));
  }
  if (production.repetition && production.amount !== undefined) {
    return OneOrMore(
      productionToDiagram(production.repetition, options),
      Comment(`${production.amount} ×`, {})
    );
  }
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
'EXCEPT'
																			),
																			Choice(
																					0,
																					Skip(),
																					'DISTINCT',
																					'ALL'
																			),
																			NonTerminal('select')
																	),
																	'skip',
															),
															Optional(
																	Sequence(
																			Terminal('ORDER BY', '#sql-orderby'),
																			OneOrMore(
																					Sequence(
																							NonTerminal('expression', '#sql-valueexpr'),
																							Choice(
																									0,
																									'ASC',
																									'DESC'
																							)
																					),
																					','
																			)
																	),
																	'skip',
															),
													),

													Sequence(
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
Choice(
																			0,
																			Sequence(
																					NonTerminal('table_name'),
																					Optional(Sequence('AS', NonTerminal('alias')))
																			),
																			Sequence(
																					'(', 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,
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
<div>
									The argument is the old and the new column names in a list (see example) <br>
									"←" can be substituted with "{'&lt;'}-"

									<div>
										rename the columns id and firstname to myId and foobar:
										<code>ρ myId←id, foobar←firstname (π id, firstname ( Customer ) )</code>
									</div>

									<div>
										'),
																					NonTerminal('new name')
																			)
																	),
																	','
															)
													),
													NonTerminal('RA-expression', '#relalg-relalgexpr')</div></div>
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
'(',
																					NonTerminal('select', '#sql-select'),
																					')'
																			),
																			','
																	),
															),
															'skip',
													),
													Sequence(
															Terminal('SELECT', '#sql-select'),
															Optional('DISTINCT', 'skip'),
															Choice(
																	0,
																	'*',
																	OneOrMore(
																			Choice(
																					0,
																					Sequence(
																							NonTerminal('column'),
																							Optional(Sequence('AS', NonTerminal('output_name')))
																					),
																					Sequence(
																							NonTerminal('expression', '#sql-valueexpr'),
																							Sequence('AS', NonTerminal('output_name'))
																					)
																			),
																			','
																	),
															),

															Terminal('FROM', '#sql-from'),