aboutsummaryrefslogtreecommitdiff
path: root/parsing
diff options
context:
space:
mode:
authorherbelin2003-09-09 15:06:44 +0000
committerherbelin2003-09-09 15:06:44 +0000
commita580a7a07da8651887c6fb386bd9af55bbe673a2 (patch)
tree4233682720571f3fa09fba77bb31e446dc6203e1 /parsing
parent51cd60453da3f1fe136904404046098d9c4f1cc3 (diff)
Ajout construction If primitive dans constr_expr et rawconstr
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@4336 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'parsing')
-rw-r--r--parsing/egrammar.ml3
-rw-r--r--parsing/g_constrnew.ml47
-rw-r--r--parsing/ppconstr.ml2
-rw-r--r--parsing/termast.ml2
4 files changed, 9 insertions, 5 deletions
diff --git a/parsing/egrammar.ml b/parsing/egrammar.ml
index 60848fdfd0..88c8211670 100644
--- a/parsing/egrammar.ml
+++ b/parsing/egrammar.ml
@@ -295,6 +295,9 @@ let subst_constr_expr a loc subs =
let na = name_app (subst_id subs) na in
let nal = List.map (name_app (subst_id subs)) nal in
CLetTuple (loc,nal,(na,option_app subst po),subst a,subst b)
+ | CIf (_,c,(na,po),b1,b2) ->
+ let na = name_app (subst_id subs) na in
+ CIf (loc,subst c,(na,option_app subst po),subst b1,subst b2)
| CFix (_,id,dl) ->
CFix (loc,id,List.map (fun (id,n,t,d) -> (id,n,subst t,subst d)) dl)
| CCoFix (_,id,dl) ->
diff --git a/parsing/g_constrnew.ml4 b/parsing/g_constrnew.ml4
index 700ac67349..9aed2b1d55 100644
--- a/parsing/g_constrnew.ml4
+++ b/parsing/g_constrnew.ml4
@@ -204,9 +204,10 @@ GEXTEND Gram
po = return_type;
":="; c1 = operconstr; "in"; c2 = operconstr LEVEL "200" ->
CLetTuple (loc,List.map snd lb,po,c1,c2)
- | "if"; c1=operconstr; "then"; c2=operconstr LEVEL "200";
- "else"; c3=operconstr LEVEL "200" ->
- COrderedCase (loc, IfStyle, None, c1, [c2; c3])
+ | "if"; c=operconstr; po = return_type;
+ "then"; b1=operconstr LEVEL "200";
+ "else"; b2=operconstr LEVEL "200" ->
+ CIf (loc, c, po, b1, b2)
| c=fix_constr -> c ] ]
;
appl_arg:
diff --git a/parsing/ppconstr.ml b/parsing/ppconstr.ml
index 7421460539..af651a4f20 100644
--- a/parsing/ppconstr.ml
+++ b/parsing/ppconstr.ml
@@ -262,7 +262,7 @@ let rec pr inherited a =
str "if " ++ pr ltop c ++ spc () ++
hov 0 (str "then" ++ brk (1,1) ++ pr ltop b1) ++ spc () ++
hov 0 (str "else" ++ brk (1,1) ++ pr ltop b2))), lif
- | CLetTuple (_,nal,(na,po),c,b) ->
+ | CLetTuple _ | CIf _ ->
error "Let tuple not supported in v7"
| COrderedCase (_,(MatchStyle|RegularStyle as style),po,c,bl) ->
diff --git a/parsing/termast.ml b/parsing/termast.ml
index b4914583e9..da683e5fa8 100644
--- a/parsing/termast.ml
+++ b/parsing/termast.ml
@@ -257,7 +257,7 @@ let rec ast_of_raw = function
::(ast_of_raw tm)
::(Array.to_list (Array.map ast_of_raw bv)))
- | RLetTuple (loc,nal,(na,typopt),tm,b) ->
+ | RLetTuple _ | RIf _ ->
error "Let tuple not supported in v7"
| RRec (_,fk,idv,tyv,bv) ->