Commits

Waldemar Kornewald  committed c40e6b6

fixed float support

  • Participants
  • Parent commits 62ed8b5

Comments (0)

Files changed (2)

File pyvascript/grammar.ometa

              | hexdigit
 number       = "0x" hexlit:n                                                   -> ['hexnumber', n]
              | digit+:ws ('.' digit+:fs                                        -> ['number', float('%s.%s' % (''.join(ws), ''.join(fs)))]
-                         | -> ['number'])                                      -> ['number', int(''.join(ws))]
+                         |                                                     -> ['number', int(''.join(ws))]
+                         )
 
 innercsv :rule = optspace (apply(rule):e optspace ',' optspace -> e)*:es (?(rule != 'tupleexpr' or len(es)) optspace apply(rule):l !(es.append(l)))? optspace -> es
 csv :rule = !(self.enter_paren()) innercsv(rule):es !(self.leave_paren()) -> es

File pyvascript/tests.py

         self.check('x.y[0].z()', 'x.y[0].z();')
         self.check('x.y[0].z[214].f().a', 'x.y[0].z[214].f().a;')
 
+    def test_floats(self):
+        self.check('2.3 * 1.4', '(2.3 * 1.4);')
+
     def test_assign_call_dot_getitem(self):
         self.check('a = x.f().y[0]', 'a = x.f().y[0];')
         self.check('a = x.y[0].z()', 'a = x.y[0].z();')