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_EXPR_CONSTS_H
18 #define ZORBA_COMPILER_EXPR_CONSTS_H
19 
20 namespace zorba
21 {
22 
23 
24 enum axis_kind_t
25 {
26   axis_kind_self = 0,
27   axis_kind_child,
28   axis_kind_parent,
29   axis_kind_descendant,
30   axis_kind_descendant_or_self,
31   axis_kind_ancestor,
32   axis_kind_ancestor_or_self,
33   axis_kind_following_sibling,
34   axis_kind_following,
35   axis_kind_preceding_sibling,
36   axis_kind_preceding,
37   axis_kind_attribute
38 };
39 
40 
41 enum match_test_t
42 {
43   match_no_test = 0,
44   match_name_test,
45   match_anykind_test,
46   match_doc_test,
47   match_elem_test,
48   match_xs_elem_test,
49   match_attr_test,
50   match_xs_attr_test,
51   match_pi_test,
52   match_comment_test,
53   match_text_test
54 };
55 
56 std::string toString(match_test_t a);
57 
58 enum match_wild_t
59 {
60   match_no_wild = 0,
61   match_all_wild,
62   match_prefix_wild,
63   match_name_wild
64 };
65 
66 
67 enum expr_script_kind_t
68 {
69   UNKNOWN_SCRIPTING_KIND =   0,
70 
71   VACUOUS_EXPR           =   1,  // An expr that will always return the empty
72                                  // sequence and will never have any side-effects.
73 
74   SIMPLE_EXPR            =   2,  // An expr that is none of the other kinds.
75 
76   UPDATING_EXPR          =   4,  // An expr that may return a non-empty PUL. The
77                                  // expr may return non-empty XDM as well.
78 
79   VAR_SETTING_EXPR       =   8,  // An expr E during the evaluation of which a
80                                  // var may be set and that var is declared
81                                  // outside the innermost block that contains E.
82 
83   APPLYING_EXPR          =  16,  // An expr during the evaluation of which a
84                                  // PUL may get applied.
85 
86   EXITING_EXPR           =  32,  // An expr during the evaluation of which an
87                                  // exit expression may be executed.
88 
89   BREAKING_EXPR          =  64,  // An expr E during the evaluation of which
90                                  // a break or continue expr may be executed
91                                  // and the the while or flwor expr being
92                                  // broken or continued contains E.
93 
94   SEQUENTIAL_FUNC_EXPR   = 128   // An expr during the evaluation of which a
95                                  // sequential function may be called.
96 };
97 
98 
99 enum BoolAnnotationValue
100 {
101   ANNOTATION_UNKNOWN = 0,
102   ANNOTATION_FALSE,
103   ANNOTATION_TRUE,
104   ANNOTATION_TRUE_FIXED
105 };
106 
107 
108 class CompareConsts
109 {
110 public:
111   enum CompareType
112   {
113     UNKNOWN,
114     VALUE_EQUAL, GENERAL_EQUAL, NODE_EQUAL,
115     VALUE_NOT_EQUAL, GENERAL_NOT_EQUAL, NODE_NOT_EQUAL,
116     VALUE_LESS, GENERAL_LESS,
117     VALUE_LESS_EQUAL, GENERAL_LESS_EQUAL,
118     VALUE_GREATER, GENERAL_GREATER,
119     VALUE_GREATER_EQUAL, GENERAL_GREATER_EQUAL
120   };
121 };
122 
123 
124 class ArithmeticConsts
125 {
126 public:
127   enum OperationKind
128   {
129     UNKNOWN,
130     ADDITION,
131     SUBTRACTION,
132     MULTIPLICATION,
133     DIVISION,
134     INTEGER_DIVISION,
135     MODULO
136   };
137 };
138 
139 
140 }; // namespace zorba
141 
142 
143 #endif /* ZORBA_EXPR_CONSTS_H */
144 /* vim:set et sw=2 ts=2: */
145