Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59717 - in trunk/libs/spirit: doc/qi test/qi
From: joel_at_[hidden]
Date: 2010-02-16 21:09:31


Author: djowel
Date: 2010-02-16 21:09:30 EST (Tue, 16 Feb 2010)
New Revision: 59717
URL: http://svn.boost.org/trac/boost/changeset/59717

Log:
minor tweaks
Text files modified:
   trunk/libs/spirit/doc/qi/quick_reference.qbk | 67 ++++++++++++++++++++-------------------
   trunk/libs/spirit/test/qi/hold.cpp | 15 +++++++-
   2 files changed, 48 insertions(+), 34 deletions(-)

Modified: trunk/libs/spirit/doc/qi/quick_reference.qbk
==============================================================================
--- trunk/libs/spirit/doc/qi/quick_reference.qbk (original)
+++ trunk/libs/spirit/doc/qi/quick_reference.qbk 2010-02-16 21:09:30 EST (Tue, 16 Feb 2010)
@@ -58,29 +58,29 @@
     [[`char_(ch, ch2)`] [`Ch`] [Matches a range of chars from `ch` to `ch2` (inclusive)]]
     [[`char_(charset)`] [`Ch`] [Matches a character set `charset`]]
 
- [[`alnum`] [`Ch`] [Matches a character based on the equivalent of
+ [[`alnum`] [`Ch`] [Matches a character based on the equivalent of
                                                   `std::isalnum` in the current character set]]
- [[`alpha`] [`Ch`] [Matches a character based on the equivalent of
+ [[`alpha`] [`Ch`] [Matches a character based on the equivalent of
                                                   `std::isalpha` in the current character set]]
- [[`blank`] [`Ch`] [Matches a character based on the equivalent of
+ [[`blank`] [`Ch`] [Matches a character based on the equivalent of
                                                   `std::isblank` in the current character set]]
- [[`cntrl`] [`Ch`] [Matches a character based on the equivalent of
+ [[`cntrl`] [`Ch`] [Matches a character based on the equivalent of
                                                   `std::iscntrl` in the current character set]]
- [[`digit`] [`Ch`] [Matches a character based on the equivalent of
+ [[`digit`] [`Ch`] [Matches a character based on the equivalent of
                                                   `std::isdigit` in the current character set]]
- [[`graph`] [`Ch`] [Matches a character based on the equivalent of
+ [[`graph`] [`Ch`] [Matches a character based on the equivalent of
                                                   `std::isgraph` in the current character set]]
- [[`print`] [`Ch`] [Matches a character based on the equivalent of
+ [[`print`] [`Ch`] [Matches a character based on the equivalent of
                                                   `std::isprint` in the current character set]]
- [[`punct`] [`Ch`] [Matches a character based on the equivalent of
+ [[`punct`] [`Ch`] [Matches a character based on the equivalent of
                                                   `std::ispunct` in the current character set]]
- [[`space`] [`Ch`] [Matches a character based on the equivalent of
+ [[`space`] [`Ch`] [Matches a character based on the equivalent of
                                                   `std::isspace` in the current character set]]
- [[`xdigit`] [`Ch`] [Matches a character based on the equivalent of
+ [[`xdigit`] [`Ch`] [Matches a character based on the equivalent of
                                                   `std::isxdigit` in the current character set]]
- [[`lower`] [`Ch`] [Matches a character based on the equivalent of
+ [[`lower`] [`Ch`] [Matches a character based on the equivalent of
                                                   `std::islower` in the current character set]]
- [[`upper`] [`Ch`] [Matches a character based on the equivalent of
+ [[`upper`] [`Ch`] [Matches a character based on the equivalent of
                                                   `std::isupper` in the current character set]]
 ]
 
@@ -109,7 +109,7 @@
 [endsect]
 [section:string String Parsers]
 
-[table
+[table
     [[Expression] [Attribute] [Description]]
     [[[qi_lit_string `str`]] [`Unused`] [Matches `str`]]
     [[[qi_lit_string `lit(str)`]] [`Unused`] [Matches `str`]]
@@ -138,7 +138,7 @@
 [endsect]
 [section:auxiliary Auxiliary Parsers]
 
-[table
+[table
     [[Expression] [Attribute] [Description]]
     [[__qi_eol__] [`Unused`] [Matches the end of line (`\r` or `\n` or `\r\n`)]]
     [[__qi_eoi__] [`Unused`] [Matches the end of input (first == last)]]
@@ -148,14 +148,14 @@
                             is the return type of `fp`] [Invoke `fp` at parse time, returning a parser
                                                         `p` which is then called to parse.]]
     [[`fp`] [see `lazy(fp)` above] [Equivalent to `lazy(fp)`]]
- [[__qi_attr__] [`Attrib`] [Doesn't consume/parse any input, but exposes the
+ [[__qi_attr__] [`Attrib`] [Doesn't consume/parse any input, but exposes the
                                                          argument `attrib` as its attribute.]]
 ]
 
 [endsect]
 [section:binary Binary Parsers]
 
-[table
+[table
     [[Expression] [Attribute] [Description]]
     [[`byte_`] [8 bits native endian] [Matches an 8 bit binary]]
     [[`word`] [16 bits native endian] [Matches a 16 bit binary]]
@@ -175,7 +175,7 @@
 
 See here for more information about [qi_auto Auto Parsers].
 
-[table
+[table
     [[Expression] [Attribute] [Description]]
     [[[qi_auto `auto_`]] [`hold_any`] [Parse input using a parser
                                              created from the supplied attribute type
@@ -186,7 +186,7 @@
 
 [section:directive Parser Directives]
 
-[table
+[table
     [[Expression] [Attribute] [Description]]
     [[__qi_lexeme__`[a]`] [`A`] [Disable skip parsing for `a`]]
     [[__qi_no_case__`[a]`] [`A`] [Inhibits case-sensitivity for `a`]]
@@ -207,11 +207,11 @@
 [endsect]
 [section:operator Parser Operators]
 
-[table
+[table
     [[Expression] [Attribute] [Description]]
- [[`!a`] [`Unused`] [Not predicate. If the predicate `a` matches,
+ [[`!a`] [`Unused`] [Not predicate. If the predicate `a` matches,
                                                         fail. Otherwise, return a zero length match.]]
- [[`&a`] [`Unused`] [And predicate. If the predicate `a` matches,
+ [[`&a`] [`Unused`] [And predicate. If the predicate `a` matches,
                                                         return a zero length match. Otherwise, fail.]]
     [[`-a`] [`optional<A>`] [Optional. Parse `a` zero or one time]]
     [[`*a`] [`vector<A>`] [Kleene. Parse `a` zero or more times]]
@@ -222,7 +222,10 @@
                                                         expected to match when `a` matches, otherwise,
                                                         an `expectation_failure` is thrown.]]
     [[`a - b`] [`A`] [Difference. Parse `a` but not `b`]]
- [[`a || b`] [`tuple<A, B>`] [Sequential Or. Parse `a` or `b` or `a` followed by `b`]]
+ [[`a || b`] [`tuple<`
+ `optional<A>,`
+ `optional<B> >`
+ ] [Sequential Or. Parse `a` or `b` or `a` followed by `b`]]
     [[`a % b`] [`vector<A>`] [List. Parse `a` delimited `b` one or more times]]
     [[`a ^ b`] [`tuple<`
                                 `optional<A>,`
@@ -233,7 +236,7 @@
 [endsect]
 [section:action Parser Semantic Actions]
 
-[table
+[table
     [[Expression] [Attribute] [Description]]
     [[`p[fa]`] [Attribute of `p`] [Call semantic action, `fa` if p succeeds.]]
 ]
@@ -253,24 +256,24 @@
 operands and `composite-attribute` is the resulting attribute type of
 the composite expression.
 
-For instance:
+For instance:
 
     a: A, b: B --> (a >> b): tuple<A, B>
 
 reads as: given, `a` and `b` are parsers, and `A` is the type of the
 attribute of `a`, and `B` is the type of the attribute of `b`, then the
-type of the attribute of `a >> b` will be `tuple<A, B>`.
+type of the attribute of `a >> b` will be `tuple<A, B>`.
 
 [important In the attribute tables, we will use `vector<A>` and
 `tuple<A, B...>` as placeholders only. The notation of `vector<A>`
 stands for ['any __stl__ container] holding elements of type `A` and the
 notation `tuple<A, B...>` stands for ['any __fusion__ sequence] holding
 `A`, `B`, ... etc. elements. Finally, `Unused` stands for
-__unused_type__. ]
+__unused_type__. ]
 
 [heading Compound Parser Attribute Types]
 
-[table
+[table
     [[Expression] [Attribute]]
 
     [[`a >> b`]
@@ -322,7 +325,7 @@
 [``a: A --> repeat(...,...)[a]: vector<A>
 a: Unused --> repeat(...,...)[a]: Unused``]]
 
- [[`a || b`]
+ [[`a || b`]
 [``a: A, b: B --> (a || b): tuple<optional<A>, optional<B> >
 a: A, b: Unused --> (a || b): optional<A>
 a: Unused, b: B --> (a || b): optional<B>
@@ -436,7 +439,7 @@
 The `unused_type` is used in the signatures above to signify 'don't
 care'.
 
-For more detailed information about semantic actions see:
+For more detailed information about semantic actions see:
 [link spirit.qi.tutorials.semantic_actions here].
 
 [endsect]
@@ -458,11 +461,11 @@
     [[`_pass`] [Assign `false` to `_pass` to force a parser failure.]]
 ]
 
-[important All placeholders mentioned above are defined in the namespace
- `boost::spirit` and, for your convenience, are available in the
+[important All placeholders mentioned above are defined in the namespace
+ `boost::spirit` and, for your convenience, are available in the
            namespace `boost::spirit::qi` as well.]
 
-For more detailed information about semantic actions see:
+For more detailed information about semantic actions see:
 [link spirit.qi.tutorials.semantic_actions here].
 
 [endsect]

Modified: trunk/libs/spirit/test/qi/hold.cpp
==============================================================================
--- trunk/libs/spirit/test/qi/hold.cpp (original)
+++ trunk/libs/spirit/test/qi/hold.cpp 2010-02-16 21:09:30 EST (Tue, 16 Feb 2010)
@@ -21,15 +21,26 @@
     using spirit_test::test_attr;
     using boost::spirit::qi::hold;
     using boost::spirit::qi::int_;
+ using boost::spirit::ascii::alpha;
 
     {
         std::vector<int> vec;
- BOOST_TEST((!test_attr("1$", hold[int_ >> ';'], vec)));
+ BOOST_TEST(!test_attr("1$", hold[int_ >> ';'], vec));
         BOOST_TEST(vec.size() == 0);
- BOOST_TEST((test_attr("1;", hold[int_ >> ';'], vec)));
+ BOOST_TEST(test_attr("1;", hold[int_ >> ';'], vec));
         BOOST_TEST(vec.size() == 1);
         BOOST_TEST(vec[0] == 1);
     }
 
+ {
+ std::string attr;
+ BOOST_TEST(
+ test_attr(
+ "abc;",
+ hold[alpha >> ';'] | (+alpha >> ';'),
+ attr));
+ BOOST_TEST(attr == "abc");
+ }
+
     return boost::report_errors();
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk