Hi!<div><br></div><div>As i'm very new to ragel i just played around a bit and tried some examples, modified them a bit and so on.</div><div><br></div><div>Before started with Ragel i used boost::spirit to parse text. boost::spirit is fine, speed is ok, much faster than using simple regexes, but one problem: The compilation time of a boost::spirit-grammar is a hell. I created a grammar for pokerhandhistory-parsing, the debug-compilation time is about 20 minutes. A bit to long!</div>
<div><br></div><div>Here is pokerhandhistory-file: <a href="http://pastebin.com/WjDP1xmj">http://pastebin.com/WjDP1xmj</a></div><div><br></div><div>I'm extracting almost all information like Datetime, Limit and all player actions and fill some structs. After parsing it's inserted to a database.</div>
<div><br></div><div>My questions:</div><div>1.Would it be easy to create such a parser with Ragel?</div><div><br></div><div>2.How to parse things like this: "player1 raises 1 to 2" all characters before ' raises ' digit ' to ' digit? (a playername can contain an action like player 1 raises raises 1 to 2)</div>
<div><br></div><div>3.How to create actions for such a line? In boost:spirit i can call a function in this way: rule = (char_+ >> double_)[class::myfunction(_1,_2)]. _1 would be the char-array and _2 a double? Is it possible with Ragel?</div>
<div><br></div><div>4.Can i use a symbol-table in Ragel? example of a symboltable with actions: </div><div>(L"calls", 1)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>(L"bets", 2)</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>(L"folds", 3)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>(L"posts the small blind of", 4)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>(L"posts a dead small blind of", 5)</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>(L"posts the big blind of", 6)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>(L"posts", 7)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>(L"antes", 8)</div>
<div>a rule for this is: rule = name SYMBOL::ACTION[function(_1, _2)]</div><div><br></div><div><br></div><div>So...please don't laugh ;-)</div><div><br></div><div>Thank you very much!!!</div>