Hi, I've done a simple parser for a SIP URI ("sip:[email protected]")
but I can't get the last field ("host"):
--------------------------------------------------------
%%{
machine sip_uri;
action _tag { mark_tag = p }
action protocol { @uri.user = data[mark_tag..p-1].pack('c*') }
action user { @uri.protocol = data[mark_tag..p-1].pack('c*') }
action host { @uri.host = data[mark_tag..p-1].pack('c*') }
protocol = ('sip'i|'sips'i) >_tag %protocol ;
user = [a-zA-Z0-9]+ >_tag %user ;
host = [.a-zA-Z0-9]+ >_tag %host ;
main := protocol ':' user '@' host ;
}%%
run_machine "sip:[email protected]"
-------------------------------------------------------
The actions "protocol" and "user" are executed, storing the parsed
data into a Ruby attribute, but the action "host" is not executed. I
assume this occurs because leaving action (%) doesn't take place but
EOF action. So I try to use a EOF action:
host = [.a-zA-Z0-9]+ >_tag %/host ;
But it doesn't work. I can't imagine how to get this "host" field, any
help please?
Thanks a lot.
--
Iñaki Baz Castillo
<[email protected]>
_______________________________________________
ragel-users mailing list
[email protected]
http://www.complang.org/mailman/listinfo/ragel-users