|  | Home | Libraries | People | FAQ | More | 
          The seek[]
          parser-directive skips all input until the subject parser matches.
        
// forwards to <boost/spirit/repository/home/qi/directive/seek.hpp> #include <boost/spirit/repository/include/qi_seek.hpp>
Also, see Include Structure.
| Name | 
|---|
| 
                     | 
Notation
a
                A Parser.
              
          Semantics of an expression is defined only where it differs from, or is
          not defined in UnaryParser.
        
| Expression | Semantics | 
|---|---|
| 
                     | 
                    Advances until the parser  | 
See Compound Attribute Notation.
| Expression | Attribute | 
|---|---|
| 
                     | 
 a: A --> seek[a]: A a: Unused --> seek[a]: Unused 
 | 
The overall complexity is defined by the complexity of its subject parser. The complexity of
seekitself is O(N), where N is the number of unsuccessful matches.
| ![[Note]](../../../images/note.png) | Note | 
|---|---|
| seeking sequence with skipping 
            Using  seek[lexeme[skip[a >> b]]] does the trick. | 
          The following example shows a simple use case of the seek[] directive, parsing C-style comment. (For
          the full source of the example, see seek.cpp)
        
Some namespace aliases:
namespace qi = boost::spirit::qi; namespace repo = boost::spirit::repository;
The input string and its iterators:
std::string str("/*C-style comment*/"); iterator it = str.begin(); iterator end = str.end();
Parsing and showing the result:
if (qi::parse(it, end, "/*" >> repo::qi::seek["*/"])) { std::cout << "-------------------------------- \n"; std::cout << "Parsing succeeded.\n"; std::cout << "---------------------------------\n"; } else { std::cout << "-------------------------------- \n"; std::cout << "Unterminated /* comment.\n"; std::cout << "-------------------------------- \n"; }