Mercurial Hosting > luan
changeset 411:23b99a5039b5
remove Luan.newTable()
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 29 Apr 2015 16:05:02 -0600 |
parents | 0d6098a29b3e |
children | 094f37c5e6f9 |
files | core/src/luan/Luan.java core/src/luan/LuanTable.java core/src/luan/impl/LuanCompiler.java core/src/luan/impl/TableExpr.java core/src/luan/modules/HtmlLuan.java core/src/luan/modules/IoLuan.java core/src/luan/modules/PackageLuan.java core/src/luan/modules/PickleClient.java core/src/luan/modules/PickleCon.java core/src/luan/modules/TableLuan.java lucene/src/luan/modules/lucene/LuceneDocument.java lucene/src/luan/modules/lucene/LuceneIndex.java lucene/src/luan/modules/lucene/LuceneSearcher.java lucene/src/luan/modules/lucene/LuceneWriter.java web/src/luan/modules/web/HttpServicer.java |
diffstat | 15 files changed, 25 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/core/src/luan/Luan.java Wed Apr 29 15:38:15 2015 -0600 +++ b/core/src/luan/Luan.java Wed Apr 29 16:05:02 2015 -0600 @@ -149,13 +149,5 @@ return null; } - public static LuanTable newTable() { - return new LuanTable(); - } - - public static LuanTable newTable(List<Object> list) { - return new LuanTable(list); - } - private Luan() {} // never }
--- a/core/src/luan/LuanTable.java Wed Apr 29 15:38:15 2015 -0600 +++ b/core/src/luan/LuanTable.java Wed Apr 29 16:05:02 2015 -0600 @@ -23,7 +23,7 @@ public LuanTable() {} - LuanTable(List<Object> list) { + public LuanTable(List<Object> list) { this.list = list; this.map = newMap(); map.put("n",list.size());
--- a/core/src/luan/impl/LuanCompiler.java Wed Apr 29 15:38:15 2015 -0600 +++ b/core/src/luan/impl/LuanCompiler.java Wed Apr 29 16:05:02 2015 -0600 @@ -6,7 +6,6 @@ import luan.LuanSource; import luan.LuanElement; import luan.LuanTable; -import luan.Luan; import luan.modules.JavaLuan; import luan.modules.PackageLuan; import java.util.Map; @@ -17,7 +16,7 @@ public static LuanFunction compile(LuanState luan,LuanSource src,LuanTable env,boolean allowExpr) throws LuanException { if( env==null ) - env = Luan.newTable(); + env = new LuanTable(); UpValue.Getter envGetter = new UpValue.ValueGetter(env); LuanParser parser = new LuanParser(src,envGetter); parser.addVar( "java", JavaLuan.javaFn );
--- a/core/src/luan/impl/TableExpr.java Wed Apr 29 15:38:15 2015 -0600 +++ b/core/src/luan/impl/TableExpr.java Wed Apr 29 16:05:02 2015 -0600 @@ -28,7 +28,7 @@ } @Override public Object eval(LuanStateImpl luan) throws LuanException { - LuanTable table = Luan.newTable(); + LuanTable table = new LuanTable(); for( Field field : fields ) { table.put( field.key.eval(luan), field.value.eval(luan) ); }
--- a/core/src/luan/modules/HtmlLuan.java Wed Apr 29 15:38:15 2015 -0600 +++ b/core/src/luan/modules/HtmlLuan.java Wed Apr 29 16:05:02 2015 -0600 @@ -136,25 +136,25 @@ } } } - return Luan.newTable(html); + return new LuanTable(html); } static LuanTable comment(String text) { - LuanTable tbl = Luan.newTable(); + LuanTable tbl = new LuanTable(); tbl.put("type","comment"); tbl.put("text",text); return tbl; } static LuanTable cdata(String text) { - LuanTable tbl = Luan.newTable(); + LuanTable tbl = new LuanTable(); tbl.put("type","cdata"); tbl.put("text",text); return tbl; } static LuanTable textContainer(LuanTable tag,String text) { - LuanTable tbl = Luan.newTable(); + LuanTable tbl = new LuanTable(); tbl.put("type","container"); tbl.put("tag",tag); tbl.put("text",text); @@ -170,7 +170,7 @@ } static LuanTable parseTag(String text) { - LuanTable tbl = Luan.newTable(); + LuanTable tbl = new LuanTable(); tbl.put("type","tag"); if( text.endsWith("/") ) { text = text.substring(0,text.length()-1); @@ -193,7 +193,7 @@ } String name = text.substring(i,i2).toLowerCase(); tbl.put("name",name); - LuanTable attributes = Luan.newTable(); + LuanTable attributes = new LuanTable(); tbl.put("attributes",attributes); i = i2; while( i<len && Character.isWhitespace(text.charAt(i)) ) i++;
--- a/core/src/luan/modules/IoLuan.java Wed Apr 29 15:38:15 2015 -0600 +++ b/core/src/luan/modules/IoLuan.java Wed Apr 29 16:05:02 2015 -0600 @@ -85,7 +85,7 @@ } private static LuanTable writer(LuanWriter luanWriter) { - LuanTable writer = Luan.newTable(); + LuanTable writer = new LuanTable(); try { writer.put( "write", new LuanJavaFunction( LuanWriter.class.getMethod( "write", LuanState.class, new Object[0].getClass() ), luanWriter @@ -101,7 +101,7 @@ public static LuanTable binaryWriter(final OutputStream out) { - LuanTable writer = Luan.newTable(); + LuanTable writer = new LuanTable(); try { writer.put( "write", new LuanJavaFunction( OutputStream.class.getMethod( "write", new byte[0].getClass() ), out @@ -203,7 +203,7 @@ } public LuanTable table() { - LuanTable tbl = Luan.newTable(); + LuanTable tbl = new LuanTable(); try { tbl.put( "to_string", new LuanJavaFunction( LuanIn.class.getMethod( "to_string" ), this @@ -393,7 +393,7 @@ File[] files = file.listFiles(); if( files==null ) return null; - LuanTable list = Luan.newTable(); + LuanTable list = new LuanTable(); for( File f : files ) { list.add(new LuanFile(luan,f).table()); } @@ -528,7 +528,7 @@ } public static LuanTable newSchemes() { - LuanTable schemes = Luan.newTable(); + LuanTable schemes = new LuanTable(); try { add( schemes, "string", LuanState.class, String.class ); add( schemes, "file", LuanState.class, String.class );
--- a/core/src/luan/modules/PackageLuan.java Wed Apr 29 15:38:15 2015 -0600 +++ b/core/src/luan/modules/PackageLuan.java Wed Apr 29 16:05:02 2015 -0600 @@ -26,7 +26,7 @@ public static LuanTable loaded(LuanState luan) { LuanTable tbl = (LuanTable)luan.registry().get("Package.loaded"); if( tbl == null ) { - tbl = Luan.newTable(); + tbl = new LuanTable(); luan.registry().put("Package.loaded",tbl); } return tbl; @@ -49,7 +49,7 @@ String src = read(luan,modName+".luan"); if( src == null ) return null; - LuanTable env = Luan.newTable(); + LuanTable env = new LuanTable(); LuanFunction loader = BasicLuan.load(luan,src,modName,env,false); Object result = Luan.first( luan.call(loader,"<require \""+modName+"\">",new Object[]{modName})
--- a/core/src/luan/modules/PickleClient.java Wed Apr 29 15:38:15 2015 -0600 +++ b/core/src/luan/modules/PickleClient.java Wed Apr 29 16:05:02 2015 -0600 @@ -64,7 +64,7 @@ } LuanTable table() { - LuanTable tbl = Luan.newTable(); + LuanTable tbl = new LuanTable(); try { tbl.put( "pickle", new LuanJavaFunction( PickleCon.class.getMethod( "pickle", Object.class ), con
--- a/core/src/luan/modules/PickleCon.java Wed Apr 29 15:38:15 2015 -0600 +++ b/core/src/luan/modules/PickleCon.java Wed Apr 29 16:05:02 2015 -0600 @@ -26,7 +26,7 @@ private final OutputStream out; private final List<byte[]> binaries = new ArrayList<byte[]>(); String src; - final LuanTable env = Luan.newTable(); + final LuanTable env = new LuanTable(); PickleCon(LuanState luan,InputStream in,OutputStream out) { this.in = in;
--- a/core/src/luan/modules/TableLuan.java Wed Apr 29 15:38:15 2015 -0600 +++ b/core/src/luan/modules/TableLuan.java Wed Apr 29 16:05:02 2015 -0600 @@ -81,7 +81,7 @@ } public static LuanTable pack(Object... args) { - LuanTable tbl = Luan.newTable(); + LuanTable tbl = new LuanTable(); boolean hasNull = false; for( int i=0; i<args.length; i++ ) { Object v = args[i];
--- a/lucene/src/luan/modules/lucene/LuceneDocument.java Wed Apr 29 15:38:15 2015 -0600 +++ b/lucene/src/luan/modules/lucene/LuceneDocument.java Wed Apr 29 16:05:02 2015 -0600 @@ -84,7 +84,7 @@ static LuanTable toTable(LuanState luan,Document doc,Map<String,String> nameMap) throws LuanException { if( doc==null ) return null; - LuanTable table = Luan.newTable(); + LuanTable table = new LuanTable(); for( IndexableField ifld : doc ) { String name = ifld.name(); String newName = nameMap.get(name);
--- a/lucene/src/luan/modules/lucene/LuceneIndex.java Wed Apr 29 15:38:15 2015 -0600 +++ b/lucene/src/luan/modules/lucene/LuceneIndex.java Wed Apr 29 16:05:02 2015 -0600 @@ -131,7 +131,7 @@ String rtn = Long.toString(++id); if( id > idLim ) { idLim += idBatch; - LuanTable doc = Luan.newTable(); + LuanTable doc = new LuanTable(); doc.put( "type", "next_id" ); doc.put( FLD_NEXT_ID, idLim ); writer.updateDocument(newTerm("type","next_id"),toLucene(luan,doc));
--- a/lucene/src/luan/modules/lucene/LuceneSearcher.java Wed Apr 29 15:38:15 2015 -0600 +++ b/lucene/src/luan/modules/lucene/LuceneSearcher.java Wed Apr 29 16:05:02 2015 -0600 @@ -141,7 +141,7 @@ } LuanTable table() { - LuanTable tbl = Luan.newTable(); + LuanTable tbl = new LuanTable(); try { add( tbl, "search", LuanState.class, Object.class, Object.class, Sort.class ); } catch(NoSuchMethodException e) {
--- a/lucene/src/luan/modules/lucene/LuceneWriter.java Wed Apr 29 15:38:15 2015 -0600 +++ b/lucene/src/luan/modules/lucene/LuceneWriter.java Wed Apr 29 16:05:02 2015 -0600 @@ -77,7 +77,7 @@ } LuanTable table() { - LuanTable tbl = Luan.newTable(); + LuanTable tbl = new LuanTable(); try { add( tbl, "save_document", LuanState.class, LuanTable.class ); add( tbl, "delete_documents", LuanState.class, LuanTable.class );
--- a/web/src/luan/modules/web/HttpServicer.java Wed Apr 29 15:38:15 2015 -0600 +++ b/web/src/luan/modules/web/HttpServicer.java Wed Apr 29 16:05:02 2015 -0600 @@ -214,7 +214,7 @@ InputStream in = new BufferedInputStream(request.getInputStream()); final MultiPartInputStream mpis = new MultiPartInputStream(in,contentType,null,null); mpis.setDeleteOnExit(true); - parameters = Luan.newTable(); + parameters = new LuanTable(); for( Part p : mpis.getParts() ) { final MultiPartInputStream.MultiPart part = (MultiPartInputStream.MultiPart)p; String name = part.getName(); @@ -332,7 +332,7 @@ } private LuanTable sessionTable() throws NoSuchMethodException { - LuanTable tbl = Luan.newTable(); + LuanTable tbl = new LuanTable(); LuanTable attributes = new NameMeta() { @Override Object get(String name) {