private String compile (String s)throws RulesException {
InputStream stream = new ByteArrayInputStream(s.getBytes());
DataInputStream input = new DataInputStream(stream);
DTRulesscanner lexer = new DTRulesscanner (input);
tfilter = new TokenFilter(session, lexer,types, localtypes);
DTRulesParser parser = new DTRulesParser(tfilter);
Object result = null;
parser.localCnt = localcnt;
try {
result = parser.parse().value;
}catch(Exception e){
int line = 0;
for (int i = 0; i < lexer.linenumber(); i++){
int tryhere = s.indexOf("\n", line);
if(tryhere >0) line = tryhere;
}
s = s.replaceAll("[\n]", " ");
s = s.replaceAll("[\r]", " ");
String before = s.substring(0, line+lexer.charnumber());
String after = s.substring(line+lexer.charnumber());
String location = "Parsing a "+before.substring(0,before.indexOf(" "));
before = before.substring(before.indexOf(" ")+1);
throw new RulesException("compileError", location, before+" *ERROR*=> "+after);