comparison core/src/luan/impl/$Luan.java @ 651:140cc5191b7a

start compiling statements
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 01 Apr 2016 17:24:44 -0600
parents d658eab7bf4c
children 067d9470184d
comparison
equal deleted inserted replaced
650:d658eab7bf4c 651:140cc5191b7a
22 return i; 22 return i;
23 } 23 }
24 24
25 public static Expressions getExpressions(int i) { 25 public static Expressions getExpressions(int i) {
26 return listExpressions.get(i); 26 return listExpressions.get(i);
27 }
28
29
30 private static List<Stmt> listStmt = new ArrayList<Stmt>();
31
32 static int addStmt(Stmt stmt) {
33 int i = listStmt.size();
34 listStmt.add(stmt);
35 return i;
36 }
37
38 public static Stmt getStmt(int i) {
39 return listStmt.get(i);
27 } 40 }
28 41
29 42
30 public static Object first(Object obj) { 43 public static Object first(Object obj) {
31 return Luan.first(obj); 44 return Luan.first(obj);
57 } 70 }
58 } 71 }
59 throw new LuanException("attempt to perform arithmetic on a "+Luan.type(o)+" value"); 72 throw new LuanException("attempt to perform arithmetic on a "+Luan.type(o)+" value");
60 } 73 }
61 74
75 public static boolean checkBoolean(Object o) throws LuanException {
76 return Luan.checkBoolean(o);
77 }
78
62 public static boolean not(Object o) throws LuanException { 79 public static boolean not(Object o) throws LuanException {
63 return !Luan.checkBoolean(o); 80 return !checkBoolean(o);
64 } 81 }
65 82
66 private static Object arithmetic(LuanState luan,String op,Object o1,Object o2) throws LuanException { 83 private static Object arithmetic(LuanState luan,String op,Object o1,Object o2) throws LuanException {
67 LuanFunction fn = Luan.getBinHandler(op,o1,o2); 84 LuanFunction fn = Luan.getBinHandler(op,o1,o2);
68 if( fn != null ) 85 if( fn != null )
173 190
174 public static boolean cnd(Object o) throws LuanException { 191 public static boolean cnd(Object o) throws LuanException {
175 return !(o == null || Boolean.FALSE.equals(o)); 192 return !(o == null || Boolean.FALSE.equals(o));
176 } 193 }
177 194
195 public static void nop(Object o) {}
196
178 } 197 }