[ragel-users] Parsing a component of a machine
Adrian Thurston
thurston at complang.org
Mon Feb 2 03:04:49 UTC 2009
Yes you can. Just make a machine specification containing common statements and then use the include feature.
Adrian
------Original Message------
From: Iñaki Baz Castillo
Sender:
To: ragel-users at complang.org
ReplyTo: ragel-users at complang.org
Sent: Jan 29, 2009 2:28 PM
Subject: [ragel-users] Parsing a component of a machine
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
_______________________________________________
ragel-users mailing list
ragel-users at complang.org
http://www.complang.org/mailman/listinfo/ragel-users
More information about the ragel-users
mailing list