diff options
author | dos-reis <gdr@axiomatics.org> | 2009-10-09 06:23:10 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2009-10-09 06:23:10 +0000 |
commit | b9b6081bee80b1eb8d4118983b03e29733f188e0 (patch) | |
tree | 3365be8261933f20b3e74d8955ee0fdd0b4b472b /src/interp | |
parent | 8634da678944367834e85def966278aa3ae14026 (diff) | |
download | open-axiom-b9b6081bee80b1eb8d4118983b03e29733f188e0.tar.gz |
Fix SF/2875134
* interp/ptrees.boot: New.
(pfIdSymbol): Use it.
(pfSymbolSymbol): Likewise.
(pfInfApplication): Likewise.
* testsuite/interpreter/sf-2875134.input: New.
Diffstat (limited to 'src/interp')
-rw-r--r-- | src/interp/ptrees.boot | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/interp/ptrees.boot b/src/interp/ptrees.boot index b31ef8c4..0359ce41 100644 --- a/src/interp/ptrees.boot +++ b/src/interp/ptrees.boot @@ -71,13 +71,25 @@ pfSemiColon(pfbody) == pfTree('SemiColon, [pfbody]) pfSemiColon?(pf) == pfAbSynOp? (pf, 'SemiColon) pfSemiColonBody pf == second pf -- was ==> +--% Renaming. +--% We decided that the identifier "^" is syntactically synonymous to "**". +--% We could have banned the later and support only the former. +--% However, that would have made all exponentiation examples from +--% the Jenks&Sutor book invalid. Which would be infortunate. +--% Rather, we opt to the renaming here. This poses the danger that +--% any other AST scheme would need to do the same work. +--% --gdr, 2009-10-08. +pfRename x == + x = "^" => "**" + x + --% LEAVES pfId(expr) == pfLeaf('id, expr) pfIdPos(expr,pos) == pfLeaf('id,expr,pos) pfId? form == pfAbSynOp?(form,'id) or pfAbSynOp?(form,'idsy) pfSymbolVariable? form == pfAbSynOp?(form,'idsy) -pfIdSymbol form == tokPart form +pfIdSymbol form == pfRename tokPart form --pfAmpersand(amptok,name) == name pfDocument strings == pfLeaf('Document, strings) @@ -106,7 +118,8 @@ pfSymb(expr, :optpos) == pfSymbol? form == pfAbSynOp?(form, 'symbol) -pfSymbolSymbol form == tokPart form + +pfSymbolSymbol form == pfRename tokPart form --% TREES -- parser interface functions @@ -127,7 +140,7 @@ pfInfApplication(op,left,right)== pfWrong(pfDocument ['"infop as argument to infop"],pfListOf []) pfIdSymbol op = "and" => pfAnd (left,right) pfIdSymbol op = "or" => pfOr (left,right) - pfApplication(op,pfTuple pfListOf [left,right]) + pfApplication(pfRename op,pfTuple pfListOf [left,right]) pfCheckInfop form== false |