CompiledExpression CompileExpression(string expression_string)
 {
     CompiledExpression compiled = new CompiledExpression();
     try
     {
         Parser expression_parser = new Parser(expression_string, m_ExecFuncEvaluator, m_CompileTimeConstants);
         compiled.expression = expression_parser.Parse();
         compiled.contains_exec = expression_parser.ContainsExec;
     }
     catch (Exception ex)
     {
         compiled.compile_error = ex;
     }
     return compiled;
 }
Exemplo n.º 2
0
 Expression Parse(string s)
 {
     try
     {
         VariableValueResolver compile_time_constants = new VariableValueResolver();
         compile_time_constants.SetVariable("true", true);
         compile_time_constants.SetVariable("false", false);
         Parser parser = new Parser(s, compile_time_constants);
         return parser.Parse();
     }
     catch (ParserException ex)
     {
         Console.WriteLine("Parser Exception:");
         Console.WriteLine(ex.InputText);
         string indent = new string(' ', ex.ErrorPos);
         Console.WriteLine("{0}^", indent);
         Console.WriteLine("{0}{1}", indent, ex.ErrorMessage);
         throw ex;
     }
 }