From 31d4ad67c7b3b442146ebb67e9153c45a40cc35c Mon Sep 17 00:00:00 2001 From: Myun2 Date: Sat, 24 Jul 2010 12:51:11 +0900 Subject: [PATCH] =?utf8?q?lexical,=20roast=5Fxml:=20=E3=82=88=E3=81=97?= =?utf8?q?=E3=81=A3=E3=80=81=E7=B4=A0=E6=99=B4=E3=82=89=E3=81=97=E3=81=84?= =?utf8?q?=E5=87=BA=E6=9D=A5=E3=81=9F=E3=80=82=E8=A1=A8=E7=A4=BA=E3=81=BE?= =?utf8?q?=E3=81=A7=E5=87=BA=E6=9D=A5=E3=81=9F=E3=81=9E=E3=83=83=EF=BC=81?= =?utf8?q?=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- roast/include/roast/lexical/parser_base.hpp | 4 ++-- roast/include/roast/lexical/structure_base.hpp | 2 +- roast/include/roast/xml/roast_xml/roast_xml_sax_parser.hpp | 14 +++++++++----- roast/test/lexical_test/parser_test.cpp | 8 ++++++-- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/roast/include/roast/lexical/parser_base.hpp b/roast/include/roast/lexical/parser_base.hpp index df7cc626..de5979a8 100644 --- a/roast/include/roast/lexical/parser_base.hpp +++ b/roast/include/roast/lexical/parser_base.hpp @@ -5,7 +5,7 @@ #define __SFJP_ROAST__lexical__parser_base_HPP__ #include "roast/lexical/base.hpp" -#include "roast/lexical/declaration_base.hpp" +#include "roast/lexical/structure_base.hpp" namespace roast { @@ -35,7 +35,7 @@ namespace roast }*/ _Document doc; - doc.analyze(m_it); + doc.analyze(m_it, doc); return doc; } }; diff --git a/roast/include/roast/lexical/structure_base.hpp b/roast/include/roast/lexical/structure_base.hpp index 7afad877..e51e273b 100644 --- a/roast/include/roast/lexical/structure_base.hpp +++ b/roast/include/roast/lexical/structure_base.hpp @@ -476,7 +476,7 @@ namespace roast get_string_end_by_analyze_true gs; if ( gs.analyze(it, param) == false ) return false; - /// + param << ::std::make_pair( gs.start_it, gs.end_it ); return true; } }; diff --git a/roast/include/roast/xml/roast_xml/roast_xml_sax_parser.hpp b/roast/include/roast/xml/roast_xml/roast_xml_sax_parser.hpp index 1770faa7..710b7ded 100644 --- a/roast/include/roast/xml/roast_xml/roast_xml_sax_parser.hpp +++ b/roast/include/roast/xml/roast_xml/roast_xml_sax_parser.hpp @@ -14,15 +14,19 @@ namespace roast { //////////////////////////////////////////////////////////////// - /*class sax_parser_impl + class sax_parser_impl : public _structure { public: - bool analyze(const char* s) + void operator << ( ::std::pair< + roast::_linear_iterator_arithmetic, + roast::_linear_iterator_arithmetic > &p) { - return true; + sized_ptr_ str(&*p.first, p.second - p.first); + sized_ccharbuf cb(str.ptr, str.size); + printf( cb.to_string().c_str() ); } - };*/ - typedef _structure sax_parser_impl; + }; + //typedef _structure sax_parser_impl; //////////////////////////////////////////////////////////////// diff --git a/roast/test/lexical_test/parser_test.cpp b/roast/test/lexical_test/parser_test.cpp index 5b26e319..2930877f 100644 --- a/roast/test/lexical_test/parser_test.cpp +++ b/roast/test/lexical_test/parser_test.cpp @@ -6,11 +6,15 @@ using namespace roast; using namespace roast::lexical; +#define BUFF_SIZE 20*1024*1024 + int main() { FILE* fp = fopen("temp.xml","r"); - char work[256]; - fread(work,sizeof(work),1,fp); + //char work[256]; + //fread(work,sizeof(work),1,fp); + char *work = new char [BUFF_SIZE]; + fread(work,BUFF_SIZE,1,fp); //roast_xml::dom_parser wss("aaa"); roast_xml::sax_parser sax(work); -- 2.11.0