1 package org.jicengine.expression; 2 3 import org.jicengine.operation.Operation; 4 5 16 17 public class LJEParser implements Parser { 18 19 private static LJEParser instance = new LJEParser(); 20 21 public static LJEParser getInstance() 22 { 23 return instance; 24 } 25 26 Parser parser; 27 28 private LJEParser() { 29 31 Parser atomParser = new CompositeParser(new Parser[]{ 34 new VariableParser(), 35 new ClassParser() 36 }); 37 38 42 Parser negationParser = new NegationParser( 43 new CompositeParser(new Parser[]{ 44 new BuildParameterParser(), 45 new VariableParser(), 46 new FieldValueParser(atomParser), 48 new InvocationParser(atomParser) 49 })); 50 51 Parser factoryInvocationParser = new FactoryInvocationParser(new VariableParser()); 52 53 parser = new CompositeParser(new Parser[]{ 55 negationParser, 56 new BuildParameterParser(), 57 factoryInvocationParser, 58 new VariableParser(), 59 new FieldValueParser(atomParser), 61 new InvocationParser(atomParser) 62 }); 63 } 64 65 public Operation parse(String expression) throws SyntaxException 66 { 67 return this.parser.parse(expression); 68 } 69 } 70 | Popular Tags |