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: [email protected]
ReplyTo: [email protected]
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
[email protected]
http://www.complang.org/mailman/listinfo/ragel-users

_______________________________________________
ragel-users mailing list
[email protected]
http://www.complang.org/mailman/listinfo/ragel-users

Reply via email to