예제 #1
0
 def test_no_for(self):
     a = 'hello'
     l = [1,2,3,4,5,6,7,[1,2,3,4,5,6,7,[1,2,3,4,5,6,7,8]]]
     q = None
     d = locals()
     try: d.update(__builtins__.__dict__)
     except AttributeError: d.update(__builtins__)
     flwr = symbols.flwrSequence([symbols.attributeValue('hello', scalar=True)])
     self.assertEquals(flwr(d), ('hello',))
     self.assertEquals(exe('''
         return l
       ''', d), (l,))
     self.assertEquals(exe('''
         let f = function(l) {
           if (isinstance(l, list))
           then {for j in l return f(j)}
           else l
         }
         return flatten f(l)
       ''', d), (1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8))
예제 #2
0
 def p_FLWRexpr8(self, t):
     'FLWRexpr : ForExpr LetExpr WhereExpr OrderByExpr ReturnExpr'
     t[0] = symbols.flwrSequence(t[1], t[5], let_expr=t[2], where_expr=t[3], order_expr=t[4])
예제 #3
0
 def p_FLWRexpr5(self, t):
     'FLWRexpr : ForExpr OrderByExpr ReturnExpr'
     t[0] = symbols.flwrSequence(t[1], t[3], order_expr=t[2])
예제 #4
0
 def p_FLWRexpr4(self, t):
     'FLWRexpr : ForExpr LetExpr WhereExpr ReturnExpr'
     t[0] = symbols.flwrSequence(t[1], t[4], let_expr=t[2], where_expr=t[3])
예제 #5
0
 def p_FLWRexpr3(self, t):
     'FLWRexpr : ForExpr WhereExpr ReturnExpr'
     t[0] = symbols.flwrSequence(t[1], t[3], where_expr=t[2])
예제 #6
0
 def p_FLWRexpr2(self, t):
     'FLWRexpr : ForExpr LetExpr ReturnExpr'
     t[0] = symbols.flwrSequence(t[1], t[3], let_expr=t[2])
예제 #7
0
 def p_FLWRexpr1(self, t):
     'FLWRexpr : ForExpr ReturnExpr'
     t[0] = symbols.flwrSequence(t[1], t[2])