how to parse class in class

Jens Kallup <[email protected]>
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
Hello,

I would like to parse a CLASS in CLASS dynamically.
How can I do it?

qi::rule<Iterator, Skipper> symbol_def_class;

symbol_class    = "CLASS"
symbol_of       = "OF"
symbol_endclass = "ENDCLASS"

symbol_alpha = +[a-zA-Z] *[a-zA-Z0-9_]


              symbol_def_class =
                  (symbol_class >> symbol_alpha >> symbol_of >> 
symbol_alpha >>
                   symbol_endclass >> (qi::eoi | qi::eol))
                  |
                  (symbol_class >> symbol_alpha >> symbol_of >> 
symbol_alpha >>
                  (symbol_def_class_inner) >>
                   symbol_endclass >> (qi::eoi | qi::eol))
                  ;

              symbol_def_class_inner =
                  *( symbol_class >> symbol_alpha >> symbol_of  >> 
symbol_alpha
                  >  symbol_endclass)
                  |
                  *( symbol_class >> symbol_alpha >> symbol_of  >> 
symbol_alpha
                  >> *(symbol_def_class_inner) > symbol_endclass)
                  ;

As Result:

CLASS
...
     CLASS
     ...
     ENDCLASS
....
ENDCLASS

TIA
Jens


------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.