[ragel-users] Parsing a component of a machine

Iñaki Baz Castillo ibc at aliax.net
Thu Jan 29 19:28:03 UTC 2009

Hi, is it possible to parse a subcomponent of a machine specification? I mean:

	alphanum = [a-zA-Z0-9]
	protocol = ('sip'i|'sips'i)
	user = alphanum+
	host = ( '.' | alphanum )+
	main := protocol ':' user '@' host ;

This code allow me to parse a complete SIP uri using "%% write exec;", but 
what about if I also want to parse a single "user" component? must I to 
duplicate the code creating a new machine just for "user"?:

	alphanum = [a-zA-Z0-9]
	main := alphanum+

Since "user" is already defined in the above machine, couldn't I use that 
machine to parse a string just containing a "user" text?

Thanks a lot.

Iñaki Baz Castillo

More information about the ragel-users mailing list