Opened 18 years ago
Closed 18 years ago
#331 closed Support Requests (None)
spirit: run-time error
| Reported by: | bnf | Owned by: | nobody |
|---|---|---|---|
| Milestone: | Component: | None | |
| Version: | None | Severity: | |
| Keywords: | Cc: |
Description
I am using the Spirit library v1.8.1, part of Boost 1.32.
Here is a test case which fails at run-time: I get a
VC++ Debug Library Error in file
core\non-terminal\impl\rule.ipp at line 173.
My compiler is VC++ 7.1 on Windows XP SP2.
In particular I get a Run-Time Check Failure #2: Stack
around the variable 'context-wrap' was corrupted.
Any idea about what can be the problem?
Please note that with the following I don't get any error:
definition(const JSIGrammar& self)
{
Rule_T pp_token = real_p
r = ch_p('#') >> str_p("line") >> +(pp_token);
}
struct JSIGrammar : public grammar<JSIGrammar>
{
template <typename ScannerT>
struct definition
{
typedef rule<ScannerT> Rule_T;
definition(const JSIGrammar& self)
{
Rule_T pp_number = real_p;
Rule_T pp_token = pp_number;
r = ch_p('#') >> str_p("line") >> +(pp_token);
}
const Rule_T& start() const
{
return r;
}
Rule_T r;
};
};
int
main(int argc, char* argv[])
{
string str;
{
ifstream in(argv[1]);
ostringstream out;
out << in.rdbuf();
str = out.str();
}
typedef parse_info<string::iterator> Info;
JSIGrammar g;
Info pi = parse(str.begin(), str.end(), g, space_p);
if ( pi.hit )
{
cout << "Match" << endl;
cout << "Full: " << (pi.full ? "Yes" : "No") << endl;
cout << "Length: " << pi.length << endl;
}
else
{
cout << "No match" << endl;
}
return 0;
}
Note:
See TracTickets
for help on using tickets.
