|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.millscript.millscript.syntax.Syntax
org.millscript.millscript.syntax.PrefixSyntax
org.millscript.millscript.syntax.SwitchSyntax
public final class SwitchSyntax
This class implements switch syntax. This is used to implement
switch statements in MillScript.
switch <expr> [ tests ] endswitch
The switch statement expression must return a single result, which can be
tested by specifying some optional tests. Each test is a CaseExpr,
e.g
case <expr> [ case <expr> ] then <expr>
Each case statement contains an expression whose result will be
compared to the switch statement expression result. The body of
the case statement will be executed if the case
statement expression result matches the switch statement expression result.
If you have several cases that need to share the same body, you
can repeat as many case statements as you require before the
then.
SwitchExpr| Constructor Summary | |
|---|---|
SwitchSyntax()
|
|
| Method Summary | |
|---|---|
SwitchExpr |
prefix(java.lang.String sym,
Parser parser)
Parse the syntax for the specified symbol, using the specified Parser. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SwitchSyntax()
| Method Detail |
|---|
public SwitchExpr prefix(java.lang.String sym,
Parser parser)
PrefixSyntaxInterfaceParser. The symbol is specified because different symbols
may share the same syntax, but result in slightly different expressions.
The Parser is supplied as the source to parse from.
prefix in interface PrefixSyntaxInterfaceprefix in class PrefixSyntaxsym - the symbol to parse this syntax forparser - Parser to parse from, i.e. the source to parse from
PrefixSyntaxInterface.prefix(java.lang.String, org.millscript.millscript.syntax.Parser)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||