|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r85052 - in branches/release/libs/spirit: . doc doc/qi example example/qi
From: joel_at_[hidden]
Date: 2013-07-16 06:52:11
Author: djowel
Date: 2013-07-16 06:52:11 EDT (Tue, 16 Jul 2013)
New Revision: 85052
URL: http://svn.boost.org/trac/boost/changeset/85052
Log:
Merge from Trunk
Properties modified:
branches/release/libs/spirit/ (props changed)
branches/release/libs/spirit/doc/ (props changed)
branches/release/libs/spirit/example/ (props changed)
Text files modified:
branches/release/libs/spirit/doc/qi/error_handling.qbk | 28 ++++++++++++++++++++++++++++
branches/release/libs/spirit/example/qi/typeof.cpp | 4 ++++
2 files changed, 32 insertions(+), 0 deletions(-)
Modified: branches/release/libs/spirit/doc/qi/error_handling.qbk
==============================================================================
--- branches/release/libs/spirit/doc/qi/error_handling.qbk Tue Jul 16 06:46:32 2013 (r85051)
+++ branches/release/libs/spirit/doc/qi/error_handling.qbk 2013-07-16 06:52:11 EDT (Tue, 16 Jul 2013) (r85052)
@@ -38,6 +38,34 @@
start_tag.name("start_tag");
end_tag.name("end_tag");
+[heading On Success]
+
+`on_success` declares a handler that is applied when a rule is
+succesfully matched.
+
+ on_success(rule, handler)
+
+This specifies that the handler will be called when a rule is
+matched successfully. The handler has the following signature:
+
+ void handler(
+ fusion::vector<
+ Iterator& first,
+ Iterator const& last,
+ Iterator const& i> args,
+ Context& context)
+
+`first` points to the position in the input sequence before the rule
+is matched. `last` points to the last position in the input sequence.
+`i` points to the position in the input sequence following the last
+character that was consumed by the rule.
+
+A success handler can be used to annotate each matched rule in the
+grammar with additional information about the portion of the input
+that matched the rule. In a compiler application, this can be a
+combination of file, line number and column number from the input
+stream for reporting diagnostics or other messages.
+
[heading On Error]
`on_error` declares our error handler:
Modified: branches/release/libs/spirit/example/qi/typeof.cpp
==============================================================================
--- branches/release/libs/spirit/example/qi/typeof.cpp Tue Jul 16 06:46:32 2013 (r85051)
+++ branches/release/libs/spirit/example/qi/typeof.cpp 2013-07-16 06:52:11 EDT (Tue, 16 Jul 2013) (r85052)
@@ -29,6 +29,10 @@
using boost::spirit::qi::parse;
typedef std::string::const_iterator iterator_type;
+///////////////////////////////////////////////////////////////////////////////
+// this works for non-c++11 compilers
+#ifdef BOOST_NO_CXX11_AUTO_DECLARATIONS
+
BOOST_SPIRIT_AUTO(qi, comment, "/*" >> *(char_ - "*/") >> "*/");
std::string str = "/*This is a comment*/";
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