add mod operator
This commit is contained in:
parent
a0ff144686
commit
a94831beac
@ -341,6 +341,7 @@ class HyASTCompiler(object):
|
||||
col_offset=e.start_column)
|
||||
|
||||
@builds("+")
|
||||
@builds("%")
|
||||
@builds("-")
|
||||
@builds("/")
|
||||
@builds("*")
|
||||
@ -352,7 +353,8 @@ class HyASTCompiler(object):
|
||||
ops = {"+": ast.Add,
|
||||
"/": ast.Div,
|
||||
"*": ast.Mult,
|
||||
"-": ast.Sub}
|
||||
"-": ast.Sub,
|
||||
"%": ast.Mod}
|
||||
|
||||
inv = expression.pop(0)
|
||||
op = ops[inv]
|
||||
|
@ -28,3 +28,7 @@
|
||||
(def test_div (fn []
|
||||
"NATIVE: Test division"
|
||||
(assert (= 25 (/ 100 2 2)))))
|
||||
|
||||
(defn test-modulo []
|
||||
"NATIVE: test mod"
|
||||
(assert (= (% 10 2) 0)))
|
||||
|
Loading…
Reference in New Issue
Block a user