internal XPathCompiler(QueryCompilerFlags flags) { this.flags = flags; this.pushInitialContext = false; }
internal XPathCompiler(FilterOptimizer optimizer, QueryCompilerFlags flags) { this.optimizer = optimizer; this.flags = flags; this.pushInitialContext = false; }
internal XPathCompiler(QueryCompilerFlags flags) : this(new FilterOptimizer(SelectFunctionTree.standard), flags) { }
internal static OpcodeBlock CompileForInternalEngine(string xpath, XmlNamespaceManager ns, QueryCompilerFlags flags, out ValueDataType returnType) { return(CompileForInternalEngine(xpath, ns, flags, defaultFunctionLibs, out returnType)); }
internal static OpcodeBlock CompileForInternalEngine(string xpath, XmlNamespaceManager nsManager, QueryCompilerFlags flags, IFunctionLibrary[] functionLibs, out ValueDataType returnType) { returnType = ValueDataType.None; if (xpath.Length == 0) { OpcodeBlock block = new OpcodeBlock(); block.Append(new PushBooleanOpcode(true)); return(block); } XPathExpr expr = new XPathParser(xpath, nsManager, functionLibs).Parse(); if (expr == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new QueryCompileException(QueryCompileError.CouldNotParseExpression)); } returnType = expr.ReturnType; XPathCompiler compiler = new XPathCompiler(flags); return(compiler.Compile(expr)); }
internal static OpcodeBlock CompileForInternalEngine(XPathMessageFilter filter, QueryCompilerFlags flags, IFunctionLibrary[] functionLibs, out ValueDataType returnType) { return(CompileForInternalEngine(filter.XPath.Trim(), filter.namespaces, flags, functionLibs, out returnType)); }
internal static OpcodeBlock CompileForInternalEngine(string xpath, XmlNamespaceManager nsManager, QueryCompilerFlags flags, IFunctionLibrary[] functionLibs, out ValueDataType returnType) { OpcodeBlock codeBlock; returnType = ValueDataType.None; if (0 == xpath.Length) { // 0 length XPaths always match codeBlock = new OpcodeBlock(); codeBlock.Append(new PushBooleanOpcode(true)); // Always match by pushing true on the eval stack } else { // Try to parse the xpath. Bind to default function libraries // The parser returns an expression tree XPathParser parser = new XPathParser(xpath, nsManager, functionLibs); XPathExpr parseTree = parser.Parse(); if (null == parseTree) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new QueryCompileException(QueryCompileError.CouldNotParseExpression)); } returnType = parseTree.ReturnType; // Compile the expression tree XPathCompiler compiler = new XPathCompiler(flags); codeBlock = compiler.Compile(parseTree); } return(codeBlock); }