[spirit] Grammar/Action problems

Hi,
my first parser and problems :-) Well, obviously I didn't understood the
translation of BNF in spirit (probably BNF also); attached the code.
The result is:
$ g++ spirit.cpp -o spirit && ./spirit
[Date] =
"[Data Ver] 3.4 "
^-- error ("D")
[Data Ver] = 0
"[File Name] foo.csv"
^-- error ("F")
[File Name] =
[Notes] = y
Can anybody help? Further more I need to replace the comment symbol rule
dynamically ("[Comment Char]") for the data self (not displayed here).
Thanks,
Olaf
---8<---
#include

sorry, I forgot the white space parser to add here: template <typename GrammarT> static void parse(GrammarT const& grammar, std::string expr) { std::string::iterator first = expr.begin(); sp::parse_infostd::string::iterator result = sp::parse(first, expr.end(), grammar, sp::space_p); if ( !result.hit ) { std::cerr << "\"" << expr << "\"" << std::endl; std::cerr << std::setw(result.stop - expr.begin() + 1) << "^-- error (" << "\"" << *result.stop << "\")" << std::endl; } else if ( !result.full ) { first = result.stop; } } Thanks, Olaf

template <typename GrammarT> static void parse(GrammarT const& grammar, std::string expr) { std::string::iterator first = expr.begin();
sp::parse_infostd::string::iterator result = sp::parse(first, expr.end(), grammar, sp::space_p);
if ( !result.hit ) { std::cerr << "\"" << expr << "\"" << std::endl; std::cerr << std::setw(result.stop - expr.begin() + 1) << "^-- error (" << "\"" << *result.stop << "\")" << std::endl; } else if ( !result.full ) { first = result.stop; } }
than I get: $ g++ spirit.cpp -o spirit && ./spirit [Date] = h [Data Ver] = -1078612884 "[File Name] foo.csv" ^-- error ("F") [File Name] = [Notes] = y
participants (1)
-
ope