Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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é.");
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>
<div>no argument
<div>
<code>ρ a ( Customer )
<span>⋈</span> a.name {'<'} 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>
<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>
<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>
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() {'<'}= 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>
),
',',
),
),
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'),
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>
The argument is the old and the new column names in a list (see example) <br>
"←" can be substituted with "{'<'}-"
<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>
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>