It works after I specified the priority!<div><br></div><div>Thanks.<br><br><div class="gmail_quote">2010/11/10 Adrian Thurston <span dir="ltr"><<a href="mailto:adrian.thurston@esentire.com">adrian.thurston@esentire.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Define:<br>
<br>
colon = ':' @(colon, 1);<br>
else_colon = ':' @(colon, 0);<br>
<br>
Then use colon in the named headers and else_colon in the final case.<br>
<br>
-Adrian<div><div></div><div class="h5"><br>
<br>
On 10-11-09 12:07 AM, hongbin kou wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div class="h5">
Now I’m using ragel to build a http parser.<br>
<br>
One requirement of the parser is to parse all the http headers, which<br>
would be used by another module.<br>
<br>
For some common headers, the header value would be parsed directly by<br>
ragel.<br>
<br>
For other headers, only mark the header name and value.<br>
<br>
Here is my ragel script:<br>
<br>
message_header =(<br>
<br>
                   ("Content-Length"i ":" LWS* digit+ $on_content_length)<br>
<br>
                 | ("Transfer-Encoding"i ":" LWS* ("Chunked"i %<br>
{request->transfer_encoding = HTTP_TE_CHUNKED;} | any* > start_TE %<br>
finish_TE))<br>
<br>
                 | ("Connection"i ":" LWS* ("Keep-alive"i %<br>
{request->connection = HTTP_CONNECTION_KEEP_ALIVE;} | "Close"i %<br>
{request->connection = HTTP_CONNECTION_CLOSE;}))<br>
<br>
                 | ("Host"i ":" LWS* field_content >start_host<br>
%*finish_host* %/break_host)<br>
<br>
                 | ("Accept"i ":" LWS* field_content >start_accept %<br>
finish_accept %/break_accept)<br>
<br>
                 | ("Accept-Charset"i ":" LWS* field_content<br>
 >start_accept_charset % finish_accept_charset %/break_accept_charset)<br>
<br>
                 | ("Accept-Encoding"i ":" LWS* field_content<br>
 >start_accept_encoding % finish_accept_encoding %/break_accept_encoding)<br>
<br>
                 | ("Accept-Language"i ":" LWS* field_content<br>
 >start_accept_language % finish_accept_language %/break_accept_language)<br>
<br>
                 | ("User-Agent"i ":" LWS* field_content<br>
 >start_user_agent % finish_user_agent %/break_user_agent)<br>
<br>
                 | ("Referer"i ":" LWS* field_content >start_referer %<br>
finish_referer %/break_referer)<br>
<br>
                 | ("X-Forward-For"i ":" LWS* field_content<br>
 >start_x_forward_for % finish_x_forward_for %/break_x_forward_for)<br>
<br>
                 | ((token) >start_header_name %finish_header_name<br>
%/break_header_name":" LWS* field_content % *header_end*)<br>
<br>
             ) :>CRLF;<br>
<br>
Here there is a nondeterminism between token and the common header names.<br>
<br>
For example, when a Host header value finished, the header’s action<br>
finish_host and the “token” action header_end will be triggered.<br>
<br>
How can I resolve this kind of problem?<br>
<br>
<br>
Thanks.<br>
<br>
<br>
Hongbin.<br>
<br>
<br>
<br>
<br></div></div>
_______________________________________________<br>
ragel-users mailing list<br>
<a href="mailto:ragel-users@complang.org" target="_blank">ragel-users@complang.org</a><br>
<a href="http://www.complang.org/mailman/listinfo/ragel-users" target="_blank">http://www.complang.org/mailman/listinfo/ragel-users</a><br>
</blockquote>
<br>
_______________________________________________<br>
ragel-users mailing list<br>
<a href="mailto:ragel-users@complang.org" target="_blank">ragel-users@complang.org</a><br>
<a href="http://www.complang.org/mailman/listinfo/ragel-users" target="_blank">http://www.complang.org/mailman/listinfo/ragel-users</a><br>
</blockquote></div><br></div>