how to get the char_ type value
Jens Kallup <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
Hello,
how can i get the char_ type and value for \n ...
in line_no_struct operator() ?
// ----------------------------------------------
// little struct, that handles the new-lines ...
// ----------------------------------------------
int line_no = 0;
struct
line_no_struct
{
template <typename> struct result { typedef void type; };
template <typename T>
void operator()(T const& s) const
{
std::cout << "DEBUG: '" << typeid(T).name() << "'\n";
}
};
boost::phoenix::function<line_no_struct> _line;
// ------------------------------------------------
// custom skipper ...
// for comments
// ------------------------------------------------
template <typename Iterator>
struct dbase_skipper : public qi::grammar<Iterator>
{
dbase_skipper() : dbase_skipper::base_type(my_skip, "dBase")
{
using qi::ascii::char_;
using qi::ascii::space;
using qi::eol;
using qi::eoi;
using qi::on_error;
using qi::fail;
my_skip =
(
char_("[ \t\n\r]")
[ line_func(qi::_1) ]
)
|
(
"**" >> *(
char_("äöüÄÖÜß")
[ line_func(qi::_1) ]
)
|
(
(char_ - eol
[ line_func(qi::_1) ])
)
>> (eol | eoi | char_("[\n\r]")
[ line_func(qi::_1) ]
)
)
|
(
"&&" >> *(
char_("äöüÄÖÜß")
[ line_func(qi::_1) ]
)
|
(
(char_ - eol
[ line_func(qi::_1) ])
)
>> (eol | eoi | char_("[\n\r]")
[ line_func(qi::_1) ]
)
)
|
(
"//"
>> *(
(
char_("äöüÄÖÜß") [ line_func(qi::_1) ]
)
|
(
char_ - eol [ line_func(qi::_1) ]
)
)
>> (
(eol | eoi | char_("[\n\r]")
[ line_func(qi::_1) ]
)
)
)
|
(
"/*"
>> *(char_ [ line_func(qi::_1) ] )
|
(char_ - "*/" ) >> "*/"
)
;
on_error<fail>
(
my_skip
, std::cout
<< boost::phoenix::val("Error! Expecting comment")
<< std::endl
);
qi::on_error<fail>(my_skip, client::error_handler_skip(_4,
_3, _2) );
BOOST_SPIRIT_DEBUG_NODE((my_skip));
}
rule<Iterator> my_skip;
phoenix::function<line_no_struct> line_func;
};
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
Spirit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general