aboutsummaryrefslogtreecommitdiff
path: root/src/interp/spad-parser.boot
diff options
context:
space:
mode:
Diffstat (limited to 'src/interp/spad-parser.boot')
-rw-r--r--src/interp/spad-parser.boot39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/interp/spad-parser.boot b/src/interp/spad-parser.boot
index 7a381471..a7780674 100644
--- a/src/interp/spad-parser.boot
+++ b/src/interp/spad-parser.boot
@@ -154,6 +154,10 @@ parseInfixWith() ==
parseWith() and
pushReduction('parseInfixWith,["Join",popStack2(),popStack1()])
+parseElseClause() ==
+ currentSymbol() is "if" => PARSE_-Conditional()
+ PARSE_-Expression()
+
++ domain inlining. Same syntax as import directive; except
++ deliberate restriction on naming one type at a time.
++ -- gdr, 2009-02-28.
@@ -177,6 +181,41 @@ parseQuantifiedVariable() ==
pushReduction('parseQuantifiedVariable,[":",popStack2(),popStack1()])
nil
+++ We should factorize these boilerplates
+parseReturn() ==
+ matchAdvanceKeyword "return" =>
+ compulsorySyntax PARSE_-Expression()
+ pushReduction('parseReturn,["return",popStack1()])
+ nil
+
+parseThrow() ==
+ matchAdvanceKeyword "throw" =>
+ compulsorySyntax PARSE_-Expression()
+ pushReduction('parseReturn,["%Throw",popStack1()])
+ nil
+
+parseExit() ==
+ matchAdvanceKeyword "exit" =>
+ x :=
+ PARSE_-Expression() => popStack1()
+ "$NoValue"
+ pushReduction('parseExit,["exit",x])
+ nil
+
+parseLeave() ==
+ matchAdvanceKeyword "leave" =>
+ x :=
+ PARSE_-Expression() => popStack1()
+ "$NoValue"
+ pushReduction('parseLeave,["leave",x])
+ nil
+
+parseJump() ==
+ s := currentSymbol() =>
+ advanceToken()
+ pushReduction('parseJump,s)
+ nil
+
parseNewExpr() ==
matchString '")" =>
processSynonyms()