diff options
-rw-r--r-- | src/ChangeLog | 9 | ||||
-rw-r--r-- | src/doc/msgs/s2-us.msgs | 2 | ||||
-rw-r--r-- | src/interp/i-intern.boot | 28 | ||||
-rw-r--r-- | src/interp/i-spec1.boot | 33 |
4 files changed, 42 insertions, 30 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index e2d74443..fc54fb63 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,14 @@ 2008-04-01 Gabriel Dos Reis <gdr@cs.tamu.edu> + Fix AW/386. + * interp/i-spec1.boot (transformCollect): Move to i-intern.boot. + (upLoopIters): Don't silently return nil for unknown iterators. + * interp/i-intern.boot (transformCollect): Tidy. Reject invalid + iterator forms. + * doc/msgs/s2-us.msgs (S2SIS0061): New. + +2008-04-01 Gabriel Dos Reis <gdr@cs.tamu.edu> + * include/nagman.H1: Remove. * include/session.H1: Move content to sman/session.c. Remove. * sman/session.c: Don't include "session.H1" anymore. diff --git a/src/doc/msgs/s2-us.msgs b/src/doc/msgs/s2-us.msgs index 6e8f8c55..02a18fe8 100644 --- a/src/doc/msgs/s2-us.msgs +++ b/src/doc/msgs/s2-us.msgs @@ -572,6 +572,8 @@ S2IS0060 The form on the left hand side of an assignment must be a single variable, a Tuple of variables or a reference to an entry in an object supporting the setelt operation. +S2IS0061 + Unknown type of loop iterator form. S2IT0001 %1b can have no other options. S2IT0002 diff --git a/src/interp/i-intern.boot b/src/interp/i-intern.boot index 90cbc66c..c23bc2f6 100644 --- a/src/interp/i-intern.boot +++ b/src/interp/i-intern.boot @@ -488,3 +488,31 @@ addIntSymTabBinding(var,proplist,e is [[curContour,:.],:.]) == e +transformCollect [:itrl,body] == + -- syntactic transformation for COLLECT form, called from mkAtree1 + iterList:=[:iterTran1 for it in itrl] where iterTran1() == + it is ["STEP",index,lower,step,:upperList] => + [["STEP",index,mkAtree1 lower,mkAtree1 step,:[mkAtree1 upper + for upper in upperList]]] + it is ["IN",index,s] => + [["IN",index,mkAtree1 s]] + it is ["ON",index,s] => + [['IN,index,mkAtree1 ['tails,s]]] + it is ["WHILE",b] => + [["WHILE",mkAtree1 b]] + it is ["|",pred] => + [["SUCHTHAT",mkAtree1 pred]] + it is ["UNTIL",:.] => nil + throwKeyedMsg("S2IS0061",nil) + bodyTree:=mkAtree1 body + iterList:=nconc(iterList,[:iterTran2 for it in itrl]) where + iterTran2() == + it is ["STEP",:.] => nil + it is ["IN",:.] => nil + it is ["ON",:.] => nil + it is ["WHILE",:.] => nil + it is ["UNTIL",b] => + [["UNTIL",mkAtree1 b]] + it is ["|",pred] => nil + [:iterList,bodyTree] + diff --git a/src/interp/i-spec1.boot b/src/interp/i-spec1.boot index 5cf7b7d6..6b80b41c 100644 --- a/src/interp/i-spec1.boot +++ b/src/interp/i-spec1.boot @@ -436,35 +436,6 @@ evalCOERCE(op,tree,m) == --% Handlers for COLLECT -transformCollect [:itrl,body] == - -- syntactic transformation for COLLECT form, called from mkAtree1 - iterList:=[:iterTran1 for it in itrl] where iterTran1() == - it is ["STEP",index,lower,step,:upperList] => - [["STEP",index,mkAtree1 lower,mkAtree1 step,:[mkAtree1 upper - for upper in upperList]]] - it is ["IN",index,s] => - [["IN",index,mkAtree1 s]] - it is ["ON",index,s] => - [['IN,index,mkAtree1 ['tails,s]]] - it is ["WHILE",b] => - [["WHILE",mkAtree1 b]] - it is ["|",pred] => - [["SUCHTHAT",mkAtree1 pred]] - it is [op,:.] and (op in '(VALUE UNTIL)) => nil - bodyTree:=mkAtree1 body - iterList:=NCONC(iterList,[:iterTran2 for it in itrl]) where - iterTran2() == - it is ["STEP",:.] => nil - it is ["IN",:.] => nil - it is ["ON",:.] => nil - it is ["WHILE",:.] => nil - it is [op,b] and (op in '(UNTIL)) => - [[op,mkAtree1 b]] - it is ["|",pred] => nil - keyedSystemError("S2GE0016", - ['"transformCollect",'"Unknown type of iterator"]) - [:iterList,bodyTree] - upCOLLECT t == -- $compilingLoop variable insures that throw to interp-only mode -- goes to the outermost loop. @@ -511,7 +482,9 @@ upLoopIters itrl == -- following is an optimization typeIsASmallInteger(get(index,'mode,$env)) => RPLACA(iter,'ISTEP) - NIL -- should have error msg here? + -- at this point, the AST may already be badly corrupted, + -- but better late than never. + throwKeyedMsg("S2IS0061",nil) upLoopIterIN(iter,index,s) == iterMs := bottomUp s |