1 /*
2 * Copyright 2006-2012 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 #include "stdafx.h"
17
18 #include "util/stl_util.h"
19 #include "diagnostics/assert.h"
20 #include "diagnostics/xquery_diagnostics.h"
21
22 #include "types/typemanager.h"
23
24 #include "store/api/item.h"
25
26 #include "context/static_context_consts.h"
27
28 #include "compiler/parsetree/parsenodes.h"
29 #include "compiler/parser/parse_constants.h"
30 #include "compiler/parsetree/parsenode_visitor.h"
31
32 #include <iostream>
33 #include <sstream>
34 #include <stdexcept>
35 #include <string>
36 #include <typeinfo>
37 #include <vector>
38 #include <assert.h>
39 #include <algorithm>
40
41
42 #include "util/tracer.h"
43
44
45 namespace zorba
46 {
47
48 int dummy;
49 void *parsenode_visitor::no_state = (void *) &dummy;
50
51 int printdepth = 0;
52 std::ostringstream __oss;
53
54 #undef INDENT
55 #define INDENT std::string(++printdepth, ' ')
56 #define OUTDENT std::string(printdepth--, ' ')
57 #define UNDENT printdepth--
58
59 #define BEGIN_VISITOR() void* visitor_state; if (NULL == (visitor_state = v.begin_visit(*this))) return
60 #define END_VISITOR() v.end_visit (*this, visitor_state)
61 #define ACCEPT( m ) do { if ((m) != NULL) (m)->accept (v); } while (0)
62 #define ACCEPT_CHK( m ) do { ZORBA_ASSERT ((m) != NULL); (m)->accept (v); } while (0)
63
64 #define ACCEPT_SEQ(T,S) \
65 for ( T::const_iterator i = S.begin(); i != S.end(); ++i ) \
66 ACCEPT( *i );
67
68 #define DECLARE_VISITOR_FUNCTOR( name, type, body) \
69 class name : public std::unary_function<rchandle<parsenode>, void> \
70 { \
71 parsenode_visitor &v; \
72 public: \
73 name (parsenode_visitor &v_) : v (v_) {} \
74 void operator () (type e) body \
75 }
76
77
78 DECLARE_VISITOR_FUNCTOR(visitor_functor, rchandle<parsenode>, { ACCEPT(e); });
79
80
81 /*******************************************************************************
82 [1] Module ::= VersionDecl? (LibraryModule | MainModule)
83 ********************************************************************************/
84
85
86 /*******************************************************************************
87 [2] VersionDecl ::= XQUERY ENCODING STRING_LITERAL SEMI |
88 XQUERY VERSION STRING_LITERAL SEMI |
89 XQUERY VERSION STRING_LITERAL ENCODING STRING_LITERAL SEMI
90 ********************************************************************************/
VersionDecl(const QueryLoc & loc_,zstring const & _version,zstring const & _encoding)91 VersionDecl::VersionDecl(
92 const QueryLoc& loc_,
93 zstring const& _version,
94 zstring const& _encoding)
95 :
96 parsenode(loc_),
97 version(_version),
98 encoding(_encoding)
99 {
100 }
101
102
accept(parsenode_visitor & v) const103 void VersionDecl::accept( parsenode_visitor &v ) const
104 {
105 BEGIN_VISITOR();
106 END_VISITOR();
107 }
108
109
110 /*******************************************************************************
111 [3] MainModule ::= Prolog QueryBody | QueryBody
112 ********************************************************************************/
MainModule(const QueryLoc & loc_,rchandle<QueryBody> _query_body_h,rchandle<Prolog> _prolog_h,rchandle<VersionDecl> _ver)113 MainModule::MainModule(
114 const QueryLoc& loc_,
115 rchandle<QueryBody> _query_body_h,
116 rchandle<Prolog> _prolog_h,
117 rchandle<VersionDecl> _ver)
118 :
119 Module(loc_, _ver),
120 prolog_h(_prolog_h),
121 query_body_h(_query_body_h)
122 {
123 }
124
125
accept(parsenode_visitor & v) const126 void MainModule::accept( parsenode_visitor &v ) const
127 {
128 BEGIN_VISITOR();
129 ACCEPT (version_decl_h);
130 ACCEPT (prolog_h);
131 ACCEPT (query_body_h);
132 END_VISITOR();
133 }
134
135
136 /*******************************************************************************
137 [4] LibraryModule ::= ModuleDecl Prolog
138 [*] DataModule := DataModuleDecl Prolog
139 ********************************************************************************/
LibraryModule(const QueryLoc & loc_,rchandle<ModuleDecl> _decl_h,rchandle<Prolog> _prolog_h,rchandle<VersionDecl> _ver)140 LibraryModule::LibraryModule(
141 const QueryLoc& loc_,
142 rchandle<ModuleDecl> _decl_h,
143 rchandle<Prolog> _prolog_h,
144 rchandle<VersionDecl> _ver)
145 :
146 Module(loc_, _ver),
147 decl_h(_decl_h),
148 prolog_h(_prolog_h)
149 {
150 }
151
152
accept(parsenode_visitor & v) const153 void LibraryModule::accept( parsenode_visitor &v ) const
154 {
155 BEGIN_VISITOR();
156 ACCEPT(version_decl_h);
157 ACCEPT(decl_h);
158 ACCEPT(prolog_h);
159 END_VISITOR();
160 }
161
162
163 /*******************************************************************************
164 [5] ModuleDecl ::= MODULE NAMESPACE NCNAME EQ URI_LITERAL SEMI
165 ********************************************************************************/
ModuleDecl(const QueryLoc & loc,zstring const & prefix,zstring const & target_namespace)166 ModuleDecl::ModuleDecl(
167 const QueryLoc& loc,
168 zstring const& prefix,
169 zstring const& target_namespace)
170 :
171 XQDocumentable(loc),
172 thePrefix(prefix),
173 theTargetNamespace(target_namespace)
174 {
175 }
176
177
accept(parsenode_visitor & v) const178 void ModuleDecl::accept( parsenode_visitor &v ) const
179 {
180 BEGIN_VISITOR();
181 END_VISITOR();
182 }
183
184
185 /******************************************************************************
186 [6] Prolog ::= SIND_DeclList? VFO_DeclList?
187
188 [6a] SIND_DeclList ::= SIND_Decl Separator | SIND_DeclList SIND_Decl Separator
189
190 [6b] VFO_DeclList ::= VFO_Decl Separator | VFO_DeclList VFO_Decl Separator
191
192 [6c] SIND_Decl ::= Setter | NamespaceDecl | DefaultNamespaceDecl | Import
193
194 [6d] VFO_Decl ::= VarDecl | ContextItemDecl | FunctionDecl | IndexDecl | OptionDecl
195
196 ********************************************************************************/
Prolog(const QueryLoc & loc_,rchandle<SIND_DeclList> _sind_list_h,rchandle<VFO_DeclList> _vfo_list_h)197 Prolog::Prolog(
198 const QueryLoc& loc_,
199 rchandle<SIND_DeclList> _sind_list_h,
200 rchandle<VFO_DeclList> _vfo_list_h)
201 :
202 parsenode(loc_),
203 sind_list_h(_sind_list_h),
204 vfo_list_h(_vfo_list_h)
205 {
206 }
207
208
set_sind_list(SIND_DeclList * list)209 bool Prolog::set_sind_list(SIND_DeclList* list)
210 {
211 bool result = true;
212 if (!sind_list_h.isNull())
213 result = false;
214 sind_list_h = list;
215 return result;
216 }
217
218
set_vfo_list(VFO_DeclList * list)219 bool Prolog::set_vfo_list(VFO_DeclList* list)
220 {
221 bool result = true;
222 if (!vfo_list_h.isNull())
223 result = false;
224 vfo_list_h = list;
225 return result;
226 }
227
228
set_list(parsenode * list)229 bool Prolog::set_list(parsenode* list)
230 {
231 SIND_DeclList* sdl = dynamic_cast<SIND_DeclList*>(list);
232 if (sdl != NULL)
233 return set_sind_list(sdl);
234
235 VFO_DeclList* vdl = dynamic_cast<VFO_DeclList*>(list);
236 if (vdl != NULL)
237 return set_vfo_list(vdl);
238
239 return false;
240 }
241
242
accept(parsenode_visitor & v) const243 void Prolog::accept( parsenode_visitor &v ) const
244 {
245 BEGIN_VISITOR();
246 ACCEPT (sind_list_h);
247 ACCEPT (vfo_list_h);
248 END_VISITOR();
249 }
250
251
252 /*******************************************************************************
253 [6a] SIND_DeclList ::= SIND_Decl Separator | SIND_DeclList SIND_Decl Separator
254 ********************************************************************************/
SIND_DeclList(const QueryLoc & loc)255 SIND_DeclList::SIND_DeclList(const QueryLoc& loc)
256 :
257 parsenode(loc)
258 {
259 }
260
261
push_back(rchandle<parsenode> decl)262 void SIND_DeclList::push_back(rchandle<parsenode> decl)
263 {
264 if (dynamic_cast<ModuleImport*>(decl.getp()) != NULL)
265 {
266 theModuleImports.push_back(decl);
267 }
268 else
269 {
270 theDecls.push_back(decl);
271 }
272 }
273
274
accept(parsenode_visitor & v) const275 void SIND_DeclList::accept(parsenode_visitor &v) const
276 {
277 BEGIN_VISITOR();
278
279 for (std::vector<rchandle<parsenode> >::const_iterator it = theDecls.begin();
280 it != theDecls.end();
281 ++it)
282 {
283 ACCEPT_CHK((*it));
284 }
285
286 for (std::vector<rchandle<parsenode> >::const_iterator it = theModuleImports.begin();
287 it != theModuleImports.end();
288 ++it)
289 {
290 ACCEPT_CHK((*it));
291 }
292
293 END_VISITOR();
294 }
295
296
297 /******************************************************************************
298 [11] BoundarySpaceDecl ::= DECLARE_BOUNDARY_SPACE ( PRESERVE | STRIP )
299 ********************************************************************************/
BoundarySpaceDecl(const QueryLoc & loc_,StaticContextConsts::boundary_space_mode_t _mode)300 BoundarySpaceDecl::BoundarySpaceDecl(
301 const QueryLoc& loc_,
302 StaticContextConsts::boundary_space_mode_t _mode)
303 :
304 parsenode(loc_),
305 mode(_mode)
306 {
307 }
308
309
accept(parsenode_visitor & v) const310 void BoundarySpaceDecl::accept( parsenode_visitor &v ) const
311 {
312 BEGIN_VISITOR();
313 END_VISITOR();
314 }
315
316
317 /******************************************************************************
318 [14] OrderingModeDecl ::= DECLARE_ORDERING ( ORDERED | UNORDERED )
319 ********************************************************************************/
OrderingModeDecl(const QueryLoc & loc_,StaticContextConsts::ordering_mode_t _mode)320 OrderingModeDecl::OrderingModeDecl(
321 const QueryLoc& loc_,
322 StaticContextConsts::ordering_mode_t _mode)
323 :
324 parsenode(loc_),
325 mode(_mode)
326 {
327 }
328
329
accept(parsenode_visitor & v) const330 void OrderingModeDecl::accept( parsenode_visitor &v ) const
331 {
332 BEGIN_VISITOR();
333 END_VISITOR();
334 }
335
336
337 /******************************************************************************
338 [15] EmptyOrderDecl ::= DECLARE_DEFAULT_ORDER EMPTY_GREATEST |
339 DECLARE_DEFAULT_ORDER EMPTY_LEAST
340 ********************************************************************************/
EmptyOrderDecl(const QueryLoc & loc_,StaticContextConsts::empty_order_mode_t _mode)341 EmptyOrderDecl::EmptyOrderDecl(
342 const QueryLoc& loc_,
343 StaticContextConsts::empty_order_mode_t _mode)
344 :
345 parsenode(loc_),
346 mode(_mode)
347 {
348 }
349
350
accept(parsenode_visitor & v) const351 void EmptyOrderDecl::accept( parsenode_visitor &v ) const
352 {
353 BEGIN_VISITOR();
354 END_VISITOR();
355 }
356
357
358 /******************************************************************************
359 [16] CopyNamespacesDecl ::= DECLARE_COPY_NAMESPACES PreserveMode COMMA InheritMode
360
361 [19] PreserveMode ::= "preserve" | "no-preserve"
362 [20] InheritMode ::= "inherit" | "no-inherit"
363 ********************************************************************************/
CopyNamespacesDecl(const QueryLoc & loc,bool preserve_ns,bool inherit_ns)364 CopyNamespacesDecl::CopyNamespacesDecl(
365 const QueryLoc& loc,
366 bool preserve_ns,
367 bool inherit_ns)
368 :
369 parsenode(loc),
370 thePreserveNamespaces(preserve_ns),
371 theInheritNamespaces(inherit_ns)
372 {
373 }
374
375
accept(parsenode_visitor & v) const376 void CopyNamespacesDecl::accept(parsenode_visitor& v) const
377 {
378 BEGIN_VISITOR();
379 END_VISITOR();
380 }
381
382
383 /******************************************************************************
384 [17] DecimalFormatDecl ::= "declare"
385 (("decimal-format" QName) | ("default" "decimal-format"))
386 (DFPropertyName "=" StringLiteral)*
387
388 [18] DFPropertyName ::= "decimal-separator" | "grouping-separator" |
389 "infinity" | "minus-sign" | "NaN" | "percent" |
390 "per-mille" | "zero-digit" | "digit" |
391 "pattern-separator"
392 ********************************************************************************/
accept(parsenode_visitor & v) const393 void DecimalFormatNode::accept( parsenode_visitor &v ) const
394 {
395 BEGIN_VISITOR();
396 END_VISITOR();
397 }
398
399
400 /*******************************************************************************
401 [21] DefaultCollationDecl ::= DECLARE_DEFAULT_COLLATION URI_LITERAL
402 ********************************************************************************/
DefaultCollationDecl(const QueryLoc & loc_,zstring const & _collation)403 DefaultCollationDecl::DefaultCollationDecl(
404 const QueryLoc& loc_,
405 zstring const& _collation)
406 :
407 parsenode(loc_),
408 collation(_collation)
409 {
410 }
411
412
accept(parsenode_visitor & v) const413 void DefaultCollationDecl::accept( parsenode_visitor &v ) const
414 {
415 BEGIN_VISITOR();
416 END_VISITOR();
417 }
418
419
420 /*******************************************************************************
421 [22] BaseURIDecl ::= DECLARE_BASE_URI URI_LITERAL
422 ********************************************************************************/
BaseURIDecl(const QueryLoc & loc_,zstring const & _base_uri)423 BaseURIDecl::BaseURIDecl(
424 const QueryLoc& loc_,
425 zstring const& _base_uri)
426 :
427 parsenode(loc_),
428 base_uri(_base_uri)
429 {
430 }
431
432
accept(parsenode_visitor & v) const433 void BaseURIDecl::accept( parsenode_visitor &v ) const
434 {
435 BEGIN_VISITOR();
436 END_VISITOR();
437 }
438
439
440 /*******************************************************************************
441 [31] ConstructionDecl ::= DECLARE CONSTRUCTION PRESERVE
442 DECLARE CONSTRUCTION STRIP
443 ********************************************************************************/
ConstructionDecl(const QueryLoc & loc_,StaticContextConsts::construction_mode_t _mode)444 ConstructionDecl::ConstructionDecl(
445 const QueryLoc& loc_,
446 StaticContextConsts::construction_mode_t _mode)
447 :
448 parsenode(loc_),
449 mode(_mode)
450 {
451 }
452
453
accept(parsenode_visitor & v) const454 void ConstructionDecl::accept( parsenode_visitor &v ) const
455 {
456 BEGIN_VISITOR();
457 END_VISITOR();
458 }
459
460
461 /******************************************************************************
462 [10] NamespaceDecl ::= ::= DECLARE NAMESPACE NCNAME EQ URI_LITERAL
463 ********************************************************************************/
NamespaceDecl(const QueryLoc & loc,const zstring & prefix,const zstring & uri)464 NamespaceDecl::NamespaceDecl(
465 const QueryLoc& loc,
466 const zstring& prefix,
467 const zstring& uri)
468 :
469 parsenode(loc),
470 thePrefix(prefix),
471 theUri(uri)
472 {
473 }
474
475
accept(parsenode_visitor & v) const476 void NamespaceDecl::accept( parsenode_visitor &v ) const
477 {
478 BEGIN_VISITOR();
479 END_VISITOR();
480 }
481
482
483 /*******************************************************************************
484 [12] DefaultNamespaceDecl ::= DECLARE DEFAULT ELEMENT NAMESPACE URILiteral |
485 DECLARE DEFAULT FUNCTION NAMESPACE URILiteral
486 ********************************************************************************/
DefaultNamespaceDecl(const QueryLoc & loc,enum ParseConstants::default_namespace_mode_t mode,const zstring & uri)487 DefaultNamespaceDecl::DefaultNamespaceDecl(
488 const QueryLoc& loc,
489 enum ParseConstants::default_namespace_mode_t mode,
490 const zstring& uri)
491 :
492 parsenode(loc),
493 theMode(mode),
494 theUri(uri)
495 {
496 }
497
498
accept(parsenode_visitor & v) const499 void DefaultNamespaceDecl::accept( parsenode_visitor &v ) const
500 {
501 BEGIN_VISITOR();
502 END_VISITOR();
503 }
504
505
506 /*******************************************************************************
507 [23] SchemaImport ::= "import" "schema" SchemaPrefix? URILiteral
508 ("at" URILiteralList)?
509 ********************************************************************************/
SchemaImport(const QueryLoc & loc,rchandle<SchemaPrefix> prefix,const zstring & uri,rchandle<URILiteralList> at_list)510 SchemaImport::SchemaImport(
511 const QueryLoc& loc,
512 rchandle<SchemaPrefix> prefix,
513 const zstring& uri,
514 rchandle<URILiteralList> at_list)
515 :
516 XQDocumentable(loc),
517 thePrefix(prefix),
518 theUri(uri),
519 theAtList(at_list)
520 {
521 }
522
523
accept(parsenode_visitor & v) const524 void SchemaImport::accept( parsenode_visitor &v ) const
525 {
526 BEGIN_VISITOR();
527 ACCEPT(thePrefix);
528 ACCEPT(theAtList);
529 END_VISITOR();
530 }
531
532
533 /******************************************************************************
534 [23a] URLLiteralList ::= URI_LITERAL | URILiteralList COMMA URI_LITERAL
535 ********************************************************************************/
URILiteralList(const QueryLoc & loc)536 URILiteralList::URILiteralList(const QueryLoc& loc)
537 :
538 parsenode(loc)
539 {
540 }
541
542
accept(parsenode_visitor & v) const543 void URILiteralList::accept( parsenode_visitor &v ) const
544 {
545 BEGIN_VISITOR();
546 #if 0
547 std::vector<string>::const_reverse_iterator it = uri_v.rbegin();
548 for (; it!=uri_v.rend(); ++it) {
549 // ..do something useful
550 }
551 #endif
552 END_VISITOR();
553 }
554
555
556 /******************************************************************************
557 [24] SchemaPrefix ::= ("namespace" NCName "=") | ("default" "element" "namespace")
558 ********************************************************************************/
SchemaPrefix(const QueryLoc & loc,bool isDefault)559 SchemaPrefix::SchemaPrefix(
560 const QueryLoc& loc,
561 bool isDefault)
562 :
563 parsenode(loc),
564 thePrefix(""),
565 theIsDefault(isDefault)
566 {
567 }
568
569
SchemaPrefix(const QueryLoc & loc,const zstring & prefix)570 SchemaPrefix::SchemaPrefix(
571 const QueryLoc& loc,
572 const zstring& prefix)
573 :
574 parsenode(loc),
575 thePrefix(prefix),
576 theIsDefault(false)
577 {
578 }
579
580
accept(parsenode_visitor & v) const581 void SchemaPrefix::accept( parsenode_visitor &v ) const
582 {
583 BEGIN_VISITOR();
584 END_VISITOR();
585 }
586
587
588 /*******************************************************************************
589 [25] ModuleImport ::= "import" "module" ("namespace" NCName "=")? URILiteral
590 ("at" URILiteralList)?
591 ********************************************************************************/
ModuleImport(const QueryLoc & loc,const zstring & uri,rchandle<URILiteralList> atlist)592 ModuleImport::ModuleImport(
593 const QueryLoc& loc,
594 const zstring& uri,
595 rchandle<URILiteralList> atlist)
596 :
597 XQDocumentable(loc),
598 theUri(uri),
599 theAtList(atlist)
600 {
601 }
602
603
ModuleImport(const QueryLoc & loc,const zstring & prefix,const zstring & uri,rchandle<URILiteralList> atlist)604 ModuleImport::ModuleImport(
605 const QueryLoc& loc,
606 const zstring& prefix,
607 const zstring& uri,
608 rchandle<URILiteralList> atlist)
609 :
610 XQDocumentable(loc),
611 thePrefix(prefix),
612 theUri(uri),
613 theAtList(atlist)
614 {
615 }
616
617
accept(parsenode_visitor & v) const618 void ModuleImport::accept( parsenode_visitor &v ) const
619 {
620 BEGIN_VISITOR();
621 ACCEPT(theAtList);
622 END_VISITOR();
623 }
624
625
626 /*******************************************************************************
627 VFO_DeclList ::= VFO_Decl Separator | VFO_DeclList VFO_Decl Separator
628
629 VFO_Decl ::= VarDecl | ContextItemDecl | FunctionDecl | IndexDecl | OptionDecl
630 ********************************************************************************/
VFO_DeclList(const QueryLoc & loc)631 VFO_DeclList::VFO_DeclList(const QueryLoc& loc)
632 :
633 parsenode(loc)
634 {
635 }
636
637
push_back(const rchandle<parsenode> & decl)638 void VFO_DeclList::push_back(const rchandle<parsenode>& decl)
639 {
640 theDecls.push_back(decl);
641
642 bool isIndexDecl = (dynamic_cast<AST_IndexDecl*>(decl.getp()) != NULL);
643 theIndexDeclFlags.push_back(isIndexDecl);
644 }
645
646
accept(parsenode_visitor & v) const647 void VFO_DeclList::accept(parsenode_visitor& v) const
648 {
649 BEGIN_VISITOR();
650
651 csize numDecls = theDecls.size();
652
653 for (csize i = 0; i < numDecls; ++i)
654 {
655 if (theIndexDeclFlags[i])
656 continue;
657
658 ACCEPT_CHK(theDecls[i]);
659 }
660
661 for (csize i = 0; i < numDecls; ++i)
662 {
663 if (!theIndexDeclFlags[i])
664 continue;
665
666 ACCEPT_CHK(theDecls[i]);
667 }
668
669 END_VISITOR();
670 }
671
672
673 /*******************************************************************************
674 OptionDecl ::= DECLARE_OPTION QNAME STRING_LITERAL
675 ********************************************************************************/
OptionDecl(const QueryLoc & loc_,rchandle<QName> _qname_h,zstring const & _val)676 OptionDecl::OptionDecl(
677 const QueryLoc& loc_,
678 rchandle<QName> _qname_h,
679 zstring const& _val)
680 :
681 parsenode(loc_),
682 qname_h(_qname_h),
683 val(_val)
684 {
685 }
686
687
accept(parsenode_visitor & v) const688 void OptionDecl::accept( parsenode_visitor &v ) const
689 {
690 BEGIN_VISITOR();
691 //qname_h->accept(v);
692 END_VISITOR();
693 }
694
695
696 /*******************************************************************************
697 ContextItemDecl ::= "declare" "context" "item" ("as" ItemType)?
698 ((":=" VarValue) | ("external" (":=" VarDefaultValue)?))
699 ********************************************************************************/
accept(parsenode_visitor & v) const700 void CtxItemDecl::accept(parsenode_visitor& v) const
701 {
702 BEGIN_VISITOR();
703 ACCEPT(theType);
704 ACCEPT(theInitExpr);
705 END_VISITOR();
706 }
707
708
709 /*******************************************************************************
710 Global declarations:
711 --------------------
712
713 AnnotatedDecl ::= "declare" Annotation* (VarDecl | FunctionDecl)
714
715 Annotation ::= "%" EQName ("(" Literal ("," Literal)* ")")?
716
717 VarDecl ::= variable" "$" VarName TypeDeclaration?
718 ((":=" VarValue) | ("external" (":=" VarDefaultValue)?))
719
720 VarValue ::= ExprSingle
721
722 VarDefaultValue ::= ExprSingle
723 ********************************************************************************/
GlobalVarDecl(const QueryLoc & loc,QName * varname,SequenceType * type_decl,exprnode * init_expr,AnnotationListParsenode * annotations,bool external)724 GlobalVarDecl::GlobalVarDecl(
725 const QueryLoc& loc,
726 QName* varname,
727 SequenceType* type_decl,
728 exprnode* init_expr,
729 AnnotationListParsenode* annotations,
730 bool external)
731 :
732 VarDeclWithInit(loc, varname, type_decl, init_expr),
733 theIsExternal(external),
734 theAnnotations(annotations)
735 {
736 }
737
738
accept(parsenode_visitor & v) const739 void GlobalVarDecl::accept(parsenode_visitor& v) const
740 {
741 BEGIN_VISITOR();
742 ACCEPT(theType);
743 ACCEPT(theExpr);
744 END_VISITOR();
745 }
746
747
748 /*******************************************************************************
749
750 ********************************************************************************/
FunctionDecl(const QueryLoc & loc,QName * name,ParamList * params,SequenceType * retType,exprnode * body,bool updating,bool external)751 FunctionDecl::FunctionDecl(
752 const QueryLoc& loc,
753 QName* name,
754 ParamList* params,
755 SequenceType* retType,
756 exprnode* body,
757 bool updating,
758 bool external)
759 :
760 XQDocumentable(loc),
761 theName(name),
762 theParams(params),
763 theReturnType(retType),
764 theBody(body),
765 theIsExternal(external),
766 theUpdating(updating)
767 {
768 }
769
770
accept(parsenode_visitor & v) const771 void FunctionDecl::accept(parsenode_visitor& v) const
772 {
773 BEGIN_VISITOR();
774 ACCEPT(theParams);
775 ACCEPT(theReturnType);
776 ACCEPT(theBody);
777 END_VISITOR();
778 }
779
780
get_param_count() const781 csize FunctionDecl::get_param_count() const
782 {
783 return theParams == NULL ? 0 : theParams->size();
784 }
785
786
set_annotations(AnnotationListParsenode * annotations)787 void FunctionDecl::set_annotations(AnnotationListParsenode* annotations)
788 {
789 theAnnotations = annotations;
790 }
791
792 /*******************************************************************************
793 [34] ParamList ::= Param ("," Param)*
794 ********************************************************************************/
ParamList(const QueryLoc & loc)795 ParamList::ParamList(const QueryLoc& loc)
796 :
797 parsenode(loc)
798 {
799 }
800
801
accept(parsenode_visitor & v) const802 void ParamList::accept(parsenode_visitor& v) const
803 {
804 BEGIN_VISITOR();
805
806 for (std::vector<rchandle<Param> >::const_iterator it = param_hv.begin();
807 it != param_hv.end();
808 ++it)
809 {
810 const parsenode *e_p = &**it;
811 ACCEPT_CHK (e_p);
812 }
813 END_VISITOR();
814 }
815
816
817 /*******************************************************************************
818 [35] Param ::= "$" QName TypeDeclaration?
819 ********************************************************************************/
Param(const QueryLoc & loc,rchandle<QName> name,rchandle<SequenceType> type)820 Param::Param(
821 const QueryLoc& loc,
822 rchandle<QName> name,
823 rchandle<SequenceType> type)
824 :
825 parsenode(loc),
826 theName(name),
827 theType(type)
828 {
829 }
830
831
accept(parsenode_visitor & v) const832 void Param::accept(parsenode_visitor& v) const
833 {
834 BEGIN_VISITOR();
835 ACCEPT(theType);
836 END_VISITOR();
837 }
838
839 /*******************************************************************************
840 AnnotationList ::= Annotation*
841 ********************************************************************************/
AnnotationListParsenode(const QueryLoc & loc,AnnotationParsenode * annotation)842 AnnotationListParsenode::AnnotationListParsenode(
843 const QueryLoc& loc,
844 AnnotationParsenode* annotation)
845 :
846 parsenode(loc)
847 {
848 push_back(annotation);
849 }
850
push_back(AnnotationParsenode * annotation)851 void AnnotationListParsenode::push_back(AnnotationParsenode* annotation)
852 {
853 theAnnotations.push_back(annotation);
854 }
855
accept(parsenode_visitor & v) const856 void AnnotationListParsenode::accept(parsenode_visitor& v) const
857 {
858 BEGIN_VISITOR();
859 ACCEPT_SEQ(std::vector<rchandle<AnnotationParsenode> >, theAnnotations);
860 END_VISITOR();
861 }
862
863
864 /*******************************************************************************
865 Annotation ::= "%" EQName ("(" Literal ("," Literal)* ")")?
866 ********************************************************************************/
AnnotationParsenode(const QueryLoc & loc,QName * qname,AnnotationLiteralListParsenode * literal_list)867 AnnotationParsenode::AnnotationParsenode(
868 const QueryLoc& loc,
869 QName* qname,
870 AnnotationLiteralListParsenode* literal_list)
871 :
872 parsenode(loc),
873 theQName(qname),
874 theLiteralsList(literal_list)
875 {
876 }
877
accept(parsenode_visitor & v) const878 void AnnotationParsenode::accept(parsenode_visitor& v) const
879 {
880 BEGIN_VISITOR();
881 ACCEPT(theLiteralsList);
882 END_VISITOR();
883 }
884
885
AnnotationLiteralListParsenode(const QueryLoc & loc,exprnode * literal)886 AnnotationLiteralListParsenode::AnnotationLiteralListParsenode(
887 const QueryLoc& loc,
888 exprnode* literal)
889 :
890 parsenode(loc)
891 {
892 push_back(literal);
893 }
894
895
accept(parsenode_visitor & v) const896 void AnnotationLiteralListParsenode::accept(parsenode_visitor& v) const
897 {
898 BEGIN_VISITOR();
899 ACCEPT_SEQ(std::vector<rchandle<exprnode> >, theLiterals);
900 END_VISITOR();
901 }
902
903
904 /*******************************************************************************
905 [*] CollectionDecl ::= "declare" %annotations "collection" QName
906 ("as" CollectionTypeDecl)?
907
908 [*] CollectionTypeDecl ::= KindTest OccurenceIndicator?
909 ********************************************************************************/
CollectionDecl(const QueryLoc & aLoc,QName * aName,rchandle<AnnotationListParsenode> aAnnotations,SequenceType * aTypeDecl)910 CollectionDecl::CollectionDecl(
911 const QueryLoc& aLoc,
912 QName* aName,
913 rchandle<AnnotationListParsenode> aAnnotations,
914 SequenceType* aTypeDecl)
915 :
916 XQDocumentable(aLoc),
917 theName(aName),
918 theTypeDecl(aTypeDecl),
919 theAnnotations(aAnnotations)
920 {
921 }
922
accept(parsenode_visitor & v) const923 void CollectionDecl::accept( parsenode_visitor &v ) const
924 {
925 BEGIN_VISITOR();
926 ACCEPT(theTypeDecl);
927 END_VISITOR();
928 }
929
930
931 /***************************************************************************//**
932 IndexDecl ::= "declare" IndexPropertyList "index" QName
933 "on" "nodes" IndexDomainExpr "by" IndexKeyList
934
935 IndexPropertyList := ("unique" | "non" "unique" |
936 "value" "range" | "value" "equality" |
937 "automatically" "maintained" | "manually" "maintained")*
938
939 IndexDomainExpr := PathExpr
940
941 IndexKeyList := IndexKeySpec+
942
943 IndexKeySpec := PathExpr AtomicType IndexKeyOrderModifier
944
945 AtomicType := QName
946
947 IndexKeyOrderModifier := ("ascending" | "descending")? ("collation" UriLiteral)?
948 ********************************************************************************/
AST_IndexDecl(const QueryLoc & loc,QName * name,exprnode * domainExpr,IndexKeyList * key,rchandle<AnnotationListParsenode> aAnnotations)949 AST_IndexDecl::AST_IndexDecl(
950 const QueryLoc& loc,
951 QName* name,
952 exprnode* domainExpr,
953 IndexKeyList* key,
954 rchandle<AnnotationListParsenode> aAnnotations)
955 :
956 XQDocumentable(loc),
957 theName(name),
958 theDomainExpr(domainExpr),
959 theKey(key),
960 theAnnotations(aAnnotations)
961 {
962 #if 0
963 // Note: the DeclPropertyList has bee validated already by the parser
964
965 if (properties == NULL)
966 return;
967
968 ulong numProperties = (ulong)properties->size();
969 for (ulong i = 0; i < numProperties; ++i)
970 {
971 const DeclProperty* property = properties->getProperty(i);
972 StaticContextConsts::declaration_property_t prop = property->getProperty();
973
974 switch (prop)
975 {
976 case StaticContextConsts::decl_unique:
977 case StaticContextConsts::decl_non_unique:
978 theIsUnique = (prop == StaticContextConsts::decl_unique);
979 break;
980
981 case StaticContextConsts::decl_value_equality:
982 case StaticContextConsts::decl_value_range:
983 theIsOrdered = (prop == StaticContextConsts::decl_value_range);
984 break;
985
986 case StaticContextConsts::decl_general_equality:
987 case StaticContextConsts::decl_general_range:
988 theIsGeneral = true;
989 theIsOrdered = (prop == StaticContextConsts::decl_general_range);
990 break;
991
992 case StaticContextConsts::decl_manual:
993 case StaticContextConsts::decl_automatic:
994 theIsAutomatic = (prop == StaticContextConsts::decl_automatic);
995 break;
996
997 default: /* do nothing */ ;
998 } // switch
999 } // for
1000 #endif
1001 }
1002
1003
1004 #if 0
1005 Error const& AST_IndexDecl::validatePropertyList(DeclPropertyList* props)
1006 {
1007 if (props == NULL)
1008 return zerr::ZXQP0000_NO_ERROR;
1009
1010 bool setUnique = false;
1011 bool setUsage = false;
1012 bool setMaintenance = false;
1013
1014 for (ulong i = 0; i < props->size(); ++i)
1015 {
1016 switch (props->getProperty(i)->getProperty())
1017 {
1018 case StaticContextConsts::decl_unique:
1019 case StaticContextConsts::decl_non_unique:
1020 {
1021 if (setUnique)
1022 return zerr::ZDST0024_INDEX_MULTIPLE_PROPERTY_VALUES;
1023
1024 setUnique = true;
1025 break;
1026 }
1027 case StaticContextConsts::decl_value_equality:
1028 case StaticContextConsts::decl_value_range:
1029 case StaticContextConsts::decl_general_equality:
1030 case StaticContextConsts::decl_general_range:
1031 {
1032 if (setUsage)
1033 return zerr::ZDST0024_INDEX_MULTIPLE_PROPERTY_VALUES;
1034
1035 setUsage = true;
1036 break;
1037 }
1038 case StaticContextConsts::decl_manual:
1039 case StaticContextConsts::decl_automatic:
1040 {
1041 if (setMaintenance)
1042 return zerr::ZDST0024_INDEX_MULTIPLE_PROPERTY_VALUES;
1043
1044 setMaintenance = true;
1045 break;
1046 }
1047 default:
1048 return zerr::ZDST0026_INDEX_INVALID_PROPERTY_VALUE;
1049 }
1050 }
1051
1052 return zerr::ZXQP0000_NO_ERROR;
1053 }
1054 #endif
1055
accept(parsenode_visitor & v) const1056 void AST_IndexDecl::accept( parsenode_visitor &v ) const
1057 {
1058 BEGIN_VISITOR();
1059
1060 ACCEPT(theDomainExpr);
1061 ACCEPT(theKey);
1062
1063 END_VISITOR();
1064 }
1065
1066
1067 /***************************************************************************//**
1068 IndexKeyList ::= IndexKeySpec ("," IndexKeySpec)*
1069 ********************************************************************************/
accept(parsenode_visitor & v) const1070 void IndexKeyList::accept( parsenode_visitor &v ) const
1071 {
1072 BEGIN_VISITOR();
1073
1074 for (std::vector<rchandle<IndexKeySpec> >::const_iterator i = theKeySpecs.begin();
1075 i != theKeySpecs.end();
1076 ++i)
1077 {
1078 ACCEPT(*i);
1079 }
1080
1081 END_VISITOR();
1082 }
1083
1084
1085 /***************************************************************************//**
1086 IndexKeySpec ::= PathExpr "as" AtomicType IndexKeyOrderModifier
1087
1088 IndexKeyOrderModifier ::= OrderDirSpec? OrderCollationSpec?
1089
1090 OrderDirSpec ::= "ascending" | "descending"
1091
1092 OrderCollationSpec ::= "collation" URILiteral
1093 ********************************************************************************/
accept(parsenode_visitor & v) const1094 void IndexKeySpec::accept( parsenode_visitor &v ) const
1095 {
1096 BEGIN_VISITOR();
1097
1098 ACCEPT(theExpr);
1099 ACCEPT(theType);
1100
1101 END_VISITOR();
1102 }
1103
1104
1105 /*******************************************************************************
1106 IntegrityConstraintDecl ::= "declare" "integrity" "constraint"
1107 QName ICType
1108 ICType ::= ICCollSimpleCheck | ICCollUniqueKey | ICCollForeachNode |
1109 ICNodeOfType | ICForeighKey
1110 ICCollSimpleCheck ::= "on" "collection" QName "$" QName "check" ExprSimple
1111 ICCollUniqueKey ::= "on" "collection" QNAME "$" QName "check" "unique"
1112 "key" "(" Expr ")"
1113 ICCollForeachNode ::= "on" "collection" QNAME "foreach" "node" "$" QName
1114 "check" ExprSingle
1115 ICNodeOfType ::= "on" "node" QName "of""type" KindTest "check" ExprSingle
1116 ICForeighKey ::= "on" "foreign" "key"
1117 "from" "collection" QName "node" "$" QName "keys"
1118 "(" Expr ")"
1119 "to" "collection" QName "node" "$" QName "keys"
1120 "(" Expr ")"
1121 *******************************************************************************/
IntegrityConstraintDecl(const QueryLoc & loc,QName * name,ICKind icKind)1122 IntegrityConstraintDecl::IntegrityConstraintDecl (
1123 const QueryLoc& loc,
1124 QName* name,
1125 ICKind icKind)
1126 :
1127 parsenode(loc),
1128 theICName(name),
1129 theICKind(icKind)
1130 {
1131 }
1132
1133 /*void IntegrityConstraintDecl::accept( parsenode_visitor &v ) const
1134 {
1135 BEGIN_VISITOR();
1136 END_VISITOR();
1137 }*/
1138
accept(parsenode_visitor & v) const1139 void ICCollSimpleCheck::accept( parsenode_visitor &v ) const
1140 {
1141 BEGIN_VISITOR();
1142 ACCEPT_CHK(getExpr());
1143 END_VISITOR();
1144 }
1145
accept(parsenode_visitor & v) const1146 void ICCollUniqueKeyCheck::accept( parsenode_visitor &v ) const
1147 {
1148 BEGIN_VISITOR();
1149 ACCEPT_CHK(getExpr());
1150 END_VISITOR();
1151 }
1152
accept(parsenode_visitor & v) const1153 void ICCollForeachNode::accept( parsenode_visitor &v ) const
1154 {
1155 BEGIN_VISITOR();
1156 ACCEPT_CHK(getExpr());
1157 END_VISITOR();
1158 }
1159
accept(parsenode_visitor & v) const1160 void ICForeignKey::accept( parsenode_visitor &v ) const
1161 {
1162 BEGIN_VISITOR();
1163 ACCEPT_CHK(getFromExpr());
1164 ACCEPT_CHK(getToExpr());
1165 END_VISITOR();
1166 }
1167
1168
1169 /*******************************************************************************
1170
1171 ********************************************************************************/
QueryBody(const QueryLoc & loc,exprnode * expr)1172 QueryBody::QueryBody(const QueryLoc& loc, exprnode* expr)
1173 :
1174 exprnode(loc),
1175 theExpr(expr)
1176 {
1177 }
1178
1179
accept(parsenode_visitor & v) const1180 void QueryBody::accept(parsenode_visitor& v) const
1181 {
1182 BEGIN_VISITOR();
1183 ACCEPT(theExpr);
1184 END_VISITOR();
1185 }
1186
1187
1188 /*******************************************************************************
1189
1190 ********************************************************************************/
accept(parsenode_visitor & v) const1191 void BlockBody::accept(parsenode_visitor& v) const
1192 {
1193 BEGIN_VISITOR();
1194
1195 for (ulong i = 0; i < size(); ++i)
1196 (*this)[i]->accept(v);
1197
1198 END_VISITOR();
1199 }
1200
1201
add(parsenode * statement)1202 void BlockBody::add(parsenode* statement)
1203 {
1204 if (dynamic_cast<VarDeclStmt*>(statement) != NULL)
1205 {
1206 VarDeclStmt* vdecl = static_cast<VarDeclStmt*>(statement);
1207
1208 csize numDecls = vdecl->size();
1209
1210 for (csize i = 0; i < numDecls; ++i)
1211 {
1212 theStatements.push_back(vdecl->getDecl(i));
1213 }
1214
1215 delete vdecl;
1216 }
1217 else
1218 {
1219 theStatements.push_back(statement);
1220 }
1221 }
1222
1223
1224 /*******************************************************************************
1225
1226 ********************************************************************************/
VarDeclStmt(const QueryLoc & loc,AnnotationListParsenode * annotations)1227 VarDeclStmt::VarDeclStmt(const QueryLoc& loc, AnnotationListParsenode* annotations)
1228 :
1229 exprnode(loc),
1230 theAnnotations(annotations)
1231 {
1232 }
1233
1234
add(parsenode * decl)1235 void VarDeclStmt::add(parsenode* decl)
1236 {
1237 LocalVarDecl* varDecl = dynamic_cast<LocalVarDecl*>(decl);
1238 if (varDecl != NULL)
1239 {
1240 varDecl->set_annotations(theAnnotations);
1241 }
1242
1243 theDecls.push_back(decl);
1244 }
1245
1246
accept(parsenode_visitor & v) const1247 void VarDeclStmt::accept(parsenode_visitor& v) const
1248 {
1249 assert(false);
1250 }
1251
1252
1253 /*******************************************************************************
1254 Local declarations:
1255 -------------------
1256
1257 VarDeclStatement ::= ("local" Annotation*)? "variable"
1258 "$" VarName TypeDeclaration? (":=" ExprSingle)?
1259 ("," "$" VarName TypeDeclaration? (":=" ExprSingle)?)* ";"
1260 ********************************************************************************/
LocalVarDecl(const QueryLoc & loc,QName * varname,SequenceType * type_decl,exprnode * init_expr,AnnotationListParsenode * annotations)1261 LocalVarDecl::LocalVarDecl(
1262 const QueryLoc& loc,
1263 QName* varname,
1264 SequenceType* type_decl,
1265 exprnode* init_expr,
1266 AnnotationListParsenode* annotations)
1267 :
1268 VarDeclWithInit(loc, varname, type_decl, init_expr),
1269 theAnnotations(annotations)
1270 {
1271 }
1272
1273
accept(parsenode_visitor & v) const1274 void LocalVarDecl::accept(parsenode_visitor& v) const
1275 {
1276 BEGIN_VISITOR();
1277 ACCEPT(theAnnotations);
1278 ACCEPT(theType);
1279 ACCEPT(theExpr);
1280 END_VISITOR();
1281 }
1282
1283
1284 /*******************************************************************************
1285
1286 ********************************************************************************/
accept(parsenode_visitor & v) const1287 void AssignExpr::accept(parsenode_visitor& v) const
1288 {
1289 BEGIN_VISITOR();
1290 ACCEPT(theValue);
1291 END_VISITOR();
1292 }
1293
1294
1295 /*******************************************************************************
1296
1297 ********************************************************************************/
accept(parsenode_visitor & v) const1298 void ApplyExpr::accept(parsenode_visitor& v) const
1299 {
1300 BEGIN_VISITOR();
1301
1302 ACCEPT(theExpr);
1303
1304 END_VISITOR();
1305 }
1306
1307
1308 /*******************************************************************************
1309
1310 ********************************************************************************/
accept(parsenode_visitor & v) const1311 void ExitExpr::accept(parsenode_visitor& v) const
1312 {
1313 BEGIN_VISITOR();
1314 ACCEPT(theValue);
1315 END_VISITOR();
1316 }
1317
1318
1319 /*******************************************************************************
1320
1321 ********************************************************************************/
accept(parsenode_visitor & v) const1322 void WhileExpr::accept(parsenode_visitor& v) const
1323 {
1324 BEGIN_VISITOR();
1325 ACCEPT (cond);
1326 ACCEPT (body);
1327 END_VISITOR();
1328 }
1329
1330
1331 /*******************************************************************************
1332
1333 ********************************************************************************/
accept(parsenode_visitor & v) const1334 void FlowCtlStatement::accept(parsenode_visitor& v) const
1335 {
1336 BEGIN_VISITOR();
1337 END_VISITOR();
1338 }
1339
1340
1341 /*******************************************************************************
1342 Expr ::= ExprSingle | Expr COMMA ExprSingle
1343 ********************************************************************************/
Expr(const QueryLoc & loc)1344 Expr::Expr(const QueryLoc& loc)
1345 :
1346 exprnode(loc)
1347 {
1348 }
1349
1350
accept(parsenode_visitor & v) const1351 void Expr::accept( parsenode_visitor &v ) const
1352 {
1353 BEGIN_VISITOR();
1354
1355 std::vector<rchandle<exprnode> >::const_reverse_iterator it = expr_hv.rbegin();
1356 for (; it != expr_hv.rend(); ++it)
1357 {
1358 const exprnode* e_p = &**it;
1359 ACCEPT_CHK(e_p);
1360 }
1361
1362 END_VISITOR();
1363 }
1364
1365
numberOfChildren() const1366 int Expr::numberOfChildren() const
1367 {
1368 return (int)expr_hv.size();
1369 }
1370
1371
FLWORExpr(const QueryLoc & loc_,rchandle<FLWORClauseList> clauses_,rchandle<exprnode> ret_,const QueryLoc & return_loc_,bool force_general)1372 FLWORExpr::FLWORExpr(
1373 const QueryLoc& loc_,
1374 rchandle<FLWORClauseList> clauses_,
1375 rchandle<exprnode> ret_,
1376 const QueryLoc& return_loc_,
1377 bool force_general)
1378 :
1379 exprnode (loc_),
1380 clauses (clauses_),
1381 return_val_h (ret_),
1382 return_location(return_loc_)
1383 {
1384 for (unsigned i = 0; i < clauses->size (); i++)
1385 {
1386 {
1387 GroupByClause *c = dynamic_cast<GroupByClause *> ((*clauses) [i].getp ());
1388 if (c != NULL)
1389 c->set_flwor (this);
1390 }
1391 {
1392 OrderByClause *c = dynamic_cast<OrderByClause *> ((*clauses) [i].getp ());
1393 if (c != NULL)
1394 c->set_flwor (this);
1395 }
1396 }
1397
1398 compute_general ();
1399
1400 if (force_general)
1401 general = true;
1402 }
1403
1404
accept(parsenode_visitor & v) const1405 void FLWORExpr::accept( parsenode_visitor &v ) const
1406 {
1407 BEGIN_VISITOR();
1408 ACCEPT (clauses);
1409 ACCEPT (return_val_h);
1410 END_VISITOR();
1411 }
1412
1413
get_flwor_clause(const FLWORExpr & f,T ** p)1414 template<class T> void get_flwor_clause (const FLWORExpr &f, T **p)
1415 {
1416 *p = NULL;
1417 rchandle<FLWORClauseList> clauses = f.get_clause_list ();
1418 for (unsigned i = 0; i < clauses->size (); i++)
1419 {
1420 FLWORClause* cp = (*clauses) [i].getp ();
1421 *p = dynamic_cast<T *> (cp);
1422 if (*p != NULL)
1423 return;
1424 }
1425 }
1426
1427 #define DEF_FLWOR_GETTER( T, name ) \
1428 T *FLWORExpr::get_##name () const { \
1429 T *p; \
1430 get_flwor_clause (*this, &p); \
1431 return p; \
1432 }
1433
DEF_FLWOR_GETTER(GroupByClause,groupby)1434 DEF_FLWOR_GETTER (GroupByClause, groupby)
1435 DEF_FLWOR_GETTER (OrderByClause, orderby)
1436 DEF_FLWOR_GETTER (WhereClause, where)
1437
1438
1439
1440 //#define ZORBA_FORCE_GFLWOR
1441
1442
1443 void FLWORExpr::compute_general ()
1444 {
1445 general = non_10 = false;
1446 #ifdef ZORBA_FORCE_GFLWOR
1447 general = true;
1448 #endif
1449
1450 bool has_where = false, has_order = false, has_group = false;
1451
1452 for (unsigned i = 0; i < clauses->size(); i++)
1453 {
1454 const FLWORClause* cp = (*clauses)[i].getp();
1455
1456 if (typeid (*cp) == typeid (ForClause))
1457 {
1458 // any preceding non-initial clause triggers GFLWOR
1459 if (has_group || has_where || has_order)
1460 non_10 = general = true;
1461
1462 const ForClause* fc = static_cast<const ForClause*>(cp);
1463 for (int j=0; j<fc->get_decl_count(); j++)
1464 {
1465 if (fc->get_vardecl_list()->operator[](j)->get_allowing_empty())
1466 non_10 = general = true;
1467 }
1468 }
1469 else if (typeid (*cp) == typeid (LetClause))
1470 {
1471 // any preceding non-initial clause triggers GFLWOR
1472 if (has_group || has_where || has_order)
1473 non_10 = general = true;
1474 }
1475 else if (typeid (*cp) == typeid (WindowClause))
1476 {
1477 non_10 = general =true;
1478 }
1479 else if (typeid (*cp) == typeid (WhereClause))
1480 {
1481 if (has_where || has_group || has_order) non_10 = general = true;
1482 has_where = true;
1483 }
1484 else if (typeid (*cp) == typeid (OrderByClause))
1485 {
1486 if (has_order) non_10 = general = true;
1487 has_order = true;
1488 }
1489 else if (typeid (*cp) == typeid (GroupByClause))
1490 {
1491 if (has_group || has_order) non_10 = general = true;
1492 has_group = true;
1493 }
1494 else if (typeid (*cp) == typeid (CountClause))
1495 {
1496 non_10 = general = true;
1497 }
1498 }
1499 }
1500
1501
1502 /*******************************************************************************
1503 WindowClause ::= "for" (TumblingWindowClause | SlidingWindowClause)
1504
1505 TumblingWindowClause ::= "tumbling" "window" WindowVarDecl
1506 WindowStartCondition WindowEndCondition?
1507
1508 SlidingWindowClause ::= "sliding" "window" WindowVarDecl
1509 WindowStartCondition WindowEndCondition
1510 ********************************************************************************/
accept(parsenode_visitor & v) const1511 void WindowClause::accept( parsenode_visitor &v ) const
1512 {
1513 BEGIN_VISITOR();
1514
1515 ACCEPT(var->get_binding_expr());
1516
1517 v.intermediate_visit(*this, visitor_state);
1518
1519 for (int i = 0; i < 2; i++)
1520 ACCEPT(conditions [i]);
1521
1522 ACCEPT(var);
1523
1524 END_VISITOR();
1525 }
1526
1527
1528 /*******************************************************************************
1529 WindowVarDecl ::= "$" VarName TypeDeclaration? "in" ExprSingle
1530 ********************************************************************************/
accept(parsenode_visitor & v) const1531 void WindowVarDecl::accept( parsenode_visitor &v ) const
1532 {
1533 BEGIN_VISITOR();
1534 ACCEPT(theType);
1535 // The domain expr has been translated already.
1536 END_VISITOR();
1537 }
1538
1539
1540 /*******************************************************************************
1541 WindowStartCondition ::= "start" WindowVars "when" ExprSingle
1542
1543 WindowEndCondition ::= "only"? "end" WindowVars "when" ExprSingle
1544 ********************************************************************************/
accept(parsenode_visitor & v) const1545 void FLWORWinCond::accept( parsenode_visitor &v ) const
1546 {
1547 BEGIN_VISITOR();
1548 ACCEPT(get_winvars());
1549 ACCEPT(get_val());
1550 END_VISITOR();
1551 }
1552
1553
1554 /*******************************************************************************
1555 WindowVars ::= ("$" CurrentItem)? PositionalVar?
1556 ("previous" "$" PreviousItem)?
1557 ("next" "$" NextItem)?
1558 ********************************************************************************/
accept(parsenode_visitor & v) const1559 void WindowVars::accept( parsenode_visitor &v ) const
1560 {
1561 BEGIN_VISITOR();
1562 ACCEPT(posvar);
1563 END_VISITOR();
1564 }
1565
1566
1567
FLWORClauseList(const QueryLoc & loc)1568 FLWORClauseList::FLWORClauseList(const QueryLoc& loc)
1569 :
1570 parsenode(loc)
1571 {
1572 }
1573
1574
accept(parsenode_visitor & v) const1575 void FLWORClauseList::accept( parsenode_visitor &v ) const
1576 {
1577 BEGIN_VISITOR();
1578 std::vector<rchandle<FLWORClause> >::const_iterator it = theClauses.begin();
1579 for (; it != theClauses.end(); ++it)
1580 {
1581 const parsenode *e_p = &**it;
1582 ACCEPT_CHK (e_p);
1583 }
1584 END_VISITOR();
1585 }
1586
1587
1588
1589 // [34] ForClause
1590 // --------------
ForClause(const QueryLoc & loc_,rchandle<VarInDeclList> _vardecl_list_h)1591 ForClause::ForClause(
1592 const QueryLoc& loc_,
1593 rchandle<VarInDeclList> _vardecl_list_h)
1594 :
1595 ForOrLetClause(loc_),
1596 vardecl_list_h(_vardecl_list_h),
1597 allowing_empty(false)
1598 {
1599 for (unsigned int j=0; j<_vardecl_list_h->size(); j++)
1600 {
1601 if (_vardecl_list_h->operator[](j)->get_allowing_empty())
1602 allowing_empty = true;
1603 }
1604 }
1605
1606
1607 //-ForClause::
1608
accept(parsenode_visitor & v) const1609 void ForClause::accept( parsenode_visitor &v ) const
1610 {
1611 BEGIN_VISITOR();
1612 ACCEPT (vardecl_list_h);
1613 END_VISITOR();
1614 }
1615
get_decl_count() const1616 int ForClause::get_decl_count () const { return (int)vardecl_list_h->size (); }
1617
1618
1619 // [34a] VarInDeclList
1620 // -------------------
VarInDeclList(const QueryLoc & loc_)1621 VarInDeclList::VarInDeclList(
1622 const QueryLoc& loc_)
1623 :
1624 parsenode(loc_)
1625 {}
1626
1627
1628 //-VarInDeclList::
1629
accept(parsenode_visitor & v) const1630 void VarInDeclList::accept( parsenode_visitor &v ) const
1631 {
1632 BEGIN_VISITOR();
1633 std::vector<rchandle<VarInDecl> >::const_iterator it = vardecl_hv.begin();
1634 for (; it!=vardecl_hv.end(); ++it) {
1635 const parsenode *e_p = &**it;
1636 ACCEPT_CHK (e_p);
1637 }
1638 END_VISITOR();
1639 }
1640
1641
1642 // [34b] VarInDecl
1643 // ---------------
VarInDecl(const QueryLoc & loc,rchandle<QName> varname,rchandle<SequenceType> typedecl_h,rchandle<PositionalVar> _posvar_h,rchandle<FTScoreVar> _ftscorevar_h,rchandle<exprnode> valexpr_h,bool _allowing_empty)1644 VarInDecl::VarInDecl(
1645 const QueryLoc& loc,
1646 rchandle<QName> varname,
1647 rchandle<SequenceType> typedecl_h,
1648 rchandle<PositionalVar> _posvar_h,
1649 rchandle<FTScoreVar> _ftscorevar_h,
1650 rchandle<exprnode> valexpr_h,
1651 bool _allowing_empty)
1652 :
1653 VarDeclWithInit (loc, varname, typedecl_h, valexpr_h),
1654 posvar_h(_posvar_h),
1655 ftscorevar_h(_ftscorevar_h),
1656 allowing_empty(_allowing_empty)
1657 {
1658 }
1659
1660
accept(parsenode_visitor & v) const1661 void VarInDecl::accept( parsenode_visitor &v ) const
1662 {
1663 BEGIN_VISITOR();
1664 ACCEPT(theType);
1665 ACCEPT(posvar_h);
1666 ACCEPT(ftscorevar_h);
1667 ACCEPT(get_binding_expr());
1668 END_VISITOR();
1669 }
1670
1671
1672 // [35] PositionalVar
1673 // ------------------
PositionalVar(const QueryLoc & loc,rchandle<QName> varname)1674 PositionalVar::PositionalVar(
1675 const QueryLoc& loc,
1676 rchandle<QName> varname)
1677 :
1678 parsenode(loc),
1679 theName(varname)
1680 {
1681 }
1682
1683
accept(parsenode_visitor & v) const1684 void PositionalVar::accept( parsenode_visitor &v ) const
1685 {
1686 BEGIN_VISITOR();
1687 END_VISITOR();
1688 }
1689
1690
1691 // [36] LetClause
1692 // --------------
LetClause(const QueryLoc & loc_,rchandle<VarGetsDeclList> _vardecl_list_h)1693 LetClause::LetClause(
1694 const QueryLoc& loc_,
1695 rchandle<VarGetsDeclList> _vardecl_list_h)
1696 :
1697 ForOrLetClause(loc_),
1698 vardecl_list_h(_vardecl_list_h)
1699 {}
1700
1701
accept(parsenode_visitor & v) const1702 void LetClause::accept( parsenode_visitor &v ) const
1703 {
1704 BEGIN_VISITOR();
1705 ACCEPT (vardecl_list_h);
1706 END_VISITOR();
1707 }
1708
get_decl_count() const1709 int LetClause::get_decl_count () const { return (int)vardecl_list_h->size (); }
1710
1711
1712 // [36a] VarGetsDeclList
1713 // ---------------------
VarGetsDeclList(const QueryLoc & loc_)1714 VarGetsDeclList::VarGetsDeclList(
1715 const QueryLoc& loc_)
1716 :
1717 parsenode(loc_)
1718 {}
1719
1720
accept(parsenode_visitor & v) const1721 void VarGetsDeclList::accept( parsenode_visitor &v ) const
1722 {
1723 BEGIN_VISITOR();
1724 std::vector<rchandle<VarGetsDecl> >::const_iterator it = vardecl_hv.begin();
1725 for (; it!=vardecl_hv.end(); ++it)
1726 {
1727 const parsenode *e_p = &**it;
1728 ACCEPT_CHK (e_p);
1729 }
1730 END_VISITOR();
1731 }
1732
1733
1734 // [36b] VarGetsDecl
1735 // ------------------
1736
accept(parsenode_visitor & v) const1737 void VarGetsDecl::accept( parsenode_visitor &v ) const
1738 {
1739 BEGIN_VISITOR();
1740 ACCEPT(theType);
1741 ACCEPT(ftscorevar_h);
1742 ACCEPT(get_binding_expr());
1743 END_VISITOR();
1744 }
1745
1746
FTScoreVar(QueryLoc const & loc,rchandle<QName> _var_name_h)1747 FTScoreVar::FTScoreVar(
1748 QueryLoc const &loc,
1749 rchandle<QName> _var_name_h)
1750 :
1751 parsenode( loc ),
1752 var_name_h(_var_name_h)
1753 {
1754 }
1755
1756
accept(parsenode_visitor & v) const1757 void FTScoreVar::accept( parsenode_visitor &v ) const
1758 {
1759 BEGIN_VISITOR();
1760 END_VISITOR();
1761 }
1762
1763
1764 // [37] WhereClause
1765 // ----------------
WhereClause(const QueryLoc & loc_,rchandle<exprnode> _predicate_h)1766 WhereClause::WhereClause(
1767 const QueryLoc& loc_,
1768 rchandle<exprnode> _predicate_h)
1769 :
1770 FLWORClause(loc_),
1771 predicate_h(_predicate_h)
1772 {}
1773
1774
accept(parsenode_visitor & v) const1775 void WhereClause::accept( parsenode_visitor &v ) const
1776 {
1777 BEGIN_VISITOR();
1778 ACCEPT (predicate_h);
1779 END_VISITOR();
1780 }
1781
1782
accept(parsenode_visitor & v) const1783 void CountClause::accept(parsenode_visitor& v) const
1784 {
1785 BEGIN_VISITOR();
1786 END_VISITOR();
1787 }
1788
1789
GroupByClause(const QueryLoc & loc,rchandle<GroupSpecList> _spec_list_h)1790 GroupByClause::GroupByClause(
1791 const QueryLoc& loc,
1792 rchandle<GroupSpecList> _spec_list_h)
1793 :
1794 FLWORClause(loc),
1795 spec_list_h(_spec_list_h)
1796 {
1797 }
1798
1799
accept(parsenode_visitor & v) const1800 void GroupByClause::accept(parsenode_visitor& v) const
1801 {
1802 BEGIN_VISITOR();
1803 ACCEPT(spec_list_h);
1804 END_VISITOR();
1805 }
1806
1807
GroupSpecList(const QueryLoc & loc)1808 GroupSpecList::GroupSpecList(const QueryLoc& loc)
1809 :
1810 parsenode(loc)
1811 {
1812 }
1813
1814
push_back(rchandle<GroupSpec> spec)1815 void GroupSpecList::push_back(rchandle<GroupSpec> spec)
1816 {
1817 theSpecs.push_back(spec);
1818 }
1819
1820
accept(parsenode_visitor & v) const1821 void GroupSpecList::accept(parsenode_visitor& v) const
1822 {
1823 BEGIN_VISITOR();
1824
1825 std::vector<rchandle<GroupSpec> >::const_iterator it = theSpecs.begin();
1826 for (; it != theSpecs.end(); ++it)
1827 {
1828 const GroupSpec* e_p = &**it;
1829 ACCEPT_CHK (e_p);
1830 }
1831
1832 END_VISITOR();
1833 }
1834
1835
GroupSpec(const QueryLoc & loc,rchandle<QName> name,rchandle<SequenceType> type,rchandle<exprnode> expr,rchandle<GroupCollationSpec> collation)1836 GroupSpec::GroupSpec(
1837 const QueryLoc& loc,
1838 rchandle<QName> name,
1839 rchandle<SequenceType> type,
1840 rchandle<exprnode> expr,
1841 rchandle<GroupCollationSpec> collation)
1842 :
1843 VarDeclWithInit(loc, name, type, expr),
1844 theCollationSpec(collation)
1845 {
1846 }
1847
1848
accept(parsenode_visitor & v) const1849 void GroupSpec::accept(parsenode_visitor& v) const
1850 {
1851 BEGIN_VISITOR();
1852 ACCEPT(theType);
1853 ACCEPT(theCollationSpec);
1854 ACCEPT(theExpr);
1855 END_VISITOR();
1856 }
1857
1858
GroupCollationSpec(const QueryLoc & loc,const zstring & uri)1859 GroupCollationSpec::GroupCollationSpec(const QueryLoc& loc, const zstring& uri)
1860 :
1861 parsenode(loc),
1862 theUri(uri)
1863 {
1864 }
1865
1866
accept(parsenode_visitor & v) const1867 void GroupCollationSpec::accept(parsenode_visitor& v) const
1868 {
1869 BEGIN_VISITOR();
1870 END_VISITOR();
1871 }
1872
1873
1874 // [38] OrderByClause
1875 // ------------------
OrderByClause(const QueryLoc & loc_,rchandle<OrderSpecList> _spec_list_h,bool _stable_b)1876 OrderByClause::OrderByClause(
1877 const QueryLoc& loc_,
1878 rchandle<OrderSpecList> _spec_list_h,
1879 bool _stable_b)
1880 :
1881 FLWORClause(loc_),
1882 spec_list_h(_spec_list_h),
1883 stable_b(_stable_b)
1884 {
1885 }
1886
1887
accept(parsenode_visitor & v) const1888 void OrderByClause::accept( parsenode_visitor &v ) const
1889 {
1890 BEGIN_VISITOR();
1891 ACCEPT(spec_list_h);
1892 END_VISITOR();
1893 }
1894
1895
1896 // [39] OrderSpecList
1897 // ------------------
OrderSpecList(const QueryLoc & loc_)1898 OrderSpecList::OrderSpecList(
1899 const QueryLoc& loc_)
1900 :
1901 parsenode(loc_)
1902 {}
1903
1904
accept(parsenode_visitor & v) const1905 void OrderSpecList::accept( parsenode_visitor &v ) const
1906 {
1907 BEGIN_VISITOR();
1908 std::vector<rchandle<OrderSpec> >::const_iterator it = spec_hv.begin();
1909 for (; it!=spec_hv.end(); ++it)
1910 {
1911 const parsenode *e_p = &**it;
1912 ACCEPT_CHK (e_p);
1913 }
1914 END_VISITOR();
1915 }
1916
1917
1918 // [40] OrderSpec
1919 // --------------
OrderSpec(const QueryLoc & loc_,exprnode * _spec_h,OrderModifierPN * _modifier_h)1920 OrderSpec::OrderSpec(
1921 const QueryLoc& loc_,
1922 exprnode* _spec_h,
1923 OrderModifierPN* _modifier_h)
1924 :
1925 parsenode(loc_),
1926 spec_h(_spec_h),
1927 modifier_h(_modifier_h)
1928 {
1929 }
1930
1931
accept(parsenode_visitor & v) const1932 void OrderSpec::accept( parsenode_visitor &v ) const
1933 {
1934 BEGIN_VISITOR();
1935 ACCEPT (spec_h);
1936 ACCEPT (modifier_h);
1937 END_VISITOR();
1938 }
1939
1940
1941 // [41] OrderModifier
1942 // ------------------
OrderModifierPN(const QueryLoc & loc_,OrderDirSpec * _dir_spec_h,OrderEmptySpec * _empty_spec_h,OrderCollationSpec * _collation_spec_h)1943 OrderModifierPN::OrderModifierPN(
1944 const QueryLoc& loc_,
1945 OrderDirSpec* _dir_spec_h,
1946 OrderEmptySpec* _empty_spec_h,
1947 OrderCollationSpec* _collation_spec_h)
1948 :
1949 parsenode(loc_),
1950 dir_spec_h(_dir_spec_h),
1951 empty_spec_h(_empty_spec_h),
1952 collation_spec_h(_collation_spec_h)
1953 {
1954 }
1955
1956
accept(parsenode_visitor & v) const1957 void OrderModifierPN::accept( parsenode_visitor &v ) const
1958 {
1959 BEGIN_VISITOR();
1960 ACCEPT (dir_spec_h);
1961 ACCEPT (empty_spec_h);
1962 ACCEPT (collation_spec_h);
1963 END_VISITOR();
1964 }
1965
1966
1967 // [41a] OrderDirSpec
1968 // ------------------
OrderDirSpec(const QueryLoc & loc_,enum ParseConstants::dir_spec_t _dir_spec)1969 OrderDirSpec::OrderDirSpec(
1970 const QueryLoc& loc_,
1971 enum ParseConstants::dir_spec_t _dir_spec)
1972 :
1973 parsenode(loc_),
1974 dir_spec(_dir_spec)
1975 {}
1976
1977
1978
1979
1980 //-OrderDirSpec::
1981
accept(parsenode_visitor & v) const1982 void OrderDirSpec::accept( parsenode_visitor &v ) const
1983 {
1984 BEGIN_VISITOR();
1985 END_VISITOR();
1986 }
1987
1988
1989 // [41b] OrderEmptySpec
1990 // --------------------
OrderEmptySpec(const QueryLoc & loc_,StaticContextConsts::empty_order_mode_t _empty_order_spec)1991 OrderEmptySpec::OrderEmptySpec(
1992 const QueryLoc& loc_,
1993 StaticContextConsts::empty_order_mode_t _empty_order_spec)
1994 :
1995 parsenode(loc_),
1996 empty_order_spec(_empty_order_spec)
1997 {}
1998
1999
2000 //-OrderEmptySpec::
2001
accept(parsenode_visitor & v) const2002 void OrderEmptySpec::accept( parsenode_visitor &v ) const
2003 {
2004 BEGIN_VISITOR();
2005 END_VISITOR();
2006 }
2007
2008
2009 // [41c] OrderCollationSpec
2010 // ------------------------
OrderCollationSpec(const QueryLoc & loc_,zstring const & _uri)2011 OrderCollationSpec::OrderCollationSpec(
2012 const QueryLoc& loc_,
2013 zstring const& _uri)
2014 :
2015 parsenode(loc_),
2016 uri(_uri)
2017 {}
2018
2019
2020 //-OrderCollationSpec::
2021
accept(parsenode_visitor & v) const2022 void OrderCollationSpec::accept( parsenode_visitor &v ) const
2023 {
2024 BEGIN_VISITOR();
2025 END_VISITOR();
2026 }
2027
2028
2029 // [42] QuantifiedExpr
2030 // -------------------
QuantifiedExpr(const QueryLoc & loc_,ParseConstants::quantification_mode_t _qmode,rchandle<QVarInDeclList> _decl_list_h,rchandle<exprnode> _expr_h)2031 QuantifiedExpr::QuantifiedExpr(
2032 const QueryLoc& loc_,
2033 ParseConstants::quantification_mode_t _qmode,
2034 rchandle<QVarInDeclList> _decl_list_h,
2035 rchandle<exprnode> _expr_h)
2036 :
2037 exprnode(loc_),
2038 qmode(_qmode),
2039 decl_list_h(_decl_list_h),
2040 expr_h(_expr_h)
2041 {}
2042
2043
2044 //-QuantifiedExpr::
2045
accept(parsenode_visitor & v) const2046 void QuantifiedExpr::accept( parsenode_visitor &v ) const
2047 {
2048 BEGIN_VISITOR();
2049 ACCEPT (decl_list_h);
2050 ACCEPT (expr_h);
2051 END_VISITOR();
2052 }
2053
2054
2055 // [42a] QVarInDeclList
2056 // --------------------
QVarInDeclList(const QueryLoc & loc_)2057 QVarInDeclList::QVarInDeclList(
2058 const QueryLoc& loc_)
2059 :
2060 parsenode(loc_)
2061 {}
2062
2063
accept(parsenode_visitor & v) const2064 void QVarInDeclList::accept( parsenode_visitor &v ) const
2065 {
2066 BEGIN_VISITOR();
2067 std::for_each (qvar_decl_hv.begin (), qvar_decl_hv.end (), visitor_functor (v));
2068 END_VISITOR();
2069 }
2070
2071
2072 // [42b] QVarInDecl
2073 // ----------------
QVarInDecl(const QueryLoc & loc_,rchandle<QName> _name,rchandle<exprnode> _val_h)2074 QVarInDecl::QVarInDecl(
2075 const QueryLoc& loc_,
2076 rchandle<QName> _name,
2077 rchandle<exprnode> _val_h)
2078 :
2079 parsenode(loc_),
2080 name(_name),
2081 typedecl_h(NULL),
2082 val_h(_val_h)
2083 {
2084 }
2085
2086
QVarInDecl(const QueryLoc & loc_,rchandle<QName> _name,rchandle<SequenceType> _typedecl_h,rchandle<exprnode> _val_h)2087 QVarInDecl::QVarInDecl(
2088 const QueryLoc& loc_,
2089 rchandle<QName> _name,
2090 rchandle<SequenceType> _typedecl_h,
2091 rchandle<exprnode> _val_h)
2092 :
2093 parsenode(loc_),
2094 name(_name),
2095 typedecl_h(_typedecl_h),
2096 val_h(_val_h)
2097 {
2098 }
2099
2100
accept(parsenode_visitor & v) const2101 void QVarInDecl::accept( parsenode_visitor &v ) const
2102 {
2103 BEGIN_VISITOR();
2104 ACCEPT (val_h);
2105 ACCEPT (typedecl_h);
2106 END_VISITOR();
2107 }
2108
2109
2110 // [71] SwitchExpr
2111 // -------------------
SwitchExpr(const QueryLoc & loc_,rchandle<exprnode> _switch_expr_h,rchandle<SwitchCaseClauseList> _clause_list_h,rchandle<exprnode> _default_expr_h)2112 SwitchExpr::SwitchExpr(
2113 const QueryLoc& loc_,
2114 rchandle<exprnode> _switch_expr_h,
2115 rchandle<SwitchCaseClauseList> _clause_list_h,
2116 rchandle<exprnode> _default_expr_h)
2117 :
2118 exprnode(loc_),
2119 switch_expr_h(_switch_expr_h),
2120 clause_list_h(_clause_list_h),
2121 default_expr_h(_default_expr_h)
2122 {}
2123
accept(parsenode_visitor & v) const2124 void SwitchExpr::accept( parsenode_visitor &v ) const
2125 {
2126 BEGIN_VISITOR();
2127 ACCEPT_CHK(switch_expr_h);
2128 ACCEPT_CHK(default_expr_h);
2129 ACCEPT_CHK(clause_list_h);
2130 END_VISITOR();
2131 }
2132
2133
2134 // [71a] SwitchCaseClauseList
2135 // --------------------
SwitchCaseClauseList(const QueryLoc & loc_)2136 SwitchCaseClauseList::SwitchCaseClauseList(
2137 const QueryLoc& loc_)
2138 :
2139 parsenode(loc_)
2140 {
2141 }
2142
accept(parsenode_visitor & v) const2143 void SwitchCaseClauseList::accept( parsenode_visitor &v ) const
2144 {
2145 BEGIN_VISITOR();
2146 std::vector<rchandle<SwitchCaseClause> >::const_reverse_iterator it = clause_hv.rbegin();
2147 for (; it!=clause_hv.rend(); ++it)
2148 {
2149 const parsenode *e_p = &**it;
2150 ACCEPT_CHK (e_p);
2151 }
2152 END_VISITOR();
2153 }
2154
2155
2156 // [72] SwitchCaseClause
2157 // -------------------
SwitchCaseClause(const QueryLoc & loc_,rchandle<SwitchCaseOperandList> _operand_list_h,rchandle<exprnode> _return_expr_h)2158 SwitchCaseClause::SwitchCaseClause(
2159 const QueryLoc& loc_,
2160 rchandle<SwitchCaseOperandList> _operand_list_h,
2161 rchandle<exprnode> _return_expr_h)
2162 :
2163 exprnode(loc_),
2164 operand_list_h(_operand_list_h),
2165 return_expr_h(_return_expr_h)
2166 {}
2167
accept(parsenode_visitor & v) const2168 void SwitchCaseClause::accept( parsenode_visitor &v ) const
2169 {
2170 BEGIN_VISITOR();
2171 ACCEPT_CHK(return_expr_h);
2172 ACCEPT_CHK(operand_list_h);
2173 END_VISITOR();
2174 }
2175
2176 // [72a] SwitchCaseOperandList
2177 // --------------------
SwitchCaseOperandList(const QueryLoc & loc_)2178 SwitchCaseOperandList::SwitchCaseOperandList(
2179 const QueryLoc& loc_)
2180 :
2181 parsenode(loc_)
2182 {
2183 }
2184
accept(parsenode_visitor & v) const2185 void SwitchCaseOperandList::accept( parsenode_visitor &v ) const
2186 {
2187 BEGIN_VISITOR();
2188 std::vector<rchandle<exprnode> >::const_reverse_iterator it = operand_hv.rbegin();
2189 for (; it!=operand_hv.rend(); ++it) {
2190 const parsenode *e_p = &**it;
2191 ACCEPT_CHK (e_p);
2192 }
2193 END_VISITOR();
2194 }
2195
2196
2197 // [43] TypeswitchExpr
2198 // -------------------
TypeswitchExpr(const QueryLoc & loc_,rchandle<exprnode> _switch_expr_h,rchandle<CaseClauseList> _clause_list_h,rchandle<exprnode> _default_clause_h)2199 TypeswitchExpr::TypeswitchExpr(
2200 const QueryLoc& loc_,
2201 rchandle<exprnode> _switch_expr_h,
2202 rchandle<CaseClauseList> _clause_list_h,
2203 rchandle<exprnode> _default_clause_h)
2204 :
2205 exprnode(loc_),
2206 switch_expr_h(_switch_expr_h),
2207 clause_list_h(_clause_list_h),
2208 default_clause_h(_default_clause_h)
2209 {}
2210
2211
TypeswitchExpr(const QueryLoc & loc_,rchandle<exprnode> _switch_expr_h,rchandle<CaseClauseList> _clause_list_h,rchandle<QName> _default_varname,rchandle<exprnode> _default_clause_h)2212 TypeswitchExpr::TypeswitchExpr(
2213 const QueryLoc& loc_,
2214 rchandle<exprnode> _switch_expr_h,
2215 rchandle<CaseClauseList> _clause_list_h,
2216 rchandle<QName> _default_varname,
2217 rchandle<exprnode> _default_clause_h)
2218 :
2219 exprnode(loc_),
2220 switch_expr_h(_switch_expr_h),
2221 clause_list_h(_clause_list_h),
2222 default_varname(_default_varname),
2223 default_clause_h(_default_clause_h)
2224 {}
2225
2226
2227 //-TypeswitchExpr::
2228
accept(parsenode_visitor & v) const2229 void TypeswitchExpr::accept( parsenode_visitor &v ) const
2230 {
2231 BEGIN_VISITOR();
2232 ACCEPT_CHK (switch_expr_h);
2233 ACCEPT_CHK (default_clause_h);
2234 ACCEPT_CHK (clause_list_h);
2235
2236 END_VISITOR();
2237 }
2238
2239
2240 // [43a] CaseClauseList
2241 // --------------------
CaseClauseList(const QueryLoc & loc_)2242 CaseClauseList::CaseClauseList(
2243 const QueryLoc& loc_)
2244 :
2245 parsenode(loc_)
2246 {
2247 }
2248
2249
accept(parsenode_visitor & v) const2250 void CaseClauseList::accept( parsenode_visitor &v ) const
2251 {
2252 BEGIN_VISITOR();
2253 std::vector<rchandle<CaseClause> >::const_reverse_iterator it = clause_hv.rbegin();
2254 for (; it!=clause_hv.rend(); ++it) {
2255 const parsenode *e_p = &**it;
2256 ACCEPT_CHK (e_p);
2257 }
2258 END_VISITOR();
2259 }
2260
2261
2262 // [44] CaseClause
2263 // ---------------
CaseClause(const QueryLoc & loc_,rchandle<QName> _varname,rchandle<SequenceType> _type_h,rchandle<exprnode> _val_h)2264 CaseClause::CaseClause(
2265 const QueryLoc& loc_,
2266 rchandle<QName> _varname,
2267 rchandle<SequenceType> _type_h,
2268 rchandle<exprnode> _val_h)
2269 :
2270 parsenode(loc_),
2271 varname(_varname),
2272 type_h(_type_h),
2273 val_h(_val_h)
2274 {
2275 }
2276
CaseClause(const QueryLoc & loc_,rchandle<SequenceType> _type_h,rchandle<exprnode> _val_h)2277 CaseClause::CaseClause(
2278 const QueryLoc& loc_,
2279 rchandle<SequenceType> _type_h,
2280 rchandle<exprnode> _val_h)
2281 :
2282 parsenode(loc_),
2283 varname(NULL),
2284 type_h(_type_h),
2285 val_h(_val_h)
2286 {
2287 }
2288
2289
accept(parsenode_visitor & v) const2290 void CaseClause::accept( parsenode_visitor &v ) const
2291 {
2292 BEGIN_VISITOR();
2293 ACCEPT (type_h);
2294 ACCEPT (val_h);
2295 END_VISITOR();
2296 }
2297
2298
2299 // [45] IfExpr
2300 // -----------
IfExpr(const QueryLoc & loc_,rchandle<exprnode> _cond_expr_h,rchandle<exprnode> _then_expr_h,rchandle<exprnode> _else_expr_h)2301 IfExpr::IfExpr(
2302 const QueryLoc& loc_,
2303 rchandle<exprnode> _cond_expr_h,
2304 rchandle<exprnode> _then_expr_h,
2305 rchandle<exprnode> _else_expr_h)
2306 :
2307 exprnode(loc_),
2308 cond_expr_h(_cond_expr_h),
2309 then_expr_h(_then_expr_h),
2310 else_expr_h(_else_expr_h)
2311 {}
2312
2313
2314 //-IfExpr::
2315
accept(parsenode_visitor & v) const2316 void IfExpr::accept( parsenode_visitor &v ) const
2317 {
2318 BEGIN_VISITOR();
2319 ACCEPT (cond_expr_h);
2320 ACCEPT (then_expr_h);
2321 ACCEPT (else_expr_h);
2322 END_VISITOR();
2323 }
2324
2325
2326 // [46] OrExpr
2327 // -----------
OrExpr(const QueryLoc & loc_,rchandle<exprnode> _or_expr_h,rchandle<exprnode> _and_expr_h)2328 OrExpr::OrExpr(
2329 const QueryLoc& loc_,
2330 rchandle<exprnode> _or_expr_h,
2331 rchandle<exprnode> _and_expr_h)
2332 :
2333 exprnode(loc_),
2334 or_expr_h(_or_expr_h),
2335 and_expr_h(_and_expr_h)
2336 {}
2337
2338
2339 //-OrExpr::
2340
accept(parsenode_visitor & v) const2341 void OrExpr::accept( parsenode_visitor &v ) const
2342 {
2343 BEGIN_VISITOR();
2344 ACCEPT (or_expr_h);
2345 ACCEPT (and_expr_h);
2346 END_VISITOR();
2347 }
2348
2349
2350 // [47] AndExpr
2351 // ------------
AndExpr(const QueryLoc & loc_,rchandle<exprnode> _and_expr_h,rchandle<exprnode> _comp_expr_h)2352 AndExpr::AndExpr(
2353 const QueryLoc& loc_,
2354 rchandle<exprnode> _and_expr_h,
2355 rchandle<exprnode> _comp_expr_h)
2356 :
2357 exprnode(loc_),
2358 and_expr_h(_and_expr_h),
2359 comp_expr_h(_comp_expr_h)
2360 {}
2361
2362
2363 //-AndExpr::
2364
accept(parsenode_visitor & v) const2365 void AndExpr::accept( parsenode_visitor &v ) const
2366 {
2367 BEGIN_VISITOR();
2368 ACCEPT (and_expr_h);
2369 ACCEPT (comp_expr_h);
2370 END_VISITOR();
2371 }
2372
2373
2374 // [48] ComparisonExpr
2375 // -------------------
ComparisonExpr(const QueryLoc & loc_,rchandle<ValueComp> _valcomp_h,rchandle<exprnode> _left_h,rchandle<exprnode> _right_h)2376 ComparisonExpr::ComparisonExpr(
2377 const QueryLoc& loc_,
2378 rchandle<ValueComp> _valcomp_h,
2379 rchandle<exprnode> _left_h,
2380 rchandle<exprnode> _right_h)
2381 :
2382 exprnode(loc_),
2383 left_h(_left_h),
2384 right_h(_right_h),
2385 valcomp_h(_valcomp_h),
2386 gencomp_h(NULL),
2387 nodecomp_h(NULL)
2388 {}
2389
ComparisonExpr(const QueryLoc & loc_,rchandle<GeneralComp> _gencomp_h,rchandle<exprnode> _left_h,rchandle<exprnode> _right_h)2390 ComparisonExpr::ComparisonExpr(
2391 const QueryLoc& loc_,
2392 rchandle<GeneralComp> _gencomp_h,
2393 rchandle<exprnode> _left_h,
2394 rchandle<exprnode> _right_h)
2395 :
2396 exprnode(loc_),
2397 left_h(_left_h),
2398 right_h(_right_h),
2399 valcomp_h(NULL),
2400 gencomp_h(_gencomp_h),
2401 nodecomp_h(NULL)
2402 {}
2403
ComparisonExpr(const QueryLoc & loc_,rchandle<NodeComp> _nodecomp_h,rchandle<exprnode> _left_h,rchandle<exprnode> _right_h)2404 ComparisonExpr::ComparisonExpr(
2405 const QueryLoc& loc_,
2406 rchandle<NodeComp> _nodecomp_h,
2407 rchandle<exprnode> _left_h,
2408 rchandle<exprnode> _right_h)
2409 :
2410 exprnode(loc_),
2411 left_h(_left_h),
2412 right_h(_right_h),
2413 valcomp_h(NULL),
2414 gencomp_h(NULL),
2415 nodecomp_h(_nodecomp_h)
2416 {}
2417
2418
2419 //-ComparisonExpr::
2420
accept(parsenode_visitor & v) const2421 void ComparisonExpr::accept( parsenode_visitor &v ) const
2422 {
2423 BEGIN_VISITOR();
2424 ACCEPT (gencomp_h);
2425 ACCEPT (nodecomp_h);
2426 ACCEPT (valcomp_h);
2427 ACCEPT (left_h);
2428 ACCEPT (right_h);
2429 END_VISITOR();
2430 }
2431
2432
FTContainsExpr(QueryLoc const & loc,exprnode const * range_expr,FTSelection const * ftselection,FTIgnoreOption const * ftignore)2433 FTContainsExpr::FTContainsExpr(
2434 QueryLoc const &loc,
2435 exprnode const *range_expr,
2436 FTSelection const *ftselection,
2437 FTIgnoreOption const *ftignore
2438 ) :
2439 exprnode( loc ),
2440 range_expr_( range_expr ),
2441 ftselection_( ftselection ),
2442 ftignore_( ftignore )
2443 {
2444 ZORBA_ASSERT( range_expr );
2445 }
2446
~FTContainsExpr()2447 FTContainsExpr::~FTContainsExpr() {
2448 delete range_expr_;
2449 delete ftselection_;
2450 delete ftignore_;
2451 }
2452
accept(parsenode_visitor & v) const2453 void FTContainsExpr::accept( parsenode_visitor &v ) const
2454 {
2455 BEGIN_VISITOR();
2456 ACCEPT( range_expr_ );
2457 ACCEPT( ftselection_ );
2458 ACCEPT( ftignore_ );
2459 END_VISITOR();
2460 }
2461
2462
2463 // [49] RangeExpr
2464 // --------------
RangeExpr(const QueryLoc & loc_,rchandle<exprnode> _from_expr_h,rchandle<exprnode> _to_expr_h)2465 RangeExpr::RangeExpr(
2466 const QueryLoc& loc_,
2467 rchandle<exprnode> _from_expr_h,
2468 rchandle<exprnode> _to_expr_h)
2469 :
2470 exprnode(loc_),
2471 from_expr_h(_from_expr_h),
2472 to_expr_h(_to_expr_h)
2473 {}
2474
2475
2476 //-RangeExpr::
2477
accept(parsenode_visitor & v) const2478 void RangeExpr::accept( parsenode_visitor &v ) const
2479 {
2480 BEGIN_VISITOR();
2481 ACCEPT (from_expr_h);
2482 ACCEPT (to_expr_h);
2483 END_VISITOR();
2484 }
2485
2486
2487 // [50] AdditiveExpr
2488 // -----------------
AdditiveExpr(const QueryLoc & loc_,enum ParseConstants::add_op_t _add_op,rchandle<exprnode> _add_expr_h,rchandle<exprnode> _mult_expr_h)2489 AdditiveExpr::AdditiveExpr(
2490 const QueryLoc& loc_,
2491 enum ParseConstants::add_op_t _add_op,
2492 rchandle<exprnode> _add_expr_h,
2493 rchandle<exprnode> _mult_expr_h)
2494 :
2495 exprnode(loc_),
2496 add_op(_add_op),
2497 add_expr_h(_add_expr_h),
2498 mult_expr_h(_mult_expr_h)
2499 {}
2500
2501
2502 //-AdditiveExpr::
2503
accept(parsenode_visitor & v) const2504 void AdditiveExpr::accept( parsenode_visitor &v ) const
2505 {
2506 BEGIN_VISITOR();
2507 ACCEPT (add_expr_h);
2508 ACCEPT (mult_expr_h);
2509 END_VISITOR();
2510 }
2511
2512
2513 // [51] MultiplicativeExpr
2514 // -----------------------
MultiplicativeExpr(const QueryLoc & loc_,enum ParseConstants::mult_op_t _mult_op,rchandle<exprnode> _mult_expr_h,rchandle<exprnode> _union_expr_h)2515 MultiplicativeExpr::MultiplicativeExpr(
2516 const QueryLoc& loc_,
2517 enum ParseConstants::mult_op_t _mult_op,
2518 rchandle<exprnode> _mult_expr_h,
2519 rchandle<exprnode> _union_expr_h)
2520 :
2521 exprnode(loc_),
2522 mult_op(_mult_op),
2523 mult_expr_h(_mult_expr_h),
2524 union_expr_h(_union_expr_h)
2525 {}
2526
2527
2528 //-MultiplicativeExpr::
2529
accept(parsenode_visitor & v) const2530 void MultiplicativeExpr::accept( parsenode_visitor &v ) const
2531 {
2532 BEGIN_VISITOR();
2533 ACCEPT (mult_expr_h);
2534 ACCEPT (union_expr_h);
2535 END_VISITOR();
2536 }
2537
2538
2539 // [52] UnionExpr
2540 // --------------
UnionExpr(const QueryLoc & loc_,rchandle<exprnode> _union_expr_h,rchandle<exprnode> _intex_expr_h)2541 UnionExpr::UnionExpr(
2542 const QueryLoc& loc_,
2543 rchandle<exprnode> _union_expr_h,
2544 rchandle<exprnode> _intex_expr_h)
2545 :
2546 exprnode(loc_),
2547 union_expr_h(_union_expr_h),
2548 intex_expr_h(_intex_expr_h)
2549 {}
2550
2551
2552 //-UnionExpr::
2553
accept(parsenode_visitor & v) const2554 void UnionExpr::accept( parsenode_visitor &v ) const
2555 {
2556 BEGIN_VISITOR();
2557 ACCEPT (union_expr_h);
2558 ACCEPT (intex_expr_h);
2559 END_VISITOR();
2560 }
2561
2562
2563 // [53] IntersectExceptExpr
2564 // ------------------------
IntersectExceptExpr(const QueryLoc & loc_,enum ParseConstants::intex_op_t _intex_op,rchandle<exprnode> _intex_expr_h,rchandle<exprnode> _instof_expr_h)2565 IntersectExceptExpr::IntersectExceptExpr(
2566 const QueryLoc& loc_,
2567 enum ParseConstants::intex_op_t _intex_op,
2568 rchandle<exprnode> _intex_expr_h,
2569 rchandle<exprnode> _instof_expr_h)
2570 :
2571 exprnode(loc_),
2572 intex_op(_intex_op),
2573 intex_expr_h(_intex_expr_h),
2574 instof_expr_h(_instof_expr_h)
2575 {}
2576
2577
2578 //-IntersectExceptExpr::
2579
accept(parsenode_visitor & v) const2580 void IntersectExceptExpr::accept( parsenode_visitor &v ) const
2581 {
2582 BEGIN_VISITOR();
2583 ACCEPT (intex_expr_h);
2584 ACCEPT (instof_expr_h);
2585 END_VISITOR();
2586 }
2587
2588
2589 // [54] InstanceofExpr
2590 // -------------------
InstanceofExpr(const QueryLoc & loc_,rchandle<exprnode> _treat_expr_h,rchandle<SequenceType> _seqtype_h)2591 InstanceofExpr::InstanceofExpr(
2592 const QueryLoc& loc_,
2593 rchandle<exprnode> _treat_expr_h,
2594 rchandle<SequenceType> _seqtype_h)
2595 :
2596 exprnode(loc_),
2597 treat_expr_h(_treat_expr_h),
2598 seqtype_h(_seqtype_h)
2599 {}
2600
2601
2602 //-InstanceofExpr::
2603
accept(parsenode_visitor & v) const2604 void InstanceofExpr::accept( parsenode_visitor &v ) const
2605 {
2606 BEGIN_VISITOR();
2607 ACCEPT (treat_expr_h);
2608 ACCEPT (seqtype_h);
2609 END_VISITOR();
2610 }
2611
2612
2613 // [55] TreatExpr
2614 // --------------
TreatExpr(const QueryLoc & loc_,rchandle<exprnode> _castable_expr_h,rchandle<SequenceType> _seqtype_h)2615 TreatExpr::TreatExpr(
2616 const QueryLoc& loc_,
2617 rchandle<exprnode> _castable_expr_h,
2618 rchandle<SequenceType> _seqtype_h)
2619 :
2620 exprnode(loc_),
2621 castable_expr_h(_castable_expr_h),
2622 seqtype_h(_seqtype_h)
2623 {}
2624
2625
2626 //-TreatExpr::
2627
accept(parsenode_visitor & v) const2628 void TreatExpr::accept( parsenode_visitor &v ) const
2629 {
2630 BEGIN_VISITOR();
2631 ACCEPT (castable_expr_h);
2632 ACCEPT (seqtype_h);
2633 END_VISITOR();
2634 }
2635
2636
2637 // [56] CastableExpr
2638 // -----------------
CastableExpr(const QueryLoc & loc_,rchandle<exprnode> _cast_expr_h,rchandle<SingleType> _singletype_h)2639 CastableExpr::CastableExpr(
2640 const QueryLoc& loc_,
2641 rchandle<exprnode> _cast_expr_h,
2642 rchandle<SingleType> _singletype_h)
2643 :
2644 exprnode(loc_),
2645 cast_expr_h(_cast_expr_h),
2646 singletype_h(_singletype_h)
2647 {}
2648
2649
2650 //-CastableExpr::
2651
accept(parsenode_visitor & v) const2652 void CastableExpr::accept( parsenode_visitor &v ) const
2653 {
2654 BEGIN_VISITOR();
2655 ACCEPT (cast_expr_h);
2656 ACCEPT (singletype_h);
2657 END_VISITOR();
2658 }
2659
2660
2661 // [57] CastExpr
2662 // -------------
CastExpr(const QueryLoc & loc_,rchandle<exprnode> _unary_expr_h,rchandle<SingleType> _singletype_h)2663 CastExpr::CastExpr(
2664 const QueryLoc& loc_,
2665 rchandle<exprnode> _unary_expr_h,
2666 rchandle<SingleType> _singletype_h)
2667 :
2668 exprnode(loc_),
2669 unary_expr_h(_unary_expr_h),
2670 singletype_h(_singletype_h)
2671 {}
2672
2673
2674 //-CastExpr::
2675
accept(parsenode_visitor & v) const2676 void CastExpr::accept( parsenode_visitor &v ) const
2677 {
2678 BEGIN_VISITOR();
2679 ACCEPT (unary_expr_h);
2680 ACCEPT (singletype_h);
2681 END_VISITOR();
2682 }
2683
2684
2685 // [58] UnaryExpr
2686 // --------------
UnaryExpr(const QueryLoc & loc_,rchandle<SignList> _signlist_h,rchandle<exprnode> _value_expr_h)2687 UnaryExpr::UnaryExpr(
2688 const QueryLoc& loc_,
2689 rchandle<SignList> _signlist_h,
2690 rchandle<exprnode> _value_expr_h)
2691 :
2692 exprnode(loc_),
2693 value_expr_h(_value_expr_h),
2694 signlist_h(_signlist_h)
2695 {}
2696
2697
2698 //-UnaryExpr::
2699
accept(parsenode_visitor & v) const2700 void UnaryExpr::accept( parsenode_visitor &v ) const
2701 {
2702 BEGIN_VISITOR();
2703 ACCEPT (signlist_h);
2704 ACCEPT (value_expr_h);
2705 END_VISITOR();
2706 }
2707
2708
2709 // [58a] SignList
2710 // --------------
SignList(const QueryLoc & loc_,bool _sign)2711 SignList::SignList(
2712 const QueryLoc& loc_,
2713 bool _sign)
2714 :
2715 parsenode(loc_),
2716 sign(_sign)
2717 {}
2718
2719
2720 //-SignList::
2721
accept(parsenode_visitor & v) const2722 void SignList::accept( parsenode_visitor &v ) const
2723 {
2724 BEGIN_VISITOR();
2725 END_VISITOR();
2726 }
2727
2728
2729 // [59] ValueExpr
2730 // --------------
2731
2732
2733 // [60] GeneralComp
2734 // ----------------
GeneralComp(const QueryLoc & loc_,enum ParseConstants::gencomp_t _type)2735 GeneralComp::GeneralComp(
2736 const QueryLoc& loc_,
2737 enum ParseConstants::gencomp_t _type)
2738 :
2739 parsenode(loc_),
2740 type(_type)
2741 {}
2742
2743
2744 //-GeneralComp::
2745
accept(parsenode_visitor & v) const2746 void GeneralComp::accept( parsenode_visitor &v ) const
2747 {
2748 BEGIN_VISITOR();
2749 END_VISITOR();
2750 }
2751
2752
2753 // [61] ValueComp
2754 // --------------
ValueComp(const QueryLoc & loc_,enum ParseConstants::valcomp_t _type)2755 ValueComp::ValueComp(
2756 const QueryLoc& loc_,
2757 enum ParseConstants::valcomp_t _type)
2758 :
2759 parsenode(loc_),
2760 type(_type)
2761 {}
2762
2763
2764 //-ValueComp::
2765
accept(parsenode_visitor & v) const2766 void ValueComp::accept( parsenode_visitor &v ) const
2767 {
2768 BEGIN_VISITOR();
2769 END_VISITOR();
2770 }
2771
2772
2773 // [62] NodeComp
2774 // -------------
NodeComp(const QueryLoc & loc_,enum ParseConstants::nodecomp_t _type)2775 NodeComp::NodeComp(
2776 const QueryLoc& loc_,
2777 enum ParseConstants::nodecomp_t _type)
2778 :
2779 parsenode(loc_),
2780 type(_type)
2781 {}
2782
2783
2784 //-NodeComp::
2785
accept(parsenode_visitor & v) const2786 void NodeComp::accept( parsenode_visitor &v ) const
2787 {
2788 BEGIN_VISITOR();
2789 END_VISITOR();
2790 }
2791
2792
2793 // [63] ValidateExpr
2794 // -----------------
ValidateExpr(const QueryLoc & loc_,zstring const & _valmode,rchandle<exprnode> _expr_h)2795 ValidateExpr::ValidateExpr(
2796 const QueryLoc& loc_,
2797 zstring const& _valmode,
2798 rchandle<exprnode> _expr_h)
2799 :
2800 exprnode(loc_),
2801 valmode(_valmode=="lax" ? ParseConstants::val_lax : ParseConstants::val_strict),
2802 expr_h(_expr_h)
2803 {}
2804
ValidateExpr(const QueryLoc & loc_,rchandle<QName> _valmode,rchandle<exprnode> _expr_h)2805 ValidateExpr::ValidateExpr(
2806 const QueryLoc& loc_,
2807 rchandle<QName> _valmode,
2808 rchandle<exprnode> _expr_h)
2809 :
2810 exprnode(loc_),
2811 expr_h(_expr_h)
2812 {
2813 if (_valmode->get_qname() == "lax")
2814 valmode = ParseConstants::val_lax;
2815 else if (_valmode->get_qname() == "strict")
2816 valmode = ParseConstants::val_strict;
2817 else
2818 {
2819 valmode = ParseConstants::val_typename;
2820 type_name = _valmode;
2821 }
2822 }
2823
2824
2825 //-ValidateExpr::
2826
accept(parsenode_visitor & v) const2827 void ValidateExpr::accept( parsenode_visitor &v ) const
2828 {
2829 BEGIN_VISITOR();
2830 ACCEPT (expr_h);
2831 END_VISITOR();
2832 }
2833
2834
2835 // [65]
ExtensionExpr(const QueryLoc & loc_,rchandle<PragmaList> const & pragmas,rchandle<exprnode> const & expr)2836 ExtensionExpr::ExtensionExpr(
2837 const QueryLoc& loc_,
2838 rchandle<PragmaList> const &pragmas,
2839 rchandle<exprnode> const &expr)
2840 :
2841 exprnode(loc_),
2842 pragmas_(pragmas),
2843 expr_(expr)
2844 {}
2845
2846
2847 //-ExtensionExpr::
2848
accept(parsenode_visitor & v) const2849 void ExtensionExpr::accept( parsenode_visitor &v ) const
2850 {
2851 BEGIN_VISITOR();
2852 ACCEPT (pragmas_);
2853 ACCEPT (expr_);
2854 END_VISITOR();
2855 }
2856
2857
2858 // [65a] PragmaList
2859 // ----------------
PragmaList(const QueryLoc & loc_)2860 PragmaList::PragmaList(
2861 const QueryLoc& loc_)
2862 :
2863 parsenode(loc_)
2864 {}
2865
2866
2867 //-PragmaList::
2868
accept(parsenode_visitor & v) const2869 void PragmaList::accept( parsenode_visitor &v ) const
2870 {
2871 BEGIN_VISITOR();
2872 list_t::const_reverse_iterator it = pragmas_.rbegin();
2873 for ( ; it != pragmas_.rend(); ++it ) {
2874 const parsenode *const p = *it;
2875 ACCEPT_CHK(p);
2876 }
2877 END_VISITOR();
2878 }
2879
2880
2881 // [66] Pragma
2882 // -----------
Pragma(const QueryLoc & loc_,rchandle<QName> _name_h,zstring const & _pragma_lit)2883 Pragma::Pragma(
2884 const QueryLoc& loc_,
2885 rchandle<QName> _name_h,
2886 zstring const &_pragma_lit)
2887 :
2888 parsenode(loc_),
2889 name_h(_name_h),
2890 pragma_lit(_pragma_lit)
2891 {
2892 }
2893
2894
2895 //-Pragma::
2896
accept(parsenode_visitor & v) const2897 void Pragma::accept( parsenode_visitor &v ) const
2898 {
2899 BEGIN_VISITOR();
2900 //name->accept(v);
2901 END_VISITOR();
2902 }
2903
2904
2905 // [67] PragmaContents
2906 // -------------------
2907 /* folded into [66] */
2908
2909
2910 /*******************************************************************************
2911
2912 ********************************************************************************/
SimpleMapExpr(const QueryLoc & loc,rchandle<exprnode> left,rchandle<exprnode> right)2913 SimpleMapExpr::SimpleMapExpr(
2914 const QueryLoc& loc,
2915 rchandle<exprnode> left,
2916 rchandle<exprnode> right)
2917 :
2918 exprnode(loc),
2919 left_expr_h(left),
2920 right_expr_h(right)
2921 {
2922 }
2923
2924
accept(parsenode_visitor & v) const2925 void SimpleMapExpr::accept(parsenode_visitor& v) const
2926 {
2927 BEGIN_VISITOR();
2928
2929 ACCEPT(left_expr_h);
2930 ACCEPT(right_expr_h);
2931
2932 END_VISITOR();
2933 }
2934
2935
2936 /*******************************************************************************
2937
2938 [68] PathExpr ::= LEADING_LONE_SLASH |
2939 SLASH RelativePathExpr |
2940 SLASH_SLASH RelativePathExpr |
2941 RelativePathExpr
2942 ********************************************************************************/
PathExpr(const QueryLoc & loc_,enum ParseConstants::pathtype_t _type,rchandle<exprnode> _relpath_expr_h)2943 PathExpr::PathExpr(
2944 const QueryLoc& loc_,
2945 enum ParseConstants::pathtype_t _type,
2946 rchandle<exprnode> _relpath_expr_h)
2947 :
2948 exprnode(loc_),
2949 type(_type),
2950 relpath_expr_h(_relpath_expr_h)
2951 {}
2952
2953
accept(parsenode_visitor & v) const2954 void PathExpr::accept( parsenode_visitor &v ) const
2955 {
2956 void* visitor_state = v.begin_visit(*this);
2957 if (visitor_state != parsenode_visitor::no_state)
2958 return;
2959 ACCEPT (relpath_expr_h);
2960 END_VISITOR();
2961 }
2962
2963
2964 /*******************************************************************************
2965
2966 [69] RelativePathExpr ::= StepExpr |
2967 StepExpr SLASH RelativePathExpr |
2968 StepExpr SLASH_SLASH RelativePathExpr
2969
2970 Note: for the 1st alternative production, a RelativePathExpr node is generated
2971 whose left child is a ContextItemExpr and its right child is the StepExpr.
2972
2973 ********************************************************************************/
RelativePathExpr(const QueryLoc & loc_,enum ParseConstants::steptype_t _step_type,rchandle<exprnode> step,rchandle<exprnode> rpe,bool implicit)2974 RelativePathExpr::RelativePathExpr(
2975 const QueryLoc& loc_,
2976 enum ParseConstants::steptype_t _step_type,
2977 rchandle<exprnode> step,
2978 rchandle<exprnode> rpe,
2979 bool implicit)
2980 :
2981 exprnode(loc_),
2982 step_type(_step_type),
2983 step_expr_h(step),
2984 is_implicit_b(implicit)
2985 {
2986 RelativePathExpr* rpep = dynamic_cast<RelativePathExpr*>(rpe.getp());
2987 if (rpep != NULL)
2988 {
2989 ContextItemExpr* dot = dynamic_cast<ContextItemExpr*>(rpep->step_expr_h.getp());
2990 if (dot != NULL)
2991 {
2992 // step/ ./... --> step/...
2993 // step/ .//... --> step//...
2994 relpath_expr_h = rpep->relpath_expr_h;
2995 if (!dot->is_placeholder())
2996 step_type = rpep->get_step_type();
2997 }
2998 else
2999 relpath_expr_h = rpe;
3000 }
3001 else
3002 {
3003 relpath_expr_h = rpe;
3004 }
3005
3006 FilterExpr* filter = dynamic_cast<FilterExpr*>(step.getp());
3007 if (filter != NULL)
3008 filter->setIsPathStep();
3009 }
3010
3011
accept(parsenode_visitor & v) const3012 void RelativePathExpr::accept( parsenode_visitor &v ) const
3013 {
3014 void* visitor_state = v.begin_visit(*this);
3015
3016 if (visitor_state == NULL)
3017 {
3018 return;
3019 }
3020
3021 ACCEPT (step_expr_h);
3022 v.intermediate_visit(*this, visitor_state);
3023 ACCEPT (relpath_expr_h);
3024 END_VISITOR();
3025 }
3026
3027
3028 /*******************************************************************************
3029
3030 [70] StepExpr ::= AxisStep | FilterExpr
3031
3032 ********************************************************************************/
3033
3034
3035 /*******************************************************************************
3036
3037 [71] AxisStep ::= (ForwardStep | ReverseStep) PredicateList?
3038
3039 ********************************************************************************/
AxisStep(const QueryLoc & loc_,rchandle<ForwardStep> _forward_step_h,rchandle<PredicateList> _predicate_list_h)3040 AxisStep::AxisStep(
3041 const QueryLoc& loc_,
3042 rchandle<ForwardStep> _forward_step_h,
3043 rchandle<PredicateList> _predicate_list_h)
3044 :
3045 exprnode(loc_),
3046 forward_step_h(_forward_step_h),
3047 reverse_step_h(NULL),
3048 predicate_list_h(_predicate_list_h)
3049 {}
3050
3051
AxisStep(const QueryLoc & loc_,rchandle<ReverseStep> _reverse_step_h,rchandle<PredicateList> _predicate_list_h)3052 AxisStep::AxisStep(
3053 const QueryLoc& loc_,
3054 rchandle<ReverseStep> _reverse_step_h,
3055 rchandle<PredicateList> _predicate_list_h)
3056 :
3057 exprnode(loc_),
3058 forward_step_h(NULL),
3059 reverse_step_h(_reverse_step_h),
3060 predicate_list_h(_predicate_list_h)
3061 {
3062 }
3063
3064
get_axis_kind() const3065 enum ParseConstants::axis_kind_t AxisStep::get_axis_kind() const
3066 {
3067 if (forward_step_h)
3068 return forward_step_h->get_axis_kind();
3069
3070 return reverse_step_h->get_axis_kind();
3071 }
3072
3073
accept(parsenode_visitor & v) const3074 void AxisStep::accept(parsenode_visitor& v) const
3075 {
3076 BEGIN_VISITOR();
3077
3078 if (forward_step_h != NULL) forward_step_h->accept(v);
3079 if (reverse_step_h != NULL) reverse_step_h->accept(v);
3080
3081 v.post_axis_visit(*this, visitor_state);
3082
3083 if (predicate_list_h != NULL) predicate_list_h->accept(v);
3084
3085 END_VISITOR();
3086 }
3087
3088
3089 /*******************************************************************************
3090
3091 [72] ForwardStep ::= ForwardAxis NodeTest | AbbrevForwardStep
3092
3093 ********************************************************************************/
ForwardStep(const QueryLoc & loc,rchandle<ForwardAxis> forward_axis,rchandle<parsenode> node_test)3094 ForwardStep::ForwardStep(
3095 const QueryLoc& loc,
3096 rchandle<ForwardAxis> forward_axis,
3097 rchandle<parsenode> node_test)
3098 :
3099 parsenode(loc),
3100 theForwardAxis(forward_axis),
3101 node_test_h(node_test),
3102 theAbbrevStep(NULL)
3103 {
3104 }
3105
3106
ForwardStep(const QueryLoc & loc,rchandle<AbbrevForwardStep> abbrev_step)3107 ForwardStep::ForwardStep(
3108 const QueryLoc& loc,
3109 rchandle<AbbrevForwardStep> abbrev_step)
3110 :
3111 parsenode(loc),
3112 theForwardAxis(NULL),
3113 node_test_h(NULL),
3114 theAbbrevStep(abbrev_step)
3115 {
3116 }
3117
3118
get_axis_kind() const3119 enum ParseConstants::axis_kind_t ForwardStep::get_axis_kind() const
3120 {
3121 if (theForwardAxis)
3122 return theForwardAxis->get_axis();
3123
3124 return (theAbbrevStep->get_attr_bit() ?
3125 ParseConstants::axis_attribute :
3126 ParseConstants::axis_child);
3127 }
3128
3129
accept(parsenode_visitor & v) const3130 void ForwardStep::accept(parsenode_visitor& v) const
3131 {
3132 BEGIN_VISITOR();
3133 if (theForwardAxis != NULL) theForwardAxis->accept(v);
3134 if (node_test_h != NULL) node_test_h->accept(v);
3135 if (theAbbrevStep != NULL) theAbbrevStep->accept(v);
3136 END_VISITOR();
3137 }
3138
3139
3140 /*******************************************************************************
3141
3142 [73] ForwardAxis ::= CHILD_AXIS | ....
3143
3144 ********************************************************************************/
ForwardAxis(const QueryLoc & loc_,enum ParseConstants::axis_kind_t _axis)3145 ForwardAxis::ForwardAxis(
3146 const QueryLoc& loc_,
3147 enum ParseConstants::axis_kind_t _axis)
3148 :
3149 parsenode(loc_),
3150 axis(_axis)
3151 {
3152 }
3153
3154
accept(parsenode_visitor & v) const3155 void ForwardAxis::accept( parsenode_visitor &v ) const
3156 {
3157 BEGIN_VISITOR();
3158 END_VISITOR();
3159 }
3160
3161
3162 /*******************************************************************************
3163
3164 [74] AbbrevForwardStep ::= NodeTest | AT_SIGN NodeTest
3165
3166 ********************************************************************************/
AbbrevForwardStep(const QueryLoc & loc_,rchandle<parsenode> _node_test_h,bool _attr_b)3167 AbbrevForwardStep::AbbrevForwardStep(
3168 const QueryLoc& loc_,
3169 rchandle<parsenode> _node_test_h,
3170 bool _attr_b)
3171 :
3172 parsenode(loc_),
3173 node_test_h(_node_test_h),
3174 attr_b(_attr_b)
3175 {
3176 }
3177
3178
accept(parsenode_visitor & v) const3179 void AbbrevForwardStep::accept( parsenode_visitor &v ) const
3180 {
3181 BEGIN_VISITOR();
3182 if (node_test_h!=NULL) node_test_h->accept(v);
3183 END_VISITOR();
3184 }
3185
3186
3187 /*******************************************************************************
3188
3189 [75] ReverseStep ::= ReverseAxis NodeTest | DOT_DOT
3190
3191 ********************************************************************************/
ReverseStep(const QueryLoc & loc,rchandle<ReverseAxis> _axis_h,rchandle<parsenode> _node_test_h)3192 ReverseStep::ReverseStep(
3193 const QueryLoc& loc,
3194 rchandle<ReverseAxis> _axis_h,
3195 rchandle<parsenode> _node_test_h)
3196 :
3197 parsenode(loc),
3198 axis_h(_axis_h),
3199 node_test_h(_node_test_h)
3200 {
3201 if (node_test_h == NULL)
3202 {
3203 node_test_h = new AnyKindTest(loc);
3204 }
3205 }
3206
3207
get_axis_kind() const3208 enum ParseConstants::axis_kind_t ReverseStep::get_axis_kind() const
3209 {
3210 return axis_h->get_axis();
3211 }
3212
3213
accept(parsenode_visitor & v) const3214 void ReverseStep::accept(parsenode_visitor& v) const
3215 {
3216 BEGIN_VISITOR();
3217 if (axis_h!=NULL) axis_h->accept(v);
3218 if (node_test_h!=NULL) node_test_h->accept(v);
3219 END_VISITOR();
3220 }
3221
3222
3223 /*******************************************************************************
3224
3225 [76] ReverseAxis ::= PARENT_AXIS | ....
3226
3227 ********************************************************************************/
ReverseAxis(const QueryLoc & loc_,enum ParseConstants::axis_kind_t _axis)3228 ReverseAxis::ReverseAxis(
3229 const QueryLoc& loc_,
3230 enum ParseConstants::axis_kind_t _axis)
3231 :
3232 parsenode(loc_),
3233 axis(_axis)
3234 {}
3235
3236
accept(parsenode_visitor & v) const3237 void ReverseAxis::accept( parsenode_visitor &v ) const
3238 {
3239 BEGIN_VISITOR();
3240 END_VISITOR();
3241 }
3242
3243
3244 /*******************************************************************************
3245
3246 [77] AbbrevReverseStep ::= folded into [75]
3247
3248 ********************************************************************************/
3249
3250
3251 /*******************************************************************************
3252
3253 [78] NodeTest ::= KindTest | NameTest
3254
3255 ********************************************************************************/
3256
3257
3258 /*******************************************************************************
3259
3260 [79] NameTest ::= QNAME | Wildcard
3261
3262 ********************************************************************************/
NameTest(const QueryLoc & loc,rchandle<QName> qname)3263 NameTest::NameTest(const QueryLoc& loc, rchandle<QName> qname)
3264 :
3265 parsenode(loc),
3266 theQName(qname),
3267 theWildcard(NULL)
3268 {}
3269
3270
NameTest(const QueryLoc & loc,rchandle<Wildcard> wild)3271 NameTest::NameTest(const QueryLoc& loc, rchandle<Wildcard> wild)
3272 :
3273 parsenode(loc),
3274 theQName(NULL),
3275 theWildcard(wild)
3276 {}
3277
3278
accept(parsenode_visitor & v) const3279 void NameTest::accept( parsenode_visitor &v ) const
3280 {
3281 BEGIN_VISITOR();
3282 END_VISITOR();
3283 }
3284
3285
3286 /*******************************************************************************
3287
3288 [80] Wildcard ::= STAR | ELEM_WILDCARD | PREFIX_WILDCARD
3289
3290 ********************************************************************************/
Wildcard(const QueryLoc & loc,const zstring & nsOrPrefix,const zstring & lname,enum ParseConstants::wildcard_t kind,bool isEQnameMatch)3291 Wildcard::Wildcard(
3292 const QueryLoc& loc,
3293 const zstring& nsOrPrefix,
3294 const zstring& lname,
3295 enum ParseConstants::wildcard_t kind,
3296 bool isEQnameMatch)
3297 :
3298 parsenode(loc),
3299 theKind(kind),
3300 theNsOrPrefix(nsOrPrefix),
3301 theLocalName(lname),
3302 theIsEQnameMatch(isEQnameMatch)
3303 {
3304 }
3305
3306
accept(parsenode_visitor & v) const3307 void Wildcard::accept( parsenode_visitor &v ) const
3308 {
3309 BEGIN_VISITOR();
3310 END_VISITOR();
3311 }
3312
3313
3314 /*******************************************************************************
3315
3316 [81] FilterExpr ::= PrimaryExpr PredicateList?
3317
3318 ********************************************************************************/
3319
FilterExpr(const QueryLoc & loc_,rchandle<exprnode> _primary_h,rchandle<PredicateList> _pred_list_h)3320 FilterExpr::FilterExpr(
3321 const QueryLoc& loc_,
3322 rchandle<exprnode> _primary_h,
3323 rchandle<PredicateList> _pred_list_h)
3324 :
3325 exprnode(loc_),
3326 primary_h(_primary_h),
3327 pred_list_h(_pred_list_h),
3328 theIsPathStep(false)
3329 {}
3330
3331
accept(parsenode_visitor & v) const3332 void FilterExpr::accept( parsenode_visitor &v ) const
3333 {
3334 BEGIN_VISITOR();
3335
3336 ACCEPT (primary_h);
3337 v.post_primary_visit(*this, visitor_state);
3338 ACCEPT (pred_list_h);
3339
3340 END_VISITOR();
3341 }
3342
3343
3344 // [82] PredicateList
3345
PredicateList(const QueryLoc & loc_)3346 PredicateList::PredicateList(
3347 const QueryLoc& loc_)
3348 :
3349 parsenode(loc_)
3350 {}
3351
3352
accept(parsenode_visitor & v) const3353 void PredicateList::accept( parsenode_visitor &v ) const
3354 {
3355 BEGIN_VISITOR();
3356
3357 for (std::vector<rchandle<exprnode> >::const_iterator it = pred_hv.begin();
3358 it!=pred_hv.end(); ++it)
3359 {
3360 const exprnode* e_p = &**it;
3361 ZORBA_ASSERT(e_p!=NULL);
3362 v.pre_predicate_visit(*this, visitor_state);
3363 e_p->accept(v);
3364 v.post_predicate_visit(*this, visitor_state);
3365 }
3366 END_VISITOR();
3367 }
3368
3369
3370 // [83] Predicate
3371 // --------------
3372
3373 // [84] PrimaryExpr
3374 // ----------------
3375
3376 // [85] Literal
3377 // ------------
Literal(exprnode * expression)3378 Literal::Literal(exprnode* expression)
3379 :
3380 exprnode(expression->get_location()),
3381 numeric_literal(NULL),
3382 string_literal(NULL),
3383 type((LITERAL_TYPE)0)
3384 {
3385 StringLiteral* sl = dynamic_cast<StringLiteral*>(expression);
3386 if (sl != NULL)
3387 {
3388 string_literal = sl;
3389 type = (LITERAL_TYPE)1;
3390 }
3391 else
3392 numeric_literal = expression;
3393 }
3394
accept(parsenode_visitor & v) const3395 void Literal::accept( parsenode_visitor &v ) const
3396 {
3397 BEGIN_VISITOR();
3398 END_VISITOR();
3399 }
3400
3401
3402 // [86] NumericLiteral
3403 // -------------------
accept(parsenode_visitor & v) const3404 void NumericLiteral::accept( parsenode_visitor &v ) const
3405 {
3406 BEGIN_VISITOR();
3407 END_VISITOR();
3408 }
3409
3410
3411 // [87] VarRef
3412 // -----------
VarRef(const QueryLoc & loc,rchandle<QName> name)3413 VarRef::VarRef(
3414 const QueryLoc& loc,
3415 rchandle<QName> name)
3416 :
3417 exprnode(loc),
3418 theName(name)
3419 {
3420 }
3421
3422
accept(parsenode_visitor & v) const3423 void VarRef::accept( parsenode_visitor &v ) const
3424 {
3425 BEGIN_VISITOR();
3426 END_VISITOR();
3427 }
3428
3429
3430 // [88] VarName
3431 // ------------
3432
3433
3434 // [89] ParenthesizedExpr
3435 // ----------------------
ParenthesizedExpr(const QueryLoc & loc_,rchandle<exprnode> _expr_h)3436 ParenthesizedExpr::ParenthesizedExpr(
3437 const QueryLoc& loc_,
3438 rchandle<exprnode> _expr_h)
3439 :
3440 exprnode(loc_),
3441 expr_h(_expr_h)
3442 {}
3443
3444
3445 //-ParenthesizedExpr::
3446
accept(parsenode_visitor & v) const3447 void ParenthesizedExpr::accept( parsenode_visitor &v ) const
3448 {
3449 BEGIN_VISITOR();
3450 ACCEPT (expr_h);
3451 END_VISITOR();
3452 }
3453
3454
3455 // [90] ContextItemExpr
3456 // --------------------
ContextItemExpr(const QueryLoc & loc_,bool _placeholder)3457 ContextItemExpr::ContextItemExpr(
3458 const QueryLoc& loc_, bool _placeholder)
3459 :
3460 exprnode(loc_),
3461 placeholder(_placeholder)
3462 {}
3463
3464
3465 //-ContextItemExpr::
3466
accept(parsenode_visitor & v) const3467 void ContextItemExpr::accept( parsenode_visitor &v ) const
3468 {
3469 BEGIN_VISITOR();
3470 END_VISITOR();
3471 }
3472
3473
3474 // [91] OrderedExpr
3475 // ----------------
3476
OrderedExpr(const QueryLoc & loc_,rchandle<exprnode> _expr_h)3477 OrderedExpr::OrderedExpr(
3478 const QueryLoc& loc_,
3479 rchandle<exprnode> _expr_h)
3480 :
3481 exprnode(loc_),
3482 expr_h(_expr_h)
3483 {}
3484
3485
3486 //-OrderedExpr::
3487
accept(parsenode_visitor & v) const3488 void OrderedExpr::accept( parsenode_visitor &v ) const
3489 {
3490 BEGIN_VISITOR();
3491 ACCEPT (expr_h);
3492 END_VISITOR();
3493 }
3494
3495
3496 // [92] UnorderedExpr
3497 // ------------------
UnorderedExpr(const QueryLoc & loc_,rchandle<exprnode> _expr_h)3498 UnorderedExpr::UnorderedExpr(
3499 const QueryLoc& loc_,
3500 rchandle<exprnode> _expr_h)
3501 :
3502 exprnode(loc_),
3503 expr_h(_expr_h)
3504 {}
3505
3506
3507 //-UnorderedExpr::
3508
accept(parsenode_visitor & v) const3509 void UnorderedExpr::accept( parsenode_visitor &v ) const
3510 {
3511 BEGIN_VISITOR();
3512 ACCEPT (expr_h);
3513 END_VISITOR();
3514 }
3515
3516
3517 // [93] FunctionCall
3518 // -----------------
3519
FunctionCall(const QueryLoc & loc_,rchandle<QName> _fname_h,rchandle<ArgList> _arg_list_h)3520 FunctionCall::FunctionCall(
3521 const QueryLoc& loc_,
3522 rchandle<QName> _fname_h,
3523 rchandle<ArgList> _arg_list_h)
3524 :
3525 exprnode(loc_),
3526 fname_h(_fname_h),
3527 arg_list_h(_arg_list_h)
3528 {}
3529
3530
3531 //-FunctionCall::
3532
accept(parsenode_visitor & v) const3533 void FunctionCall::accept( parsenode_visitor &v ) const
3534 {
3535 BEGIN_VISITOR();
3536 //fname_h->accept(v);
3537 ACCEPT (arg_list_h);
3538 END_VISITOR();
3539 }
3540
3541
3542 // [93a] ArgList
3543 // -------------
ArgList(const QueryLoc & loc_)3544 ArgList::ArgList(
3545 const QueryLoc& loc_)
3546 :
3547 parsenode(loc_)
3548 {
3549 }
3550
3551
3552 //-ArgList::
3553
accept(parsenode_visitor & v) const3554 void ArgList::accept( parsenode_visitor &v ) const
3555 {
3556 BEGIN_VISITOR();
3557 std::vector<rchandle<exprnode> >::const_iterator it = arg_hv.begin();
3558 for (; it!=arg_hv.end(); ++it) {
3559 const exprnode* e_p = &**it;
3560 ACCEPT_CHK (e_p);
3561 }
3562 END_VISITOR();
3563 }
3564
3565
3566 // [94] Constructor
3567 // ----------------
3568
3569 /*******************************************************************************
3570 EnclosedExpr ::= "{" Expr "}"
3571 ********************************************************************************/
EnclosedExpr(const QueryLoc & loc_,rchandle<exprnode> _expr_h)3572 EnclosedExpr::EnclosedExpr(
3573 const QueryLoc& loc_,
3574 rchandle<exprnode> _expr_h)
3575 :
3576 exprnode(loc_),
3577 expr_h(_expr_h)
3578 {
3579 }
3580
3581
accept(parsenode_visitor & v) const3582 void EnclosedExpr::accept( parsenode_visitor &v ) const
3583 {
3584 BEGIN_VISITOR();
3585 ACCEPT (expr_h);
3586 END_VISITOR();
3587 }
3588
3589
3590 // [95] DirectConstructor
3591 // ----------------------
3592
3593
3594 // [96] DirElemConstructor
3595 // -----------------------
3596
DirElemConstructor(const QueryLoc & loc_,rchandle<QName> _open_name_h,rchandle<QName> _close_name_h,rchandle<DirAttributeList> _attr_list_h,rchandle<DirElemContentList> _dir_content_list_h)3597 DirElemConstructor::DirElemConstructor(
3598 const QueryLoc& loc_,
3599 rchandle<QName> _open_name_h,
3600 rchandle<QName> _close_name_h,
3601 rchandle<DirAttributeList> _attr_list_h,
3602 rchandle<DirElemContentList> _dir_content_list_h)
3603 :
3604 exprnode(loc_),
3605 elem_name_h(_open_name_h),
3606 end_name_h(_close_name_h),
3607 attr_list_h(_attr_list_h),
3608 dir_content_list_h(_dir_content_list_h)
3609 {}
3610
3611
3612 //-DirElemConstructor::
3613
accept(parsenode_visitor & v) const3614 void DirElemConstructor::accept( parsenode_visitor &v ) const
3615 {
3616 BEGIN_VISITOR();
3617 //open_name_h->accept(v);
3618 //close_name_h->accept(v);
3619
3620 if( attr_list_h != NULL )
3621 attr_list_h->accept(v);
3622
3623 ACCEPT (dir_content_list_h);
3624 END_VISITOR();
3625 }
3626
3627
3628 // [96a] DirElemContentList
3629 // ------------------------
DirElemContentList(const QueryLoc & loc_)3630 DirElemContentList::DirElemContentList(
3631 const QueryLoc& loc_)
3632 :
3633 parsenode(loc_)
3634 {}
3635
3636
3637 //-DirElemContentList::
3638
accept(parsenode_visitor & v) const3639 void DirElemContentList::accept( parsenode_visitor &v ) const
3640 {
3641 BEGIN_VISITOR();
3642
3643 std::vector<rchandle<DirElemContent> >::const_reverse_iterator it =
3644 dir_content_hv.rbegin();
3645
3646 const DirElemContent* lPrev = 0;
3647 // To find out if a DirElemContent is boundary whitespace, the current item cannot be accepted till
3648 // the next item (relative to the current item) is passed to check_boundary_whitespace.
3649 v.begin_check_boundary_whitespace();
3650 for (; it!=dir_content_hv.rend(); ++it)
3651 {
3652 const DirElemContent* e_p = &**it;
3653 v.check_boundary_whitespace (*e_p);
3654 if (lPrev != 0) {
3655 ACCEPT_CHK(lPrev);
3656 }
3657 lPrev = e_p;
3658 }
3659 v.end_check_boundary_whitespace();
3660 if (lPrev != 0) {
3661 ACCEPT_CHK(lPrev);
3662 }
3663 END_VISITOR();
3664 }
3665
3666
3667 // [97] DirAttributeList
3668
DirAttributeList(const QueryLoc & loc)3669 DirAttributeList::DirAttributeList(
3670 const QueryLoc& loc)
3671 :
3672 parsenode(loc)
3673 {}
3674
3675
accept(parsenode_visitor & v) const3676 void DirAttributeList::accept( parsenode_visitor &v ) const
3677 {
3678 BEGIN_VISITOR();
3679 std::vector<rchandle<DirAttr> >::const_iterator it = theAttributes.begin();
3680 for (; it != theAttributes.end(); ++it)
3681 {
3682 const parsenode *e_p = &**it;
3683 ACCEPT_CHK (e_p);
3684 }
3685 END_VISITOR();
3686 }
3687
3688
3689 // [97a] DirAttr
3690
DirAttr(const QueryLoc & loc,rchandle<QName> name,rchandle<DirAttributeValue> value)3691 DirAttr::DirAttr(
3692 const QueryLoc& loc,
3693 rchandle<QName> name,
3694 rchandle<DirAttributeValue> value)
3695 :
3696 parsenode(loc),
3697 theName(name),
3698 theValue(value)
3699 {}
3700
3701
accept(parsenode_visitor & v) const3702 void DirAttr::accept( parsenode_visitor &v ) const
3703 {
3704 BEGIN_VISITOR();
3705 ACCEPT(theValue);
3706 END_VISITOR();
3707 }
3708
3709
3710 // [98] DirAttributeValue
3711
DirAttributeValue(const QueryLoc & loc_,rchandle<QuoteAttrContentList> _quot_attr_content_h)3712 DirAttributeValue::DirAttributeValue(
3713 const QueryLoc& loc_,
3714 rchandle<QuoteAttrContentList> _quot_attr_content_h)
3715 :
3716 parsenode(loc_),
3717 quot_attr_content_h(_quot_attr_content_h),
3718 apos_attr_content_h(NULL)
3719 {}
3720
DirAttributeValue(const QueryLoc & loc_,rchandle<AposAttrContentList> _apos_attr_content_h)3721 DirAttributeValue::DirAttributeValue(
3722 const QueryLoc& loc_,
3723 rchandle<AposAttrContentList> _apos_attr_content_h)
3724 :
3725 parsenode(loc_),
3726 quot_attr_content_h(NULL),
3727 apos_attr_content_h(_apos_attr_content_h)
3728 {}
3729
3730
3731 //-DirAttributeValue::
3732
accept(parsenode_visitor & v) const3733 void DirAttributeValue::accept( parsenode_visitor &v ) const
3734 {
3735 BEGIN_VISITOR();
3736 ACCEPT (quot_attr_content_h);
3737 ACCEPT (apos_attr_content_h);
3738 END_VISITOR();
3739 }
3740
3741
3742 // [98a] QuoteAttrContentList
3743 // --------------------------
QuoteAttrContentList(const QueryLoc & loc_)3744 QuoteAttrContentList::QuoteAttrContentList(
3745 const QueryLoc& loc_)
3746 :
3747 parsenode(loc_)
3748 {}
3749
3750
3751 //-QuoteAttrContentList::
3752
accept(parsenode_visitor & v) const3753 void QuoteAttrContentList::accept( parsenode_visitor &v ) const
3754 {
3755 BEGIN_VISITOR();
3756
3757 std::vector<rchandle<QuoteAttrValueContent> >::const_reverse_iterator it =
3758 quot_atval_content_hv.rbegin();
3759
3760 for (; it!=quot_atval_content_hv.rend(); ++it)
3761 {
3762 const parsenode *e_p = &**it;
3763 ACCEPT_CHK (e_p);
3764 }
3765 END_VISITOR();
3766 }
3767
3768
3769 // [98b] AposAttrContentList
3770 // -------------------------
AposAttrContentList(const QueryLoc & loc_)3771 AposAttrContentList::AposAttrContentList(
3772 const QueryLoc& loc_)
3773 :
3774 parsenode(loc_)
3775 {}
3776
3777
3778 //-AposAttrContentList::
3779
accept(parsenode_visitor & v) const3780 void AposAttrContentList::accept( parsenode_visitor &v ) const
3781 {
3782 BEGIN_VISITOR();
3783
3784 std::vector<rchandle<AposAttrValueContent> >::const_reverse_iterator it =
3785 apos_atval_content_hv.rbegin();
3786
3787 for (; it!=apos_atval_content_hv.rend(); ++it)
3788 {
3789 const parsenode *e_p = &**it;
3790 ACCEPT_CHK (e_p);
3791 }
3792 END_VISITOR();
3793 }
3794
3795
3796 // [99] QuotAttrValueContent
3797 // -------------------------
QuoteAttrValueContent(const QueryLoc & loc_,zstring _quot_atcontent)3798 QuoteAttrValueContent::QuoteAttrValueContent(
3799 const QueryLoc& loc_,
3800 zstring _quot_atcontent)
3801 :
3802 parsenode(loc_),
3803 quot_atcontent(_quot_atcontent),
3804 common_content_h(NULL)
3805 {}
3806
QuoteAttrValueContent(const QueryLoc & loc_,rchandle<CommonContent> _common_content_h)3807 QuoteAttrValueContent::QuoteAttrValueContent(
3808 const QueryLoc& loc_,
3809 rchandle<CommonContent> _common_content_h)
3810 :
3811 parsenode(loc_),
3812 quot_atcontent(""),
3813 common_content_h(_common_content_h)
3814 {}
3815
3816
3817 //-QuoteAttrValueContent::
3818
accept(parsenode_visitor & v) const3819 void QuoteAttrValueContent::accept( parsenode_visitor &v ) const
3820 {
3821 BEGIN_VISITOR();
3822 ACCEPT (common_content_h);
3823 END_VISITOR();
3824 }
3825
3826
3827 // [100] AposAttrValueContent
3828 // --------------------------
AposAttrValueContent(const QueryLoc & loc_,zstring _apos_atcontent)3829 AposAttrValueContent::AposAttrValueContent(
3830 const QueryLoc& loc_,
3831 zstring _apos_atcontent)
3832 :
3833 parsenode(loc_),
3834 apos_atcontent(_apos_atcontent),
3835 common_content_h(NULL)
3836 {}
3837
AposAttrValueContent(const QueryLoc & loc_,rchandle<CommonContent> _common_content_h)3838 AposAttrValueContent::AposAttrValueContent(
3839 const QueryLoc& loc_,
3840 rchandle<CommonContent> _common_content_h)
3841 :
3842 parsenode(loc_),
3843 apos_atcontent(""),
3844 common_content_h(_common_content_h)
3845 {}
3846
3847
3848 //-AposAttrValueContent::
3849
accept(parsenode_visitor & v) const3850 void AposAttrValueContent::accept( parsenode_visitor &v ) const
3851 {
3852 BEGIN_VISITOR();
3853 ACCEPT (common_content_h);
3854 END_VISITOR();
3855 }
3856
3857
3858 // [101] DirElemContent
3859 // --------------------
DirElemContent(const QueryLoc & loc_,rchandle<exprnode> _direct_cons_h)3860 DirElemContent::DirElemContent(
3861 const QueryLoc& loc_,
3862 rchandle<exprnode> _direct_cons_h)
3863 :
3864 exprnode(loc_),
3865 direct_cons_h(_direct_cons_h)
3866 {}
3867
DirElemContent(const QueryLoc & loc_,zstring _elem_content)3868 DirElemContent::DirElemContent(
3869 const QueryLoc& loc_,
3870 zstring _elem_content)
3871 :
3872 exprnode(loc_),
3873 elem_content(_elem_content)
3874 {}
3875
DirElemContent(const QueryLoc & loc_,rchandle<CDataSection> _cdata_h)3876 DirElemContent::DirElemContent(
3877 const QueryLoc& loc_,
3878 rchandle<CDataSection> _cdata_h)
3879 :
3880 exprnode(loc_),
3881 cdata_h(_cdata_h)
3882 {}
3883
DirElemContent(const QueryLoc & loc_,rchandle<CommonContent> _common_content_h)3884 DirElemContent::DirElemContent(
3885 const QueryLoc& loc_,
3886 rchandle<CommonContent> _common_content_h)
3887 :
3888 exprnode(loc_),
3889 common_content_h(_common_content_h)
3890 {}
3891
3892
3893 //-DirElemContent::
3894
accept(parsenode_visitor & v) const3895 void DirElemContent::accept( parsenode_visitor &v ) const
3896 {
3897 BEGIN_VISITOR();
3898
3899 ACCEPT (direct_cons_h);
3900
3901 ACCEPT (cdata_h);
3902
3903 ACCEPT (common_content_h);
3904 END_VISITOR();
3905 }
3906
3907
3908 // [102] CommonContent
3909 // -------------------
CommonContent(const QueryLoc & loc_,enum ParseConstants::common_content_t _type,zstring const & _ref)3910 CommonContent::CommonContent(
3911 const QueryLoc& loc_,
3912 enum ParseConstants::common_content_t _type,
3913 zstring const &_ref)
3914 :
3915 exprnode(loc_),
3916 type(_type),
3917 ref(_ref),
3918 expr_h(NULL)
3919 {}
3920
CommonContent(const QueryLoc & loc_,rchandle<EnclosedExpr> _expr_h)3921 CommonContent::CommonContent(
3922 const QueryLoc& loc_,
3923 rchandle<EnclosedExpr> _expr_h)
3924 :
3925 exprnode(loc_),
3926 type(ParseConstants::cont_expr),
3927 ref(""),
3928 expr_h(_expr_h)
3929 {}
3930
CommonContent(const QueryLoc & loc_,enum ParseConstants::common_content_t _type)3931 CommonContent::CommonContent(
3932 const QueryLoc& loc_,
3933 enum ParseConstants::common_content_t _type)
3934 :
3935 exprnode(loc_),
3936 type(_type),
3937 ref(""),
3938 expr_h(NULL)
3939 {}
3940
3941
3942 //-CommonContent::
3943
accept(parsenode_visitor & v) const3944 void CommonContent::accept( parsenode_visitor &v ) const
3945 {
3946 BEGIN_VISITOR();
3947 ACCEPT (expr_h);
3948 END_VISITOR();
3949 }
3950
3951
3952 // [103] DirCommentConstructor
3953 // ---------------------------
DirCommentConstructor(const QueryLoc & loc_,zstring const & _comment)3954 DirCommentConstructor::DirCommentConstructor(
3955 const QueryLoc& loc_,
3956 zstring const& _comment)
3957 :
3958 exprnode(loc_),
3959 comment(_comment)
3960 {}
3961
3962
3963 //-DirCommentConstructor::
3964
accept(parsenode_visitor & v) const3965 void DirCommentConstructor::accept( parsenode_visitor &v ) const
3966 {
3967 BEGIN_VISITOR();
3968 END_VISITOR();
3969 }
3970
3971
3972 // [104] DirCommentContents
3973 // ------------------------
3974 /* lexical rule */
3975
3976
3977 // [105] DirPIConstructor
3978 // ----------------------
DirPIConstructor(const QueryLoc & loc_,zstring const & _pi_target)3979 DirPIConstructor::DirPIConstructor(
3980 const QueryLoc& loc_,
3981 zstring const& _pi_target)
3982 :
3983 exprnode(loc_),
3984 pi_target(_pi_target),
3985 pi_content("")
3986 {}
3987
DirPIConstructor(const QueryLoc & loc_,zstring const & _pi_target,zstring const & _pi_content)3988 DirPIConstructor::DirPIConstructor(
3989 const QueryLoc& loc_,
3990 zstring const& _pi_target,
3991 zstring const& _pi_content)
3992 :
3993 exprnode(loc_),
3994 pi_target(_pi_target),
3995 pi_content(_pi_content)
3996 {}
3997
3998
3999 //-DirPIConstructor::
4000
accept(parsenode_visitor & v) const4001 void DirPIConstructor::accept( parsenode_visitor &v ) const
4002 {
4003 BEGIN_VISITOR();
4004 END_VISITOR();
4005 }
4006
4007
4008 // [106] DirPIContents
4009 // -------------------
4010 /* lexical rule */
4011
4012
4013 // [107] CDataSection
4014 // ------------------
CDataSection(const QueryLoc & loc_,zstring const & _cdata_content)4015 CDataSection::CDataSection(
4016 const QueryLoc& loc_,
4017 zstring const& _cdata_content)
4018 :
4019 exprnode(loc_),
4020 cdata_content(_cdata_content)
4021 {}
4022
4023
4024 //-CDataSection::
4025
accept(parsenode_visitor & v) const4026 void CDataSection::accept( parsenode_visitor &v ) const
4027 {
4028 BEGIN_VISITOR();
4029 END_VISITOR();
4030 }
4031
4032
4033 // [108] CDataSectionContents
4034 // --------------------------
4035 /* lexical rule */
4036
4037
4038 // [109] ComputedConstructor
4039 // -------------------------
4040
4041
4042 // [110] CompDocConstructor
4043 // ------------------------
CompDocConstructor(const QueryLoc & loc_,rchandle<exprnode> _expr_h)4044 CompDocConstructor::CompDocConstructor(
4045 const QueryLoc& loc_,
4046 rchandle<exprnode> _expr_h)
4047 :
4048 exprnode(loc_),
4049 expr_h(_expr_h)
4050 {}
4051
4052
accept(parsenode_visitor & v) const4053 void CompDocConstructor::accept( parsenode_visitor &v ) const
4054 {
4055 BEGIN_VISITOR();
4056 ACCEPT (expr_h);
4057 END_VISITOR();
4058 }
4059
4060
4061 // [111] CompElemConstructor
4062
CompElemConstructor(const QueryLoc & loc_,rchandle<exprnode> _qname_expr_h,rchandle<exprnode> _content_expr_h)4063 CompElemConstructor::CompElemConstructor(
4064 const QueryLoc& loc_,
4065 rchandle<exprnode> _qname_expr_h,
4066 rchandle<exprnode> _content_expr_h)
4067 :
4068 exprnode(loc_),
4069 qname_expr_h(_qname_expr_h),
4070 content_expr_h(_content_expr_h)
4071 {}
4072
4073
accept(parsenode_visitor & v) const4074 void CompElemConstructor::accept( parsenode_visitor &v ) const
4075 {
4076 BEGIN_VISITOR();
4077 if (dynamic_cast<QName*>(qname_expr_h.getp()) == NULL)
4078 ACCEPT(qname_expr_h);
4079 ACCEPT(content_expr_h);
4080 END_VISITOR();
4081 }
4082
4083
4084 // [113] CompAttrConstructor
4085
CompAttrConstructor(const QueryLoc & loc_,rchandle<exprnode> _qname_expr_h,rchandle<exprnode> _val_expr_h)4086 CompAttrConstructor::CompAttrConstructor(
4087 const QueryLoc& loc_,
4088 rchandle<exprnode> _qname_expr_h,
4089 rchandle<exprnode> _val_expr_h)
4090 :
4091 exprnode(loc_),
4092 qname_expr_h(_qname_expr_h),
4093 val_expr_h(_val_expr_h)
4094 {}
4095
4096
accept(parsenode_visitor & v) const4097 void CompAttrConstructor::accept( parsenode_visitor &v ) const
4098 {
4099 BEGIN_VISITOR();
4100 if (dynamic_cast<QName*>(qname_expr_h.getp()) == NULL)
4101 ACCEPT(qname_expr_h);
4102 ACCEPT(val_expr_h);
4103 END_VISITOR();
4104 }
4105
4106
4107 // [114] CompTextConstructor
4108
CompTextConstructor(const QueryLoc & loc_,rchandle<exprnode> _text_expr_h)4109 CompTextConstructor::CompTextConstructor(
4110 const QueryLoc& loc_,
4111 rchandle<exprnode> _text_expr_h)
4112 :
4113 exprnode(loc_),
4114 text_expr_h(_text_expr_h)
4115 {}
4116
4117
accept(parsenode_visitor & v) const4118 void CompTextConstructor::accept( parsenode_visitor &v ) const
4119 {
4120 BEGIN_VISITOR();
4121 ACCEPT (text_expr_h);
4122 END_VISITOR();
4123 }
4124
4125
4126 // [115] CompCommentConstructor
4127
CompCommentConstructor(const QueryLoc & loc_,rchandle<exprnode> _comment_expr_h)4128 CompCommentConstructor::CompCommentConstructor(
4129 const QueryLoc& loc_,
4130 rchandle<exprnode> _comment_expr_h)
4131 :
4132 exprnode(loc_),
4133 comment_expr_h(_comment_expr_h)
4134 {}
4135
4136
4137 //-CompCommentConstructor::
4138
accept(parsenode_visitor & v) const4139 void CompCommentConstructor::accept( parsenode_visitor &v ) const
4140 {
4141 BEGIN_VISITOR();
4142 ACCEPT (comment_expr_h);
4143 END_VISITOR();
4144 }
4145
4146
4147 // [116] CompPIConstructor
4148 // -----------------------
CompPIConstructor(const QueryLoc & loc_,zstring const & _target,rchandle<exprnode> _content_expr_h)4149 CompPIConstructor::CompPIConstructor(
4150 const QueryLoc& loc_,
4151 zstring const& _target,
4152 rchandle<exprnode> _content_expr_h)
4153 :
4154 exprnode(loc_),
4155 target(_target),
4156 target_expr_h(NULL),
4157 content_expr_h(_content_expr_h)
4158 {}
4159
CompPIConstructor(const QueryLoc & loc_,rchandle<exprnode> _target_expr_h,rchandle<exprnode> _content_expr_h)4160 CompPIConstructor::CompPIConstructor(
4161 const QueryLoc& loc_,
4162 rchandle<exprnode> _target_expr_h,
4163 rchandle<exprnode> _content_expr_h)
4164 :
4165 exprnode(loc_),
4166 target(""),
4167 target_expr_h(_target_expr_h),
4168 content_expr_h(_content_expr_h)
4169 {}
4170
4171
4172 //-CompPIConstructor::
4173
accept(parsenode_visitor & v) const4174 void CompPIConstructor::accept( parsenode_visitor &v ) const
4175 {
4176 BEGIN_VISITOR();
4177 ACCEPT (target_expr_h);
4178 ACCEPT (content_expr_h);
4179 END_VISITOR();
4180 }
4181
4182
4183 // [117] SingleType
4184 // ----------------
SingleType(const QueryLoc & loc_,rchandle<AtomicType> _atomic_type_h,bool _hook_b)4185 SingleType::SingleType(
4186 const QueryLoc& loc_,
4187 rchandle<AtomicType> _atomic_type_h,
4188 bool _hook_b)
4189 :
4190 parsenode(loc_),
4191 atomic_type_h(_atomic_type_h),
4192 hook_b(_hook_b)
4193 {}
4194
4195
accept(parsenode_visitor & v) const4196 void SingleType::accept( parsenode_visitor &v ) const
4197 {
4198 BEGIN_VISITOR();
4199 ACCEPT (atomic_type_h);
4200 END_VISITOR();
4201 }
4202
4203
4204 // [119] SequenceType
4205 // ------------------
SequenceType(const QueryLoc & loc_,rchandle<parsenode> _itemtype_h,rchandle<OccurrenceIndicator> _occur_h)4206 SequenceType::SequenceType(
4207 const QueryLoc& loc_,
4208 rchandle<parsenode> _itemtype_h,
4209 rchandle<OccurrenceIndicator> _occur_h)
4210 :
4211 parsenode(loc_),
4212 itemtype_h(_itemtype_h),
4213 occur_h(_occur_h)
4214 {}
4215
4216
4217 //-SequenceType::
4218
accept(parsenode_visitor & v) const4219 void SequenceType::accept( parsenode_visitor &v ) const
4220 {
4221 BEGIN_VISITOR();
4222 ACCEPT (itemtype_h);
4223 ACCEPT (occur_h);
4224 END_VISITOR();
4225 }
4226
4227
4228 // [120] OccurrenceIndicator
4229 // -------------------------
OccurrenceIndicator(const QueryLoc & loc_,enum ParseConstants::occurrence_t _type)4230 OccurrenceIndicator::OccurrenceIndicator(
4231 const QueryLoc& loc_,
4232 enum ParseConstants::occurrence_t _type)
4233 :
4234 parsenode(loc_),
4235 type(_type)
4236 {}
4237
4238
4239 //-OccurrenceIndicator::
4240
accept(parsenode_visitor & v) const4241 void OccurrenceIndicator::accept( parsenode_visitor &v ) const
4242 {
4243 BEGIN_VISITOR();
4244 END_VISITOR();
4245 }
4246
4247
4248 // [121] ItemType
4249 // --------------
ItemType(const QueryLoc & loc_,bool _item_test_b)4250 ItemType::ItemType(
4251 const QueryLoc& loc_,
4252 bool _item_test_b)
4253 :
4254 parsenode(loc_),
4255 item_test_b(_item_test_b)
4256 {}
4257
ItemType(const QueryLoc & loc_)4258 ItemType::ItemType(
4259 const QueryLoc& loc_)
4260 :
4261 parsenode(loc_),
4262 item_test_b(false)
4263 {}
4264
4265
4266 //-ItemType::
4267
accept(parsenode_visitor & v) const4268 void ItemType::accept( parsenode_visitor &v ) const
4269 {
4270 BEGIN_VISITOR();
4271 END_VISITOR();
4272 }
4273
4274
accept(parsenode_visitor & v) const4275 void StructuredItemType::accept(parsenode_visitor& v) const
4276 {
4277 BEGIN_VISITOR();
4278 END_VISITOR();
4279 }
4280
4281
4282 // [122] AtomicType
4283 // ----------------
AtomicType(const QueryLoc & loc_,rchandle<QName> _qname_h)4284 AtomicType::AtomicType(
4285 const QueryLoc& loc_,
4286 rchandle<QName> _qname_h)
4287 :
4288 parsenode(loc_),
4289 qname_h(_qname_h)
4290 {}
4291
4292
4293 //-AtomicType::
4294
accept(parsenode_visitor & v) const4295 void AtomicType::accept( parsenode_visitor &v ) const
4296 {
4297 BEGIN_VISITOR();
4298 //qname_h->accept(v);
4299 END_VISITOR();
4300 }
4301
4302
4303 // [123] KindTest
4304 // --------------
4305
4306
4307 // [124] AnyKindTest
4308 // -----------------
AnyKindTest(const QueryLoc & loc_)4309 AnyKindTest::AnyKindTest(
4310 const QueryLoc& loc_)
4311 :
4312 parsenode(loc_)
4313 {}
4314
4315
accept(parsenode_visitor & v) const4316 void AnyKindTest::accept( parsenode_visitor &v ) const
4317 {
4318 BEGIN_VISITOR();
4319 END_VISITOR();
4320 }
4321
4322
4323 // [125] DocumentTest
4324 // ------------------
DocumentTest(const QueryLoc & loc)4325 DocumentTest::DocumentTest(const QueryLoc& loc)
4326 :
4327 parsenode(loc),
4328 elem_test_h(NULL),
4329 schema_elem_test_h(NULL)
4330 {
4331 }
4332
DocumentTest(const QueryLoc & loc,rchandle<ElementTest> _elem_test_h)4333 DocumentTest::DocumentTest(const QueryLoc& loc, rchandle<ElementTest> _elem_test_h)
4334 :
4335 parsenode(loc),
4336 elem_test_h(_elem_test_h),
4337 schema_elem_test_h(NULL)
4338 {
4339 }
4340
DocumentTest(const QueryLoc & loc,rchandle<SchemaElementTest> _schema_elem_test_h)4341 DocumentTest::DocumentTest(
4342 const QueryLoc& loc,
4343 rchandle<SchemaElementTest> _schema_elem_test_h)
4344 :
4345 parsenode(loc),
4346 elem_test_h(NULL),
4347 schema_elem_test_h(_schema_elem_test_h)
4348 {
4349 }
4350
4351
accept(parsenode_visitor & v) const4352 void DocumentTest::accept( parsenode_visitor &v ) const
4353 {
4354 BEGIN_VISITOR();
4355 ACCEPT(elem_test_h);
4356 ACCEPT(schema_elem_test_h);
4357 END_VISITOR();
4358 }
4359
4360
4361 // [126] TextTest
4362 // --------------
TextTest(const QueryLoc & loc_)4363 TextTest::TextTest(
4364 const QueryLoc& loc_)
4365 :
4366 parsenode(loc_)
4367 {}
4368
4369
accept(parsenode_visitor & v) const4370 void TextTest::accept( parsenode_visitor &v ) const
4371 {
4372 BEGIN_VISITOR();
4373 END_VISITOR();
4374 }
4375
4376
4377 // [127] CommentTest
4378 // -----------------
CommentTest(const QueryLoc & loc_)4379 CommentTest::CommentTest(
4380 const QueryLoc& loc_)
4381 :
4382 parsenode(loc_)
4383 {}
4384
4385
accept(parsenode_visitor & v) const4386 void CommentTest::accept( parsenode_visitor &v ) const
4387 {
4388 BEGIN_VISITOR();
4389 END_VISITOR();
4390 }
4391
4392
4393
4394 // [128] PITest
4395
PITest(const QueryLoc & loc_,zstring const & _target)4396 PITest::PITest(
4397 const QueryLoc& loc_,
4398 zstring const& _target)
4399 :
4400 parsenode(loc_),
4401 target(_target)
4402 {}
4403
4404
accept(parsenode_visitor & v) const4405 void PITest::accept( parsenode_visitor &v ) const
4406 {
4407 BEGIN_VISITOR();
4408 END_VISITOR();
4409 }
4410
4411
4412 // [129] AttributeTest
4413
AttributeTest(const QueryLoc & loc,rchandle<QName> attrName,rchandle<TypeName> typeName)4414 AttributeTest::AttributeTest(
4415 const QueryLoc& loc,
4416 rchandle<QName> attrName,
4417 rchandle<TypeName> typeName)
4418 :
4419 parsenode(loc),
4420 theAttrName(attrName),
4421 theTypeName(typeName)
4422 {}
4423
4424
accept(parsenode_visitor & v) const4425 void AttributeTest::accept( parsenode_visitor &v ) const
4426 {
4427 BEGIN_VISITOR();
4428 END_VISITOR();
4429 }
4430
4431
4432 // [130] AttribNameOrWildcard
4433
4434
4435 // [131] SchemaAttributeTest
4436 // -------------------------
SchemaAttributeTest(const QueryLoc & loc_,rchandle<QName> _attr_h)4437 SchemaAttributeTest::SchemaAttributeTest(
4438 const QueryLoc& loc_,
4439 rchandle<QName> _attr_h)
4440 :
4441 parsenode(loc_),
4442 attr_h(_attr_h)
4443 {}
4444
4445
4446 //-SchemaAttributeTest::
4447
accept(parsenode_visitor & v) const4448 void SchemaAttributeTest::accept( parsenode_visitor &v ) const
4449 {
4450 BEGIN_VISITOR();
4451 //if (attr_h!=NULL) attr_h->accept(v);
4452 END_VISITOR();
4453 }
4454
4455
4456 /*******************************************************************************
4457
4458 ElementTest ::= ELEMENT_LPAR RPAR |
4459 ELEMENT_LPAR ElementNameOrWildcard RPAR |
4460 ELEMENT_LPAR ElementNameOrWildcard COMMA TypeName RPAR |
4461 ELEMENT_LPAR ElementNameOrWildcard COMMA TypeName HOOK RPAR
4462
4463 ********************************************************************************/
ElementTest(const QueryLoc & loc,rchandle<QName> ename,rchandle<TypeName> tname,bool na)4464 ElementTest::ElementTest(
4465 const QueryLoc& loc,
4466 rchandle<QName> ename,
4467 rchandle<TypeName> tname,
4468 bool na)
4469 :
4470 parsenode(loc),
4471 theElementName(ename),
4472 theTypeName(tname),
4473 theNilledAllowed(na)
4474 {}
4475
4476
accept(parsenode_visitor & v) const4477 void ElementTest::accept( parsenode_visitor &v ) const
4478 {
4479 BEGIN_VISITOR();
4480 END_VISITOR();
4481 }
4482
4483
4484 // [135] SchemaElementTest
4485 // -----------------------
SchemaElementTest(const QueryLoc & loc_,rchandle<QName> _elem_h)4486 SchemaElementTest::SchemaElementTest(
4487 const QueryLoc& loc_,
4488 rchandle<QName> _elem_h)
4489 :
4490 parsenode(loc_),
4491 elem_h(_elem_h)
4492 {}
4493
4494
4495 //-SchemaElementTest::
4496
accept(parsenode_visitor & v) const4497 void SchemaElementTest::accept( parsenode_visitor &v ) const
4498 {
4499 BEGIN_VISITOR();
4500 //if (elem_h!=NULL) elem_h->accept(v);
4501 END_VISITOR();
4502 }
4503
4504
4505 /* inlined productions */
4506 /* ------------------- */
4507 // [130] AttribNameOrWildcard ::= AttributeName | STAR
4508 // [132] AttributeDeclaration ::= AttributeName
4509 // [134] ElementNameOrWildcard ::= ElementName | STAR
4510 // [136] ElementDeclaration ::= ElementName
4511 // [137] AttributeName ::= QNAME
4512 // [138] ElementName ::= QNAME
4513
4514
4515 // [139] TypeName
4516 // --------------
TypeName(const QueryLoc & loc_,rchandle<QName> _qname_h)4517 TypeName::TypeName(
4518 const QueryLoc& loc_,
4519 rchandle<QName> _qname_h)
4520 :
4521 parsenode(loc_),
4522 qname_h(_qname_h),
4523 optional_b(false)
4524 {}
4525
TypeName(const QueryLoc & loc_,rchandle<QName> _qname_h,bool _b)4526 TypeName::TypeName(
4527 const QueryLoc& loc_,
4528 rchandle<QName> _qname_h,
4529 bool _b)
4530 :
4531 parsenode(loc_),
4532 qname_h(_qname_h),
4533 optional_b(_b)
4534 {}
4535
4536
4537 //-TypeName::
4538
accept(parsenode_visitor & v) const4539 void TypeName::accept( parsenode_visitor &v ) const
4540 {
4541 BEGIN_VISITOR();
4542 //if (qname_h!=NULL) qname_h->accept(v);
4543 END_VISITOR();
4544 }
4545
accept(parsenode_visitor & v) const4546 void StringConcatExpr::accept( parsenode_visitor &v ) const
4547 {
4548 BEGIN_VISITOR();
4549 ACCEPT (left);
4550 ACCEPT (right);
4551 END_VISITOR();
4552 }
4553
4554 /* lexical rules, see xquery.l */
4555 /* --------------------------- */
4556 // [140] URILiteral
4557 // [141] IntegerLiteral
4558 // [142] DecimalLiteral
4559 // [143] DoubleLiteral
4560
4561
4562 // [144] StringLiteral
4563 // -------------------
StringLiteral(const QueryLoc & loc_,zstring const & _strval)4564 StringLiteral::StringLiteral(
4565 const QueryLoc& loc_,
4566 zstring const& _strval)
4567 :
4568 exprnode(loc_),
4569 strval(_strval)
4570 {}
4571
4572
4573 //-StringLiteral::
4574
accept(parsenode_visitor & v) const4575 void StringLiteral::accept( parsenode_visitor &v ) const
4576 {
4577 BEGIN_VISITOR();
4578 END_VISITOR();
4579 }
4580
4581
4582 /* lexical rules, see xquery.l */
4583 /* --------------------------- */
4584
4585 // [145] PredefinedEntityRef
4586 // [146] EscapeQuot
4587 // [147] EscapeApos
4588 // [148] ElementContentChar
4589 // [149] QuotAttrContentChar
4590 // [150] AposAttrContentChar
4591 // [151] Comment
4592 // [152] PITarget
4593 // [153] CharRef
4594
4595 // [155] NCName
4596 // [156] S (WS)
4597 // [157] Char
4598 // [158] Digits
4599 // [159] CommentContents
4600
4601
4602 // [154] QName
4603 // -----------
QName(const QueryLoc & loc,const zstring & qname,bool isEQName)4604 QName::QName(
4605 const QueryLoc& loc,
4606 const zstring& qname,
4607 bool isEQName)
4608 :
4609 exprnode(loc),
4610 theQName(qname),
4611 theIsEQName(isEQName)
4612 {
4613 zstring::size_type n = qname.rfind(':');
4614
4615 if (n == zstring::npos)
4616 {
4617 theNamespace = "";
4618 thePrefix = "";
4619 theLocalName = qname;
4620 }
4621 else if (theIsEQName)
4622 {
4623 theNamespace = qname.substr(0, n);
4624 thePrefix = "";
4625 theLocalName = qname.substr(n+1);
4626 }
4627 else
4628 {
4629 theNamespace = "";
4630 thePrefix = qname.substr(0, n);
4631 theLocalName = qname.substr(n+1);
4632 }
4633 }
4634
4635
accept(parsenode_visitor & v) const4636 void QName::accept( parsenode_visitor &v ) const
4637 {
4638 BEGIN_VISITOR();
4639 END_VISITOR();
4640 }
4641
4642
operator ==(const QName & other) const4643 bool QName::operator==(const QName& other) const
4644 {
4645 if (theIsEQName != other.theIsEQName)
4646 return false;
4647
4648 if (theIsEQName)
4649 {
4650 return (theLocalName == other.theLocalName &&
4651 theNamespace == other.theNamespace);
4652 }
4653 else
4654 {
4655 return (theLocalName == other.theLocalName &&
4656 thePrefix == other.thePrefix);
4657 }
4658 }
4659
4660
4661 /*
4662 **
4663 ** Update productions
4664 ** [http:://www.w3.org/TR/xqupdate/]
4665 **
4666 */
4667
4668 // [241] RevalidationDecl
4669 // -----------------------
4670
4671 //-RevalidationDecl::
4672
accept(parsenode_visitor & v) const4673 void RevalidationDecl::accept( parsenode_visitor &v ) const
4674 {
4675 BEGIN_VISITOR();
4676 END_VISITOR();
4677 }
4678
4679
4680 // [242] InsertExpr
4681 // ----------------
InsertExpr(const QueryLoc & aLoc,store::UpdateConsts::InsertType aInsertType,rchandle<exprnode> aSourceExpr,rchandle<exprnode> aTargetExpr)4682 InsertExpr::InsertExpr(
4683 const QueryLoc& aLoc,
4684 store::UpdateConsts::InsertType aInsertType,
4685 rchandle<exprnode> aSourceExpr,
4686 rchandle<exprnode> aTargetExpr)
4687 :
4688 exprnode(aLoc),
4689 theInsertType(aInsertType),
4690 theSourceExpr(aSourceExpr),
4691 theTargetExpr(aTargetExpr)
4692 {}
4693
4694
4695 //-InsertExpr::
4696
accept(parsenode_visitor & v) const4697 void InsertExpr::accept( parsenode_visitor &v ) const
4698 {
4699 BEGIN_VISITOR();
4700 ACCEPT(theSourceExpr);
4701 ACCEPT(theTargetExpr);
4702 END_VISITOR();
4703 }
4704
4705
4706 // [243] DeleteExpr
4707 // ----------------
DeleteExpr(const QueryLoc & aLoc,rchandle<exprnode> aTargetExpr)4708 DeleteExpr::DeleteExpr(
4709 const QueryLoc& aLoc,
4710 rchandle<exprnode> aTargetExpr)
4711 :
4712 exprnode(aLoc),
4713 theTargetExpr(aTargetExpr)
4714 {}
4715
4716
4717 //-DeleteExpr::
4718
accept(parsenode_visitor & v) const4719 void DeleteExpr::accept( parsenode_visitor &v ) const
4720 {
4721 BEGIN_VISITOR();
4722 ACCEPT (theTargetExpr);
4723 END_VISITOR();
4724 }
4725
4726
4727 // [244] ReplaceExpr
4728 // -----------------
ReplaceExpr(const QueryLoc & aLoc,store::UpdateConsts::ReplaceType aReplaceType,rchandle<exprnode> aTargetExpr,rchandle<exprnode> aReplaceExpr)4729 ReplaceExpr::ReplaceExpr(
4730 const QueryLoc& aLoc,
4731 store::UpdateConsts::ReplaceType aReplaceType,
4732 rchandle<exprnode> aTargetExpr,
4733 rchandle<exprnode> aReplaceExpr)
4734 :
4735 exprnode(aLoc),
4736 theReplaceType(aReplaceType),
4737 theTargetExpr(aTargetExpr),
4738 theReplaceExpr(aReplaceExpr)
4739 {}
4740
4741
4742 //-ReplaceExpr::
4743
accept(parsenode_visitor & v) const4744 void ReplaceExpr::accept( parsenode_visitor &v ) const
4745 {
4746 BEGIN_VISITOR();
4747 ACCEPT (theTargetExpr);
4748 ACCEPT (theReplaceExpr);
4749 END_VISITOR();
4750 }
4751
4752
4753 // [245] RenameExpr
4754 // ----------------
RenameExpr(const QueryLoc & aLoc,rchandle<exprnode> aTargetExpr,rchandle<exprnode> aNameExpr)4755 RenameExpr::RenameExpr(
4756 const QueryLoc& aLoc,
4757 rchandle<exprnode> aTargetExpr,
4758 rchandle<exprnode> aNameExpr)
4759 :
4760 exprnode(aLoc),
4761 theTargetExpr(aTargetExpr),
4762 theNameExpr(aNameExpr)
4763 {}
4764
4765
4766 //-RenameExpr::
4767
accept(parsenode_visitor & v) const4768 void RenameExpr::accept( parsenode_visitor &v ) const
4769 {
4770 BEGIN_VISITOR();
4771 ACCEPT (theTargetExpr);
4772 ACCEPT (theNameExpr);
4773 END_VISITOR();
4774 }
4775
4776
4777 // [246] SourceExpr
4778 // ----------------
4779 // folded
4780
4781 // [247] TargetExpr
4782 // ----------------
4783 // folded
4784
4785 // [248] NewNameExpr
4786 // -----------------
4787 // folded into [245] RenameExpr
4788
4789
4790 /*******************************************************************************
4791 TransformExpr := "copy" "$" CopyVarList "modify" ExprSingle "return" ExprSingle
4792
4793 CopyVarList := VarBinding | CopyVarList "," "$" VarBinding
4794 ********************************************************************************/
TransformExpr(const QueryLoc & loc,rchandle<CopyVarList> var_list_h,rchandle<exprnode> modifyExpr,rchandle<exprnode> returnExpr)4795 TransformExpr::TransformExpr(
4796 const QueryLoc& loc,
4797 rchandle<CopyVarList> var_list_h,
4798 rchandle<exprnode> modifyExpr,
4799 rchandle<exprnode> returnExpr)
4800 :
4801 exprnode(loc),
4802 var_list(var_list_h),
4803 theModifyExpr(modifyExpr),
4804 theReturnExpr(returnExpr)
4805 {
4806 }
4807
4808
accept(parsenode_visitor & v) const4809 void TransformExpr::accept( parsenode_visitor& v ) const
4810 {
4811 BEGIN_VISITOR();
4812 ACCEPT (var_list);
4813 ACCEPT (theModifyExpr);
4814 ACCEPT (theReturnExpr);
4815 END_VISITOR();
4816 }
4817
4818
CopyVarList(const QueryLoc & loc)4819 CopyVarList::CopyVarList(const QueryLoc& loc)
4820 :
4821 exprnode(loc)
4822 {
4823 }
4824
4825
accept(parsenode_visitor & v) const4826 void CopyVarList::accept( parsenode_visitor& v ) const
4827 {
4828 BEGIN_VISITOR();
4829
4830 std::vector<rchandle<VarBinding> >::const_iterator it;
4831
4832 for (it = var_bindings.begin(); it != var_bindings.end(); ++it)
4833 {
4834 const parsenode *e_p = &**it;
4835 ACCEPT_CHK (e_p);
4836 }
4837 END_VISITOR();
4838 }
4839
4840
VarBinding(const QueryLoc & loc,rchandle<QName> varname,rchandle<exprnode> expr_h)4841 VarBinding::VarBinding(
4842 const QueryLoc& loc,
4843 rchandle<QName> varname,
4844 rchandle<exprnode> expr_h)
4845 :
4846 exprnode(loc),
4847 var_name(varname),
4848 expr(expr_h)
4849 {
4850 }
4851
4852
accept(parsenode_visitor & v) const4853 void VarBinding::accept( parsenode_visitor& v ) const
4854 {
4855 BEGIN_VISITOR();
4856 ACCEPT (expr);
4857 END_VISITOR();
4858 }
4859
4860
4861 // TryExpr
4862 // ---
accept(parsenode_visitor & v) const4863 void TryExpr::accept( parsenode_visitor &v ) const
4864 {
4865 BEGIN_VISITOR();
4866 ACCEPT(theExprSingle);
4867 ACCEPT(theCatchListExpr);
4868 END_VISITOR();
4869 }
4870
4871 // CatchListExpr
4872 // -------------
accept(parsenode_visitor & v) const4873 void CatchListExpr::accept( parsenode_visitor &v ) const
4874 {
4875 BEGIN_VISITOR();
4876 std::vector<rchandle<CatchExpr> >::const_reverse_iterator it = theCatchExprs.rbegin();
4877 for (; it!=theCatchExprs.rend(); ++it)
4878 {
4879 ACCEPT_CHK(*it);
4880 }
4881 END_VISITOR();
4882 }
4883
4884 // CatchExpr
4885 // -----
accept(parsenode_visitor & v) const4886 void CatchExpr::accept( parsenode_visitor &v ) const
4887 {
4888 BEGIN_VISITOR();
4889
4890 for(NameTestList::const_iterator i = theNameTests.begin();
4891 i != theNameTests.end();
4892 ++i)
4893 {
4894 ACCEPT(*i);
4895 }
4896
4897 ACCEPT(theExprSingle);
4898 END_VISITOR();
4899 }
4900
4901
4902
4903 /*
4904 *
4905 * Full-text productions
4906 * [http://www.w3.org/TR/xquery-full-text/]
4907 *
4908 */
4909
FTSelection(QueryLoc const & loc,parsenode const * ftor,pos_filter_list_t * pos_filter_list)4910 FTSelection::FTSelection(
4911 QueryLoc const &loc,
4912 parsenode const *ftor,
4913 pos_filter_list_t *pos_filter_list )
4914 :
4915 FTPrimary( loc ),
4916 ftor_( ftor )
4917 {
4918 ZORBA_ASSERT( ftor );
4919 if ( pos_filter_list )
4920 pos_filter_list_.swap( *pos_filter_list );
4921 }
4922
~FTSelection()4923 FTSelection::~FTSelection() {
4924 delete ftor_;
4925 ztd::delete_ptr_seq( pos_filter_list_ );
4926 }
4927
accept(parsenode_visitor & v) const4928 void FTSelection::accept( parsenode_visitor &v ) const
4929 {
4930 BEGIN_VISITOR();
4931 ACCEPT( ftor_ );
4932 ACCEPT_SEQ( pos_filter_list_t, pos_filter_list_ );
4933 END_VISITOR();
4934 }
4935
4936
FTAnd(QueryLoc const & loc,parsenode const * left,parsenode const * right)4937 FTAnd::FTAnd(
4938 QueryLoc const &loc,
4939 parsenode const *left,
4940 parsenode const *right
4941 ) :
4942 parsenode( loc ),
4943 left_( left ),
4944 right_( right )
4945 {
4946 ZORBA_ASSERT( left );
4947 ZORBA_ASSERT( right );
4948 }
4949
~FTAnd()4950 FTAnd::~FTAnd() {
4951 delete left_;
4952 delete right_;
4953 }
4954
accept(parsenode_visitor & v) const4955 void FTAnd::accept( parsenode_visitor &v ) const
4956 {
4957 BEGIN_VISITOR();
4958 ACCEPT( left_ );
4959 ACCEPT( right_ );
4960 END_VISITOR();
4961 }
4962
4963
FTOr(QueryLoc const & loc,parsenode const * left,parsenode const * right)4964 FTOr::FTOr(
4965 QueryLoc const &loc,
4966 parsenode const *left,
4967 parsenode const *right
4968 ) :
4969 parsenode( loc ),
4970 left_( left ),
4971 right_( right )
4972 {
4973 ZORBA_ASSERT( left );
4974 ZORBA_ASSERT( right );
4975 }
4976
~FTOr()4977 FTOr::~FTOr() {
4978 delete left_;
4979 delete right_;
4980 }
4981
accept(parsenode_visitor & v) const4982 void FTOr::accept( parsenode_visitor &v ) const
4983 {
4984 BEGIN_VISITOR();
4985 ACCEPT( left_ );
4986 ACCEPT( right_ );
4987 END_VISITOR();
4988 }
4989
4990
FTMildNot(QueryLoc const & loc,parsenode const * left,parsenode const * right)4991 FTMildNot::FTMildNot(
4992 QueryLoc const &loc,
4993 parsenode const *left,
4994 parsenode const *right
4995 ) :
4996 parsenode( loc ),
4997 left_( left ),
4998 right_( right )
4999 {
5000 ZORBA_ASSERT( left );
5001 ZORBA_ASSERT( right );
5002 }
5003
~FTMildNot()5004 FTMildNot::~FTMildNot() {
5005 delete left_;
5006 delete right_;
5007 }
5008
accept(parsenode_visitor & v) const5009 void FTMildNot::accept( parsenode_visitor &v ) const
5010 {
5011 BEGIN_VISITOR();
5012 ACCEPT( left_ );
5013 ACCEPT( right_ );
5014 END_VISITOR();
5015 }
5016
5017
FTUnaryNot(QueryLoc const & loc,FTPrimaryWithOptions const * primary_with_options)5018 FTUnaryNot::FTUnaryNot(
5019 QueryLoc const &loc,
5020 FTPrimaryWithOptions const *primary_with_options
5021 ) :
5022 parsenode( loc ),
5023 primary_with_options_( primary_with_options )
5024 {
5025 ZORBA_ASSERT( primary_with_options );
5026 }
5027
~FTUnaryNot()5028 FTUnaryNot::~FTUnaryNot() {
5029 delete primary_with_options_;
5030 }
5031
accept(parsenode_visitor & v) const5032 void FTUnaryNot::accept( parsenode_visitor &v ) const
5033 {
5034 BEGIN_VISITOR();
5035 ACCEPT( primary_with_options_ );
5036 END_VISITOR();
5037 }
5038
5039
FTPrimaryWithOptions(QueryLoc const & loc,FTPrimary const * primary,FTMatchOptions const * match_options,FTWeight const * weight)5040 FTPrimaryWithOptions::FTPrimaryWithOptions(
5041 QueryLoc const &loc,
5042 FTPrimary const *primary,
5043 FTMatchOptions const *match_options,
5044 FTWeight const *weight
5045 ) :
5046 parsenode( loc ),
5047 primary_( primary ),
5048 match_options_( match_options ),
5049 weight_( weight )
5050 {
5051 ZORBA_ASSERT( primary );
5052 }
5053
~FTPrimaryWithOptions()5054 FTPrimaryWithOptions::~FTPrimaryWithOptions() {
5055 delete primary_;
5056 delete match_options_;
5057 delete weight_;
5058 }
5059
accept(parsenode_visitor & v) const5060 void FTPrimaryWithOptions::accept( parsenode_visitor &v ) const
5061 {
5062 BEGIN_VISITOR();
5063 ACCEPT( primary_ );
5064 ACCEPT( match_options_ );
5065 ACCEPT( weight_ );
5066 END_VISITOR();
5067 }
5068
5069
FTMatchOptions(QueryLoc const & loc)5070 FTMatchOptions::FTMatchOptions(
5071 QueryLoc const &loc
5072 ) :
5073 parsenode( loc )
5074 {
5075 }
5076
~FTMatchOptions()5077 FTMatchOptions::~FTMatchOptions() {
5078 ztd::delete_ptr_seq( match_options_ );
5079 }
5080
accept(parsenode_visitor & v) const5081 void FTMatchOptions::accept( parsenode_visitor &v ) const
5082 {
5083 BEGIN_VISITOR();
5084 ACCEPT_SEQ( match_option_list_t, match_options_ );
5085 END_VISITOR();
5086 }
5087
FTWeight(const QueryLoc & loc,exprnode * expr)5088 FTWeight::FTWeight(
5089 const QueryLoc &loc,
5090 exprnode *expr
5091 ) :
5092 parsenode( loc ),
5093 expr_( expr )
5094 {
5095 ZORBA_ASSERT( expr );
5096 }
5097
accept(parsenode_visitor & v) const5098 void FTWeight::accept( parsenode_visitor &v ) const
5099 {
5100 BEGIN_VISITOR();
5101 ACCEPT( expr_ );
5102 END_VISITOR();
5103 }
5104
5105
FTWords(QueryLoc const & loc,FTWordsValue const * words_value,FTAnyallOption const * any_all_option)5106 FTWords::FTWords(
5107 QueryLoc const &loc,
5108 FTWordsValue const *words_value,
5109 FTAnyallOption const *any_all_option
5110 ) :
5111 parsenode( loc ),
5112 words_value_( words_value ),
5113 any_all_option_( any_all_option )
5114 {
5115 ZORBA_ASSERT( words_value );
5116 }
5117
~FTWords()5118 FTWords::~FTWords() {
5119 delete words_value_;
5120 delete any_all_option_;
5121 }
5122
accept(parsenode_visitor & v) const5123 void FTWords::accept( parsenode_visitor &v ) const
5124 {
5125 BEGIN_VISITOR();
5126 ACCEPT( words_value_ );
5127 ACCEPT( any_all_option_ );
5128 END_VISITOR();
5129 }
5130
FTWordsTimes(QueryLoc const & loc,FTWords const * words,FTTimes const * times)5131 FTWordsTimes::FTWordsTimes(
5132 QueryLoc const &loc,
5133 FTWords const *words,
5134 FTTimes const *times
5135 ) :
5136 FTPrimary( loc ),
5137 words_( words ),
5138 times_( times )
5139 {
5140 ZORBA_ASSERT( words );
5141 }
5142
~FTWordsTimes()5143 FTWordsTimes::~FTWordsTimes() {
5144 delete words_;
5145 delete times_;
5146 }
5147
accept(parsenode_visitor & v) const5148 void FTWordsTimes::accept( parsenode_visitor &v ) const {
5149 BEGIN_VISITOR();
5150 ACCEPT( words_ );
5151 ACCEPT( times_ );
5152 END_VISITOR();
5153 }
5154
5155
FTWordsValue(QueryLoc const & loc,StringLiteral * literal,exprnode * expr)5156 FTWordsValue::FTWordsValue(
5157 QueryLoc const &loc,
5158 StringLiteral *literal,
5159 exprnode *expr
5160 ) :
5161 parsenode( loc ),
5162 literal_( literal ),
5163 expr_( expr )
5164 {
5165 ZORBA_ASSERT( literal || expr );
5166 }
5167
accept(parsenode_visitor & v) const5168 void FTWordsValue::accept( parsenode_visitor &v ) const
5169 {
5170 BEGIN_VISITOR();
5171 ACCEPT( literal_ );
5172 ACCEPT( expr_ );
5173 END_VISITOR();
5174 }
5175
5176
FTOrder(QueryLoc const & loc)5177 FTOrder::FTOrder(
5178 QueryLoc const &loc
5179 ) :
5180 FTPosFilter( loc )
5181 {
5182 }
5183
accept(parsenode_visitor & v) const5184 void FTOrder::accept( parsenode_visitor &v ) const
5185 {
5186 BEGIN_VISITOR();
5187 END_VISITOR();
5188 }
5189
5190
FTMatchOption(const QueryLoc & loc)5191 FTMatchOption::FTMatchOption(
5192 const QueryLoc &loc
5193 ) :
5194 parsenode( loc )
5195 {
5196 }
5197
5198
FTCaseOption(QueryLoc const & loc,ft_case_mode::type mode)5199 FTCaseOption::FTCaseOption(
5200 QueryLoc const &loc,
5201 ft_case_mode::type mode
5202 ) :
5203 FTMatchOption( loc ),
5204 mode_( mode )
5205 {
5206 }
5207
accept(parsenode_visitor & v) const5208 void FTCaseOption::accept( parsenode_visitor &v ) const
5209 {
5210 BEGIN_VISITOR();
5211 END_VISITOR();
5212 }
5213
5214
FTDiacriticsOption(QueryLoc const & loc,ft_diacritics_mode::type mode)5215 FTDiacriticsOption::FTDiacriticsOption(
5216 QueryLoc const &loc,
5217 ft_diacritics_mode::type mode
5218 ) :
5219 FTMatchOption( loc ),
5220 mode_( mode )
5221 {
5222 }
5223
accept(parsenode_visitor & v) const5224 void FTDiacriticsOption::accept( parsenode_visitor &v ) const
5225 {
5226 BEGIN_VISITOR();
5227 END_VISITOR();
5228 }
5229
5230
FTStemOption(QueryLoc const & loc,ft_stem_mode::type mode)5231 FTStemOption::FTStemOption(
5232 QueryLoc const &loc,
5233 ft_stem_mode::type mode
5234 ) :
5235 FTMatchOption( loc ),
5236 mode_( mode )
5237 {
5238 }
5239
accept(parsenode_visitor & v) const5240 void FTStemOption::accept( parsenode_visitor &v ) const
5241 {
5242 BEGIN_VISITOR();
5243 END_VISITOR();
5244 }
5245
5246
FTThesaurusOption(QueryLoc const & loc,thesaurus_id_list_t * thesaurus_id_list,bool includes_default,bool no_thesaurus)5247 FTThesaurusOption::FTThesaurusOption(
5248 QueryLoc const &loc,
5249 thesaurus_id_list_t *thesaurus_id_list,
5250 bool includes_default,
5251 bool no_thesaurus
5252 ) :
5253 FTMatchOption( loc ),
5254 includes_default_( includes_default ),
5255 no_thesaurus_( no_thesaurus )
5256 {
5257 if ( thesaurus_id_list )
5258 thesaurus_id_list_.swap( *thesaurus_id_list );
5259 }
5260
~FTThesaurusOption()5261 FTThesaurusOption::~FTThesaurusOption() {
5262 ztd::delete_ptr_seq( thesaurus_id_list_ );
5263 }
5264
5265
accept(parsenode_visitor & v) const5266 void FTThesaurusOption::accept( parsenode_visitor &v ) const
5267 {
5268 BEGIN_VISITOR();
5269 ACCEPT_SEQ( thesaurus_id_list_t, thesaurus_id_list_ );
5270 END_VISITOR();
5271 }
5272
5273
FTThesaurusID(QueryLoc const & loc,zstring const & uri,zstring const & relationship,FTRange const * levels)5274 FTThesaurusID::FTThesaurusID(
5275 QueryLoc const &loc,
5276 zstring const &uri,
5277 zstring const &relationship,
5278 FTRange const *levels
5279 ) :
5280 parsenode( loc ),
5281 uri_( uri ),
5282 relationship_( relationship ),
5283 levels_( levels )
5284 {
5285 }
5286
~FTThesaurusID()5287 FTThesaurusID::~FTThesaurusID() {
5288 delete levels_;
5289 }
5290
5291
accept(parsenode_visitor & v) const5292 void FTThesaurusID::accept( parsenode_visitor &v ) const
5293 {
5294 BEGIN_VISITOR();
5295 ACCEPT( levels_ );
5296 END_VISITOR();
5297 }
5298
5299
FTStopWordOption(QueryLoc const & loc,FTStopWords const * stop_words,incl_excl_list_t * incl_excl_list,ft_stop_words_mode::type mode)5300 FTStopWordOption::FTStopWordOption(
5301 QueryLoc const &loc,
5302 FTStopWords const *stop_words,
5303 incl_excl_list_t *incl_excl_list,
5304 ft_stop_words_mode::type mode
5305 ) :
5306 FTMatchOption( loc ),
5307 stop_words_( stop_words ),
5308 mode_( mode )
5309 {
5310 if ( incl_excl_list )
5311 incl_excl_list_.swap( *incl_excl_list );
5312 }
5313
~FTStopWordOption()5314 FTStopWordOption::~FTStopWordOption() {
5315 delete stop_words_;
5316 ztd::delete_ptr_seq( incl_excl_list_ );
5317 }
5318
5319
accept(parsenode_visitor & v) const5320 void FTStopWordOption::accept( parsenode_visitor &v ) const
5321 {
5322 BEGIN_VISITOR();
5323 ACCEPT( stop_words_ );
5324 ACCEPT_SEQ( incl_excl_list_t, incl_excl_list_ );
5325 END_VISITOR();
5326 }
5327
5328
FTStopWords(QueryLoc const & loc,zstring const & uri,list_t * stop_words)5329 FTStopWords::FTStopWords(
5330 QueryLoc const &loc,
5331 zstring const &uri,
5332 list_t *stop_words
5333 ) :
5334 parsenode( loc ),
5335 uri_( uri )
5336 {
5337 if ( stop_words )
5338 {
5339 stop_words_.swap( *stop_words );
5340 delete stop_words;
5341 }
5342 }
5343
5344
accept(parsenode_visitor & v) const5345 void FTStopWords::accept( parsenode_visitor &v ) const
5346 {
5347 BEGIN_VISITOR();
5348 END_VISITOR();
5349 }
5350
5351
FTStopWordsInclExcl(QueryLoc const & loc,FTStopWords const * stop_words,ft_stop_words_unex::type mode)5352 FTStopWordsInclExcl::FTStopWordsInclExcl(
5353 QueryLoc const &loc,
5354 FTStopWords const *stop_words,
5355 ft_stop_words_unex::type mode
5356 ) :
5357 parsenode( loc ),
5358 stop_words_( stop_words ),
5359 mode_( mode )
5360 {
5361 ZORBA_ASSERT( stop_words );
5362 }
5363
~FTStopWordsInclExcl()5364 FTStopWordsInclExcl::~FTStopWordsInclExcl() {
5365 delete stop_words_;
5366 }
5367
5368
accept(parsenode_visitor & v) const5369 void FTStopWordsInclExcl::accept( parsenode_visitor &v ) const {
5370 BEGIN_VISITOR();
5371 ACCEPT( stop_words_ );
5372 END_VISITOR();
5373 }
5374
5375
FTLanguageOption(QueryLoc const & loc,zstring const & language)5376 FTLanguageOption::FTLanguageOption(
5377 QueryLoc const &loc,
5378 zstring const &language
5379 ) :
5380 FTMatchOption( loc ),
5381 language_( language )
5382 {
5383 }
5384
accept(parsenode_visitor & v) const5385 void FTLanguageOption::accept( parsenode_visitor &v ) const
5386 {
5387 BEGIN_VISITOR();
5388 END_VISITOR();
5389 }
5390
5391
FTWildCardOption(QueryLoc const & loc,ft_wild_card_mode::type mode)5392 FTWildCardOption::FTWildCardOption(
5393 QueryLoc const &loc,
5394 ft_wild_card_mode::type mode
5395 ) :
5396 FTMatchOption( loc ),
5397 mode_( mode )
5398 {
5399 }
5400
accept(parsenode_visitor & v) const5401 void FTWildCardOption::accept( parsenode_visitor &v ) const {
5402 BEGIN_VISITOR();
5403 END_VISITOR();
5404 }
5405
5406
FTContent(QueryLoc const & loc,ft_content_mode::type mode)5407 FTContent::FTContent(
5408 QueryLoc const &loc,
5409 ft_content_mode::type mode
5410 ) :
5411 FTPosFilter( loc ),
5412 mode_( mode )
5413 {
5414 }
5415
accept(parsenode_visitor & v) const5416 void FTContent::accept( parsenode_visitor &v ) const
5417 {
5418 BEGIN_VISITOR();
5419 END_VISITOR();
5420 }
5421
5422
FTAnyallOption(QueryLoc const & loc,ft_anyall_mode::type option)5423 FTAnyallOption::FTAnyallOption(
5424 QueryLoc const &loc,
5425 ft_anyall_mode::type option
5426 ) :
5427 parsenode( loc ),
5428 option_( option )
5429 {
5430 }
5431
accept(parsenode_visitor & v) const5432 void FTAnyallOption::accept( parsenode_visitor &v ) const
5433 {
5434 BEGIN_VISITOR();
5435 END_VISITOR();
5436 }
5437
5438
FTRange(QueryLoc const & loc,ft_range_mode::type mode,exprnode const * expr1,exprnode const * expr2)5439 FTRange::FTRange(
5440 QueryLoc const &loc,
5441 ft_range_mode::type mode,
5442 exprnode const *expr1,
5443 exprnode const *expr2
5444 ) :
5445 parsenode( loc ),
5446 mode_( mode ),
5447 expr1_( expr1 ),
5448 expr2_( expr2 )
5449 {
5450 ZORBA_ASSERT( expr1 );
5451 }
5452
~FTRange()5453 FTRange::~FTRange() {
5454 delete expr1_;
5455 delete expr2_;
5456 }
5457
accept(parsenode_visitor & v) const5458 void FTRange::accept( parsenode_visitor &v ) const
5459 {
5460 BEGIN_VISITOR();
5461 ACCEPT( expr1_ );
5462 ACCEPT( expr2_ );
5463 END_VISITOR();
5464 }
5465
5466
FTDistance(QueryLoc const & loc,FTRange const * distance,FTUnit const * unit)5467 FTDistance::FTDistance(
5468 QueryLoc const &loc,
5469 FTRange const *distance,
5470 FTUnit const *unit
5471 ) :
5472 FTPosFilter( loc ),
5473 distance_( distance ),
5474 unit_( unit )
5475 {
5476 ZORBA_ASSERT( distance );
5477 ZORBA_ASSERT( unit );
5478 }
5479
~FTDistance()5480 FTDistance::~FTDistance() {
5481 delete distance_;
5482 delete unit_;
5483 }
5484
accept(parsenode_visitor & v) const5485 void FTDistance::accept( parsenode_visitor &v ) const
5486 {
5487 BEGIN_VISITOR();
5488 ACCEPT( distance_ );
5489 ACCEPT( unit_ );
5490 END_VISITOR();
5491 }
5492
FTExtensionOption(const QueryLoc & loc,QName * qname,zstring const & value)5493 FTExtensionOption::FTExtensionOption(
5494 const QueryLoc &loc,
5495 QName *qname,
5496 zstring const &value
5497 ) :
5498 FTMatchOption( loc ),
5499 qname_( qname ),
5500 value_( value )
5501 {
5502 ZORBA_ASSERT( qname );
5503 }
5504
accept(parsenode_visitor & v) const5505 void FTExtensionOption::accept( parsenode_visitor &v ) const
5506 {
5507 BEGIN_VISITOR();
5508 ACCEPT( qname_ );
5509 END_VISITOR();
5510 }
5511
FTExtensionSelection(QueryLoc const & loc,rchandle<PragmaList> const & pragmas,FTSelection const * ftselection)5512 FTExtensionSelection::FTExtensionSelection(
5513 QueryLoc const &loc,
5514 rchandle<PragmaList> const &pragmas,
5515 FTSelection const *ftselection
5516 ) :
5517 FTPrimary( loc ),
5518 pragmas_( pragmas ),
5519 ftselection_( ftselection )
5520 {
5521 ZORBA_ASSERT( pragmas_.getp() );
5522 }
5523
~FTExtensionSelection()5524 FTExtensionSelection::~FTExtensionSelection() {
5525 delete ftselection_;
5526 }
5527
accept(parsenode_visitor & v) const5528 void FTExtensionSelection::accept( parsenode_visitor &v ) const
5529 {
5530 BEGIN_VISITOR();
5531 ACCEPT( pragmas_ );
5532 ACCEPT( ftselection_ );
5533 END_VISITOR();
5534 }
5535
5536
FTWindow(QueryLoc const & loc,AdditiveExpr const * window,FTUnit const * unit)5537 FTWindow::FTWindow(
5538 QueryLoc const &loc,
5539 AdditiveExpr const *window,
5540 FTUnit const *unit
5541 ) :
5542 FTPosFilter( loc ),
5543 window_( window ),
5544 unit_( unit )
5545 {
5546 ZORBA_ASSERT( window );
5547 }
5548
~FTWindow()5549 FTWindow::~FTWindow() {
5550 delete window_;
5551 delete unit_;
5552 }
5553
accept(parsenode_visitor & v) const5554 void FTWindow::accept( parsenode_visitor &v ) const
5555 {
5556 BEGIN_VISITOR();
5557 ACCEPT( window_ );
5558 ACCEPT( unit_ );
5559 END_VISITOR();
5560 }
5561
5562
FTTimes(QueryLoc const & loc,FTRange const * range)5563 FTTimes::FTTimes(
5564 QueryLoc const &loc,
5565 FTRange const *range
5566 ) :
5567 parsenode( loc ),
5568 range_( range )
5569 {
5570 ZORBA_ASSERT( range );
5571 }
5572
~FTTimes()5573 FTTimes::~FTTimes() {
5574 delete range_;
5575 }
5576
accept(parsenode_visitor & v) const5577 void FTTimes::accept( parsenode_visitor &v ) const
5578 {
5579 BEGIN_VISITOR();
5580 ACCEPT( range_ );
5581 END_VISITOR();
5582 }
5583
5584
FTScope(QueryLoc const & loc,ft_scope::type scope,FTBigUnit const * big_unit)5585 FTScope::FTScope(
5586 QueryLoc const &loc,
5587 ft_scope::type scope,
5588 FTBigUnit const *big_unit
5589 ) :
5590 FTPosFilter( loc ),
5591 scope_( scope ),
5592 big_unit_( big_unit )
5593 {
5594 ZORBA_ASSERT( big_unit );
5595 }
5596
~FTScope()5597 FTScope::~FTScope() {
5598 delete big_unit_;
5599 }
5600
accept(parsenode_visitor & v) const5601 void FTScope::accept( parsenode_visitor &v ) const
5602 {
5603 BEGIN_VISITOR();
5604 ACCEPT( big_unit_ );
5605 END_VISITOR();
5606 }
5607
5608
FTUnit(QueryLoc const & loc,ft_unit::type unit)5609 FTUnit::FTUnit(
5610 QueryLoc const &loc,
5611 ft_unit::type unit
5612 ) :
5613 parsenode( loc ),
5614 unit_( unit )
5615 {
5616 }
5617
accept(parsenode_visitor & v) const5618 void FTUnit::accept( parsenode_visitor &v ) const
5619 {
5620 BEGIN_VISITOR();
5621 END_VISITOR();
5622 }
5623
5624
FTBigUnit(QueryLoc const & loc,ft_big_unit::type unit)5625 FTBigUnit::FTBigUnit(
5626 QueryLoc const &loc,
5627 ft_big_unit::type unit
5628 ) :
5629 parsenode( loc ),
5630 unit_( unit )
5631 {
5632 }
5633
accept(parsenode_visitor & v) const5634 void FTBigUnit::accept( parsenode_visitor &v ) const
5635 {
5636 BEGIN_VISITOR();
5637 END_VISITOR();
5638 }
5639
5640
FTIgnoreOption(QueryLoc const & loc,exprnode const * expr)5641 FTIgnoreOption::FTIgnoreOption(
5642 QueryLoc const &loc,
5643 exprnode const *expr
5644 ) :
5645 parsenode( loc ),
5646 expr_( expr )
5647 {
5648 ZORBA_ASSERT( expr );
5649 }
5650
~FTIgnoreOption()5651 FTIgnoreOption::~FTIgnoreOption() {
5652 delete expr_;
5653 }
5654
accept(parsenode_visitor & v) const5655 void FTIgnoreOption::accept( parsenode_visitor &v ) const
5656 {
5657 BEGIN_VISITOR();
5658 ACCEPT( expr_ );
5659 END_VISITOR();
5660 }
5661
5662
FTOptionDecl(QueryLoc const & loc,FTMatchOptions const * match_options)5663 FTOptionDecl::FTOptionDecl(
5664 QueryLoc const &loc,
5665 FTMatchOptions const *match_options
5666 ) :
5667 parsenode( loc ),
5668 match_options_( match_options )
5669 {
5670 }
5671
~FTOptionDecl()5672 FTOptionDecl::~FTOptionDecl() {
5673 delete match_options_;
5674 }
5675
accept(parsenode_visitor & v) const5676 void FTOptionDecl::accept( parsenode_visitor &v ) const
5677 {
5678 BEGIN_VISITOR();
5679 ACCEPT( match_options_ );
5680 END_VISITOR();
5681 }
5682
~LiteralFunctionItem()5683 LiteralFunctionItem::~LiteralFunctionItem()
5684 {
5685 delete theArity;
5686 }
5687
accept(parsenode_visitor & v) const5688 void LiteralFunctionItem::accept(parsenode_visitor& v) const
5689 {
5690 BEGIN_VISITOR ();
5691 END_VISITOR ();
5692 }
5693
accept(parsenode_visitor & v) const5694 void InlineFunction::accept(parsenode_visitor& v) const
5695 {
5696 BEGIN_VISITOR ();
5697 ACCEPT (theReturnType);
5698 //ACCEPT (theParamList);
5699 ACCEPT (theEnclosedExpr);
5700 END_VISITOR ();
5701 }
5702
accept(parsenode_visitor & v) const5703 void AnyFunctionTest::accept(parsenode_visitor& v) const
5704 {
5705 BEGIN_VISITOR ();
5706 END_VISITOR ();
5707 }
5708
accept(parsenode_visitor & v) const5709 void TypeList::accept(parsenode_visitor& v) const
5710 {
5711 BEGIN_VISITOR ();
5712 std::vector<rchandle<SequenceType> >::const_iterator it = theTypes.begin();
5713 for (; it!=theTypes.end(); ++it)
5714 {
5715 const parsenode* e_p = &**it;
5716 ACCEPT_CHK (e_p);
5717 }
5718 END_VISITOR ();
5719 }
5720
accept(parsenode_visitor & v) const5721 void TypedFunctionTest::accept(parsenode_visitor& v) const
5722 {
5723 BEGIN_VISITOR ();
5724 END_VISITOR ();
5725 }
5726
accept(parsenode_visitor & v) const5727 void DynamicFunctionInvocation::accept(parsenode_visitor& v) const
5728 {
5729 BEGIN_VISITOR();
5730 ACCEPT(thePrimaryExpr);
5731 if(theArgList != 0) ACCEPT(theArgList);
5732 END_VISITOR();
5733 }
5734
5735 ////////// JSON ///////////////////////////////////////////////////////////////
5736
JSONArrayConstructor(const QueryLoc & loc,const exprnode * expr)5737 JSONArrayConstructor::JSONArrayConstructor(
5738 const QueryLoc& loc,
5739 const exprnode* expr)
5740 :
5741 exprnode(loc),
5742 expr_(expr)
5743 {
5744 }
5745
5746
~JSONArrayConstructor()5747 JSONArrayConstructor::~JSONArrayConstructor()
5748 {
5749 delete expr_;
5750 }
5751
5752
accept(parsenode_visitor & v) const5753 void JSONArrayConstructor::accept(parsenode_visitor& v) const
5754 {
5755 BEGIN_VISITOR();
5756 ACCEPT(expr_);
5757 END_VISITOR();
5758 }
5759
5760
JSONObjectConstructor(const QueryLoc & loc,const exprnode * expr,bool accumulate)5761 JSONObjectConstructor::JSONObjectConstructor(
5762 const QueryLoc& loc,
5763 const exprnode* expr,
5764 bool accumulate)
5765 :
5766 exprnode(loc),
5767 expr_(expr),
5768 theAccumulate(accumulate)
5769 {
5770 }
5771
5772
~JSONObjectConstructor()5773 JSONObjectConstructor::~JSONObjectConstructor()
5774 {
5775 delete expr_;
5776 }
5777
5778
accept(parsenode_visitor & v) const5779 void JSONObjectConstructor::accept(parsenode_visitor& v) const
5780 {
5781 BEGIN_VISITOR();
5782 ACCEPT(expr_);
5783 END_VISITOR();
5784 }
5785
5786
JSONDirectObjectConstructor(const QueryLoc & loc,const JSONPairList * pairs)5787 JSONDirectObjectConstructor::JSONDirectObjectConstructor(
5788 const QueryLoc& loc,
5789 const JSONPairList* pairs)
5790 :
5791 exprnode(loc),
5792 thePairs(pairs)
5793 {
5794 }
5795
5796
~JSONDirectObjectConstructor()5797 JSONDirectObjectConstructor::~JSONDirectObjectConstructor()
5798 {
5799 delete thePairs;
5800 }
5801
5802
numPairs() const5803 csize JSONDirectObjectConstructor::numPairs() const
5804 {
5805 return thePairs->size();
5806 }
5807
5808
accept(parsenode_visitor & v) const5809 void JSONDirectObjectConstructor::accept(parsenode_visitor& v) const
5810 {
5811 BEGIN_VISITOR();
5812 ACCEPT(thePairs);
5813 END_VISITOR();
5814 }
5815
5816
accept(parsenode_visitor & v) const5817 void JSONPairList::accept(parsenode_visitor& v) const
5818 {
5819 BEGIN_VISITOR();
5820
5821 std::vector<rchandle<JSONPairConstructor> >::const_iterator it = thePairs.begin();
5822
5823 for (; it != thePairs.end(); ++it)
5824 {
5825 const parsenode* e_p = &**it;
5826 ACCEPT_CHK(e_p);
5827 }
5828
5829 END_VISITOR();
5830 }
5831
5832
JSONPairConstructor(const QueryLoc & loc,const exprnode * expr1,const exprnode * expr2)5833 JSONPairConstructor::JSONPairConstructor(
5834 const QueryLoc& loc,
5835 const exprnode* expr1,
5836 const exprnode* expr2)
5837 :
5838 parsenode(loc),
5839 expr1_(expr1),
5840 expr2_(expr2)
5841 {
5842 }
5843
5844
~JSONPairConstructor()5845 JSONPairConstructor::~JSONPairConstructor()
5846 {
5847 delete expr1_;
5848 delete expr2_;
5849 }
5850
5851
accept(parsenode_visitor & v) const5852 void JSONPairConstructor::accept(parsenode_visitor& v) const
5853 {
5854 BEGIN_VISITOR();
5855 ACCEPT( expr2_ );
5856 ACCEPT( expr1_ );
5857 END_VISITOR();
5858 }
5859
5860
JSON_Test(const QueryLoc & loc,store::StoreConsts::JSONItemKind k)5861 JSON_Test::JSON_Test(
5862 const QueryLoc& loc,
5863 store::StoreConsts::JSONItemKind k)
5864 :
5865 parsenode(loc),
5866 jt_(k)
5867 {
5868 }
5869
5870
accept(parsenode_visitor & v) const5871 void JSON_Test::accept(parsenode_visitor& v) const
5872 {
5873 BEGIN_VISITOR();
5874 END_VISITOR();
5875 }
5876
5877
5878 /*******************************************************************************
5879
5880 ********************************************************************************/
JSONObjectInsertExpr(const QueryLoc & loc,const rchandle<exprnode> & contentExpr,const rchandle<exprnode> & targetExpr)5881 JSONObjectInsertExpr::JSONObjectInsertExpr(
5882 const QueryLoc& loc,
5883 const rchandle<exprnode>& contentExpr,
5884 const rchandle<exprnode>& targetExpr)
5885 :
5886 exprnode(loc),
5887 theContentExpr(contentExpr),
5888 theTargetExpr(targetExpr)
5889 {
5890 }
5891
5892
accept(parsenode_visitor & v) const5893 void JSONObjectInsertExpr::accept(parsenode_visitor& v) const
5894 {
5895 BEGIN_VISITOR();
5896 ACCEPT(theContentExpr);
5897 ACCEPT(theTargetExpr);
5898 END_VISITOR();
5899 }
5900
5901
5902 /*******************************************************************************
5903
5904 ********************************************************************************/
JSONArrayInsertExpr(const QueryLoc & loc,const rchandle<exprnode> & valueExpr,const rchandle<exprnode> & targetExpr,const rchandle<exprnode> & posExpr)5905 JSONArrayInsertExpr::JSONArrayInsertExpr(
5906 const QueryLoc& loc,
5907 const rchandle<exprnode>& valueExpr,
5908 const rchandle<exprnode>& targetExpr,
5909 const rchandle<exprnode>& posExpr)
5910 :
5911 exprnode(loc),
5912 theTargetExpr(targetExpr),
5913 thePositionExpr(posExpr),
5914 theValueExpr(valueExpr)
5915 {
5916 }
5917
5918
accept(parsenode_visitor & v) const5919 void JSONArrayInsertExpr::accept(parsenode_visitor& v) const
5920 {
5921 BEGIN_VISITOR();
5922 ACCEPT(theValueExpr);
5923 ACCEPT(theTargetExpr);
5924 ACCEPT(thePositionExpr);
5925 END_VISITOR();
5926 }
5927
5928
5929 /*******************************************************************************
5930
5931 ********************************************************************************/
JSONArrayAppendExpr(const QueryLoc & loc,const rchandle<exprnode> & valueExpr,const rchandle<exprnode> & targetExpr)5932 JSONArrayAppendExpr::JSONArrayAppendExpr(
5933 const QueryLoc& loc,
5934 const rchandle<exprnode>& valueExpr,
5935 const rchandle<exprnode>& targetExpr)
5936 :
5937 exprnode(loc),
5938 theTargetExpr(targetExpr),
5939 theValueExpr(valueExpr)
5940 {
5941 }
5942
5943
accept(parsenode_visitor & v) const5944 void JSONArrayAppendExpr::accept(parsenode_visitor& v) const
5945 {
5946 BEGIN_VISITOR();
5947 ACCEPT(theValueExpr);
5948 ACCEPT(theTargetExpr);
5949 END_VISITOR();
5950 }
5951
5952
5953 /*******************************************************************************
5954
5955 ********************************************************************************/
JSONDeleteExpr(const QueryLoc & loc,const rchandle<exprnode> & targetExpr,const rchandle<exprnode> & selectorExpr)5956 JSONDeleteExpr::JSONDeleteExpr(
5957 const QueryLoc& loc,
5958 const rchandle<exprnode>& targetExpr,
5959 const rchandle<exprnode>& selectorExpr)
5960 :
5961 exprnode(loc),
5962 theTargetExpr(targetExpr),
5963 theSelectorExpr(selectorExpr)
5964 {
5965 }
5966
5967
accept(parsenode_visitor & v) const5968 void JSONDeleteExpr::accept(parsenode_visitor& v) const
5969 {
5970 BEGIN_VISITOR();
5971 ACCEPT(theTargetExpr);
5972 ACCEPT(theSelectorExpr);
5973 END_VISITOR();
5974 }
5975
5976
5977 /*******************************************************************************
5978
5979 ********************************************************************************/
JSONReplaceExpr(const QueryLoc & loc,const rchandle<exprnode> & targetExpr,const rchandle<exprnode> & selectorExpr,const rchandle<exprnode> & valueExpr)5980 JSONReplaceExpr::JSONReplaceExpr(
5981 const QueryLoc& loc,
5982 const rchandle<exprnode>& targetExpr,
5983 const rchandle<exprnode>& selectorExpr,
5984 const rchandle<exprnode>& valueExpr)
5985 :
5986 exprnode(loc),
5987 theTargetExpr(targetExpr),
5988 theSelectorExpr(selectorExpr),
5989 theValueExpr(valueExpr)
5990 {
5991 }
5992
5993
accept(parsenode_visitor & v) const5994 void JSONReplaceExpr::accept(parsenode_visitor& v) const
5995 {
5996 BEGIN_VISITOR();
5997 ACCEPT(theTargetExpr);
5998 ACCEPT(theSelectorExpr);
5999 ACCEPT(theValueExpr);
6000 END_VISITOR();
6001 }
6002
6003
6004 /*******************************************************************************
6005
6006 ********************************************************************************/
JSONRenameExpr(const QueryLoc & loc,const rchandle<exprnode> & targetExpr,const rchandle<exprnode> & nameExpr,const rchandle<exprnode> & newNameExpr)6007 JSONRenameExpr::JSONRenameExpr(
6008 const QueryLoc& loc,
6009 const rchandle<exprnode>& targetExpr,
6010 const rchandle<exprnode>& nameExpr,
6011 const rchandle<exprnode>& newNameExpr)
6012 :
6013 exprnode(loc),
6014 theTargetExpr(targetExpr),
6015 theNameExpr(nameExpr),
6016 theNewNameExpr(newNameExpr)
6017 {
6018 }
6019
6020
accept(parsenode_visitor & v) const6021 void JSONRenameExpr::accept(parsenode_visitor& v) const
6022 {
6023 BEGIN_VISITOR();
6024 ACCEPT(theTargetExpr);
6025 ACCEPT(theNameExpr);
6026 ACCEPT(theNewNameExpr);
6027 END_VISITOR();
6028 }
6029
6030
6031 ///////////////////////////////////////////////////////////////////////////////
6032
6033 } // namespace zorba
6034 /* vim:set et sw=2 ts=2: */
6035