comparison core/src/luan/modules/parsers/BBCode.java @ 646:cdc70de628b5

simplify LuanException
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 29 Mar 2016 19:58:39 -0600
parents 3ab4f282f0bd
children
comparison
equal deleted inserted replaced
645:859c0dedc8b6 646:cdc70de628b5
23 private final Parser parser; 23 private final Parser parser;
24 private final LuanFunction quoter; 24 private final LuanFunction quoter;
25 private final boolean toHtml; 25 private final boolean toHtml;
26 26
27 private BBCode(LuanState luan,String text,LuanFunction quoter,boolean toHtml) throws LuanException { 27 private BBCode(LuanState luan,String text,LuanFunction quoter,boolean toHtml) throws LuanException {
28 Utils.checkNotNull(luan,text,1); 28 Utils.checkNotNull(text,1);
29 Utils.checkNotNull(luan,quoter,2); 29 Utils.checkNotNull(quoter,2);
30 this.luan = luan; 30 this.luan = luan;
31 this.parser = new Parser(text); 31 this.parser = new Parser(text);
32 this.quoter = quoter; 32 this.quoter = quoter;
33 this.toHtml = toHtml; 33 this.toHtml = toHtml;
34 } 34 }
264 } 264 }
265 265
266 private String quote(Object... args) throws LuanException { 266 private String quote(Object... args) throws LuanException {
267 Object obj = quoter.call(luan,args); 267 Object obj = quoter.call(luan,args);
268 if( !(obj instanceof String) ) 268 if( !(obj instanceof String) )
269 throw new LuanException(luan,"BBCode quoter function returned "+Luan.type(obj)+" but string required"); 269 throw new LuanException("BBCode quoter function returned "+Luan.type(obj)+" but string required");
270 return (String)obj; 270 return (String)obj;
271 } 271 }
272 272
273 private String parseQuote1() throws LuanException { 273 private String parseQuote1() throws LuanException {
274 parser.begin(); 274 parser.begin();