1 /* 2 * Copyright 2006-2008 The FLWOR Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #pragma once 17 #ifndef ZORBA_COMPILER_PARSE_CONSTANTS_H 18 #define ZORBA_COMPILER_PARSE_CONSTANTS_H 19 20 #include <assert.h> 21 22 namespace zorba { 23 24 class ParseConstants 25 { 26 public: 27 enum default_namespace_mode_t 28 { 29 ns_element_default, 30 ns_function_default 31 }; 32 33 enum function_type_t 34 { 35 fn_simple, 36 fn_extern_simple, 37 fn_update, 38 fn_extern_update, 39 fn_sequential, 40 fn_extern_sequential 41 }; 42 43 enum dir_spec_t 44 { 45 dir_ascending, 46 dir_descending 47 }; 48 49 enum quantification_mode_t 50 { 51 quant_some, 52 quant_every 53 }; 54 55 enum add_op_t 56 { 57 op_plus, 58 op_minus 59 }; 60 61 enum mult_op_t 62 { 63 op_mul, 64 op_div, 65 op_idiv, 66 op_mod 67 }; 68 69 enum intex_op_t 70 { 71 op_intersect, 72 op_except 73 }; 74 75 enum gencomp_t 76 { 77 op_eq, 78 op_ne, 79 op_lt, 80 op_le, 81 op_gt, 82 op_ge 83 }; 84 85 enum valcomp_t 86 { 87 op_val_eq, 88 op_val_ne, 89 op_val_lt, 90 op_val_le, 91 op_val_gt, 92 op_val_ge 93 }; 94 95 enum nodecomp_t 96 { 97 op_is, 98 op_precedes, 99 op_follows 100 }; 101 102 enum validation_mode_t 103 { 104 val_strict, 105 val_lax, 106 val_dtd_lax, 107 val_typename 108 }; 109 110 enum pathtype_t 111 { 112 path_leading_lone_slash, 113 path_leading_slash, 114 path_leading_slashslash, 115 path_relative 116 }; 117 118 enum steptype_t 119 { 120 st_step, 121 st_slash, 122 st_slashslash 123 }; 124 125 enum axis_kind_t 126 { 127 axis_child, 128 axis_descendant, 129 axis_attribute, 130 axis_self, 131 axis_descendant_or_self, 132 axis_following_sibling, 133 axis_following, 134 axis_parent, 135 axis_ancestor, 136 axis_preceding_sibling, 137 axis_preceding, 138 axis_ancestor_or_self 139 }; 140 141 enum wildcard_t 142 { 143 wild_all, 144 wild_elem, 145 wild_prefix 146 }; 147 148 enum numeric_type_t 149 { 150 num_integer, 151 num_decimal, 152 num_double 153 }; 154 155 enum common_content_t 156 { 157 cont_entity, 158 cont_charref, 159 cont_escape_lbrace, 160 cont_escape_rbrace, 161 cont_expr 162 }; 163 164 enum occurrence_t 165 { 166 occurs_never, 167 occurs_exactly_one, 168 occurs_optionally, 169 occurs_zero_or_more, 170 occurs_one_or_more 171 }; 172 173 decode_numeric_type(enum numeric_type_t t)174 static const char* decode_numeric_type (enum numeric_type_t t) 175 { 176 switch (t) 177 { 178 case num_integer: return "integer"; 179 case num_decimal: return "decimal"; 180 case num_double: return "double"; 181 default: assert (false); return "?"; 182 } 183 } 184 decode_axis_kind(axis_kind_t a)185 static const char* decode_axis_kind(axis_kind_t a) 186 { 187 switch (a) 188 { 189 case axis_child: return "child"; 190 case axis_descendant: return "descendant"; 191 case axis_attribute: return "attr"; 192 case axis_self: return "self"; 193 case axis_descendant_or_self: return "descendant-or-self"; 194 case axis_following_sibling: return "following-sibling"; 195 case axis_following: return "following"; 196 case axis_parent: return "parent"; 197 case axis_ancestor: return "ancestor"; 198 case axis_preceding_sibling: return "preceding_sibling"; 199 case axis_preceding: return "preceding"; 200 case axis_ancestor_or_self: return "ancestor_or_self"; 201 default: assert (false); return "?"; 202 } 203 } 204 decode_pathtype_t(enum pathtype_t ptype)205 static const char* decode_pathtype_t(enum pathtype_t ptype) 206 { 207 switch (ptype) 208 { 209 case path_leading_lone_slash : return "path_leading_lone_slash"; 210 case path_leading_slash : return "path_leading_slash"; 211 case path_leading_slashslash : return "path_leading_slashslash"; 212 case path_relative : return "path_relative"; 213 default: assert (false); return "?"; 214 } 215 } 216 decode_steptype_t(enum steptype_t stype)217 static const char* decode_steptype_t(enum steptype_t stype) 218 { 219 switch (stype) 220 { 221 case st_step : return "st_step"; 222 case st_slash : return "st_slash"; 223 case st_slashslash : return "st_slashslash"; 224 default: assert (false); return "?"; 225 } 226 } 227 }; /* class ParseConstants */ 228 229 } /* namespace zorba */ 230 #endif /* ZORBA_PARSE_CONSTANTS_H */ 231 /* vim:set et sw=2 ts=2: */ 232