OSDN Git Service

lexical/structure_base.hpp: test Add.
authorMyun2 <myun2@nwhite.info>
Sun, 25 Jul 2010 02:52:27 +0000 (11:52 +0900)
committerMyun2 <myun2@nwhite.info>
Sun, 25 Jul 2010 02:52:27 +0000 (11:52 +0900)
roast_xml: テキストとかコメントとか

roast/include/roast/lexical/structure_base.hpp
roast/include/roast/xml/roast_xml/structure.hpp

index 5dad89c..056985c 100644 (file)
@@ -34,6 +34,21 @@ namespace roast
                                }
                        };
 
+                       template <typename T>
+                       class test
+                       {
+                       public:
+                               template <typename _It, typename _Param>
+                               bool analyze(_It& it, _Param& param)
+                               {
+                                       _It it_work = it;
+                                       T t;
+                                       return t.analyze(it, param);
+                               }
+                       };
+                       //      Alias : test -> check
+                       template <typename T> class check : public test<T> {};
+
                        ////////////////////////////////////////////////////////////////
 
                        /*template <typename U>
@@ -231,7 +246,7 @@ namespace roast
                        ////////////////////
 
                        template <typename T>
-                       class repeat
+                       class repeat    //      optional_repeat
                        {
                        public:
                                template <typename _It, typename _Param>
index a2a76e4..a2bafd7 100644 (file)
@@ -61,6 +61,8 @@ namespace roast
                                >                       //      >
                        > comment;
 
+                       typedef repeat<comment> opt_comments;
+
                        /*class optcomm
                        {
                        };*/
@@ -99,37 +101,44 @@ namespace roast
                        {
                        };*/
                        typedef seq<
-                               //get_string_end_by< lesser >,
-                               //optional< comment >,
+                               //      comments
                                repeat< comment >,
-                               push_num<20>,
-                               repeat<
-                                       seq<get_string_end_by<lesser>, optional<comment>,
-                                               not< seq<lesser, not<exclamation> > >
+
+                               repeat< 
+                                       seq<
+                                               //      text body
+                                               push_num<20>,
+                                               get_string_end_by<lesser>,
+                                               push_num<11>,
+
+                                               //      comments
+                                               repeat<comment>,
+
+                                               //      end when tag start.
+                                               test< not<
+                                                       seq<
+                                                               lesser,                         //      <
+                                                               not<exclamation>        //      not !
+                                                       >
+                                               > >
                                        >
-                               >,
-                               push_num<11>
+                               >
                        > text;
 
                        //      Element, Body
 
-                       /*typedef normal_tag;
-                       typedef empty_elem_tag;
-                       typedef or<normal_tag, empty_elem_tag> tag;*/
-
-                       /*typedef startend_element_impl;
-                       typedef empty_element_impl;
-                       typedef or<startend_element_impl, empty_element_impl> element_impl;*/
-
                        class element_;
 
                        typedef seq<
                                greater,
+
+                               //      Texts and Elements.
                                text,
-                               //lesser,
                                repeat<
-                                       seq< element_, text >
+                                       seq< _debug_print<21>,element_,_debug_print<211>, text, _debug_print<213> >
                                >,
+
+                               _debug_print<1>,
                                push_num<62>,   //      Close Tag Name start
                                get_string_end_by< or<slash, whitespace> >,
                                noreqws,
@@ -144,8 +153,8 @@ namespace roast
                                push_num<11>,   //      Start Tag Name end
                                attrs,
                                or<
-                                       seq< slash, push_num<69> >,
-                                       startend_element_impl
+                                       seq< slash, push_num<69> >,     //      for Empty Element Tag
+                                       startend_element_impl           //      Normal Tag
                                >
                        > element_impl;