Mercurial Hosting > luan
comparison core/src/luan/impl/LuanCompiler.java @ 411:23b99a5039b5
remove Luan.newTable()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 29 Apr 2015 16:05:02 -0600 |
parents | 0be73ac9103d |
children | 0ca5d1d6250b |
comparison
equal
deleted
inserted
replaced
410:0d6098a29b3e | 411:23b99a5039b5 |
---|---|
4 import luan.LuanState; | 4 import luan.LuanState; |
5 import luan.LuanException; | 5 import luan.LuanException; |
6 import luan.LuanSource; | 6 import luan.LuanSource; |
7 import luan.LuanElement; | 7 import luan.LuanElement; |
8 import luan.LuanTable; | 8 import luan.LuanTable; |
9 import luan.Luan; | |
10 import luan.modules.JavaLuan; | 9 import luan.modules.JavaLuan; |
11 import luan.modules.PackageLuan; | 10 import luan.modules.PackageLuan; |
12 import java.util.Map; | 11 import java.util.Map; |
13 | 12 |
14 | 13 |
15 public final class LuanCompiler { | 14 public final class LuanCompiler { |
16 private LuanCompiler() {} // never | 15 private LuanCompiler() {} // never |
17 | 16 |
18 public static LuanFunction compile(LuanState luan,LuanSource src,LuanTable env,boolean allowExpr) throws LuanException { | 17 public static LuanFunction compile(LuanState luan,LuanSource src,LuanTable env,boolean allowExpr) throws LuanException { |
19 if( env==null ) | 18 if( env==null ) |
20 env = Luan.newTable(); | 19 env = new LuanTable(); |
21 UpValue.Getter envGetter = new UpValue.ValueGetter(env); | 20 UpValue.Getter envGetter = new UpValue.ValueGetter(env); |
22 LuanParser parser = new LuanParser(src,envGetter); | 21 LuanParser parser = new LuanParser(src,envGetter); |
23 parser.addVar( "java", JavaLuan.javaFn ); | 22 parser.addVar( "java", JavaLuan.javaFn ); |
24 parser.addVar( "require", PackageLuan.requireFn ); | 23 parser.addVar( "require", PackageLuan.requireFn ); |
25 FnDef fnDef = parse(luan,parser,allowExpr); | 24 FnDef fnDef = parse(luan,parser,allowExpr); |