Debian Codegraph @

net/sf/saxon/expr/parser/CodeInjector.java

raw symbols SCIP
1 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2018 Saxonica Limited.
3 // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
4 // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0.
6 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
7
8 package net.sf.saxon.expr.parser;
9
10 import net.sf.saxon.expr.Expression;
11 import net.sf.saxon.expr.StaticContext;
12 import net.sf.saxon.expr.flwor.Clause;
13 import net.sf.saxon.om.StructuredQName;
14
15 /**
16 * A code injector can be used to add code to the expression tree (for example, diagnostic tracing code)
17 * during the process of parsing and tree construction
18 */
19 public interface CodeInjector {
20
21 /**
22 * Wrap an expression in a diagnostic expression.
23 *
24 * @param exp the expression to be wrapped
25 * @param env the static context
26 * @param construct integer constant identifying the kind of construct
27 * @param qName the name of the construct (if applicable)
28 * @return a replacement for the original expression (or the original expression unchanged). Normally
29 * the new expression will collect or output some diagnostic information and then invoke the original
30 * expression. However this is not required; the new expression could be a complete replacement for the
31 * original.
32 */
33
34 Expression inject(Expression exp, StaticContext env, int construct, StructuredQName qName);
35
36 /**
37 * Insert a tracing clause into the pipeline of clauses that evaluates a FLWOR expression
38 *
39 * @param target the clause whose execution is being traced
40 * @param env the static context of the containing FLWOR expression
41 */
42
43 Clause injectClause(Clause target, StaticContext env);
44 }
45