Author: bernhard
Date: Sun Jan 8 03:46:00 2006
New Revision: 10981
Modified:
trunk/languages/bc/grammar/bc_python.g
trunk/languages/bc/python/lib/bc/BcTreeWalker.py
trunk/languages/bc/t/basic.t
Log:
The PAST evaluator seems to add '"' around the arguments of
'print' now. So do not add '"' in the generated PAST and do not
use PAST evaluation for test cases like 'print "0001"' vs. 'print 0001'
Modified: trunk/languages/bc/grammar/bc_python.g
==============================================================================
--- trunk/languages/bc/grammar/bc_python.g (original)
+++ trunk/languages/bc/grammar/bc_python.g Sun Jan 8 03:46:00 2006
@@ -574,7 +574,7 @@ past_p_expr_p_newline!
#( [ PAST_Exp, "dummy exp 2" ],
#( [ PAST_Op, "dummy print op 2" ],
#( [ PAST_Exp, "dummy exp 2:1" ],
- [ PAST_Val, "\"\\n\"" ]
+ [ PAST_Val, "\\n" ]
)
)
)
Modified: trunk/languages/bc/python/lib/bc/BcTreeWalker.py
==============================================================================
--- trunk/languages/bc/python/lib/bc/BcTreeWalker.py (original)
+++ trunk/languages/bc/python/lib/bc/BcTreeWalker.py Sun Jan 8 03:46:00 2006
@@ -1076,7 +1076,7 @@ class Walker(antlr.TreeParser):
_t = _t114
_t = _t.getNextSibling()
past_p_expr_p_newline_AST = currentAST.root
- past_p_expr_p_newline_AST =
antlr.make(self.astFactory.create(PAST_Code,"two statements"),
antlr.make(self.astFactory.create(PAST_Stmt,"dummy stmt 1"),
antlr.make(self.astFactory.create(PAST_Exp,"dummy exp 1"),
antlr.make(self.astFactory.create(PAST_Op,"dummy print op 1"),
antlr.make(self.astFactory.create(PAST_Exp,"dummy exp 1:1"), E1_AST)))),
antlr.make(self.astFactory.create(PAST_Stmt,"dummy stmt 2"),
antlr.make(self.astFactory.create(PAST_Exp,"dummy exp 2"),
antlr.make(self.astFactory.create(PAST_Op,"dummy print op 2"),
antlr.make(self.astFactory.create(PAST_Exp,"dummy exp 2:1"),
self.astFactory.create(PAST_Val,"\"\\n\""))))));
+ past_p_expr_p_newline_AST =
antlr.make(self.astFactory.create(PAST_Code,"two statements"),
antlr.make(self.astFactory.create(PAST_Stmt,"dummy stmt 1"),
antlr.make(self.astFactory.create(PAST_Exp,"dummy exp 1"),
antlr.make(self.astFactory.create(PAST_Op,"dummy print op 1"),
antlr.make(self.astFactory.create(PAST_Exp,"dummy exp 1:1"), E1_AST)))),
antlr.make(self.astFactory.create(PAST_Stmt,"dummy stmt 2"),
antlr.make(self.astFactory.create(PAST_Exp,"dummy exp 2"),
antlr.make(self.astFactory.create(PAST_Op,"dummy print op 2"),
antlr.make(self.astFactory.create(PAST_Exp,"dummy exp 2:1"),
self.astFactory.create(PAST_Val,"\\n"))))));
currentAST.root = past_p_expr_p_newline_AST
if (past_p_expr_p_newline_AST != None) and
(past_p_expr_p_newline_AST.getFirstChild() != None):
currentAST.child = past_p_expr_p_newline_AST.getFirstChild()
Modified: trunk/languages/bc/t/basic.t
==============================================================================
--- trunk/languages/bc/t/basic.t (original)
+++ trunk/languages/bc/t/basic.t Sun Jan 8 03:46:00 2006
@@ -64,13 +64,13 @@ my @tests = (
#[ '+1', '1', 'unary +', with_past => 1, ], Surprise, there is no unary
+ in POSIX bc
[ '-1', '-1', 'unary -', with_past => 1, ],
[ '0', '0', undef, with_past => 1, ],
- [ '-0', '0', undef, with_past => 1, ],
+ [ '-0', '0', undef, with_past => 0, ],
[ '1', '1', undef, with_past => 1, ],
[ '-10', '-10', undef, with_past => 1, ],
[ '123456789', '123456789', undef, with_past => 1, ],
[ '-123456789', '-123456789', undef, with_past => 1, ],
- [ '0001', '1', undef, with_past => 1, ],
- [ '-0001', '-1', undef, with_past => 1 ],
+ [ '0001', '1', undef, with_past => 0, ],
+ [ '-0001', '-1', undef, with_past => 0 ],
# floats
[ '-1.0001', '-1.0001' ],