OSDN Git Service

lexical2_test Add.
authormyun2 <myun2@nwhite.info>
Tue, 29 May 2012 20:00:20 +0000 (05:00 +0900)
committermyun2 <myun2@nwhite.info>
Tue, 29 May 2012 20:00:20 +0000 (05:00 +0900)
18 files changed:
roast/test/lexical2_test/big_xml.zip [new file with mode: 0644]
roast/test/lexical2_test/css_test.cpp [new file with mode: 0644]
roast/test/lexical2_test/dom_test.cpp [new file with mode: 0644]
roast/test/lexical2_test/html_test.cpp [new file with mode: 0644]
roast/test/lexical2_test/lex_var_test.cpp [new file with mode: 0644]
roast/test/lexical2_test/lexical_test_vc2010.sln [new file with mode: 0644]
roast/test/lexical2_test/lexical_test_vc2010.vcxproj [new file with mode: 0644]
roast/test/lexical2_test/lexical_test_vc2010.vcxproj.filters [new file with mode: 0644]
roast/test/lexical2_test/mbstring_test.cpp [new file with mode: 0644]
roast/test/lexical2_test/roast_test_2nc.sln [new file with mode: 0644]
roast/test/lexical2_test/roast_test_2nc.vcproj [new file with mode: 0644]
roast/test/lexical2_test/roast_xml/sax_test.hpp [new file with mode: 0644]
roast/test/lexical2_test/roast_xml_test.cpp [new file with mode: 0644]
roast/test/lexical2_test/sax_test.cpp [new file with mode: 0644]
roast/test/lexical2_test/static_map.cpp [new file with mode: 0644]
roast/test/lexical2_test/temp.xml [new file with mode: 0644]
roast/test/lexical2_test/twitter_parser.cpp [new file with mode: 0644]
roast/test/lexical2_test/xml_gen_test.cpp [new file with mode: 0644]

diff --git a/roast/test/lexical2_test/big_xml.zip b/roast/test/lexical2_test/big_xml.zip
new file mode 100644 (file)
index 0000000..7fddf10
Binary files /dev/null and b/roast/test/lexical2_test/big_xml.zip differ
diff --git a/roast/test/lexical2_test/css_test.cpp b/roast/test/lexical2_test/css_test.cpp
new file mode 100644 (file)
index 0000000..d2a051e
--- /dev/null
@@ -0,0 +1,65 @@
+#include "roast/web/css.hpp"
+#include <stdio.h>
+
+using namespace roast;
+
+class printer
+{
+public:
+       void operator << (char c){ putc(c,stdout); }
+       void operator << (const char* s){ printf(s); }
+
+       int pop_string(){ return 0; };
+};
+
+ROAST_LEXICAL_FIXSTR(hoge, "hoge")
+ROAST_LEXICAL_FIXSTR(hoge2, "hoge2")
+
+ROAST_LEXICAL_FIXSTR(_Family, "_Family")
+ROAST_LEXICAL_FIXSTR(_Size, "_Size")
+ROAST_LEXICAL_FIXSTR(_Style, "_Style")
+ROAST_LEXICAL_FIXSTR(_Weight, "_Weight")
+ROAST_LEXICAL_FIXSTR(_Variant, "_Variant")
+ROAST_LEXICAL_FIXSTR(_Height, "_Height")
+
+int main()
+{
+       using namespace roast::css;
+       using namespace roast::css::attr;
+       using namespace roast::css::attr::unit;
+       using namespace roast::lexical::rule;
+
+//     ::roast::css::lexical::parser_rule cssa;
+//     cssa.analyze("/*ZZZ*//*ZZZ*/ /*ZZZ*//*ZZZ*/  /*ZZZ*/ hoge/*ZZZ*/ {aa /*ZZZ*/ :/*ZZZ*/ bb/*ZZZ*/; /*ZZZ*/ee:ss /*ZZZ*/}\n"
+//             "/*ZZZ*/hoge2,2#dd{cc:dd; aa  : bb ;  aa  : bb}",printer());
+
+       //padding_<px_<10>, px_<10>, px_<10> > a;
+       //color_<colorval_per<33,44,66> > a;
+       //border_color_<border_color::threedshadow> a;
+       //line_height_<hoge> a;
+       //vertical_align_<vertical_align::bottom> a;
+       text_decoration_<text_decoration::line_through, text_decoration::overline> a;
+       //padding_px_<10,20,30,8> a;
+       //color_<0xFF88DA>
+       //top_<chex_string<0xFF88DA> > a;
+       //float_string<132,58,2> a;
+       //num_string<592116> a;
+       font_<_Family, _Size/*, _Style, _Weight*/, _Variant, _Height> b;
+       //font_style_<font_style::italic> c;
+       //font_style_<font_style::bold> d;
+       //font_variant_<font_variant::small_caps> c;
+       //font_size_<font_size::x_large> d;
+       font_family_<font_family::serif> c;
+       font_family_<font_family::sans_serif, font_family::sans_serif, font_family::sans_serif, font_family::sans_serif, font_family::sans_serif> d;
+       //unit::px_<10> a;
+       a.generate(printer(),printer());
+       printf(";\n");
+       b.generate(printer(),printer());
+       printf(";\n");
+       c.generate(printer(),printer());
+       printf(";\n");
+       d.generate(printer(),printer());
+       printf(";\n");
+       
+       return 0;
+}
diff --git a/roast/test/lexical2_test/dom_test.cpp b/roast/test/lexical2_test/dom_test.cpp
new file mode 100644 (file)
index 0000000..ec4f046
--- /dev/null
@@ -0,0 +1,246 @@
+#include "roast/xml/roast_xml/dom3.hpp"
+#include <stdio.h>
+#include <string>
+#include <vector>
+#include <map>
+#include <time.h>
+#include "roast_xml/sax_test.hpp"
+
+using namespace std;
+using namespace roast;
+using namespace roast::roast_xml;
+
+#pragma warning(disable:4996)
+#pragma warning(disable:4102)
+
+///////////////////////////////////////////////////////////
+const bool g_detail = false;
+
+#define BUF_SIZE       (64*1024*1024)  //      32MB
+
+class A
+{
+public:
+       vector<int>& aa;
+       A(vector<int>& a_):aa(a_){}
+
+       //A& operator = (A& a){ return *this; }
+};
+
+bool sax_error_test_detail(const char* xml_text, const char* expect_msg)
+{
+       try
+       {
+               printf("text:    \"%s\"\n", xml_text);
+               sax(xml_text, speed_test_sax_impl);
+       }
+       catch(::std::string& e)
+       {
+               printf("message: %s\n", e.c_str());
+               printf("expect:  %s\n", expect_msg);
+
+               if ( e.compare(expect_msg) == 0 )
+               {
+                       printf( " ** OK! **\n\n");
+                       return true;
+               }
+               else
+               {
+                       printf( " ** NG! **\n\n");
+                       return false;
+               }
+       }
+       printf( " ** Not cause exception. (NG) **\n\n");
+       return false;
+}
+
+bool sax_error_test(const char* xml_text, const char* expect_msg)
+{
+       if ( g_detail )
+               return sax_error_test_detail(xml_text, expect_msg);
+       try
+       {
+               //printf("text:    \"%s\"\n", xml_text);
+               sax(xml_text, speed_test_sax_impl);
+       }
+       catch(::std::string& e)
+       {
+               /*printf("message: %s\n", e.c_str());
+               printf("expect:  %s\n", expect_msg);
+
+               if ( e.compare(expect_msg) == 0 )
+               {
+                       printf( " ** OK! **\n\n");
+                       return true;
+               }
+               else
+               {
+                       printf( " ** NG! **\n\n");
+                       return false;
+               }*/
+               if ( e.compare(expect_msg) == 0 )
+               {
+                       printf("[o] \"%s\"\n", xml_text);
+                       return true;
+               }
+               else
+               {
+                       printf("[x] \"%s\"\n", xml_text);
+                       printf("  message: %s\n", e.c_str());
+                       printf("  expect:  %s\n", expect_msg);
+                       return false;
+               }
+       }
+       //printf( " ** Not cause exception. (NG) **\n\n");
+       printf("[x] \"%s\" (Not cause exception.)\n", xml_text);
+       return false;
+}
+
+int main()
+{
+       document doc;
+       try
+       {
+               FILE* fp = fopen("temp.xml","rb");
+               char* work = new char [BUF_SIZE];
+               memset(work,0,BUF_SIZE);
+               fread(work,1,BUF_SIZE,fp);
+
+               //////////////////////////////////////////////
+
+               //document doc = dom_parse(work);
+               printf("%d\n", clock());
+               //sax((const char*)work, speed_test_sax_impl);
+               //dom_parse(work, doc);
+
+               //const char* root_cant_have_text_test = "   a";
+               //sax(root_cant_have_text_test, speed_test_sax_impl);
+
+               using namespace roast::roast_xml::rule;
+
+               goto LABEL1;
+
+               //      root_cant_have_text
+               sax_error_test("<", illegal_term_exception().c_str() );
+               sax_error_test("<?", illegal_term_in_xmldecl_exception().c_str() );
+               sax_error_test("<a", illegal_term_exception().c_str() );
+               sax_error_test("<?a", illegal_term_in_xmldecl_exception().c_str() );
+               sax_error_test("<!", illegal_term_in_xmldecl_exception().c_str() );
+               sax_error_test("<! ", illegal_term_in_xmldecl_exception().c_str() );
+LABEL1:
+               sax_error_test("<!----><!", invalid_comment_start_exception().c_str() );
+
+               sax_error_test("   a", root_cant_have_text_exception().c_str() );
+               sax_error_test("   <! ", invalid_comment_start_exception().c_str() );
+               sax_error_test("   <!- ", invalid_comment_start_exception().c_str() );
+               sax_error_test("   <!-> ", invalid_comment_start_exception().c_str() );
+               sax_error_test("   <!--> ", illegal_term_in_comment_exception().c_str() );
+               sax_error_test("   <!-- ddd", illegal_term_in_comment_exception().c_str() );
+LABEL2:
+               sax_error_test("   <!-- ddddd --> ", no_root_element_exception().c_str() );// X
+               //goto END;
+               sax_error_test("   <!-- ddddd -->", no_root_element_exception().c_str() );// X
+               sax_error_test("   <!--ddddd--> ", no_root_element_exception().c_str() );// X
+               sax_error_test("   <!--- ", illegal_term_in_comment_exception().c_str() );
+               sax_error_test("   <!---> ", illegal_term_in_comment_exception().c_str() );
+               sax_error_test("   <!----> ", no_root_element_exception().c_str() );// X
+               sax_error_test("   <!-- -- ", invalid_comment_end_exception().c_str() );
+               sax_error_test("   <!-- --", invalid_comment_end_exception().c_str() );
+               sax_error_test("   <!-- --> ", no_root_element_exception().c_str() );// X
+               sax_error_test("   <!-- --< ", invalid_comment_end_exception().c_str() );
+               sax_error_test("   <!-- ---> ", invalid_comment_end_exception().c_str() );
+               sax_error_test("   <!-----> ", invalid_comment_end_exception().c_str() );
+               sax_error_test("   <!--dddd---> ", invalid_comment_end_exception().c_str() );
+               sax_error_test("   <!---dddd--> ", no_root_element_exception().c_str() );
+               sax_error_test("<!--dddd--> ", no_root_element_exception().c_str() );// X
+               sax_error_test("<!--dddd-->", no_root_element_exception().c_str() );// X
+
+               sax_error_test("  <!--ddddd-->  <! ", invalid_comment_start_exception().c_str() );
+               sax_error_test("  <!--ddddd-->  <!- ", invalid_comment_start_exception().c_str() );
+               sax_error_test("  <!--ddddd-->  <!-> ", invalid_comment_start_exception().c_str() );
+               sax_error_test("  <!--ddddd-->  <!--> ", illegal_term_in_comment_exception().c_str() );
+               sax_error_test("  <!--ddddd-->  <!-- ddd", illegal_term_in_comment_exception().c_str() );
+               sax_error_test("  <!--ddddd-->  <!-- ddddd --> ", no_root_element_exception().c_str() );// X
+               sax_error_test("  <!--ddddd-->  <!--ddddd--> ", no_root_element_exception().c_str() );// X
+               sax_error_test("  <!--ddddd-->  <!--- ", illegal_term_in_comment_exception().c_str() );
+               sax_error_test("  <!--ddddd-->  <!---> ", illegal_term_in_comment_exception().c_str() );
+               sax_error_test("  <!--ddddd-->  <!----> ", no_root_element_exception().c_str() );// X
+               sax_error_test("  <!--ddddd-->  <!-- -- ", invalid_comment_end_exception().c_str() );
+               sax_error_test("  <!--ddddd-->  <!-- --", invalid_comment_end_exception().c_str() );
+               sax_error_test("  <!--ddddd-->  <!-- --> ", no_root_element_exception().c_str() );// X
+               sax_error_test("  <!--ddddd-->  <!-- --< ", invalid_comment_end_exception().c_str() );
+               sax_error_test("  <!--ddddd-->  <!-- ---> ", invalid_comment_end_exception().c_str() );
+               sax_error_test("  <!--ddddd-->  <!-----> ", invalid_comment_end_exception().c_str() );
+               sax_error_test("  <!--ddddd-->  <!--dddd---> ", invalid_comment_end_exception().c_str() );
+               sax_error_test("  <!--ddddd-->  <!---dddd--> ", no_root_element_exception().c_str() );
+               
+               sax_error_test("  <!--ddddd--><! ", invalid_comment_start_exception().c_str() );
+               sax_error_test("  <!--ddddd--><!- ", invalid_comment_start_exception().c_str() );
+               sax_error_test("  <!--ddddd--><!-> ", invalid_comment_start_exception().c_str() );
+               sax_error_test("  <!--ddddd--><!--> ", illegal_term_in_comment_exception().c_str() );
+               sax_error_test("  <!--ddddd--><!-- ddd", illegal_term_in_comment_exception().c_str() );
+               sax_error_test("  <!--ddddd--><!-- ddddd --> ", no_root_element_exception().c_str() );// X
+               sax_error_test("  <!--ddddd--><!--ddddd--> ", no_root_element_exception().c_str() );// X
+               sax_error_test("  <!--ddddd--><!--- ", illegal_term_in_comment_exception().c_str() );
+               sax_error_test("  <!--ddddd--><!---> ", illegal_term_in_comment_exception().c_str() );
+               sax_error_test("  <!--ddddd--><!----> ", no_root_element_exception().c_str() );// X
+               sax_error_test("  <!--ddddd--><!-- -- ", invalid_comment_end_exception().c_str() );
+               sax_error_test("  <!--ddddd--><!-- --", invalid_comment_end_exception().c_str() );
+               sax_error_test("  <!--ddddd--><!-- --> ", no_root_element_exception().c_str() );// X
+               sax_error_test("  <!--ddddd--><!-- --< ", invalid_comment_end_exception().c_str() );
+               sax_error_test("  <!--ddddd--><!-- ---> ", invalid_comment_end_exception().c_str() );
+               sax_error_test("  <!--ddddd--><!-----> ", invalid_comment_end_exception().c_str() );
+               sax_error_test("  <!--ddddd--><!--dddd---> ", invalid_comment_end_exception().c_str() );
+               sax_error_test("  <!--ddddd--><!---dddd--> ", no_root_element_exception().c_str() );
+END:
+               ;
+       }
+       catch(sax_exception& e)
+       {
+               printf("%d\n", clock());
+               printf("\n\n#############################################################################"
+                       "\n%s\n", e.c_str());
+               //printf("Error!!\n");
+       }
+       catch(::std::string& e)
+       {
+               printf("%d\n", clock());
+               printf("\n\n#############################################################################"
+                       "\n%s\n", e.c_str());
+               //printf("Error!!\n");
+       }
+       return 0;
+
+       try
+       {
+               if ( !doc.is_empty() )
+               {
+                       element& e = doc.get_root_element();
+                       //element& e2 = e.get_first_element();
+
+                       printf("%s\n", e.name.c_str());
+                       //printf("%s\n", e2.name.c_str());
+                       for(element_iterator it=e.get_element_iterator(); it.is_valid(); it++)
+                       {
+                               printf("  %s\n", it->name.c_str());
+                               for(element_iterator it2=it->get_element_iterator(); it2.is_valid(); it2++)
+                               {
+                                       printf("    %s\n", it2->name.c_str());
+
+                                       for(element_iterator it3=it2->get_element_iterator(); it3.is_valid(); it3++)
+                                       {
+                                               printf("      %s\n", it3->name.c_str());
+                                       }
+                               }
+                       }
+               }
+       }
+       catch(::std::string& e)
+       {
+               printf("\n\n#############################################################################"
+                       "\n%s\n", e.c_str());
+               //printf("Error!!\n");
+       }
+
+       return 0;
+}
diff --git a/roast/test/lexical2_test/html_test.cpp b/roast/test/lexical2_test/html_test.cpp
new file mode 100644 (file)
index 0000000..9eb1644
--- /dev/null
@@ -0,0 +1,20 @@
+#include "roast/web/html.hpp"
+#include "roast/web/css.hpp"
+#include <stdio.h>
+
+using namespace roast;
+
+int main()
+{
+       using namespace roast::web::css;
+
+       printf("%s\n", color("red").to_string().c_str() );
+       printf("%s\n", background_color(0x11223344).to_string().c_str() );
+       printf("%s\n", background_repeat(background_repeat::repeat).to_string().c_str() );
+       printf("%s\n", background_position(background_position::left, background_position::top).to_string().c_str() );
+
+       printf("%s\n", font_size(unit::px(10)).to_string().c_str() );
+       printf("%s\n", font_size(font_size::larger).to_string().c_str() );
+
+       return 0;
+}
diff --git a/roast/test/lexical2_test/lex_var_test.cpp b/roast/test/lexical2_test/lex_var_test.cpp
new file mode 100644 (file)
index 0000000..a353a56
--- /dev/null
@@ -0,0 +1,49 @@
+#include "roast/std/any.hpp"
+#include "roast/lexical.hpp"
+
+using namespace ::roast;
+using namespace ::roast::lexical;
+using namespace ::roast::lexical::variable;
+
+int main()
+{
+       int_ aa(33);
+       char_ aa2(33);
+       short_ aa3(33);
+       long_ aa4(33);
+
+       ::roast::any hoge(2.5);
+       //printf("%f\n", *((double*)hoge.get()) );
+       printf("%f\n", hoge.get<double>() );
+       hoge = 100;
+       //printf("%d\n", *((int*)hoge.get()) );
+       printf("%d\n", hoge.get<int>() );
+
+       int aaa = 200;
+
+       ::roast::any_ref hugi(aaa);
+       printf("%d\n", hugi.get<int>() );
+       hugi = 4000;
+       printf("%d\n", aaa );
+       printf("%d\n", hugi.get<int>() );
+
+       int_array<4> ia;
+
+       any2 an2;
+       an2 = aa;
+
+       ::roast::lexical::print(aa);
+
+       ////////////////////////////////////////////////
+
+       //avector av;
+       ::roast::any_vector avec;
+       avec.push_back(100);
+       avec.push_back(::std::string("aaaaa"));
+
+       printf("======================\n");
+       printf("%d\n", any_cast<int>(avec[0]) );
+       printf("%s\n", any_cast<::std::string>(avec[1]).c_str() );
+
+       return 0;
+}
diff --git a/roast/test/lexical2_test/lexical_test_vc2010.sln b/roast/test/lexical2_test/lexical_test_vc2010.sln
new file mode 100644 (file)
index 0000000..28a9978
--- /dev/null
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C++ Express 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lexical_test_vc2010", "lexical_test_vc2010.vcxproj", "{75F2DCA9-E904-47A9-A62E-FE8659548B0D}"
+EndProject
+Global
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution
+               Debug|Win32 = Debug|Win32
+               Release|Win32 = Release|Win32
+       EndGlobalSection
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution
+               {75F2DCA9-E904-47A9-A62E-FE8659548B0D}.Debug|Win32.ActiveCfg = Debug|Win32
+               {75F2DCA9-E904-47A9-A62E-FE8659548B0D}.Debug|Win32.Build.0 = Debug|Win32
+               {75F2DCA9-E904-47A9-A62E-FE8659548B0D}.Release|Win32.ActiveCfg = Release|Win32
+               {75F2DCA9-E904-47A9-A62E-FE8659548B0D}.Release|Win32.Build.0 = Release|Win32
+       EndGlobalSection
+       GlobalSection(SolutionProperties) = preSolution
+               HideSolutionNode = FALSE
+       EndGlobalSection
+EndGlobal
diff --git a/roast/test/lexical2_test/lexical_test_vc2010.vcxproj b/roast/test/lexical2_test/lexical_test_vc2010.vcxproj
new file mode 100644 (file)
index 0000000..792d6ce
--- /dev/null
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{75F2DCA9-E904-47A9-A62E-FE8659548B0D}</ProjectGuid>
+    <RootNamespace>lexical_test_vc2010</RootNamespace>
+    <Keyword>Win32Proj</Keyword>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <CharacterSet>Unicode</CharacterSet>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>true</MinimalRebuild>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+    </ClCompile>
+    <Link>
+      <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Console</SubSystem>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <AdditionalIncludeDirectories>../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <Link>
+      <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Console</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="lex_var_test.cpp" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file
diff --git a/roast/test/lexical2_test/lexical_test_vc2010.vcxproj.filters b/roast/test/lexical2_test/lexical_test_vc2010.vcxproj.filters
new file mode 100644 (file)
index 0000000..73dcd1d
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="ソース ファイル">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="ヘッダー ファイル">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="lex_var_test.cpp">
+      <Filter>ソース ファイル</Filter>
+    </ClCompile>
+  </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/roast/test/lexical2_test/mbstring_test.cpp b/roast/test/lexical2_test/mbstring_test.cpp
new file mode 100644 (file)
index 0000000..365e8e3
--- /dev/null
@@ -0,0 +1,24 @@
+#include "roast/str/multibyte/utf8_lexical.hpp"
+#include <stdio.h>
+#include <time.h>
+
+using namespace roast;
+using namespace roast::lexical;
+
+#define BUFF_SIZE              200*1024*1024
+
+int main()
+{
+       FILE* fp = fopen("temp.xml","r");
+       //FILE* fp = fopen("MIDI\83f\83o\83C\83X\83}\83l\81[\83W\83\833.xml","r");
+       //char work[256];
+       //fread(work,sizeof(work),1,fp);
+       char *work = new char [BUFF_SIZE];
+       fread(work,BUFF_SIZE,1,fp);
+
+       //printf("%d\n", clock());
+
+       //printf("%d\n", clock());
+
+       return 0;
+}
diff --git a/roast/test/lexical2_test/roast_test_2nc.sln b/roast/test/lexical2_test/roast_test_2nc.sln
new file mode 100644 (file)
index 0000000..da9ea35
--- /dev/null
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual C++ Express 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "roast_test_2nc", "roast_test_2nc.vcproj", "{75F2DCA9-E904-47A9-A62E-FE8659548B0D}"
+EndProject
+Global
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution
+               Debug|Win32 = Debug|Win32
+               Release|Win32 = Release|Win32
+       EndGlobalSection
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution
+               {75F2DCA9-E904-47A9-A62E-FE8659548B0D}.Debug|Win32.ActiveCfg = Debug|Win32
+               {75F2DCA9-E904-47A9-A62E-FE8659548B0D}.Debug|Win32.Build.0 = Debug|Win32
+               {75F2DCA9-E904-47A9-A62E-FE8659548B0D}.Release|Win32.ActiveCfg = Release|Win32
+               {75F2DCA9-E904-47A9-A62E-FE8659548B0D}.Release|Win32.Build.0 = Release|Win32
+       EndGlobalSection
+       GlobalSection(SolutionProperties) = preSolution
+               HideSolutionNode = FALSE
+       EndGlobalSection
+EndGlobal
diff --git a/roast/test/lexical2_test/roast_test_2nc.vcproj b/roast/test/lexical2_test/roast_test_2nc.vcproj
new file mode 100644 (file)
index 0000000..fc74ca5
--- /dev/null
@@ -0,0 +1,221 @@
+<?xml version="1.0" encoding="shift_jis"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="9.00"
+       Name="roast_test_2nc"
+       ProjectGUID="{75F2DCA9-E904-47A9-A62E-FE8659548B0D}"
+       RootNamespace="roast_test_2nc"
+       Keyword="Win32Proj"
+       TargetFrameworkVersion="196613"
+       >
+       <Platforms>
+               <Platform
+                       Name="Win32"
+               />
+       </Platforms>
+       <ToolFiles>
+       </ToolFiles>
+       <Configurations>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory="$(ConfigurationName)"
+                       ConfigurationType="1"
+                       CharacterSet="1"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               AdditionalIncludeDirectories="../../include"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+                               MinimalRebuild="true"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="3"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               DebugInformationFormat="4"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               LinkIncremental="2"
+                               AdditionalLibraryDirectories=""
+                               GenerateDebugInformation="true"
+                               SubSystem="1"
+                               TargetMachine="1"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+               <Configuration
+                       Name="Release|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory="$(ConfigurationName)"
+                       ConfigurationType="1"
+                       CharacterSet="1"
+                       WholeProgramOptimization="1"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="2"
+                               EnableIntrinsicFunctions="true"
+                               AdditionalIncludeDirectories="../../include"
+                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+                               RuntimeLibrary="2"
+                               EnableFunctionLevelLinking="true"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               DebugInformationFormat="3"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               LinkIncremental="1"
+                               AdditionalLibraryDirectories=""
+                               GenerateDebugInformation="true"
+                               SubSystem="1"
+                               OptimizeReferences="2"
+                               EnableCOMDATFolding="2"
+                               TargetMachine="1"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <Filter
+                       Name="\83\\81[\83\83t\83@\83C\83\8b"
+                       Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+                       >
+                       <File
+                               RelativePath=".\lex_var_test.cpp"
+                               >
+                       </File>
+               </Filter>
+               <Filter
+                       Name="\83w\83b\83_\81\83t\83@\83C\83\8b"
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"
+                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+                       >
+                       <File
+                               RelativePath="..\..\include\roast\lexical\rule.hpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\include\roast\xml\roast_xml\rule_xml.hpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\include\roast\xml\roast_xml\sax.hpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\include\roast\xml\roast_xml\sax_generator.hpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath=".\roast_xml\sax_test.hpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\..\include\roast\lexical\string_rule.hpp"
+                               >
+                       </File>
+               </Filter>
+               <Filter
+                       Name="\83\8a\83\\81[\83\83t\83@\83C\83\8b"
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+                       >
+               </Filter>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>
diff --git a/roast/test/lexical2_test/roast_xml/sax_test.hpp b/roast/test/lexical2_test/roast_xml/sax_test.hpp
new file mode 100644 (file)
index 0000000..1c27fd3
--- /dev/null
@@ -0,0 +1,80 @@
+#include "roast/xml/roast_xml/sax.hpp"
+
+using namespace std;
+using namespace roast;
+using namespace roast::roast_xml;
+
+
+class _test_sax_impl
+{
+private:
+       ::std::string m_indent;
+public:
+       void start_xml_declaration()
+       {
+               printf("=XML Declaration : start=\n" );
+               m_indent += "  ";
+       }
+
+       void end_xml_declaration()
+       {
+               printf("=XML Declaration : end=\n\n" );
+               m_indent = m_indent.substr(2);
+       }
+
+       void attribute( const sized_ccharbuf &attr_name, const sized_ccharbuf &attr_value )
+       {
+               printf("%sattr: %s=\"%s\"\n",
+                       m_indent.c_str(),
+                       attr_name.to_string().c_str(),
+                       attr_value.to_string().c_str() );
+       }
+
+       void comment( const sized_ccharbuf &s )
+       {
+               printf("%scomment: \"%s\"\n",
+                       m_indent.c_str(),
+                       s.to_string().c_str() );
+       }
+
+       void text( const sized_ccharbuf &s )
+       {
+               printf("%stext: \"%s\"\n",
+                       m_indent.c_str(),
+                       s.to_string().c_str() );
+       }
+       void start_element( const sized_ccharbuf &s )
+       {
+               printf("%s<elem: \"%s\"\n", m_indent.c_str(), s.to_string().c_str() );
+               m_indent += "  ";
+       }
+       void end_element(){
+               m_indent = m_indent.substr(2);
+               printf("  %send of element.\n%s>\n", m_indent.c_str(), m_indent.c_str());
+       }
+       void end_element( const sized_ccharbuf &s ){
+               m_indent = m_indent.substr(2);
+               printf("  %s/%s end of element.\n%s>\n", m_indent.c_str(), s.to_string().c_str(), m_indent.c_str());
+       }
+};
+
+
+class _speed_test_sax_impl
+{
+private:
+       ::std::string m_indent;
+public:
+       void start_xml_declaration(){}
+       void end_xml_declaration(){}
+       void attribute( const sized_ccharbuf &attr_name, const sized_ccharbuf &attr_value ){}
+       void comment( const sized_ccharbuf &s ){}
+       void text( const sized_ccharbuf &s ){}
+       void start_element( const sized_ccharbuf &s ){}
+       void end_element(){}
+       void end_element( const sized_ccharbuf &s ){}
+};
+
+//typedef sax_impl_<_test_sax_impl> test_sax_impl;
+//typedef sax_impl_<_speed_test_sax_impl> speed_test_sax_impl;
+static sax_impl_<_test_sax_impl> test_sax_impl;
+static sax_impl_<_speed_test_sax_impl> speed_test_sax_impl;
diff --git a/roast/test/lexical2_test/roast_xml_test.cpp b/roast/test/lexical2_test/roast_xml_test.cpp
new file mode 100644 (file)
index 0000000..e3fa64f
--- /dev/null
@@ -0,0 +1,51 @@
+#include "roast/xml/roast_xml.hpp"
+#include <stdio.h>
+#include <memory.h>
+#include <iostream>
+
+using namespace roast;
+using namespace roast::lexical;
+
+int main()
+{
+       FILE* fp = fopen("temp.xml","r");
+       char* work = new char [20*1024*1024];
+       memset(work,0,20*1024*1024);
+       fread(work,(20*1024*1024),1,fp);
+
+       roast_xml::dom_parser xml(work);
+       roast_xml::document* pdoc = xml.analyze();
+
+       using namespace roast_xml;
+       using namespace roast_xml::rxpath;
+
+       element *e = pdoc->get_root_element();
+       printf("%s\n", e->get_attribute("date")->value.to_string().c_str() );
+       //printf("%s\n", *(*e / "version") [0].get_attribute("date")->value.to_string().c_str() );
+       printf("%s\n", (*e / el("version")) [2]->get_attribute("module")->value.to_string().c_str() );
+       //printf("%s\n", (*e / el("dev")[at("type")="SYSTEM"]) [0]->get_attribute("name")->value.to_string().c_str() );
+       printf("%s\n", (*e / el("dev")[at("type")="SYSTEM"][0] / at("title") )->value.to_string().c_str() );
+       printf("%s\n", (*e / el("dev")[at("type")="SYSTEM"][0] / (at("name")="product") / 0 / xpath::text).c_str() );
+       printf("%s\n", (*e / el("dev")[at("type")=="SYSTEM"][0] / atval("name","product") / 0 / rxpath::text).c_str() );
+
+       //printf("%s\n", *e [el("dev",at("type")="SYSTEM")] [0] [at("title")] ->value.to_string().c_str() );
+
+       /*
+       element_list_t el = e->get_child_elements();
+       for(int i=0; i<el.size(); i++)
+       {
+               element *e2 = el[i];
+               printf("%s\n", e2->name.to_string().c_str() );
+       }*/
+       /*
+       for(int i=0; i<e->node_list.size(); i++)
+       {
+               node *n = e->node_list[i];
+       }*/
+       /*roast_xml::dom_generator gen;
+       gen.generate(::std::cout, *pdoc);
+
+       delete pdoc;*/
+
+       return 0;
+}
diff --git a/roast/test/lexical2_test/sax_test.cpp b/roast/test/lexical2_test/sax_test.cpp
new file mode 100644 (file)
index 0000000..abb70dc
--- /dev/null
@@ -0,0 +1,82 @@
+#include "roast/xml/roast_xml/sax.hpp"
+#include "roast/xml/roast_xml/rxpath.hpp"
+#include "roast/xml/roast_xml/sax_generator.hpp"
+#include "roast_xml/sax_test.hpp"
+#include <stdio.h>
+#include <string>
+#include <vector>
+#include <map>
+#include <time.h>
+
+using namespace std;
+using namespace roast;
+using namespace roast::roast_xml;
+using namespace roast::roast_xml::rxpath;
+
+///////////////////////////////////////////////////////////
+
+#define BUF_SIZE       (32*1024*1024)  //      32MB
+
+int main()
+{
+       try
+       {
+               FILE* fp = fopen("temp.xml","rb");
+               char* work = new char [BUF_SIZE];
+               memset(work,0,BUF_SIZE);
+               fread(work,1,BUF_SIZE,fp);
+
+               //////////////////////////////////////////////
+
+               map<int,string> tl;
+               int id;
+
+               ::std::string s;
+
+               printf("start:%d\n", clock());
+               sax sx;
+               sx.analyze((const char*)work, speed_test_sax_impl);
+               printf("end:%d\n", clock());
+               printf("lines:%d\n", speed_test_sax_impl.get_line());
+
+               /*
+               //printf(work);
+               sax_parser saxpar;
+               saxpar.analyze((const char*)work,
+                       rax
+                       / "hoge"
+                       / "hoge"
+                       / text2print() );
+               /*      saxpar.analyze((const char*)work,
+                       rax /"statuses"/"status"/
+                               text2int(id) &&
+                               ( el("user")/aster/text/user_append_functor(id,tl)
+                                 || aster/text/status_append_functor(id,tl)
+                               )
+               );*/
+                       //saxgen /"statuses"/"status"/ ( el("!user")/status_append_o || el("user")/user ) );
+                       //saxgen / el("statuses") / el("status") / (  );
+               //printf("%s\n", s.c_str());
+       }
+       catch(::roast::lexical::rule::eoi_exception& e)
+       {
+               printf("Invalid XML Term\n");
+               printf("lines:%d\n", speed_test_sax_impl.get_line());
+               //printf("Error!!\n");
+       }
+       catch(::std::string& e)
+       {
+               printf("\n\n#############################################################################"
+                       "\n%s\n", e.c_str());
+               printf("lines:%d\n", speed_test_sax_impl.get_line());
+               //printf("Error!!\n");
+       }
+       /*catch(rax_parse_error& e)
+       {
+               printf("%s\n", e.c_str());
+               //printf("Error!!\n");
+       }*/
+
+
+       return 0;
+}
diff --git a/roast/test/lexical2_test/static_map.cpp b/roast/test/lexical2_test/static_map.cpp
new file mode 100644 (file)
index 0000000..9e75201
--- /dev/null
@@ -0,0 +1,26 @@
+#include "roast/tp/static_map.hpp"
+#include <stdio.h>
+#include <time.h>
+
+using namespace roast;
+using namespace roast::lexical;
+
+
+int main()
+{
+       //static_map<int, tuple< pair<1,10>, pair<2,20>, pair<3,40> > > sm;
+       //printf("%d\n", sm::get<1>::value );
+       using namespace std;
+       static_map<const char*, 3> sm( make_ul_tuple( make_pair(1,"hoge"), make_pair(4,"huge"), make_pair(6,"hige") ) );
+       printf("%s\n", sm.get<4>() );
+
+       map<int,const char*> mp;
+       mp[1] = "hoge";
+       mp[4] = "huge";
+       mp[6] = "hige";
+       printf("%s\n", mp[4] );
+
+               //(long long)'hoge';
+
+       return 0;
+}
diff --git a/roast/test/lexical2_test/temp.xml b/roast/test/lexical2_test/temp.xml
new file mode 100644 (file)
index 0000000..e8705a9
--- /dev/null
@@ -0,0 +1,7 @@
+
+
+
+<!--
+
+
+ -->
\ No newline at end of file
diff --git a/roast/test/lexical2_test/twitter_parser.cpp b/roast/test/lexical2_test/twitter_parser.cpp
new file mode 100644 (file)
index 0000000..af3e276
--- /dev/null
@@ -0,0 +1,133 @@
+#include "roast/xml/roast_xml/roast_xml_dom_parser.hpp"
+#include "roast/xml/roast_xml/roast_xml_sax_parser.hpp"
+#include <stdio.h>
+#include <time.h>
+
+using namespace roast;
+using namespace roast::lexical;
+
+#define BUFF_SIZE              200*1024*1024
+
+namespace myun2
+{
+       namespace twitter
+       {
+               //template <typename _Callback>
+               class timeline_sax_parser_impl
+               {
+               private:
+                       //::std::string m_tagname;
+                       sized_ccharbuf m_tagname;
+                       bool m_on_user;
+
+               public:
+                       virtual void on_next_status()=0;
+                       virtual void status_value( const sized_ccharbuf &name, const sized_ccharbuf &value )=0;
+                       virtual void user_value( const sized_ccharbuf &name, const sized_ccharbuf &value )=0;
+
+               protected:
+                       timeline_sax_parser_impl(){
+                               m_tagname.ptr = 0;
+                               m_tagname.size = 0;
+                               m_on_user = false;
+                       }
+
+                       //      nothing...
+                       void start_xml_declaration(){}
+                       void end_xml_declaration(){}
+                       void attribute( const sized_ccharbuf &attr_name, const sized_ccharbuf &attr_value ){}
+                       void comment( const sized_ccharbuf &s ){}
+
+                       ////////////////////////////////////////////////////////
+
+                       void text( const sized_ccharbuf &s )
+                       {
+                               if ( m_tagname.ptr != 0 )
+                               {
+                                       if ( m_on_user )
+                                               user_value( m_tagname, s );
+                                       else
+                                               status_value( m_tagname, s );
+                               }
+                       }
+                       void start_element( const sized_ccharbuf &s )
+                       {
+                               if ( s == "statuses" )
+                                       ;
+                               else if ( s == "status" )
+                                       on_next_status();
+                               else if ( s == "user" )
+                                       m_on_user = true;
+                               else
+                                       m_tagname = s;
+                               //m_tagname = ::std::string(s.ptr, s.size);
+                       }
+                       void end_element(){
+                               /*if ( m_on_user )
+                               {
+                                       if ( m_tagname.ptr != 0 )
+                                               m_tagname = sized_ccharbuf();
+                                       else
+                                               m_on_user = false;
+                               }*/
+                               if ( m_tagname.ptr != 0 )
+                                       m_tagname = sized_ccharbuf(0,0);
+                               else if ( m_on_user )
+                                       m_on_user = false;
+                       }
+               };
+       }
+}
+
+using namespace myun2::twitter;
+using namespace roast::roast_xml;
+
+class tl_test : public timeline_sax_parser_impl
+{
+public:
+       void on_next_status()
+       {
+               printf("==============================================\n");
+       }
+       void status_value( const sized_ccharbuf &name, const sized_ccharbuf &value )
+       {
+               printf("%s: \"%s\"\n", name.to_string().c_str(), value.to_string().c_str() );
+       }
+       void user_value( const sized_ccharbuf &name, const sized_ccharbuf &value )
+       {
+               printf("user/%s: \"%s\"\n", name.to_string().c_str(), value.to_string().c_str() );
+       }
+};
+
+
+int main()
+{
+       sized_ccharbuf a("abcde", 3);
+       sized_ccharbuf b("abcff", 3);
+       sized_ccharbuf c("abdff", 3);
+       sized_ccharbuf d("abcde", 4);
+       sized_ccharbuf e("abcde", 2);
+       printf("%d\n", a == a );
+       printf("%d\n", a == b );
+       printf("%d\n", a == c );
+       printf("%d\n", a == d );
+       printf("%d\n", d == a );
+       printf("%d\n", a == e );
+       printf("\n");
+       printf("%d\n", a == "abc" );
+       printf("%d\n", a == "aba" );
+       printf("%d\n", a == "ab" );
+       printf("%d\n", a == "abcd" );
+       printf("\n");
+
+       ////////////////////////////////////////////////////
+
+       FILE* fp = fopen("temp.xml","r");
+       char *work = new char [BUFF_SIZE];
+       fread(work,BUFF_SIZE,1,fp);
+
+       sax_parser<tl_test> bb(work);
+       bb.analyze();
+
+       return 0;
+}
\ No newline at end of file
diff --git a/roast/test/lexical2_test/xml_gen_test.cpp b/roast/test/lexical2_test/xml_gen_test.cpp
new file mode 100644 (file)
index 0000000..7ed49fa
--- /dev/null
@@ -0,0 +1,28 @@
+#include "roast/xml/roast_xml/rule_xml.hpp"
+
+using namespace roast::lexical;
+using namespace roast::lexical::rule;
+using namespace roast::roast_xml::rule;
+
+#pragma warning(disable:4996)
+#pragma warning(disable:4102)
+
+///////////////////////////////////////////////////////////
+
+ROAST_LEXICAL_FIXSTR(aaa, "aaa");
+ROAST_LEXICAL_FIXSTR(bbb, "bbb");
+
+int main()
+{
+       printf("%s\n", str_generate<angle_bracket<aaa> >(null_document).c_str() );
+       printf("%s\n", str_generate<excl_tag<aaa> >(null_document).c_str() );
+
+       printf("%s\n", str_generate<comment_<aaa> >(null_document).c_str() );
+       printf("%s\n", str_generate<processing_instruction<aaa> >(null_document).c_str() );
+
+       printf("%s\n", str_generate<attr_<aaa,bbb> >(null_document).c_str() );
+       printf("%s\n", str_generate<element_<aaa,_true_analyze,_true_analyze> >(null_document).c_str() );
+       printf("%s\n", str_generate<element_<aaa,_true_analyze,bbb> >(null_document).c_str() );
+
+       return 0;
+}