|
Boost : |
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2008-02-06 10:56:45
Hi Eric,
(Apologies in advance for such a stupid question.)
I'm building a fairly simple parser using xpressive. I need to parse
text like this:
node C91967
{
label = "What brand of coffee do you use?";
position = (100 280);
states = ("Columbian blend" "Columbian gold" "Columbian all star"
"Columbian cinnamon");
HR_Inaccuracy = "0";
HR_Risk = "0";
HR_Time = "1";
HR_RefKey = "";
HR_Desc = "Question";
HR_ID = "91967";
HR_Def = "<div align=\"left\">&#160;</div><br/>";
HR_Web_Page = "";
HR_Type2 = "3";
}
potential (C91976 | CXXX)
{
data = ( 0 1 % Coffee type not to your taste
0 1 % Discount coffee
0.98 0.02 % Low quality coffee filter
0 1 % Low water quality
0 1 % Old coffee machine
0 1 % Used coffee filter
0 1 % Water coffee mixture incorrect
0 1 ); % Other Problem
}
There are multiple nodes or potential in the files, so my final regex
looks something like
netFile = modelConfiguration >>
causeNode >>
actions >>
optional( questions ) >>
causeProbabilities >>
actionProbabilities;
I then make one regex to parse a single potential, and wrap
that regex in another so I can look for a list of those potentials:
sregex row = *space >>
_float[push_back(ref(actionProbs),as<Float>(_))] >>
space >>
-*_ >> _ln;
actionPotential = -*_ >> "potential (C" >>
-*_ >> "data = (" >>
+row >>
-*_ >> '}';
actionProbabilities = +( *space >> actionPotential );
Now my problem is that I get a stack overflow very easily if the 'row'
regex is too long. In factm I have to remove the latter ">> space" from
'row' to not get a stack overflow.
Am I using the library in a fundamentally wrong way?
If so, how can I try to fix it?
best regards
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk