aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorronny2001-07-24 15:53:16 +0000
committerronny2001-07-24 15:53:16 +0000
commit6476ef81ee2e31625a332d207d214d33fecb2128 (patch)
treed64011551dbc9f9512b5ee4b797edb7be091971d
parentbug fix funny_id_after_type (diff)
bug fix parsebug_missing_result
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@567 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
-rw-r--r--frontend/parse.icl25
1 files changed, 15 insertions, 10 deletions
diff --git a/frontend/parse.icl b/frontend/parse.icl
index ed18348..0c40360 100644
--- a/frontend/parse.icl
+++ b/frontend/parse.icl
@@ -785,19 +785,24 @@ where
= root_expression localsExpected token nodeDefs (reverse alts) sep pState
root_expression :: !Bool !Token ![NodeDefWithLocals] ![GuardedExpr] !(Token -> Bool) !ParseState -> (!OptGuardedAlts, !ParseState)
- root_expression withExpected token nodeDefs [] sep pState
- # (file_name, line_nr, pState) = getFileAndLineNr pState // MW++
- (expr,pState) = want_OptExprWithLocals withExpected token nodeDefs sep pState
- = case expr of
- Yes expr -> ( UnGuardedExpr expr, pState)
- No -> ( UnGuardedExpr {ewl_nodes = [], ewl_expr = PE_Empty, ewl_locals = LocalParsedDefs [],
+ root_expression withExpected token nodeDefs alts sep pState
+ # (optional_expr,pState) = want_OptExprWithLocals withExpected token nodeDefs sep pState
+ = build_root token optional_expr alts nodeDefs pState
+ where
+ build_root :: !Token !(Optional ExprWithLocalDefs) ![GuardedExpr] ![NodeDefWithLocals] !ParseState -> (!OptGuardedAlts, !ParseState)
+ build_root _ (Yes expr) [] _ pState
+ = ( UnGuardedExpr expr, pState)
+ build_root _ No alts=:[_:_] [] pState
+ = (GuardedAlts alts No, pState)
+ build_root _ optional_expr alts=:[_:_] _ pState
+ = (GuardedAlts alts optional_expr, pState)
+ build_root token _ _ _ pState
+ # (file_name, line_nr, pState) = getFileAndLineNr pState // MW++
+ = (UnGuardedExpr {ewl_nodes = [], ewl_expr = PE_Empty, ewl_locals = LocalParsedDefs [],
ewl_position = LinePos file_name line_nr}
, parseError "RHS: root expression" (Yes token) "= <ExprWithLocals>" pState
)
- root_expression withExpected token nodeDefs alts sep pState
- # (expr,pState) = want_OptExprWithLocals withExpected token nodeDefs sep pState
- = (GuardedAlts alts expr, pState)
-
+
default_found (GuardedAlts _ No) = False
default_found _ = True