1 /*
2 * Copyright 2006-2008 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 #include "stdafx.h"
17
18 #include <ostream>
19 #include "compiler/parsetree/parsenode_print_xml_visitor.h"
20 #include "compiler/parsetree/parsenode_visitor.h"
21 #include "types/typemanager.h"
22
23 using namespace std;
24
25 namespace zorba {
26
27 #define INDENT os << std::string(theIndent, ' ')
28 #define INDENT_INC theIndent += 2
29 #define INDENT_DEC theIndent -= 2
30 #define NL os << std::endl
31
32 class ParseNodePrintXMLVisitor : public parsenode_visitor
33 {
34 protected:
35 int theIndent;
36 std::ostream & os;
37
38 public:
39
ParseNodePrintXMLVisitor(std::ostream & aStream)40 ParseNodePrintXMLVisitor(std::ostream &aStream)
41 :
42 theIndent(0),
43 os(aStream)
44 {
45 }
46
47
print(const parsenode * p)48 void print(const parsenode* p)
49 {
50 os << "<?xml version='1.0' ?>" << std::endl;
51 os << "<ParseNodeTree>" << std::endl;
52 p->accept(*this);
53 os << "</ParseNodeTree>" << std::endl;
54 }
55
56 #define IDS \
57 " pos='" << n.get_location() << "' ptr='" << &n << "'"
58
59 #define BEGIN_TAG( cls ) \
60 void *begin_visit (const cls &n) { \
61 INDENT; \
62 os << "<" #cls << IDS << ">"; \
63 INDENT_INC; NL; \
64 return no_state; \
65 }
66
67
68 #define NO_END_TAG( cls ) \
69 void end_visit(const cls& /*n*/, void* /*visit_state*/) {}
70
71 #define END_TAG( cls ) \
72 void end_visit(const cls& /*n*/, void* /*visit_state*/) { \
73 INDENT_DEC; INDENT; \
74 os << "</" #cls ">"; \
75 NL; \
76 }
77
78 #define BEGIN_END_TAG( cls ) \
79 BEGIN_TAG (cls) \
80 END_TAG (cls)
81
begin_visit(const AbbrevForwardStep & n)82 void *begin_visit(const AbbrevForwardStep &n)
83 {
84 INDENT;
85
86 os << "<AbbrevForwardStep" << IDS;
87 if (n.get_attr_bit ()) os << " attr='true'";
88 os << ">";
89
90 INDENT_INC; NL;
91 return no_state;
92 }
93
94
begin_visit(const CaseClause & n)95 void *begin_visit(const CaseClause &n)
96 {
97 INDENT;
98
99 os << "<CaseClause" << IDS << " var='" << n.get_varname () << "'";
100
101 os << ">";
102
103 INDENT_INC; NL;
104 return no_state;
105 }
106
107
begin_visit(const DefaultNamespaceDecl & n)108 void *begin_visit(const DefaultNamespaceDecl &n)
109 {
110 INDENT;
111
112 os << "<DefaultNamespaceDecl mode='"
113 << (n.get_mode () == ParseConstants::ns_element_default ? "element" : "function")
114 << "' uri='" << n.get_default_namespace () << "'" << IDS;
115
116 os << "/>";
117
118 NL;
119 return no_state;
120 }
121
122 NO_END_TAG (NamespaceDecl)
123
NO_END_TAG(DefaultNamespaceDecl)124 NO_END_TAG (DefaultNamespaceDecl)
125
126 void *begin_visit(const DirAttr &n)
127 {
128 INDENT;
129
130 os << "<DirAttr pos='" << n.get_location() << "' name='"
131 << n.get_name()->get_qname() << "' ptr='" << &n << "'";
132
133 os << ">";
134
135 INDENT_INC; NL;
136 return no_state;
137 }
138
begin_visit(const ForwardAxis & n)139 void *begin_visit(const ForwardAxis &n)
140 {
141 INDENT;
142
143 os << "<ForwardAxis" << IDS;
144 os << " axis='" << ParseConstants::decode_axis_kind(n.get_axis()) << "'";
145 os << ">";
146
147 INDENT_INC; NL;
148 return no_state;
149 }
150
begin_visit(const FunctionDecl & n)151 void *begin_visit(const FunctionDecl &n)
152 {
153 INDENT;
154
155 os << "<FunctionDecl name='" << n.get_name()->get_qname() << "'" << IDS;
156
157 os << ">";
158
159 INDENT_INC; NL;
160 return no_state;
161 }
162
begin_visit(const GeneralComp & n)163 void *begin_visit(const GeneralComp &n)
164 {
165 INDENT;
166
167 os << "<GeneralComp" << IDS;
168
169 os << "/>";
170
171 NL;
172
173 return no_state;
174 }
175
NO_END_TAG(GeneralComp)176 NO_END_TAG (GeneralComp)
177
178 void *begin_visit(const MainModule &n)
179 {
180 INDENT;
181
182 os << "<MainModule" << IDS;
183
184 os << ">";
185
186 INDENT_INC; NL;
187
188 return no_state;
189 }
190
begin_visit(const ModuleDecl & n)191 void *begin_visit(const ModuleDecl &n)
192 {
193 INDENT;
194
195 os << "<ModuleDecl" << IDS;
196 os << " prefix='" << n.get_prefix() << "' "
197 << "target_namespace='" << n.get_target_namespace() << "'";
198 os << ">";
199
200 INDENT_INC; NL;
201 return no_state;
202 }
203
begin_visit(const ModuleImport & n)204 void *begin_visit(const ModuleImport &n)
205 {
206 INDENT;
207
208 os << "<ModuleImport" << IDS;
209 os << " prefix='" << n.get_prefix() << "' "
210 << "target_namespace='" << n.get_uri() << "'";
211 os << ">";
212
213 INDENT_INC; NL;
214 return no_state;
215 }
216
begin_visit(const NameTest & n)217 void *begin_visit(const NameTest &n)
218 {
219 INDENT;
220
221 os << "<NameTest" << IDS;
222
223 os << ">";
224
225 INDENT_INC; NL;
226
227 // Hack: visitor is broken, QName is never visited.
228 // However fixing this would impact the translator.
229 // So we "visit" here.
230 if (n.getQName () != NULL) n.getQName ()->accept (*this);
231
232 return no_state;
233 }
234
begin_visit(const NamespaceDecl & n)235 void *begin_visit(const NamespaceDecl &n)
236 {
237 INDENT;
238
239 os << "<NamespaceDecl prefix='" << n.get_prefix () << "' uri='" << n.get_uri () << "'" << IDS;
240
241 os << "/>";
242
243 INDENT_INC; NL;
244 return no_state;
245 }
246
begin_visit(const NodeComp & n)247 void *begin_visit(const NodeComp &n)
248 {
249 INDENT;
250
251 os << "<NodeComp" << IDS;
252
253 os << "/>";
254
255 NL;
256 return no_state;
257 }
258
NO_END_TAG(NodeComp)259 NO_END_TAG (NodeComp)
260
261 void *begin_visit(GroupByClause const& n)
262 {
263 INDENT;
264
265 os << "<GroupByClause" << IDS;
266
267 os << ">";
268
269 INDENT_INC; NL;
270 return no_state;
271 }
272
begin_visit(GroupSpecList const & n)273 void *begin_visit(GroupSpecList const& n)
274 {
275 INDENT;
276
277 os << "<GroupSpecList" << IDS;
278
279 os << ">";
280
281 INDENT_INC; NL;
282 return no_state;
283 }
284
begin_visit(GroupSpec const & n)285 void *begin_visit(GroupSpec const& n)
286 {
287 INDENT;
288
289 os << "<GroupSpec" << IDS;
290
291 os << ">";
292
293 INDENT_INC; NL;
294 return no_state;
295 }
296
begin_visit(GroupCollationSpec const & n)297 void *begin_visit(GroupCollationSpec const& n)
298 {
299 INDENT;
300
301 os << "<GroupCollationSpec" << IDS;
302
303 os << ">";
304
305 INDENT_INC; NL;
306 return no_state;
307 }
308
309
begin_visit(const Param & n)310 void *begin_visit(const Param &n)
311 {
312 INDENT;
313
314 os << "<Param name='" << n.get_name () << "'" << IDS;
315
316 os << "/>";
317
318 NL;
319 return no_state;
320 }
321
NO_END_TAG(Param)322 NO_END_TAG (Param)
323
324 void *begin_visit(const SchemaImport &n)
325 {
326 #ifndef ZORBA_NO_XMLSCHEMA
327 INDENT;
328
329 os << "<SchemaImport" << IDS;
330
331 os << ">";
332
333 INDENT_INC; NL;
334 return no_state;
335 #else
336 throw XQUERY_EXCEPTION(err::XQST0009);
337 #endif
338 }
339
begin_visit(const URILiteralList & n)340 void *begin_visit (const URILiteralList &n)
341 {
342 INDENT;
343
344 os << "<URILiteralList" << IDS;
345
346 os << ">";
347
348 INDENT_INC; NL;
349
350 for (ulong i = 0; i < n.size(); i++)
351 {
352 INDENT;
353 os << "<URI>" << n [i] << "</URI>" << "\n";
354 }
355
356 return no_state;
357 }
358
begin_visit(const ValueComp & n)359 void *begin_visit(const ValueComp &n)
360 {
361 INDENT;
362
363 os << "<ValueComp" << IDS;
364
365 os << "/>";
366
367 NL;
368 return no_state;
369 }
370
NO_END_TAG(ValueComp)371 NO_END_TAG (ValueComp)
372
373 void* begin_visit(const GlobalVarDecl &n)
374 {
375 INDENT;
376
377 os << "<VarDecl pos='" << n.get_location() << "' var='"
378 << n.get_var_name()->get_qname() << "' ptr='" << &n << "'";
379
380 os << ">";
381
382 INDENT_INC; NL;
383 return no_state;
384 }
385
386
begin_visit(const LocalVarDecl & n)387 void* begin_visit(const LocalVarDecl &n)
388 {
389 INDENT;
390
391 os << "<LocalVarDecl pos='" << n.get_location() << "' var='"
392 << n.get_var_name()->get_qname() << "' ptr='" << &n << "'";
393
394 os << ">";
395
396 INDENT_INC; NL;
397 return no_state;
398 }
399
400
begin_visit(const VarGetsDecl & n)401 void *begin_visit(const VarGetsDecl &n)
402 {
403 INDENT;
404
405 os << "<VarGetsDecl pos='" << n.get_location() << "' var='"
406 << n.get_var_name()->get_qname() << "' ptr='" << &n << "'";
407
408 os << ">";
409
410 INDENT_INC; NL;
411 return no_state;
412 }
413
begin_visit(const VarInDecl & n)414 void *begin_visit(const VarInDecl &n)
415 {
416 INDENT;
417
418 os << "<VarInDecl pos='" << n.get_location() << "' var='"
419 << n.get_var_name()->get_qname() << "' ptr='" << &n << "'";
420
421 os << ">";
422
423 INDENT_INC; NL;
424 return no_state;
425 }
426
begin_visit(const VersionDecl & n)427 void *begin_visit(const VersionDecl &n)
428 {
429 INDENT;
430
431 os << "<VersionDecl" << IDS;
432 os << "version='" << n.get_version() << "' "
433 << "encoding='" << n.get_encoding() << "' ";
434
435 os << ">";
436
437 INDENT_INC; NL;
438 return no_state;
439 }
440
begin_visit(const QName & n)441 void *begin_visit(const QName &n)
442 {
443 INDENT;
444
445 os << "<QName name='" << n.get_qname () << "'" << IDS;
446
447 os << "/>";
448
449 NL;
450
451 return no_state;
452 }
453
NO_END_TAG(QName)454 NO_END_TAG (QName)
455
456 void *begin_visit(const CommonContent &n)
457 {
458 INDENT;
459
460 os << "<CommonContent" << IDS;
461
462 os << ">";
463
464 NL;
465 INDENT_INC;
466 INDENT;
467 os << "<Type>";
468 switch (n.get_type())
469 {
470 case ParseConstants::cont_entity:
471 {
472 os << "entity";
473 break;
474 }
475 case ParseConstants::cont_charref:
476 {
477 os << "charref";
478 break;
479 }
480 case ParseConstants::cont_escape_lbrace:
481 {
482 os << "escaped lbrace";
483 break;
484 }
485 case ParseConstants::cont_escape_rbrace:
486 {
487 os << "escaped rbrace";
488 break;
489 }
490 case ParseConstants::cont_expr:
491 {
492 os << "expr";
493 break;
494 }
495 }
496 os << "</Type>";
497 INDENT_DEC;
498 INDENT;
499
500 INDENT_INC; NL;
501 return no_state;
502 }
503
begin_visit(const ComparisonExpr & n)504 void *begin_visit(const ComparisonExpr &n)
505 {
506 INDENT;
507
508 os << "<ComparisonExpr" << IDS;
509
510 os << ">";
511
512 INDENT_INC; NL;
513
514 // Hack: visitor does not visit
515
516 return no_state;
517 }
518
begin_visit(const NumericLiteral & n)519 void *begin_visit(const NumericLiteral &n)
520 {
521 INDENT;
522
523 os << "<NumericLiteral" << IDS << " type='"
524 << ParseConstants::decode_numeric_type (n.get_type ()) << "' val='" << n.toString () << "'";
525
526 os << "/>";
527
528 NL;
529 return no_state;
530 }
531
NO_END_TAG(NumericLiteral)532 NO_END_TAG (NumericLiteral)
533
534 void *begin_visit(const PathExpr &n)
535 {
536 INDENT;
537
538 os << "<PathExpr type='" << ParseConstants::decode_pathtype_t(n.get_type()) << "' pos='" << n.get_location() << "' " << "ptr='" << &n << "'";
539
540 os << ">";
541
542 INDENT_INC; NL;
543 return no_state;
544 }
545
begin_visit(const RelativePathExpr & n)546 void *begin_visit(const RelativePathExpr &n)
547 {
548 INDENT;
549
550 os << "<RelativePathExpr step_type='" << ParseConstants::decode_steptype_t(n.get_step_type()) << "' pos='" << n.get_location() << "' " << "ptr='" << &n << "'";
551
552 os << ">";
553
554 INDENT_INC; NL;
555 return no_state;
556 }
557
END_TAG(RelativePathExpr)558 END_TAG(RelativePathExpr)
559
560 void *begin_visit(const SimpleMapExpr &n)
561 {
562 INDENT;
563
564 os << "<SimpleMapExpr pos='" << n.get_location() << "' " << "ptr='" << &n << "'";
565
566 os << ">";
567
568 INDENT_INC; NL;
569 return no_state;
570 }
571
END_TAG(SimpleMapExpr)572 END_TAG(SimpleMapExpr)
573
574 void *begin_visit(const TypeswitchExpr &n)
575 {
576 INDENT;
577
578 os << "<TypeswitchExpr" << IDS << " default-var='" << n.get_default_varname() << "'";
579
580 os << ">";
581
582 INDENT_INC; NL;
583 return no_state;
584 }
585
begin_visit(const VarRef & n)586 void *begin_visit(const VarRef &n)
587 {
588 INDENT;
589
590 os << "<VarRef" << IDS << " var='" << n.get_name()->get_qname() << "'";
591
592 os << "/>";
593
594 NL;
595 return no_state;
596 }
597
NO_END_TAG(VarRef)598 NO_END_TAG (VarRef)
599
600 void *begin_visit(const VarBinding &n)
601 {
602 INDENT;
603
604 os << "<VarBinding varname='" << n.get_varname()
605 << "' npos='" << n.get_location() << "' ptr='" << &n << "'";
606
607 os << ">";
608
609 INDENT_INC; NL;
610 return no_state;
611 }
612
613
begin_visit(const LiteralFunctionItem & n)614 void* begin_visit(const LiteralFunctionItem& n)
615 {
616 INDENT;
617 os << "<LiteralFunctionItem " << "arity=\"" << n.getArity() << "\" ";
618 os << "' npos='" << n.get_location() << "' ptr='" << &n << "'";
619 os << ">";
620 INDENT_INC; NL;
621 return no_state;
622 }
623
END_TAG(LiteralFunctionItem)624 END_TAG(LiteralFunctionItem)
625
626 void* begin_visit(const InlineFunction& n)
627 {
628 INDENT;
629 os << "<InlineFunction ";
630 os << "' npos='" << n.get_location() << "' ptr='" << &n << "'";
631 os << ">";
632 INDENT_INC; NL;
633 return no_state;
634 }
635
END_TAG(InlineFunction)636 END_TAG(InlineFunction)
637
638 void* begin_visit(const AnyFunctionTest& n)
639 {
640 INDENT;
641 os << "<AnyFunctionTest pos='" << n.get_location() << "'/>";
642 NL;
643 return 0;
644 }
645
end_visit(const AnyFunctionTest &,void *)646 void end_visit(const AnyFunctionTest& /*n*/, void* /*visit_state*/){}
647
begin_visit(const TypeList & n)648 void* begin_visit(const TypeList& n)
649 {
650 INDENT;
651 os << "<TypeList ";
652 os << "pos='" << n.get_location() << "' ptr='" << &n << "'";
653 os << ">";
654 INDENT_INC; NL;
655 return no_state;
656 }
657
END_TAG(TypeList)658 END_TAG(TypeList)
659
660 void *begin_visit(const TypedFunctionTest& n)
661 {
662 INDENT;
663 os << "<TypedFunctionTest ";
664 os << "pos='" << n.get_location() << "' ptr='" << &n << "'";
665 os << ">";
666 INDENT_INC; NL;
667 return no_state;
668 }
669
END_TAG(TypedFunctionTest)670 END_TAG(TypedFunctionTest)
671
672
673 void *begin_visit(const DynamicFunctionInvocation& n)
674 {
675 INDENT;
676 os << "<DynamicFunctionInvocation ";
677 os << "pos='" << n.get_location() << "' ptr='" << &n << "'";
678 os << ">";
679 INDENT_INC; NL;
680 return no_state;
681 }
682
683 END_TAG(DynamicFunctionInvocation)
684
685
END_TAG(AbbrevForwardStep)686 END_TAG (AbbrevForwardStep)
687 BEGIN_END_TAG (AdditiveExpr)
688 BEGIN_END_TAG (AndExpr)
689 BEGIN_END_TAG (AnnotationParsenode)
690 BEGIN_END_TAG (AnnotationListParsenode)
691 BEGIN_END_TAG (AnnotationLiteralListParsenode)
692 BEGIN_END_TAG (AnyKindTest)
693 BEGIN_END_TAG (AposAttrContentList)
694 BEGIN_END_TAG (AposAttrValueContent)
695 BEGIN_END_TAG (ArgList)
696 BEGIN_END_TAG (AtomicType)
697 BEGIN_END_TAG (AttributeTest)
698 BEGIN_END_TAG (AxisStep)
699 BEGIN_END_TAG (BaseURIDecl)
700 BEGIN_END_TAG (BlockBody)
701 BEGIN_END_TAG (ApplyExpr)
702 BEGIN_END_TAG (BoundarySpaceDecl)
703 END_TAG (CaseClause)
704 BEGIN_END_TAG (CaseClauseList)
705 BEGIN_END_TAG (CastableExpr)
706 BEGIN_END_TAG (CastExpr)
707 BEGIN_END_TAG (CatchExpr)
708 BEGIN_END_TAG (CatchListExpr)
709 BEGIN_END_TAG (CDataSection)
710 BEGIN_END_TAG (CommentTest)
711 END_TAG (CommonContent)
712 END_TAG (ComparisonExpr)
713 BEGIN_END_TAG (CompAttrConstructor)
714 BEGIN_END_TAG (CompCommentConstructor)
715 BEGIN_END_TAG (CompDocConstructor)
716 BEGIN_END_TAG (CompElemConstructor)
717 BEGIN_END_TAG (CompPIConstructor)
718 BEGIN_END_TAG (CompTextConstructor)
719 BEGIN_END_TAG (ConstructionDecl)
720 BEGIN_END_TAG (ContextItemExpr)
721 BEGIN_END_TAG (CopyNamespacesDecl)
722 BEGIN_END_TAG (CountClause)
723 BEGIN_END_TAG (DefaultCollationDecl)
724 BEGIN_END_TAG (DeleteExpr)
725 END_TAG (DirAttr)
726 BEGIN_END_TAG (DirAttributeList)
727 BEGIN_END_TAG (DirAttributeValue)
728 BEGIN_END_TAG (DirCommentConstructor)
729 BEGIN_END_TAG (DirElemConstructor)
730 BEGIN_END_TAG (DirElemContent)
731 BEGIN_END_TAG (DirElemContentList)
732 BEGIN_END_TAG (DirPIConstructor)
733 BEGIN_END_TAG (DocumentTest)
734 BEGIN_END_TAG (ElementTest)
735 BEGIN_END_TAG (EmptyOrderDecl)
736 BEGIN_END_TAG (EnclosedExpr)
737 BEGIN_END_TAG (AssignExpr)
738 BEGIN_END_TAG (ExitExpr)
739 BEGIN_END_TAG (Expr)
740 BEGIN_TAG (exprnode)
741 BEGIN_END_TAG (ExtensionExpr)
742 BEGIN_END_TAG (FilterExpr)
743 BEGIN_END_TAG (FlowCtlStatement)
744 BEGIN_END_TAG (FLWORClauseList)
745 BEGIN_END_TAG (FLWORExpr)
746 BEGIN_END_TAG (FLWORWinCond)
747 BEGIN_END_TAG (ForClause)
748 END_TAG (ForwardAxis)
749 BEGIN_END_TAG (ForwardStep)
750 BEGIN_END_TAG (FunctionCall)
751 END_TAG (FunctionDecl)
752 END_TAG (GroupByClause)
753 END_TAG (GroupCollationSpec)
754 END_TAG (GroupSpec)
755 END_TAG (GroupSpecList)
756 BEGIN_END_TAG (IfExpr)
757 BEGIN_END_TAG (InsertExpr)
758 BEGIN_END_TAG (InstanceofExpr)
759 BEGIN_END_TAG (IntersectExceptExpr)
760 BEGIN_END_TAG (ItemType)
761 BEGIN_END_TAG (StructuredItemType)
762 BEGIN_END_TAG (LetClause)
763 BEGIN_END_TAG (LibraryModule)
764 BEGIN_END_TAG (Literal)
765 END_TAG (MainModule )
766 END_TAG (ModuleDecl)
767 END_TAG (ModuleImport)
768 BEGIN_END_TAG (MultiplicativeExpr)
769 END_TAG (NameTest)
770 BEGIN_END_TAG (OccurrenceIndicator)
771 BEGIN_END_TAG (OptionDecl)
772 BEGIN_END_TAG (OrderByClause)
773 BEGIN_END_TAG (OrderCollationSpec)
774 BEGIN_END_TAG (OrderDirSpec)
775 BEGIN_END_TAG (OrderedExpr)
776 BEGIN_END_TAG (OrderEmptySpec)
777 BEGIN_END_TAG (OrderingModeDecl)
778 BEGIN_END_TAG (OrderModifierPN)
779 BEGIN_END_TAG (OrderSpec)
780 BEGIN_END_TAG (OrderSpecList)
781 BEGIN_END_TAG (OrExpr)
782 BEGIN_END_TAG (ParamList)
783 BEGIN_END_TAG (ParenthesizedExpr)
784 BEGIN_END_TAG (ParseErrorNode)
785 BEGIN_TAG (parsenode)
786 END_TAG (PathExpr)
787 BEGIN_END_TAG (PITest)
788 BEGIN_END_TAG (PositionalVar)
789 BEGIN_END_TAG (Pragma)
790 BEGIN_END_TAG (PragmaList)
791 BEGIN_END_TAG (PredicateList)
792 BEGIN_END_TAG (Prolog)
793 BEGIN_END_TAG (QuantifiedExpr)
794 BEGIN_END_TAG (QueryBody)
795 BEGIN_END_TAG (QuoteAttrContentList)
796 BEGIN_END_TAG (QuoteAttrValueContent)
797 BEGIN_END_TAG (QVarInDecl)
798 BEGIN_END_TAG (QVarInDeclList)
799 BEGIN_END_TAG (RangeExpr)
800 BEGIN_END_TAG (RenameExpr)
801 BEGIN_END_TAG (ReplaceExpr)
802 BEGIN_END_TAG (RevalidationDecl)
803 BEGIN_END_TAG (ReverseAxis)
804 BEGIN_END_TAG (ReverseStep)
805 BEGIN_END_TAG (SchemaAttributeTest)
806 BEGIN_END_TAG (SchemaElementTest)
807 END_TAG (SchemaImport)
808 BEGIN_END_TAG (SchemaPrefix)
809 BEGIN_END_TAG (SequenceType)
810 BEGIN_END_TAG (SignList)
811 BEGIN_END_TAG (SIND_DeclList)
812 BEGIN_END_TAG (DecimalFormatNode)
813 BEGIN_END_TAG (SingleType)
814 BEGIN_END_TAG (StringLiteral)
815 BEGIN_END_TAG (StringConcatExpr)
816 BEGIN_END_TAG (TextTest)
817 BEGIN_END_TAG (TransformExpr)
818 BEGIN_END_TAG (TreatExpr)
819 BEGIN_END_TAG (TryExpr)
820 BEGIN_END_TAG (TypeName)
821 BEGIN_END_TAG (SwitchExpr)
822 BEGIN_END_TAG (SwitchCaseClause)
823 BEGIN_END_TAG (SwitchCaseClauseList)
824 BEGIN_END_TAG (SwitchCaseOperandList)
825 END_TAG (TypeswitchExpr)
826 BEGIN_END_TAG (UnaryExpr)
827 BEGIN_END_TAG (UnionExpr)
828 BEGIN_END_TAG (UnorderedExpr)
829 END_TAG (URILiteralList)
830 BEGIN_END_TAG (ValidateExpr)
831 END_TAG (VarBinding)
832 BEGIN_END_TAG (CtxItemDecl)
833 BEGIN_END_TAG (CollectionDecl)
834 BEGIN_END_TAG (AST_IndexDecl)
835 BEGIN_END_TAG (IndexKeySpec)
836 BEGIN_END_TAG (IndexKeyList)
837 BEGIN_END_TAG (IntegrityConstraintDecl)
838 END_TAG (GlobalVarDecl)
839 END_TAG (LocalVarDecl)
840 END_TAG (VarGetsDecl)
841 BEGIN_END_TAG (VarGetsDeclList)
842 END_TAG (VarInDecl)
843 BEGIN_END_TAG (VarInDeclList)
844 BEGIN_END_TAG (CopyVarList)
845 END_TAG (VersionDecl)
846 BEGIN_END_TAG (VFO_DeclList)
847 BEGIN_END_TAG (WhereClause)
848 BEGIN_END_TAG (WhileExpr)
849 BEGIN_END_TAG (Wildcard)
850 BEGIN_END_TAG (WindowClause)
851 BEGIN_END_TAG (WindowVarDecl)
852 BEGIN_END_TAG (WindowVars)
853
854
855 ////////// Full-text //////////////////////////////////////////////////////////
856
857 BEGIN_END_TAG( FTAnd )
858
859 void* begin_visit( FTAnyallOption const &n ) {
860 INDENT;
861 os << "<FTAnyallOption" << IDS
862 << " mode='" << ft_anyall_mode::string_of[ n.get_option() ] << "'"
863 << "/>";
864 NL;
865 return no_state;
866 }
NO_END_TAG(FTAnyallOption)867 NO_END_TAG( FTAnyallOption )
868
869 void* begin_visit( FTBigUnit const &n ) {
870 INDENT;
871 os << "<FTBigUnit" << IDS
872 << " unit='" << ft_big_unit::string_of[ n.get_unit() ] << "'"
873 << "/>";
874 NL;
875 return no_state;
876 }
NO_END_TAG(FTBigUnit)877 NO_END_TAG( FTBigUnit )
878
879 void* begin_visit( FTCaseOption const &n ) {
880 INDENT;
881 os << "<FTCaseOption" << IDS
882 << " mode='" << ft_case_mode::string_of[ n.get_mode() ] << "'"
883 << "/>";
884 NL;
885 return no_state;
886 }
887 NO_END_TAG( FTCaseOption )
888
BEGIN_END_TAG(FTContainsExpr)889 BEGIN_END_TAG(FTContainsExpr)
890
891 void* begin_visit( FTContent const &n ) {
892 INDENT;
893 os << "<FTContent" << IDS
894 << " mode='" << ft_content_mode::string_of[ n.get_mode() ] << "'"
895 << "/>";
896 NL;
897 return no_state;
898 }
NO_END_TAG(FTContent)899 NO_END_TAG( FTContent )
900
901 void* begin_visit( FTDiacriticsOption const &n ) {
902 INDENT;
903 os << "<FTDiacriticsOption" << IDS
904 << " mode='" << ft_diacritics_mode::string_of[ n.get_mode() ] << "'"
905 << "/>";
906 NL;
907 return no_state;
908 }
909 NO_END_TAG( FTDiacriticsOption )
910
BEGIN_END_TAG(FTDistance)911 BEGIN_END_TAG( FTDistance )
912 BEGIN_END_TAG( FTExtensionOption )
913 BEGIN_END_TAG( FTExtensionSelection )
914 BEGIN_END_TAG( FTIgnoreOption )
915
916 void* begin_visit( FTLanguageOption const &n ) {
917 INDENT;
918 os << "<FTLanguageOption" << IDS
919 << " lang='" << n.get_language() << "'"
920 << "/>";
921 NL;
922 return no_state;
923 }
924 NO_END_TAG(FTLanguageOption)
925
BEGIN_END_TAG(FTMatchOptions)926 BEGIN_END_TAG( FTMatchOptions )
927 BEGIN_END_TAG( FTMildNot )
928 BEGIN_END_TAG( FTOptionDecl )
929 BEGIN_END_TAG( FTOr )
930 BEGIN_END_TAG( FTOrder )
931 BEGIN_END_TAG( FTPrimaryWithOptions )
932
933 void* begin_visit( FTRange const &n ) {
934 INDENT;
935 os << "<FTRange" << IDS
936 << " mode='" << ft_range_mode::string_of[ n.get_mode() ] << "'"
937 << ">";
938 INDENT_INC; NL;
939 return no_state;
940 }
END_TAG(FTRange)941 END_TAG( FTRange )
942
943 void* begin_visit( FTScope const &n ) {
944 INDENT;
945 os << "<FTScope" << IDS
946 << " scope='" << ft_scope::string_of[ n.get_scope() ] << "'"
947 << ">";
948 INDENT_INC; NL;
949 return no_state;
950 }
END_TAG(FTScope)951 END_TAG( FTScope )
952
953 void* begin_visit( FTScoreVar const &n ) {
954 INDENT;
955 os << "<FTScoreVar" << IDS
956 << " varname='" << n.get_var_name() << "'"
957 << "/>";
958 NL;
959 return no_state;
960 }
961 NO_END_TAG( FTScoreVar )
962
BEGIN_END_TAG(FTSelection)963 BEGIN_END_TAG( FTSelection )
964
965 void* begin_visit( FTStemOption const &n ) {
966 INDENT;
967 os << "<FTStemOption" << IDS
968 << " mode='" << ft_stem_mode::string_of[ n.get_mode() ] << "'"
969 << "/>";
970 NL;
971 return no_state;
972 }
NO_END_TAG(FTStemOption)973 NO_END_TAG( FTStemOption )
974
975 void* begin_visit( FTStopWordOption const &n ) {
976 INDENT;
977 os << "<FTStopWordOption" << IDS
978 << " mode='" << ft_stop_words_mode::string_of[ n.get_mode() ] << "'"
979 << "/>";
980 NL;
981 return no_state;
982 }
NO_END_TAG(FTStopWordOption)983 NO_END_TAG( FTStopWordOption )
984
985 void* begin_visit( FTStopWords const &n ) {
986 INDENT;
987 os << "<FTStopWords" << IDS
988 << " uri='" << n.get_uri() << "'"
989 << ">";
990 INDENT_INC; NL;
991 return no_state;
992 }
END_TAG(FTStopWords)993 END_TAG( FTStopWords )
994
995 void* begin_visit( FTStopWordsInclExcl const &n ) {
996 INDENT;
997 os << "<FTStopWordsInclExcl" << IDS
998 << " mode='" << ft_stop_words_unex::string_of[ n.get_mode() ] << "'"
999 << ">";
1000 INDENT_INC; NL;
1001 return no_state;
1002 }
END_TAG(FTStopWordsInclExcl)1003 END_TAG( FTStopWordsInclExcl )
1004
1005 void* begin_visit( FTThesaurusID const &n ) {
1006 INDENT;
1007 os << "<FTThesaurusID" << IDS
1008 << " uri='" << n.get_uri() << "'"
1009 << " relationship='" << n.get_relationship() << "'"
1010 << ">";
1011 INDENT_INC; NL;
1012 return no_state;
1013 }
END_TAG(FTThesaurusID)1014 END_TAG( FTThesaurusID )
1015
1016 void* begin_visit( FTThesaurusOption const &n ) {
1017 INDENT;
1018 os << "<FTThesaurusOption" << IDS
1019 << " includes-default='" << (n.includes_default() ? 'T' : 'F') << "'"
1020 << " no-thesaurus='" << (n.no_thesaurus() ? 'T' : 'F') << "'"
1021 << ">";
1022 INDENT_INC; NL;
1023 return no_state;
1024 }
1025 END_TAG( FTThesaurusOption )
1026
BEGIN_END_TAG(FTTimes)1027 BEGIN_END_TAG( FTTimes )
1028 BEGIN_END_TAG( FTUnaryNot )
1029
1030 void* begin_visit( FTUnit const &n ) {
1031 INDENT;
1032 os << "<FTUnit" << IDS
1033 << " unit='" << ft_unit::string_of[ n.get_unit() ] << "'"
1034 << "/>";
1035 NL;
1036 return no_state;
1037 }
1038 NO_END_TAG( FTUnit )
1039
BEGIN_END_TAG(FTWeight)1040 BEGIN_END_TAG( FTWeight )
1041
1042 void* begin_visit( FTWildCardOption const &n ) {
1043 INDENT;
1044 os << "<FTWildCardOption" << IDS
1045 << " mode='" << ft_wild_card_mode::string_of[ n.get_mode() ] << "'"
1046 << "/>";
1047 NL;
1048 return no_state;
1049 }
1050 NO_END_TAG( FTWildCardOption )
1051
BEGIN_END_TAG(FTWindow)1052 BEGIN_END_TAG( FTWindow )
1053 BEGIN_END_TAG( FTWords )
1054 BEGIN_END_TAG( FTWordsTimes )
1055 BEGIN_END_TAG( FTWordsValue )
1056
1057 ////////// JSON ///////////////////////////////////////////////////////////////
1058
1059 BEGIN_END_TAG(JSONArrayConstructor)
1060
1061 BEGIN_END_TAG(JSONObjectConstructor)
1062
1063 BEGIN_END_TAG(JSONDirectObjectConstructor)
1064
1065 BEGIN_END_TAG(JSONPairList)
1066
1067 BEGIN_END_TAG(JSONPairConstructor)
1068
1069 BEGIN_END_TAG(JSONObjectInsertExpr)
1070
1071 BEGIN_END_TAG(JSONArrayInsertExpr)
1072
1073 BEGIN_END_TAG(JSONArrayAppendExpr)
1074
1075 BEGIN_END_TAG(JSONDeleteExpr)
1076
1077 BEGIN_END_TAG(JSONReplaceExpr)
1078
1079 BEGIN_END_TAG(JSONRenameExpr)
1080
1081 void* begin_visit(const JSON_Test& n)
1082 {
1083 INDENT;
1084 os << "<JSON_Test type=\"" << store::StoreConsts::toString(n.get_kind()) << "\"/>";
1085 INDENT_INC; NL;
1086 return no_state;
1087 }
1088
1089 END_TAG(JSON_Test)
1090
1091 };
1092
1093
1094
print_parsetree_xml(ostream & os,const parsenode * p)1095 void print_parsetree_xml(ostream& os, const parsenode* p)
1096 {
1097 ParseNodePrintXMLVisitor v (os);
1098 v.print (p);
1099 }
1100
1101 } // end namespace
1102 /* vim:set et sw=2 ts=2: */
1103