ScriptParsers
object ScriptParsers
Performs the following context-free rewritings:
- Places all pattern variables in Bind nodes. In a pattern, for identifiers <code>x</code>:
<pre> x => x @ _ x:T => x @ (_ : T) </pre>
- Removes pattern definitions (PatDef's) as follows: If pattern is a simple (typed) identifier:
<pre> <b>val</b> x = e ==> <b>val</b> x = e <b>val</b> x: T = e ==> <b>val</b> x: T = e </pre>
if there are no variables in pattern
<pre> <b>val</b> p = e ==> e match (case p => ()) </pre>
if there is exactly one variable in pattern
<pre> <b>val</b> x_1 = e <b>match</b> (case p => (x_1)) </pre>
if there is more than one variable in pattern
<pre> <b>val</b> p = e ==> <b>private synthetic val</b> t$ = e <b>match</b> (case p => (x_1, ..., x_N)) <b>val</b> x_1 = t$._1 ... <b>val</b> x_N = t$._N </pre>
- Removes function types as follows:
<pre> (argtpes) => restpe ==> scala.Function_n[argtpes, restpe] </pre>
- Wraps naked case definitions in a match as follows:
<pre> { cases } ==> (x => x.match {cases})<span style="font-family:normal;">, except when already argument to match</span> </pre>