comparison core/src/luan/modules/BasicLuan.java @ 584:0742ac78fa69

add Luan.load_theme
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 12 Aug 2015 05:21:21 -0600
parents 60c549d43988
children 97c8ae330efe
comparison
equal deleted inserted replaced
583:1368ca798ccc 584:0742ac78fa69
16 import luan.LuanSource; 16 import luan.LuanSource;
17 import luan.LuanElement; 17 import luan.LuanElement;
18 import luan.LuanMethod; 18 import luan.LuanMethod;
19 import luan.LuanMeta; 19 import luan.LuanMeta;
20 import luan.impl.LuanCompiler; 20 import luan.impl.LuanCompiler;
21 import luan.impl.ThemeParser;
21 22
22 23
23 public final class BasicLuan { 24 public final class BasicLuan {
24 25
25 public static String type(Object obj) { 26 public static String type(Object obj) {
30 throws LuanException 31 throws LuanException
31 { 32 {
32 if( allowExpr==null ) 33 if( allowExpr==null )
33 allowExpr = false; 34 allowExpr = false;
34 return LuanCompiler.compile(luan,new LuanSource(sourceName,text),env,allowExpr); 35 return LuanCompiler.compile(luan,new LuanSource(sourceName,text),env,allowExpr);
36 }
37
38 public static LuanFunction load_theme(LuanState luan,String text,String sourceName)
39 throws LuanException
40 {
41 if( sourceName==null )
42 sourceName = "THEME";
43 return ThemeParser.compile(luan,new LuanSource(sourceName,text));
35 } 44 }
36 45
37 public static LuanFunction load_file(LuanState luan,String fileName,Boolean addExtension) throws LuanException { 46 public static LuanFunction load_file(LuanState luan,String fileName,Boolean addExtension) throws LuanException {
38 if( fileName == null ) 47 if( fileName == null )
39 fileName = "stdin:"; 48 fileName = "stdin:";