Hello guys,<br><br>I try to use ragel in the open-source project "Percona-Playback":<br><a href="https://code.launchpad.net/~tsarev/percona-playback/alpha">https://code.launchpad.net/~tsarev/percona-playback/alpha</a><br>
Ragel is great compliant to my targets.<br><br>But I have trouble what can't solve and documentation not answer to my question.<br>So I read parts 2.1.4, but don't understand how its work<br><br>Suppose I have one machine (thread_id.rl file):<br>
{{%<br> machine thread_id;<br> action thread_id_begin { thread_id= 0; }<br> action thread_id_step { thread_id= thread_id * 10 + (fc - '0'); }<br> action thread_id_end { set_thread_id(thread_id); }<br>
key = 'Thread_id: ';<br> value = ([0-9] @thread_id_step;)+ %thread_id_end;<br> main := (key @thread_id_begin) . value;<br>%}}<br><br>Now i want two things:<br>1) Write unit test to this machine<br>2) Use this machine to another, more complex machine.<br>
<br>I tried to include this machine in another file:<br>%%{<br> machine thread_id_test;<br> error = [^\n]* '\n'<br> >{ std::cout << "start skip: '"; }<br> ${ std::cout << fc; }<br>
@{ std::cout < "'\n" << std::flush; fgoto main; };<br> thread_id= include thread_id "../../src/parser/thread_id.rl";<br> main := (thread_id | error)*;<br> write data;<br>}%%<br>
<br>but receive error:<br>[ 69%] Generating thread_id_test.cc<br>/storage/project/playback/head/test/parser/thread_id_test.rl:39:10: at token TK_ColonEquals: parse error<br><br>I tried another way:<br>%%{<br> machine thread_id_test;<br>
include thread_id "../../src/parser/thread_id.rl";<br> error = [^\n]* '\n'<br> >{ std::cout << "start skip: '"; }<br> ${ std::cout << fc; }<br> @{ std::cout < "'\n" << std::flush; fgoto main; };<br>
main := (thread_id | error)*;<br> write data;<br>}%%<br><br>but get another error:<br>[ 69%] Generating thread_id_test.cc<br>/storage/project/playback/head/test/parser/thread_id_test.rl:39:14: graph lookup of "thread_id" failed<br>
<br>Thank you very much for any help.<br><br>Best regards, Oleg<br>