hapy-users Mailing List for Hapy
Status: Beta
Brought to you by:
rousskov
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(1) |
Feb
(1) |
Mar
(1) |
Apr
|
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Alex R. <rou...@me...> - 2004-09-08 15:37:53
|
Srinidhi, I am not sure what causes the errors you quoted. It seems to be related to the Hapy use of the std_bidirectional_iterator template. It is not the first time that supposed-to-be-portable STL construct causes compilation troubles. Perhaps my code in PreeKids.h uses std_bidirectional_iterator interface the wrong way. Attached is a patch that might help. It changes std::iterator_traits<PreeKidsIterator> in typedefs to more explicit std::iterator_traits< PreeKidsIterator<Base> > The patch does not cause compilation problems with GCC 2.95. I do not have access to MSVC. Please let me know whether the patch helps in your case. I doubt the patch helps, but it does not hurt to try. FWIW, there are many Hapy users building Hapy with MS compilers. I wonder if there is some MSVC version compatibility issue here? What version do you use? If anybody has better std_bidirectional_iterator knowledge or workaround suggestions please chime in! Thank you, Alex. -- Protocol performance, functionality, and reliability testing. Tools, services, and know-how. http://www.measurement-factory.com/ On Wed, 8 Sep 2004, srinidhi wrote: > Hi > I am trying to build the hapy parser library under MSVC windows. > I am getting the following errors: > Compiling... > Algorithm.cpp > c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(98 > ) : error C2027: use of undefined type 'PreeKidsIterator<class Hapy::Pree>' > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see > reference to class template instantiation '_STL::iterator_traits<class > Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference > to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' > being compiled > c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(98 > ) : error C2146: syntax error : missing ';' before identifier > 'iterator_category' > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see > reference to class template instantiation '_STL::iterator_traits<class > Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference > to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' > being compiled > c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(98 > ) : error C2868: 'iterator_category' : illegal syntax for using-declaration; > expected qualified-name > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see > reference to class template instantiation '_STL::iterator_traits<class > Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference > to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' > being compiled > c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(99 > ) : error C2027: use of undefined type 'PreeKidsIterator<class Hapy::Pree>' > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see > reference to class template instantiation '_STL::iterator_traits<class > Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference > to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' > being compiled > c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(99 > ) : error C2146: syntax error : missing ';' before identifier 'value_type' > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see > reference to class template instantiation '_STL::iterator_traits<class > Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference > to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' > being compiled > c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(99 > ) : error C2868: 'value_type' : illegal syntax for using-declaration; > expected qualified-name > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see > reference to class template instantiation '_STL::iterator_traits<class > Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference > to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' > being compiled > c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 > 0) : error C2027: use of undefined type 'PreeKidsIterator<class Hapy::Pree>' > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see > reference to class template instantiation '_STL::iterator_traits<class > Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference > to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' > being compiled > c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 > 0) : error C2146: syntax error : missing ';' before identifier > 'difference_type' > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see > reference to class template instantiation '_STL::iterator_traits<class > Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference > to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' > being compiled > c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 > 0) : error C2868: 'difference_type' : illegal syntax for using-declaration; > expected qualified-name > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see > reference to class template instantiation '_STL::iterator_traits<class > Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference > to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' > being compiled > c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 > 1) : error C2027: use of undefined type 'PreeKidsIterator<class Hapy::Pree>' > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see > reference to class template instantiation '_STL::iterator_traits<class > Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference > to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' > being compiled > c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 > 1) : error C2146: syntax error : missing ';' before identifier 'pointer' > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see > reference to class template instantiation '_STL::iterator_traits<class > Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference > to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' > being compiled > c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 > 1) : error C2868: 'pointer' : illegal syntax for using-declaration; expected > qualified-name > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see > reference to class template instantiation '_STL::iterator_traits<class > Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference > to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' > being compiled > c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 > 2) : error C2027: use of undefined type 'PreeKidsIterator<class Hapy::Pree>' > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see > reference to class template instantiation '_STL::iterator_traits<class > Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference > to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' > being compiled > c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 > 2) : error C2146: syntax error : missing ';' before identifier 'reference' > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see > reference to class template instantiation '_STL::iterator_traits<class > Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference > to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' > being compiled > c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 > 2) : error C2868: 'reference' : illegal syntax for using-declaration; > expected qualified-name > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see > reference to class template instantiation '_STL::iterator_traits<class > Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference > to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' > being compiled > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(32) : warning C4284: > return type for 'Hapy::PreeKidsIterator<class Hapy::Pree>::operator ->' is > 'int' (ie; not a UDT or reference to a UDT. Will produce errors if applied > using infix notation) > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference > to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' > being compiled > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(114) : error C2839: invalid > return type 'int' for overloaded 'operator ->' > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(114) : error C2227: left of > '->rid' must point to class/struct/union > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(115) : error C2102: '&' > requires l-value > d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(116) : error C2664: > 'find_first' : cannot convert parameter 1 from 'int' to 'const class > Hapy::Pree &' > Reason: cannot convert from 'int' to 'const class Hapy::Pree' > No constructor could take the source type, or constructor overload > resolution was ambiguous > Error executing cl.exe. > > What is the fix for this?? > regards > Srinidhi > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > _______________________________________________ > Hapy-users mailing list > Hap...@li... > https://lists.sourceforge.net/lists/listinfo/hapy-users > |
From: srinidhi <sri...@on...> - 2004-09-08 06:52:18
|
Hi I am trying to build the hapy parser library under MSVC windows. I am getting the following errors: Compiling... Algorithm.cpp c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(98 ) : error C2027: use of undefined type 'PreeKidsIterator<class Hapy::Pree>' d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see reference to class template instantiation '_STL::iterator_traits<class Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' being compiled c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(98 ) : error C2146: syntax error : missing ';' before identifier 'iterator_category' d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see reference to class template instantiation '_STL::iterator_traits<class Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' being compiled c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(98 ) : error C2868: 'iterator_category' : illegal syntax for using-declaration; expected qualified-name d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see reference to class template instantiation '_STL::iterator_traits<class Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' being compiled c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(99 ) : error C2027: use of undefined type 'PreeKidsIterator<class Hapy::Pree>' d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see reference to class template instantiation '_STL::iterator_traits<class Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' being compiled c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(99 ) : error C2146: syntax error : missing ';' before identifier 'value_type' d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see reference to class template instantiation '_STL::iterator_traits<class Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' being compiled c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(99 ) : error C2868: 'value_type' : illegal syntax for using-declaration; expected qualified-name d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see reference to class template instantiation '_STL::iterator_traits<class Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' being compiled c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 0) : error C2027: use of undefined type 'PreeKidsIterator<class Hapy::Pree>' d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see reference to class template instantiation '_STL::iterator_traits<class Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' being compiled c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 0) : error C2146: syntax error : missing ';' before identifier 'difference_type' d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see reference to class template instantiation '_STL::iterator_traits<class Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' being compiled c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 0) : error C2868: 'difference_type' : illegal syntax for using-declaration; expected qualified-name d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see reference to class template instantiation '_STL::iterator_traits<class Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' being compiled c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 1) : error C2027: use of undefined type 'PreeKidsIterator<class Hapy::Pree>' d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see reference to class template instantiation '_STL::iterator_traits<class Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' being compiled c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 1) : error C2146: syntax error : missing ';' before identifier 'pointer' d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see reference to class template instantiation '_STL::iterator_traits<class Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' being compiled c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 1) : error C2868: 'pointer' : illegal syntax for using-declaration; expected qualified-name d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see reference to class template instantiation '_STL::iterator_traits<class Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' being compiled c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 2) : error C2027: use of undefined type 'PreeKidsIterator<class Hapy::Pree>' d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see reference to class template instantiation '_STL::iterator_traits<class Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' being compiled c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 2) : error C2146: syntax error : missing ';' before identifier 'reference' d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see reference to class template instantiation '_STL::iterator_traits<class Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' being compiled c:\mmp3\master\base\external\c\stlport-4.6.2\stlport\stl\_iterator_base.h(10 2) : error C2868: 'reference' : illegal syntax for using-declaration; expected qualified-name d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(17) : see reference to class template instantiation '_STL::iterator_traits<class Hapy::PreeKidsIterator<class Hapy::Pree> >' being compiled d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' being compiled d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\preekids.h(32) : warning C4284: return type for 'Hapy::PreeKidsIterator<class Hapy::Pree>::operator ->' is 'int' (ie; not a UDT or reference to a UDT. Will produce errors if applied using infix notation) d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(113) : see reference to class template instantiation 'Hapy::PreeKidsIterator<class Hapy::Pree>' being compiled d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(114) : error C2839: invalid return type 'int' for overloaded 'operator ->' d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(114) : error C2227: left of '->rid' must point to class/struct/union d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(115) : error C2102: '&' requires l-value d:\ozone3\hapy\hapy-0.0.6\src\include\hapy\pree.h(116) : error C2664: 'find_first' : cannot convert parameter 1 from 'int' to 'const class Hapy::Pree &' Reason: cannot convert from 'int' to 'const class Hapy::Pree' No constructor could take the source type, or constructor overload resolution was ambiguous Error executing cl.exe. What is the fix for this?? regards Srinidhi |
From: Alex R. <rou...@me...> - 2004-07-01 20:15:23
|
On Thu, 3 Jun 2004, Romain Behar wrote: > There is another tweak in the prefix parsing loop: > ... > helps the parser not to stop on string parsing (e.g. > "<!--" in rComment); > is there a better way to handle this trick? Romain's use case uncovered a bug in prefixing code. The patch is attached and will be included in 0.0.7 release. The bug does not affect parsers that have access to entire input. Thank you, Alex. -- Protocol performance, functionality, and reliability testing. Tools, services, and know-how. http://www.measurement-factory.com/ |
From: Alex R. <rou...@me...> - 2004-06-03 15:30:33
|
On Thu, 3 Jun 2004, Romain Behar wrote: > The attached example is an attempt for an "on the fly" XML parser. > XML files tend to get very big: the idea is not to load the entire > file into memory but to parse it when loading the file. That's a reasonable approach provided you need to extract something small from the XML file as opposed to load and manipulate the entire file. > The parser was modified to use prefix parsing, and the rNode and > rElement merged into a new rXML rule. We loose the element nesting > information: a stack needs to be set up to keep track of nesting > level or skip entire blocks. > > Could the prefix parser stop on defined rules, that would avoid > changing the grammar? Do you mean stop if any of the specified rules match, as opposed to stopping when the top-most rule (the grammar) matches? It sounds like you may want to use semantic actions attached to the rules you are interested in: http://www.hapy.org/actions.html We probably need more experience with this, but for now the following rules of thumb seem accurate to me: - Use prefix parsing to handle a stream of "objects", where each object has the same grammar - Use actions to handle a complex "object" where parts of the object are have different grammars The two approaches can be combined, of course. If you mark the rules as both committed and verbatim, then the parser will discard the parsing tree formed by those rules, after calling your action. Thus, memory overhead would be reduced. Do we need to add a feature to the action interface to allow the action to dynamically mark the parsed result as discardable? > There is another tweak in the prefix parsing loop: > > char c = file.get(); > while(c != ' ' && c != '\n' && c != '\r' && c != '\t') > { > ... > } > > helps the parser not to stop on string parsing (e.g. > "<!--" in rComment); > > is there a better way to handle this trick? Hmm... As far as I can see, your parser should only stop when the entire comment (rComment) is mathed. It should not stop when only "<!--" part matched, unless it stops because more input is needed. Are you sure that the parser with "<-- ... -->" as available input stops after "<--"? That would be a bug, I think. Thanks, Alex. -- Protocol performance, functionality, and reliability testing. Tools, services, and know-how. http://www.measurement-factory.com/ |
From: Romain B. <rom...@ya...> - 2004-06-03 10:33:26
|
The attached example is an attempt for an "on the fly" XML parser. XML files tend to get very big: the idea is not to load the entire file into memory but to parse it when loading the file. The parser was modified to use prefix parsing, and the rNode and rElement merged into a new rXML rule. We loose the element nesting information: a stack needs to be set up to keep track of nesting level or skip entire blocks. Could the prefix parser stop on defined rules, that would avoid changing the grammar? There is another tweak in the prefix parsing loop: char c = file.get(); while(c != ' ' && c != '\n' && c != '\r' && c != '\t') { ... } helps the parser not to stop on string parsing (e.g. "<!--" in rComment); is there a better way to handle this trick? Regards, Romain __________________________________ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/ |
From: Alex R. <rou...@me...> - 2004-05-17 04:59:12
|
Hi there, Hapy library version 0.0.6 has been released. The sixth release adds "inlined" registration of semantic actions via subscript[] operator of a Rule. Several users specifically requested that feature. The current implementation of inlined registration relies on a templated method, for convenience. It probably does not have to use a templated method for a few common cases. While Hapy continues to build fine on many platforms, I am not a template guru; please let me know if new action interface does not work in your environment -- it is probably my fault. Updated documentation is at http://www.hapy.org/actions.html One can now reuse simple parsers (initialize with grammar() once, then parse() many times). That feature used to be available only via prefix parsing interface. There is also a bug fix for recursive grammars. The change log is below. Enjoy, Alex. 0.0.6 2004/05/13: - Allow Parser::parse() to be called multiple times. No need to explicitly reset the parser; the parser is reset automatically whenever parse() is called. - Added ability to supply actions inline, through Rule's subscript[] operator - Got rid of now-gone ptr_action Action wrapper; using action() directly or new subscript[] operator should work instead; Action uses templated method; this may not be portable and should probably be checked in ./configure - Added "Attaching Action to a Rule" section to "Actions" documentation page, explaining old Rule's action() method and newly added subscript[] operator - Added optional command line options to TestMaker, to control the shape of generated test cases: generate test cases that use one parser per clause or one parser per case; generate test cases that feed all input at once or one input octet at a time. The later is not supported yet. Defaults have not changed. - Generate and execute "shared parsers" and "encapsulated parsers" tests using newly added TestMaker command-line options - Temporary disabled a parsing optimization that failed tests for some recursive grammars (causing infinite loop during parser initialization) |
From: Alex R. <rou...@me...> - 2004-03-05 06:46:31
|
Hi, Hapy library version 0.0.5 has been released. The fifth release contains major performance optimizations and minor bug fixes/improvements. The change log is below. Enjoy, Alex. 0.0.5 2004/03/04: - enable debugging if the code writer did not explicitly prohibit it by calling Rule::Debug(false), and the code runner set the HAPY_DEBUG environmental variable to "USER"; this allows debugging of previously compiled programs without modifying their code - parsing speed and greed optimizations - added dedicated user-level interfaces for controlling debugging and optimization: Hapy::Debug() and Hapy::Optimize() - when debugging, report rejection due to left recursion or empty sequence repetition - use AX_PREFIX_CONFIG_H autoconf macro to prefix config.h #defines with a HAPY_ prefix, to avoid conflicts with other libraries using autoconf - do not #include config.h if HAVE_CONFIG_H or HAPY_HAVE_CONFIG_H is not defined; always include Top.h though - changed left recursion detection algorithm to take care of cases where the parsing rule is repeated without visible progress but the second appearance may lead (once the duplicate path is rejected) to a different path, making progress; added an indirectRecursion test case to make sure we always handle this kind of recursion correctly - added UselessRecursion test case, mainly to test handling of A = A kind of rules; this test case exposed the problem with the negative operator (A - B): when placed at the top of the grammar, the exceptional rule (B) may not match end of input while the user may expect it to; explicit end_r rule would be required to parse (A - B) correctly at the top of the grammar - Pree::rid() now returns RuleId, not int |
From: Alex R. <rou...@me...> - 2004-02-04 15:55:20
|
Hi, Hapy library version 0.0.4 has been released. The fourth release adds semantic actions and character set/range builtin parsing rules. The release also contains performance optimizations and documentation improvements. The change log is below. Enjoy, Alex. 0.0.4 2004/02/04: - added char_range_r(first,last) rule to match any character in the specified [first,last] inclusive range - added char_set_r(string) rule to match any character in the specified string - added action interface; a rule can now be augmented with an action that gets triggered when the rule matches; an action can confirm the match, generate a parsing error, or reject the match with a miss; the latter causes new matches to be found; the action is called before the rule commits - added find_if(node,f) function to search for a parsing tree node for which f() returns true - polished and documented debugging mechanisms - use loops instead of indirect recursion when backtracking through alternatives; recursion can easily run out of [stack] memory when dealing with huge invalid inputs and character-at-a-time rules; not all algorithms were checked for recursion loops so this may need more work - avoid polluting macro name space with VERSION and PACKAGE* #defines in config.h; such pollution prevented seemless integration of Hapy with other packages |
From: Alex R. <rou...@me...> - 2004-01-13 01:04:58
|
Hi, Hapy library version 0.0.3 has been released. The third release contains API improvements, compiler compatibility fixes, and performance optimizations. Hapy benchmarking methodology is now documented and is being reviewed by other parser generation projects prior to getting "officially" published. Please contact Hapy developers if you want to be in the loop. The change log is below. Enjoy, Alex. 0.0.3 2004/01/12: - added RuleId class to hold Rule identifiers (used to be integers); switched to new RuleId-based construction of user-level Rules; one no longer can specify Rule IDs, but can only extract auto-assigned ones if needed; this avoids extra ink in some cases and might make integration of 3rd party rules easier - when Parser::parse() interface is used, assume that all input must be consumed to report a successful match; that is, end_r becomes implied and users no longer need to specify it explicitly if they use the simple Parser::parse() interface. - do not build examples, tests, and doc programs when running "make" only "make check" builds them now; the intent is to increase chances of having a functional "make install" even if some examples/tests (i.e., non-essential features) fail to compile - support and use implicit conversion from char to char_r; grammar rules can now use characters directly, without a char_r wrapper - parser debugging is now controlled by the Rule::Debug(bool) call rather than the HAPY_DEBUG #define - increased parsing speed and decreased parser memory consumption in some common cases - benchmarking methodology is now documented and is being reviewed by other parser generation projects prior to getting "officially" published. - MS Visual Studio .NET 2003 portability fixes - GCC 3.2 portability fixes - fixed parsing tree node memory leaks (known since 0.0.1) - enabled most GCC warnings by default |
From: Alex R. <rou...@me...> - 2003-12-19 01:49:16
|
The first snapshot of the Hapy library has been released. Please see http://hapy.org/ for the updated documentation. Alex. |