How to use the railroad-diagrams.Terminal 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 dbis-uibk / relax / calc2 / views / help.tsx View on Github external
)
																	),
															),
													),

													Sequence(
															Optional(
																	Sequence(
																			Terminal('WHERE', '#sql-where'),
																			NonTerminal('condition')
																	),
																	'skip',
															),
															Optional(
																	Sequence(
																			Terminal('GROUP BY', '#sql-groupby'),
																			NonTerminal('expression', '#sql-valueexpr')
																	),
																	'skip',
															),
															Optional(
																	Sequence(
																			Terminal('HAVING', '#sql-having'),
																			NonTerminal('condition')
																	),
																	'skip',
															),
													),

													Sequence(
															Optional(
																	Sequence(
github kach / nearley / bin / nearley-railroad.js View on Github external
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));
            } 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
const productionToDiagram = (production, options) => {
  if (production.identifier) {
    return production.complex
      ? ComplexDiagram(productionToDiagram(production.definition, options))
      : Diagram(productionToDiagram(production.definition, options));
  }
  if (production.terminal) {
    return Terminal(production.terminal);
  }
  if (production.nonTerminal) {
    return NonTerminal(production.nonTerminal, {
      href: `#${dasherize(production.nonTerminal)}`
    });
  }
  if (production.skip) {
    return Skip();
  }
  if (production.specialSequence) {
    const sequence = NonTerminal(" " + production.specialSequence + " ", {});
    sequence.attrs.class = "special-sequence";
    return sequence;
  }
  if (production.choice) {
    const makeChoice = items => new Choice(0, items);
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
Terminal('WITH', '#sql-with'),
																	OneOrMore(
																			Sequence(
																					NonTerminal('name'),
																					'AS',
																					'(',
																					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'))
																					)
																			),
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
'INTERSECT',
																					'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',
															),
													),
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
),

													Sequence(
															Optional(
																	Sequence(
																			Terminal('LIMIT', '#sql-limit'),
																			Choice(0,
																					NonTerminal('count'),
																					'ALL'
																			)
																	),
																	'skip',
															),
															Optional(
																	Sequence(
																			Terminal('OFFSET', '#sql-limit'),
																			NonTerminal('start'),
																			Optional('ROWS')
																	),
																	'skip',
															),
													),


													Sequence(
															Optional(
																	Sequence(
																			Terminal('FETCH FIRST', '#sql-limit'),
																			NonTerminal('count'),
																			Optional('ROWS'),
																			'ONLY'
																	),
github kach / nearley / bin / nearley-railroad.js View on Github external
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 dbis-uibk / relax / calc2 / views / help.tsx View on Github external
),
															Optional(
																	Sequence(
																			Terminal('OFFSET', '#sql-limit'),
																			NonTerminal('start'),
																			Optional('ROWS')
																	),
																	'skip',
															),
													),


													Sequence(
															Optional(
																	Sequence(
																			Terminal('FETCH FIRST', '#sql-limit'),
																			NonTerminal('count'),
																			Optional('ROWS'),
																			'ONLY'
																	),
																	'skip',
															),
													),
											),
									)} />
							

							<h3 id="sql-translation">Semantic and Translation to relational algebra</h3>


							<h4 id="sql-translation-sequence">Sequence of execution</h4>
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
Sequence(
																			Terminal('WHERE', '#sql-where'),
																			NonTerminal('condition')
																	),
																	'skip',
															),
															Optional(
																	Sequence(
																			Terminal('GROUP BY', '#sql-groupby'),
																			NonTerminal('expression', '#sql-valueexpr')
																	),
																	'skip',
															),
															Optional(
																	Sequence(
																			Terminal('HAVING', '#sql-having'),
																			NonTerminal('condition')
																	),
																	'skip',
															),
													),

													Sequence(
															Optional(
																	Sequence(
																			Choice(
																					0,
																					'UNION',
																					'INTERSECT',
																					'EXCEPT'
																			),
																			Choice(