| 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.trace; |
| 9 | |
| 10 | import net.sf.saxon.expr.ContextOriginator; |
| 11 | |
| 12 | /** |
| 13 | * This class holds constants identifying different kinds of location in a source stylesheet or query. |
| 14 | * These constants are used in the getConstructType() method of class InstructionInfo. |
| 15 | * They represent points in the evaluation of a stylesheet |
| 16 | * (or query or XPath expression) that are notified to the trace listener. |
| 17 | * <p>Any constant used in {@link net.sf.saxon.om.StandardNames} can be used as a Location. Such |
| 18 | * names are generally used to identify XSLT instructions. They are also used for equivalent constructs |
| 19 | * in XQuery, for example XSL_ELEMENT is used for a computed element constructor in XQuery. The constants |
| 20 | * in StandardNames are all in the range 0-1023, so constants defined in this class are outside this |
| 21 | * range.</p> |
| 22 | * <p>The constants in this file are annotated with Q to indicate they can appear in XQuery trace output, |
| 23 | * T to indicate they can appear in XSLT trace output.</p> |
| 24 | * |
| 25 | * @since 9.7: previously named net.sf.saxon.trace.Location. No longer used to identify constructs causing |
| 26 | * changes on the context stack; the class {@link ContextOriginator} is now used for this purpose. |
| 27 | */ |
| 28 | public class LocationKind { |
| 29 | |
| 30 | |
| 31 | /** |
| 32 | * An XSLT instruction. The name of the instruction (which may be an extension instruction) can |
| 33 | * be obtained using the fingerprint property. Usage:T |
| 34 | */ |
| 35 | public static final int EXTENSION_INSTRUCTION = 2005; |
| 36 | |
| 37 | /** |
| 38 | * An XSLT literal result element, or an XQuery direct element constructor. Usage:QT |
| 39 | */ |
| 40 | public static final int LITERAL_RESULT_ELEMENT = 2006; |
| 41 | |
| 42 | /** |
| 43 | * An attribute of an XSLT literal result element or of an XQuery direct element constructor. |
| 44 | * Usage: QT |
| 45 | */ |
| 46 | public static final int LITERAL_RESULT_ATTRIBUTE = 2007; |
| 47 | |
| 48 | /** |
| 49 | * An XSLT user-written template rule or named template. Usage: T |
| 50 | */ |
| 51 | public static final int TEMPLATE = 2008; |
| 52 | |
| 53 | /** |
| 54 | * An XPath function call to a user-defined function. |
| 55 | * The "expression" property references the actual expression, of class ComputedExpression. |
| 56 | * The "target" property references the function being called, of class UserFunction. |
| 57 | * Usage: QTC |
| 58 | */ |
| 59 | public static final int FUNCTION_CALL = 2009; |
| 60 | |
| 61 | |
| 62 | /** |
| 63 | * Entry point to a top-level XPath expression within an XSLT stylesheet. |
| 64 | * Usage: TC |
| 65 | */ |
| 66 | |
| 67 | public static final int XPATH_IN_XSLT = 2011; |
| 68 | |
| 69 | /** |
| 70 | * An XPath or XQuery "for" clause. Usage: Q |
| 71 | */ |
| 72 | |
| 73 | public static final int FOR_EXPRESSION = 2012; |
| 74 | |
| 75 | /** |
| 76 | * An XQuery "let" clause, or an XSLT local variable (which compiles into a LET clause). |
| 77 | * Usage: Q,T |
| 78 | */ |
| 79 | |
| 80 | public static final int LET_EXPRESSION = 2013; |
| 81 | |
| 82 | /** |
| 83 | * An XPath or XQuery "return" clause. Usage: Q |
| 84 | */ |
| 85 | |
| 86 | public static final int RETURN_EXPRESSION = 2014; |
| 87 | |
| 88 | |
| 89 | /** |
| 90 | * An XPath or XQuery "if" expression. Usage: Q |
| 91 | */ |
| 92 | |
| 93 | public static final int IF_EXPRESSION = 2015; |
| 94 | |
| 95 | /** |
| 96 | * An XPath or XQuery "then" clause. Usage: Q |
| 97 | */ |
| 98 | |
| 99 | public static final int THEN_EXPRESSION = 2016; |
| 100 | |
| 101 | /** |
| 102 | * An XPath or XQuery "else" clause. Usage: Q |
| 103 | */ |
| 104 | |
| 105 | public static final int ELSE_EXPRESSION = 2017; |
| 106 | |
| 107 | /** |
| 108 | * A WHERE clause in a FLWOR expression. Usage: Q |
| 109 | */ |
| 110 | |
| 111 | public static final int WHERE_CLAUSE = 2018; |
| 112 | |
| 113 | /** |
| 114 | * An order-by clause in a FLWOR expression. Usage: Q |
| 115 | */ |
| 116 | |
| 117 | public static final int ORDER_BY_CLAUSE = 2019; |
| 118 | |
| 119 | /** |
| 120 | * An XPath or XQuery "typeswitch" expression. Usage: Q |
| 121 | */ |
| 122 | |
| 123 | public static final int TYPESWITCH_EXPRESSION = 2020; |
| 124 | |
| 125 | /** |
| 126 | * CASE clause within "typeswitch". Usage: Q |
| 127 | */ |
| 128 | |
| 129 | public static final int CASE_EXPRESSION = 2021; |
| 130 | |
| 131 | /** |
| 132 | * DEFAULT clause within "typeswitch". Usage: Q |
| 133 | */ |
| 134 | |
| 135 | public static final int DEFAULT_EXPRESSION = 2022; |
| 136 | |
| 137 | /** |
| 138 | * An XPath or XQuery "validate" expression. Usage: Q |
| 139 | */ |
| 140 | |
| 141 | public static final int VALIDATE_EXPRESSION = 2023; |
| 142 | |
| 143 | |
| 144 | /** |
| 145 | * An XPath or XQuery "switch" expression. Usage: Q |
| 146 | */ |
| 147 | |
| 148 | public static final int SWITCH_EXPRESSION = 2026; |
| 149 | |
| 150 | /** |
| 151 | * An XQuery Update copy-modify (transform) expression. Usage: Q |
| 152 | */ |
| 153 | |
| 154 | public static final int COPY_MODIFY_EXPRESSION = 2027; |
| 155 | |
| 156 | /** |
| 157 | * An XQuery Update insert expression. Usage: Q |
| 158 | */ |
| 159 | |
| 160 | public static final int INSERT_EXPRESSION = 2028; |
| 161 | |
| 162 | /** |
| 163 | * An XPath or XQuery replace expression. Usage: Q |
| 164 | */ |
| 165 | |
| 166 | public static final int REPLACE_EXPRESSION = 2029; |
| 167 | |
| 168 | /** |
| 169 | * An XPath or XQuery delete expression. Usage: Q |
| 170 | */ |
| 171 | |
| 172 | public static final int DELETE_EXPRESSION = 2030; |
| 173 | |
| 174 | /** |
| 175 | * An XPath or XQuery rename expression. Usage: Q |
| 176 | */ |
| 177 | |
| 178 | public static final int RENAME_EXPRESSION = 2031; |
| 179 | |
| 180 | |
| 181 | /** |
| 182 | * An explicit call of the fn:trace() function. Usage: QT |
| 183 | */ |
| 184 | |
| 185 | public static final int TRACE_CALL = 2041; |
| 186 | |
| 187 | /** |
| 188 | * An XPath expression constructed dynamically using saxon:evaluate (or saxon:expression). |
| 189 | * Usage: QTC |
| 190 | */ |
| 191 | |
| 192 | public static final int SAXON_EVALUATE = 2051; |
| 193 | |
| 194 | |
| 195 | /** |
| 196 | * A function declaration in XSLT or XQuery |
| 197 | */ |
| 198 | |
| 199 | public static final int FUNCTION = 2065; |
| 200 | |
| 201 | /** |
| 202 | * The main XQuery body |
| 203 | */ |
| 204 | |
| 205 | public static final int XQUERY_BODY = 2070; |
| 206 | |
| 207 | /** |
| 208 | * XPath expression, otherwise unclassified. The "expression" property references the actual expression, |
| 209 | * of class ComputedExpression. Used in fallback cases only. |
| 210 | */ |
| 211 | public static final int XPATH_EXPRESSION = 2098; |
| 212 | |
| 213 | /** |
| 214 | * Unclassified location. Used in fallback cases only. |
| 215 | */ |
| 216 | public static final int UNCLASSIFIED = 2099; |
| 217 | |
| 218 | /** |
| 219 | * Values of the form CLAUSE_BASE + n represent FLWOR clauses |
| 220 | */ |
| 221 | public static final int CLAUSE_BASE = 3000; |
| 222 | |
| 223 | private LocationKind() { |
| 224 | } |
| 225 | } |