comparison core/src/luan/impl/Parser.java @ 694:b620b8e1010f

remove Luan.load() allow_expression param and add Luan.eval()
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 20 Apr 2016 20:56:08 -0600
parents 43522473599d
children
comparison
equal deleted inserted replaced
693:ca169567ce07 694:b620b8e1010f
7 int i; 7 int i;
8 StringBuilder sb; 8 StringBuilder sb;
9 } 9 }
10 10
11 // private final LuanSource src; 11 // private final LuanSource src;
12 public final String text;
12 public final String sourceName; 13 public final String sourceName;
13 public final String text;
14 private final int len; 14 private final int len;
15 private Frame[] stack = new Frame[256]; 15 private Frame[] stack = new Frame[256];
16 private int frame = 0; 16 private int frame = 0;
17 private int iHigh; 17 private int iHigh;
18 18
19 public Parser(String sourceName,String text) { 19 public Parser(String text,String sourceName) {
20 // this.src = src; 20 // this.src = src;
21 this.text = text;
21 this.sourceName = sourceName; 22 this.sourceName = sourceName;
22 this.text = text;
23 this.len = text.length(); 23 this.len = text.length();
24 stack[0] = new Frame(); 24 stack[0] = new Frame();
25 } 25 }
26 26
27 private int i() { 27 private int i() {
76 frame--; 76 frame--;
77 return false; 77 return false;
78 } 78 }
79 79
80 public ParseException exception(String msg) { 80 public ParseException exception(String msg) {
81 return new ParseException(msg,sourceName,text,i(),iHigh); 81 return new ParseException(msg,text,sourceName,i(),iHigh);
82 } 82 }
83 83
84 public ParseException exception() { 84 public ParseException exception() {
85 return exception("Invalid input"); 85 return exception("Invalid input");
86 } 86 }