How to use the railroad-diagrams.Choice 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é.");
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
alternative syntax
											right outer join<br>right join
										
									
								
								<div>optional join condition; if no join condition is given it acts as a natural right outer join
									<div>
										
									</div>
								</div>
							
							<div>
								<h4 id="relalg-operations-fulljoin">full outer join</h4>
								<table>
									<tbody>
										<tr>
											<th>symbol</th>
											<td></td></tr></tbody></table></div>
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
<div>no argument

									<div>
										<code>ρ a ( Customer )
				<span></span> a.name {'&lt;'} b.name ( ρ b ( Customer ) )</code>
									</div>

									<div>
										
									</div>
								</div>
							
							<div>
								<h4 id="relalg-operations-leftjoin">left outer join</h4>
								<table>
									<tbody>
										<tr>
											<th>symbol</th>
											<td></td>
										</tr>
										<tr>
											<th>alternative syntax</th></tr></tbody></table></div>
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
<div>no argument

									<div>
										<code>( Customer ) ∪ ( Customer )</code>
									</div>
									the schemas must be unifiable

									<div>
										
									</div>
								</div>
							
							<div>
								<h4 id="relalg-operations-division">division</h4>
								<table>
									<tbody>
										<tr>
											<th>symbol</th>
											<td>÷</td>
										</tr>
										<tr>
											<th>alternative syntax</th></tr></tbody></table></div>
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
<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')
												)
											}
										/&gt;
									</div>
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
<div>
									In this example the top 5 customers with the most orders are selected,
									where countOrders could be the result of a previous aggregation.
									<code>pi firstname, lastname
				sigma rownum() {'&lt;'}= 5
				tau countOrders desc
				Customer
									</code>
								</div>

								<div>
									
								</div>
							

							<div>
								<h4 id="relalg-operations-selection">selection</h4>
								<table>
									<tbody>
										<tr>
											<th>symbol</th>
											<td>σ</td>
										</tr>
										<tr></tr></tbody></table></div>
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
),
																	',',
															),
													),

													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(
																					0,
																					Sequence(
																							NonTerminal('table_name'),
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
The argument is a list of columns by which the relation should be ordered (see examples)

									<div>
										order the result by the first column (default is ascending) and the second column descending:
										<code>τ [1], firstname desc (π id, firstname ( Customer ) )</code>
									</div>

									<div>
										
									</div>
								
							

							<div>
								<h4 id="relalg-operations-groupby">group by</h4></div>
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
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>
github dbis-uibk / relax / calc2 / views / help.tsx View on Github external
alternative syntax
											full outer join
										
									
								
								<div>optional join condition; if no join condition is given it acts as a natural full outer join
									<div>
										
									</div>
								</div>
							
							<div>
								<h4 id="relalg-operations-leftsemijoin">left semi join</h4>
								<table>
									<tbody>
										<tr>
											<th>symbol</th>
											<td></td></tr></tbody></table></div>