Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84746 - trunk/libs/spirit/doc/qi
From: joel_at_[hidden]
Date: 2013-06-12 00:37:40


Author: djowel
Date: 2013-06-12 00:37:39 EDT (Wed, 12 Jun 2013)
New Revision: 84746
URL: http://svn.boost.org/trac/boost/changeset/84746

Log:
Added on_success docs from Richard

Text files modified:
   trunk/libs/spirit/doc/qi/error_handling.qbk | 28 ++++++++++++++++++++++++++++
   1 files changed, 28 insertions(+), 0 deletions(-)

Modified: trunk/libs/spirit/doc/qi/error_handling.qbk
==============================================================================
--- trunk/libs/spirit/doc/qi/error_handling.qbk Tue Jun 11 15:49:19 2013 (r84745)
+++ trunk/libs/spirit/doc/qi/error_handling.qbk 2013-06-12 00:37:39 EDT (Wed, 12 Jun 2013) (r84746)
@@ -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:


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