diff options
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/cparse.boot | 1 | ||||
-rw-r--r-- | src/interp/i-map.boot | 11 | ||||
-rw-r--r-- | src/interp/pf2sex.boot | 15 |
3 files changed, 24 insertions, 3 deletions
diff --git a/src/interp/cparse.boot b/src/interp/cparse.boot index 11118d31..07640279 100644 --- a/src/interp/cparse.boot +++ b/src/interp/cparse.boot @@ -1010,6 +1010,7 @@ npDefinitionItem()== npMdef "MDEF" npRestore a npMacro() or npDefn() + or npName() and npDecl() npTrap() npDefinition() == diff --git a/src/interp/i-map.boot b/src/interp/i-map.boot index 03c15c50..7832613a 100644 --- a/src/interp/i-map.boot +++ b/src/interp/i-map.boot @@ -88,10 +88,18 @@ addDefMap(['DEF,lhs,mapsig,.,rhs],pred) == -- next check is for bad forms on the lhs of the ==, such as -- numbers, constants. + + -- FIXME: this function miguidedly characterizes constant definitions + -- as rules definitions. In particular, typed constant definitions + -- are characterized are rules in one part, and announced to user + -- a niladic functions. We try to limit the damage as much as we can. + defineeIsConstant := false + if atom lhs then op := lhs putHist(op,'isInterpreterRule,true,$e) putHist(op,'isInterpreterFunction,false,$e) + defineeIsConstant := true lhs := [lhs] else -- this is a function definition. If it has been declared @@ -132,7 +140,8 @@ addDefMap(['DEF,lhs,mapsig,.,rhs],pred) == if allDecs then mapmode := nreverse mapmode putHist(op,'mode,mapmode,$e) - sayKeyedMsg("S2IM0006",[formatOpSignature(op,rest mapmode)]) + if not defineeIsConstant then + sayKeyedMsg("S2IM0006",[formatOpSignature(op,rest mapmode)]) else if someDecs then throwKeyedMsg("S2IM0007",[op]) -- if map is declared, check that signature arg count is the diff --git a/src/interp/pf2sex.boot b/src/interp/pf2sex.boot index 2735580e..0e3904f1 100644 --- a/src/interp/pf2sex.boot +++ b/src/interp/pf2sex.boot @@ -307,8 +307,19 @@ pfDefinition2Sex pf == systemError '"lhs of definition must be a single item in the interpreter" id := first idList rhs := pfDefinitionRhs pf - [argList, :body] := pfLambdaTran rhs - ["DEF", (argList = 'id => id; [id, :argList]), :body] + lhs := nil + body := nil + -- Sometimes, a typed constant definition is mischaracterized as + -- a definition of the colon delimiter. + if id is [":",id',t] then + id := id' + if pfLambda? rhs then + [argList, :body] := pfLambdaTran rhs + lhs := [id,:argList] + else + lhs := id + body := [[t],[nil],pf2Sex1 rhs] + ["DEF",lhs,:body] pfLambdaTran pf == pfLambda? pf => |