1[/==============================================================================
2    Copyright (C) 2001-2011 Joel de Guzman
3    Copyright (C) 2001-2011 Hartmut Kaiser
4
5    Distributed under the Boost Software License, Version 1.0. (See accompanying
6    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7===============================================================================/]
8[section:operator Parser Operators]
9
10Operators are used as a means for object composition and embedding.
11Simple parsers may be composed to form composites through operator
12overloading, crafted to approximate the syntax of __peg__ (PEG). An
13expression such as:
14
15    a | b
16
17yields a new parser type which is a composite of its operands, `a` and
18`b`.
19
20This module includes different parsers which get instantiated if one of
21the overloaded operators is used with more primitive parser constructs.
22It includes Alternative (`|`), And-predicate (unary `&`), Difference
23(`-`), Expect (`>`), Kleene star (unary `*`), Lists (`%`), Not-predicate (`!`),
24Optional (unary `-`), Permutation (`^`), Plus (unary
25`+`), Sequence (`>>`), and Sequential-Or (`||`).
26
27[heading Module Header]
28
29    // forwards to <boost/spirit/home/qi/operator.hpp>
30    #include <boost/spirit/include/qi_operator.hpp>
31
32Also, see __include_structure__.
33
34[/------------------------------------------------------------------------------]
35[section:alternative Alternative Parser (`a | b`)]
36
37[heading Description]
38
39The alternative operator, `a | b`, matches one of two or more operands
40(`a`, `b`, ... etc.):
41
42    a | b | ...
43
44Alternative operands are tried one by one on a first-match-wins basis
45starting from the leftmost operand. After a successfully matched
46alternative is found, the parser concludes its search, essentially
47short-circuiting the search for other potentially viable candidates.
48This short-circuiting implicitly gives the highest priority to the
49leftmost alternative.
50
51Short-circuiting is done in the same manner as C or C++'s logical
52expressions; e.g. `if (x < 3 || y < 2)` where, if `x < 3`, the `y < 2`
53test is not done at all. In addition to providing an implicit priority
54rule for alternatives which is necessary, given its non-deterministic
55nature, short-circuiting improves the execution time. If the order of
56your alternatives is logically irrelevant, strive to put the (expected)
57most common choice first for maximum efficiency.
58
59[heading Header]
60
61    // forwards to <boost/spirit/home/qi/operator/alternative.hpp>
62    #include <boost/spirit/include/qi_alternative.hpp>
63
64Also, see __include_structure__.
65
66[heading Model of]
67
68[:__nary_parser_concept__]
69
70[variablelist Notation
71    [[`a`, `b`]     [A __parser_concept__]]
72]
73
74[heading Expression Semantics]
75
76Semantics of an expression is defined only where it differs from, or is not
77defined in __nary_parser_concept__.
78
79[table
80    [[Expression]       [Semantics]]
81    [[`a | b`]          [Match `a` or `b`.]]
82]
83
84[heading Attributes]
85
86See __qi_comp_attr_notation__.
87
88[table
89    [[Expression]       [Attribute]]
90    [[`a | b`]
91[``a: A, b: B --> (a | b): variant<A, B>
92a: A, b: Unused --> (a | b): optional<A>
93a: A, b: B, c: Unused --> (a | b | c): optional<variant<A, B> >
94a: Unused, b: B --> (a | b): optional<B>
95a: Unused, b: Unused --> (a | b): Unused
96a: A, b: A --> (a | b): A``]]
97]
98
99[note Alternative parsers do not roll back changes made to the outer attribute
100      because of a failed alternative. If you need to enforce that only the
101      succeeded alternative changes the outer attribute please utilize the
102      directive __qi_hold__`[]`.]
103
104[heading Complexity]
105
106[:The overall complexity of the alternative parser is defined by the sum
107of the complexities of its elements. The complexity of the alternative
108parser itself is O(N), where N is the number of alternatives.]
109
110[heading Example]
111
112[note The test harness for the example(s) below is presented in the
113__qi_basics_examples__ section.]
114
115Some using declarations:
116
117[reference_using_declarations_alternative]
118
119[reference_alternative]
120
121[endsect] [/ Alternative]
122
123[/------------------------------------------------------------------------------]
124[section:and_predicate And-Predicate Parser (`&a`)]
125
126[heading Description]
127
128Syntactic predicates assert a certain conditional syntax to be satisfied
129before evaluating another production. Similar to semantic predicates,
130__qi_eps__, syntactic predicates do not consume any input. The /and-predicate/,
131`&a`, is a positive syntactic predicate that returns a zero
132length match only if its predicate matches.
133
134[heading Header]
135
136    // forwards to <boost/spirit/home/qi/operator/and_predicate.hpp>
137    #include <boost/spirit/include/qi_and_predicate.hpp>
138
139Also, see __include_structure__.
140
141[heading Model of]
142
143[:__unary_parser_concept__]
144
145[variablelist Notation
146    [[`a`]      [A __parser_concept__]]
147]
148
149[heading Expression Semantics]
150
151Semantics of an expression is defined only where it differs from, or is
152not defined in __unary_parser_concept__.
153
154[table
155    [[Expression]       [Semantics]]
156    [[`&a`]             [If the predicate `a` matches, return a zero
157                        length match. Otherwise, fail.]]
158]
159
160[heading Attributes]
161
162See __qi_comp_attr_notation__.
163
164[table
165    [[Expression]       [Attribute]]
166    [[`&a`]             [__unused_type__]]
167]
168
169[heading Complexity]
170
171[:The complexity is defined by the complexity of the predicate, `a`]
172
173[heading Example]
174
175[note The test harness for the example(s) below is presented in the
176__qi_basics_examples__ section.]
177
178[reference_and_predicate]
179
180[endsect] [/ And Predicate]
181
182[/------------------------------------------------------------------------------]
183[section:difference Difference Parser (`a - b`)]
184
185[heading Description]
186
187The difference operator, `a - b`, is a binary operator that matches the
188first (LHS) operand but not the second (RHS). [footnote Unlike classic
189Spirit, with Spirit2, the expression will always fail if the RHS is a
190successful match regardless if the RHS matches less characters. For
191example, the rule `lit("policeman") - "police"` will always fail to
192match. Spirit2 does not count the matching chars while parsing and there
193is no reliable and fast way to check if the LHS matches more than the
194RHS.]
195
196[heading Header]
197
198    // forwards to <boost/spirit/home/qi/operator/difference.hpp>
199    #include <boost/spirit/include/qi_difference.hpp>
200
201Also, see __include_structure__.
202
203[heading Model of]
204
205[:__binary_parser_concept__]
206
207[variablelist Notation
208    [[`a`, `b`]     [A __parser_concept__]]
209]
210
211[heading Expression Semantics]
212
213Semantics of an expression is defined only where it differs from, or is
214not defined in __binary_parser_concept__.
215
216[table
217    [[Expression]       [Semantics]]
218    [[`a - b`]          [Parse `a` but not `b`.]]
219]
220
221[heading Attributes]
222
223See __qi_comp_attr_notation__.
224
225[table
226    [[Expression]       [Attribute]]
227    [[`a - b`]
228[``a: A, b: B --> (a - b): A
229a: Unused, b: B --> (a - b): Unused``]]
230]
231
232[heading Complexity]
233
234[:The complexity of the difference parser is defined by the sum of the
235complexities of both operands.]
236
237[heading Example]
238
239[note The test harness for the example(s) below is presented in the
240__qi_basics_examples__ section.]
241
242[reference_difference]
243
244[endsect] [/ Difference]
245
246[/------------------------------------------------------------------------------]
247[section:expect Expectation Operator (`a > b`)]
248
249[heading Description]
250
251There are occasions in which it is expected that the input must match a
252particular parser or the input is invalid. Such cases generally arise
253after matching a portion of a grammar, such that the context is fully
254known. In such a situation, failure to match should result in an
255exception. For example, when parsing an e-mail address, after matching a
256name and "@" there must be a domain name or the address is invalid.
257
258The expectation operator (>) requires that the following parser match
259the input or an exception is emitted. Using on_error(), that exception
260can be handled by calling a handler with the context at which the
261parsing failed can be reported.
262
263By contrast, the follows operator (>>) does not require that the
264following parser match the input, which allows for backtracking or
265simply returning false from the parse() function with no exceptions.
266
267Like the __qi_sequence__, the expectation operator, `a > b`, parses two or
268more operands (`a`, `b`, ... etc.), in sequence:
269
270    a > b > ...
271
272However, while the plain __qi_sequence__ simply returns a no-match
273(returns `false`) when one of the elements fail, the expectation: `>`
274operator throws an __qi_expectation_failure__`<Iter>` when the second or
275succeeding operands (all operands except the first) fail to match.
276
277[heading Header]
278
279    // forwards to <boost/spirit/home/qi/operator/expect.hpp>
280    #include <boost/spirit/include/qi_expect.hpp>
281
282Also, see __include_structure__.
283
284[heading Model of]
285
286[:__nary_parser_concept__]
287
288[variablelist Notation
289    [[`a`, `b`]     [A __parser_concept__]]
290    [[`Iter`]       [A __fwditer__ type]]
291]
292
293[heading Expectation Failure]
294
295When any operand, except the first, fail to match an
296`expectation_failure<Iter>` is thrown:
297
298    template <typename Iter>
299    struct expectation_failure : std::runtime_error
300    {
301        Iter first;           // [first, last) iterator pointing
302        Iter last;            // to the error position in the input.
303        __info__ what_;       // Information about the nature of the error.
304    };
305
306[heading Expression Semantics]
307
308Semantics of an expression is defined only where it differs from, or is not
309defined in __nary_parser_concept__.
310
311[table
312    [[Expression]       [Semantics]]
313    [[`a > b`]          [Match `a` followed by `b`. If `a` fails, no-match.
314                        If `b` fails, throw an `expectation_failure<Iter>`]]
315]
316
317[note If you need an exception to be thrown if `a` fails, use the __qi_expectd__ directive instead of the expectation operator.]
318
319[heading Attributes]
320
321See __qi_comp_attr_notation__.
322
323[table
324    [[Expression]       [Attribute]]
325    [[`a > b`]
326[``a: A, b: B --> (a > b): tuple<A, B>
327a: A, b: Unused --> (a > b): A
328a: Unused, b: B --> (a > b): B
329a: Unused, b: Unused --> (a > b): Unused
330
331a: A, b: A --> (a > b): vector<A>
332a: vector<A>, b: A --> (a > b): vector<A>
333a: A, b: vector<A> --> (a > b): vector<A>
334a: vector<A>, b: vector<A> --> (a > b): vector<A>``]]
335]
336
337[heading Complexity]
338
339[:The overall complexity of the expectation parser is defined by the sum
340of the complexities of its elements. The complexity of the expectation
341operator itself is O(N), where N is the number of elements in the
342sequence.]
343
344[heading Example]
345
346[note The test harness for the example(s) below is presented in the
347__qi_basics_examples__ section.]
348
349Some using declarations:
350
351[reference_using_declarations_expect]
352
353[reference_expect]
354
355[endsect] [/ Expectation]
356
357[/------------------------------------------------------------------------------]
358[section:kleene Kleene Parser (`*a`)]
359
360[heading Description]
361
362The kleene operator, `*a`, is a unary operator that matches its operand
363zero or more times.
364
365[heading Header]
366
367    // forwards to <boost/spirit/home/qi/operator/kleene.hpp>
368    #include <boost/spirit/include/qi_kleene.hpp>
369
370Also, see __include_structure__.
371
372[heading Model of]
373
374[:__unary_parser_concept__]
375
376[variablelist Notation
377    [[`a`]      [A __parser_concept__]]
378]
379
380[heading Expression Semantics]
381
382Semantics of an expression is defined only where it differs from, or is not
383defined in __unary_parser_concept__.
384
385[table
386    [[Expression]       [Semantics]]
387    [[`*a`]             [Match `a` zero or more times.]]
388]
389
390[heading Attributes]
391
392See __qi_comp_attr_notation__.
393
394[table
395    [[Expression]       [Attribute]]
396    [[`*a`]
397[``a: A --> *a: vector<A>
398a: Unused --> *a: Unused``]]
399]
400
401[heading Complexity]
402
403[:The overall complexity of the Kleene star is defined by the complexity
404of its subject, `a`, multiplied by the number of repetitions. The
405complexity of the Kleene star itself is O(N), where N is the number
406successful repetitions.]
407
408[heading Example]
409
410[note The test harness for the example(s) below is presented in the
411__qi_basics_examples__ section.]
412
413[reference_kleene]
414
415[endsect] [/ Kleene]
416
417[/------------------------------------------------------------------------------]
418[section:list List Parser (`a % b`)]
419
420[heading Description]
421
422The list operator, `a % b`, is a binary operator that matches a list of
423one or more repetitions of `a` separated by occurrences of `b`. This is
424equivalent to `a >> *(b >> a)`.
425
426[heading Header]
427
428    // forwards to <boost/spirit/home/qi/operator/list.hpp>
429    #include <boost/spirit/include/qi_list.hpp>
430
431Also, see __include_structure__.
432
433[heading Model of]
434
435[:__binary_parser_concept__]
436
437[variablelist Notation
438    [[`a`, `b`]     [A __parser_concept__]]
439]
440
441[heading Expression Semantics]
442
443Semantics of an expression is defined only where it differs from, or is
444not defined in __binary_parser_concept__.
445
446[table
447    [[Expression]       [Semantics]]
448    [[`a % b`]          [Match a list of one or more repetitions of `a`
449                        separated by occurrences of `b`. This is
450                        equivalent to `a >> *(omit[b] >> a)`.]]
451]
452
453[note The list operator `a % b` omits the attribute of parser `b`. If you need
454      `b` to contribute to the result attribute choose `a >> *(b >> a)` over
455      the list operator `a % b`.]
456
457
458[heading Attributes]
459
460See __qi_comp_attr_notation__.
461
462[table
463    [[Expression]       [Attribute]]
464    [[`a % b`]
465[``a: A, b: B --> (a % b): vector<A>
466a: Unused, b: B --> (a % b): Unused``]]
467]
468
469[heading Complexity]
470
471[:The overall complexity of the List is defined by the complexity of its
472subject, `a`, multiplied by the number of repetitions. The complexity of
473the List itself is O(N), where N is the number successful repetitions.]
474
475[heading Example]
476
477[note The test harness for the example(s) below is presented in the
478__qi_basics_examples__ section.]
479
480[reference_list]
481
482[endsect] [/ List]
483
484[/------------------------------------------------------------------------------]
485[section:not_predicate Not-Predicate Parser (`!a`)]
486
487[heading Description]
488
489Syntactic predicates assert a certain conditional syntax to be satisfied
490before evaluating another production. Similar to semantic predicates,
491__qi_eps__, syntactic predicates do not consume any input. The /not-predicate/,
492`!a`, is a negative syntactic predicate that returns a zero
493length match only if its predicate fails to match.
494
495[heading Header]
496
497    // forwards to <boost/spirit/home/qi/operator/not_predicate.hpp>
498    #include <boost/spirit/include/qi_not_predicate.hpp>
499
500Also, see __include_structure__.
501
502[heading Model of]
503
504[:__unary_parser_concept__]
505
506[variablelist Notation
507    [[`a`]      [A __parser_concept__]]
508]
509
510[heading Expression Semantics]
511
512Semantics of an expression is defined only where it differs from, or is
513not defined in __unary_parser_concept__.
514
515[table
516    [[Expression]       [Semantics]]
517    [[`!a`]             [If the predicate `a` matches, fail. Otherwise,
518                        return a zero length match.]]
519]
520
521[heading Attributes]
522
523See __qi_comp_attr_notation__.
524
525[table
526    [[Expression]       [Attribute]]
527    [[`!a`]             [__unused_type__]]
528]
529
530[heading Complexity]
531
532[:The complexity is defined by the complexity of the predicate, `a`]
533
534[heading Example]
535
536[note The test harness for the example(s) below is presented in the
537__qi_basics_examples__ section.]
538
539[reference_not_predicate]
540
541[endsect] [/ Not Predicate]
542
543[/------------------------------------------------------------------------------]
544[section:optional Optional Parser (`-a`)]
545
546[heading Description]
547
548The optional operator, `-a`, is a unary operator that matches its
549operand zero or one time.
550
551[heading Header]
552
553    // forwards to <boost/spirit/home/qi/operator/optional.hpp>
554    #include <boost/spirit/include/qi_optional.hpp>
555
556Also, see __include_structure__.
557
558[heading Model of]
559
560[:__unary_parser_concept__]
561
562[variablelist Notation
563    [[`a`]      [A __parser_concept__]]
564]
565
566[heading Expression Semantics]
567
568Semantics of an expression is defined only where it differs from, or is not
569defined in __unary_parser_concept__.
570
571[table
572    [[Expression]       [Semantics]]
573    [[`-a`]             [Match `a` zero or one time.]]
574]
575
576[heading Attributes]
577
578See __qi_comp_attr_notation__.
579
580[table
581    [[Expression]       [Attribute]]
582    [[`-a`]
583[``a: A --> -a: optional<A>
584a: Unused --> -a: Unused``]]
585]
586
587[heading Complexity]
588
589[:The complexity is defined by the complexity of the operand, `a`]
590
591[heading Example]
592
593[note The test harness for the example(s) below is presented in the
594__qi_basics_examples__ section.]
595
596[reference_optional]
597
598[endsect] [/ Optional]
599
600[/------------------------------------------------------------------------------]
601[section:permutation Permutation Parser (`a ^ b`)]
602
603[heading Description]
604
605The permutation operator, `a ^ b`, matches one or more operands (`a`, `b`,
606... etc.) in any order:
607
608    a ^ b ^ ...
609
610The operands are the elements in the permutation set. Each element in
611the permutation set may occur at most once, but not all elements of the
612given set need to be present. Note that by this definition, the
613permutation operator is not limited to strict permutations.
614
615For example:
616
617     char_('a') ^ 'b' ^ 'c'
618
619matches:
620
621     "a", "ab", "abc", "cba", "bca" ... etc.
622
623[heading Header]
624
625    // forwards to <boost/spirit/home/qi/operator/permutation.hpp>
626    #include <boost/spirit/include/qi_permutation.hpp>
627
628Also, see __include_structure__.
629
630[heading Model of]
631
632[:__nary_parser_concept__]
633
634[variablelist Notation
635    [[`a`, `b`]     [A __parser_concept__]]
636]
637
638[heading Expression Semantics]
639
640Semantics of an expression is defined only where it differs from, or is not
641defined in __nary_parser_concept__.
642
643[table
644    [[Expression]       [Semantics]]
645    [[`a ^ b`]          [Match `a` or `b` in any order. Each operand
646                        may match zero or one time as long as at least
647                        one operand matches.]]
648]
649
650[heading Attributes]
651
652See __qi_comp_attr_notation__.
653
654[table
655    [[Expression]       [Attribute]]
656    [[`a ^ b`]
657[``a: A, b: B --> (a ^ b): tuple<optional<A>, optional<B> >
658a: A, b: Unused --> (a ^ b): optional<A>
659a: Unused, b: B --> (a ^ b): optional<B>
660a: Unused, b: Unused --> (a ^ b): Unused``]]
661]
662
663[heading Complexity]
664
665[:The overall complexity of the permutation parser is defined by the sum
666of the complexities of its elements, s, multiplied by log s. The
667complexity of the permutation parser itself is O(N log N), where N is
668the number of elements.]
669
670[heading Example]
671
672[note The test harness for the example(s) below is presented in the
673__qi_basics_examples__ section.]
674
675Some using declarations:
676
677[reference_using_declarations_permutation]
678
679[reference_permutation]
680
681[endsect] [/ Permutation]
682
683[/------------------------------------------------------------------------------]
684[section:plus Plus Parser (`+a`)]
685
686[heading Description]
687
688The plus operator, `+a`, is a unary operator that matches its operand one
689or more times.
690
691[heading Header]
692
693    // forwards to <boost/spirit/home/qi/operator/plus.hpp>
694    #include <boost/spirit/include/qi_plus.hpp>
695
696Also, see __include_structure__.
697
698[heading Model of]
699
700[:__unary_parser_concept__]
701
702[variablelist Notation
703    [[`a`]      [A __parser_concept__]]
704]
705
706[heading Expression Semantics]
707
708Semantics of an expression is defined only where it differs from, or is not
709defined in __unary_parser_concept__.
710
711[table
712    [[Expression]       [Semantics]]
713    [[`+a`]             [Match `a` one or more times.]]
714]
715
716[heading Attributes]
717
718See __qi_comp_attr_notation__.
719
720[table
721    [[Expression]       [Attribute]]
722    [[`+a`]
723[``a: A --> +a: vector<A>
724a: Unused --> +a: Unused``]]
725]
726
727[heading Complexity]
728
729[:The overall complexity of the Plus is defined by the complexity of its
730subject, `a`, multiplied by the number of repetitions. The complexity of
731the Plus itself is O(N), where N is the number successful repetitions.]
732
733[heading Example]
734
735[note The test harness for the example(s) below is presented in the
736__qi_basics_examples__ section.]
737
738[reference_plus]
739
740[endsect] [/ Plus]
741
742[/------------------------------------------------------------------------------]
743[section:sequence Sequence Parser (`a >> b`)]
744
745[heading Description]
746
747The sequence operator, `a >> b`, parses two or more operands (`a`,
748`b`, ... etc.), in sequence:
749
750    a >> b >> ...
751
752[heading Header]
753
754    // forwards to <boost/spirit/home/qi/operator/sequence.hpp>
755    #include <boost/spirit/include/qi_sequence.hpp>
756
757Also, see __include_structure__.
758
759[heading Model of]
760
761[:__nary_parser_concept__]
762
763[variablelist Notation
764    [[`a`, `b`]     [A __parser_concept__]]
765]
766
767[heading Expression Semantics]
768
769Semantics of an expression is defined only where it differs from, or is not
770defined in __nary_parser_concept__.
771
772[table
773    [[Expression]       [Semantics]]
774    [[`a >> b`]         [Match `a` followed by `b`.]]
775]
776
777[heading Attributes]
778
779See __qi_comp_attr_notation__.
780
781[table
782    [[Expression]       [Attribute]]
783    [[`a >> b`]
784[``a: A, b: B --> (a >> b): tuple<A, B>
785a: A, b: Unused --> (a >> b): A
786a: Unused, b: B --> (a >> b): B
787a: Unused, b: Unused --> (a >> b): Unused
788
789a: A, b: A --> (a >> b): vector<A>
790a: vector<A>, b: A --> (a >> b): vector<A>
791a: A, b: vector<A> --> (a >> b): vector<A>
792a: vector<A>, b: vector<A> --> (a >> b): vector<A>``]]
793]
794
795[heading Complexity]
796
797[:The overall complexity of the sequence parser is defined by the sum of
798the complexities of its elements. The complexity of the sequence itself
799is O(N), where N is the number of elements in the sequence.]
800
801[heading Example]
802
803Some using declarations:
804
805[reference_using_declarations_sequence]
806
807[note The test harness for the example(s) below is presented in the
808__qi_basics_examples__ section.]
809
810[reference_sequence]
811
812[endsect] [/ Sequence]
813
814[/------------------------------------------------------------------------------]
815[section:sequential_or Sequential Or Parser (`a || b`)]
816
817[heading Description]
818
819The sequential-or operator, `a || b`, matches `a` or `b` or `a` followed
820by `b`.  That is, if both `a` and `b` match, it must be in sequence; this
821is equivalent to `a >> -b | b`:
822
823    a || b || ...
824
825[heading Header]
826
827    // forwards to <boost/spirit/home/qi/operator/sequential_or.hpp>
828    #include <boost/spirit/include/qi_sequential_or.hpp>
829
830Also, see __include_structure__.
831
832[heading Model of]
833
834[:__nary_parser_concept__]
835
836[variablelist Notation
837    [[`a`, `b`]     [A __parser_concept__]]
838]
839
840[heading Expression Semantics]
841
842Semantics of an expression is defined only where it differs from, or is not
843defined in __nary_parser_concept__.
844
845[table
846    [[Expression]       [Semantics]]
847    [[`a || b`]         [Match `a` or `b` in sequence. equivalent to `a >> -b | b`]]
848]
849
850[heading Attributes]
851
852See __qi_comp_attr_notation__.
853
854[table
855    [[Expression]       [Attribute]]
856    [[`a || b`]
857[``a: A, b: B --> (a || b): tuple<optional<A>, optional<B> >
858a: A, b: Unused --> (a || b): optional<A>
859a: Unused, b: B --> (a || b): optional<B>
860a: Unused, b: Unused --> (a || b): Unused
861
862a: A, b: A --> (a || b): vector<optional<A> >``]]
863]
864
865[note The sequential-or parser behaves attribute-wise very similar to the
866      plain sequence parser (`a >> b`) in the sense that it exposes the
867      attributes of its elements separately. For instance, if you attach a
868      semantic action to the whole sequential-or:
869      ``
870          (int_ || int_)[print_pair(_1, _2)]
871      ``
872      the function object `print_pair` would be invoked with the
873      attribute of the first `int_` (`boost::optional<int>`) as its first
874      parameter and the attribute of the second `int_` (`boost::optional<int>`
875      as well) as its second parameter.]
876
877[heading Complexity]
878
879[:The overall complexity of the sequential-or parser is defined by the
880sum of the complexities of its elements. The complexity of the
881sequential-or itself is O(N), where N is the number of elements in the
882sequence.]
883
884[heading Example]
885
886[note The test harness for the example(s) below is presented in the
887__qi_basics_examples__ section.]
888
889Some using declarations:
890
891[reference_using_declarations_sequential_or]
892
893[reference_sequential_or]
894
895[endsect] [/ Sequential Or]
896
897[endsect]
898