From: Tom H. <tom...@us...> - 2003-03-24 18:15:38
|
Update of /cvsroot/rccparser/rccparser/src In directory sc8-pr-cvs1:/tmp/cvs-serv1335/src Modified Files: Makefile.am header.tex.tmpl rcclexer.h rccparse.ypp rccparser.h rccptest.cpp Added Files: rccparser.cpp Log Message: 2003-03-21 Tom Howard <tom...@us...> * ./src/Makefile.am * ./src/RC.epdf * ./src/RC.eps * ./src/RC.tif * ./src/RC.xcf * ./src/doxygen.sty * ./src/header.tex.tmpl Spruced up pdf and ps docs. --- NEW FILE: rccparser.cpp --- // -*-c++-*- /*************************************************************************** rccparser.cpp Parser Abstract Base Class ------------------- begin : 22-MAR-2003 copyright : (C) 2003 by Tom Howard email : tom...@us... ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU GPL as published by the Free Software * * Foundation; either version 2 of the License, or (at your option) any * * later version. * * * ***************************************************************************/ #include "rccparser.h" #include "rcclexer.h" #include <algorithm> namespace rcc { Parser::Param::Param( Parser& parser ) : M_parser( parser ), M_lexer( new rcc::Lexer ) {} Parser::Param::~Param() { delete M_lexer; } Parser::Param::Param( const Param& param ) : M_parser( param.M_parser ), M_lexer( new rcc::Lexer( *( param.M_lexer ) ) ) {} Parser::Param& Parser::Param::operator=( const Parser::Param& param ) { Parser::Param tmp( param ); std::swap( tmp, *this ); return *this; } bool Parser::setStream( std::istream& strm ) { M_param.getLexer().switch_streams( &strm, &std::cerr ); return true; } } Index: Makefile.am =================================================================== RCS file: /cvsroot/rccparser/rccparser/src/Makefile.am,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Makefile.am 21 Mar 2003 16:06:51 -0000 1.36 --- Makefile.am 24 Mar 2003 18:15:19 -0000 1.37 *************** *** 24,28 **** librccparser_la_SOURCES = \ rcclexer.cpp \ ! rccparse.ypp librccparser_la_LDFLAGS = -version-info 3:0:3 --- 24,29 ---- librccparser_la_SOURCES = \ rcclexer.cpp \ ! rccparse.ypp \ ! rccparser.cpp librccparser_la_LDFLAGS = -version-info 3:0:3 *************** *** 109,113 **** ! HTMLFILES = doc/html/annotated.html \ doc/html/annotated.html \ doc/html/classes.html \ --- 110,114 ---- ! HTMLFILES = \ doc/html/annotated.html \ doc/html/classes.html \ *************** *** 117,126 **** doc/html/classrcc_1_1Parser__inherit__graph.gif \ doc/html/files.html \ ! doc/html/footer.html \ doc/html/functions.html \ doc/html/globals.html \ doc/html/graph_legend.gif \ doc/html/graph_legend.html \ - doc/html/header.html \ doc/html/hierarchy.html \ doc/html/index.html \ --- 118,126 ---- doc/html/classrcc_1_1Parser__inherit__graph.gif \ doc/html/files.html \ ! doc/html/doxygen.gif \ doc/html/functions.html \ doc/html/globals.html \ doc/html/graph_legend.gif \ doc/html/graph_legend.html \ doc/html/hierarchy.html \ doc/html/index.html \ *************** *** 135,190 **** doc/html/rccparser_8h.html \ doc/html/rccparser_8h__dep__incl.gif \ ! doc/html/rccparser_8h__incl.gifrccptest_8cpp-source.html header.tex: header.tex.tmpl ! $(AWK) -v ver=@VERSION@ -v date=`date +%Y-%m-%d` \ ! '/@VER@/ { sub( /@VER@/, ver ); } /@DATE@/ { sub( /@DATE@/, date ); } { print }' \ $(srcdir)/header.tex.tmpl > header.tex doc/html/style.css: style.css ! if ! test -d doc; then rm -f doc; mkdir doc; fi ! if ! test -d doc/html; then rm -f doc/html; mkdir doc/html; fi ! cp -f $(srcdir)/style.css doc/html/style.css doc/html/header.jpg: header.jpg ! if ! test -d doc; then rm -f doc; mkdir doc; fi ! if ! test -d doc/html; then rm -f doc/html; mkdir doc/html; fi ! cp -f $(srcdir)/header.jpg doc/html/header.jpg doc/latex/doxygen.sty: doxygen.sty ! if ! test -d doc; then rm -f doc; mkdir doc; fi ! if ! test -d doc/latex; then rm -f doc/latex; mkdir doc/latex; fi ! cp -f $(srcdir)/doxygen.sty doc/latex/doxygen.sty ! ! doc/latex/header.tex: header.tex ! if ! test -d doc; then rm -f doc; mkdir doc; fi ! if ! test -d doc/latex; then rm -f doc/latex; mkdir doc/latex; fi ! cp -f $(srcdir)/header.tex doc/latex/header.tex doc/latex/RC.eps: RC.eps ! if ! test -d doc; then rm -f doc; mkdir doc; fi ! if ! test -d doc/latex; then rm -f doc/latex; mkdir doc/latex; fi ! cp -f $(srcdir)/RC.eps doc/latex/RC.eps ! doc/latex/RC.pdf: RC.pdf ! if ! test -d doc; then rm -f doc; mkdir doc; fi ! if ! test -d doc/latex; then rm -f doc/latex; mkdir doc/latex; fi ! cp -f $(srcdir)/RC.pdf doc/latex/RC.pdf doc/html/getcomments.pl: getcomments.pl ! if ! test -d doc; then rm -f doc; mkdir doc; fi ! if ! test -d doc/html; then rm -f doc/html; mkdir doc/html; fi ! cp -f $(srcdir)/getcomments.pl doc/html/getcomments.pl doc/html/comment.pl: comment.pl ! if ! test -d doc; then rm -f doc; mkdir doc; fi ! if ! test -d doc/html; then rm -f doc/html; mkdir doc/html; fi ! cp -f $(srcdir)/comment.pl doc/html/comment.pl doc/html/addcomment.pl: addcomment.pl ! if ! test -d doc; then rm -f doc; mkdir doc; fi ! if ! test -d doc/html; then rm -f doc/html; mkdir doc/html; fi ! cp -f $(srcdir)/addcomment.pl doc/html/addcomment.pl --- 135,186 ---- doc/html/rccparser_8h.html \ doc/html/rccparser_8h__dep__incl.gif \ ! doc/html/rccparser_8h__incl.gif \ ! doc/html/rccptest_8cpp-source.html header.tex: header.tex.tmpl ! @$(AWK) -v ver=@VERSION@ -v date=`date +%Y-%m-%d` \ ! '/@VER@/ { sub( /@VER@/, ver ); } { print }' \ $(srcdir)/header.tex.tmpl > header.tex doc/html/style.css: style.css ! @if ! test -d doc; then rm -f doc; mkdir doc; fi ! @if ! test -d doc/html; then rm -f doc/html; mkdir doc/html; fi ! @cp -f $(srcdir)/style.css doc/html/style.css doc/html/header.jpg: header.jpg ! @if ! test -d doc; then rm -f doc; mkdir doc; fi ! @if ! test -d doc/html; then rm -f doc/html; mkdir doc/html; fi ! @cp -f $(srcdir)/header.jpg doc/html/header.jpg doc/latex/doxygen.sty: doxygen.sty ! @if ! test -d doc; then rm -f doc; mkdir doc; fi ! @if ! test -d doc/latex; then rm -f doc/latex; mkdir doc/latex; fi ! @cp -f $(srcdir)/doxygen.sty doc/latex/doxygen.sty doc/latex/RC.eps: RC.eps ! @if ! test -d doc; then rm -f doc; mkdir doc; fi ! @if ! test -d doc/latex; then rm -f doc/latex; mkdir doc/latex; fi ! @cp -f $(srcdir)/RC.eps doc/latex/RC.eps ! doc/latex/RC.pdf: RC.epdf ! @if ! test -d doc; then rm -f doc; mkdir doc; fi ! @if ! test -d doc/latex; then rm -f doc/latex; mkdir doc/latex; fi ! @cp -f $(srcdir)/RC.epdf doc/latex/RC.pdf doc/html/getcomments.pl: getcomments.pl ! @if ! test -d doc; then rm -f doc; mkdir doc; fi ! @if ! test -d doc/html; then rm -f doc/html; mkdir doc/html; fi ! @cp -f $(srcdir)/getcomments.pl doc/html/getcomments.pl doc/html/comment.pl: comment.pl ! @if ! test -d doc; then rm -f doc; mkdir doc; fi ! @if ! test -d doc/html; then rm -f doc/html; mkdir doc/html; fi ! @cp -f $(srcdir)/comment.pl doc/html/comment.pl doc/html/addcomment.pl: addcomment.pl ! @if ! test -d doc; then rm -f doc; mkdir doc; fi ! @if ! test -d doc/html; then rm -f doc/html; mkdir doc/html; fi ! @cp -f $(srcdir)/addcomment.pl doc/html/addcomment.pl *************** *** 194,239 **** doxygen.conf: doxygen.conf.tmpl $(pkginclude_HEADERS) $(librccparser_la_SOURCES) $(rccptest_SOURCES) header.tex ! $(AWK) -v have_dot=@HAVE_DOT@ \ ! '/@DOT@/ { sub( /@DOT@/, have_dot ); } /@INPUT@/ { sub( /@INPUT@/, "$(srcdir)" ); } { print }' \ $(srcdir)/doxygen.conf.tmpl > doxygen.conf doxygen doxygen.conf ! cp -f $(srcdir)/doxygen.sty doc/latex/doxygen.sty $(HTMLFILES): doxygen doc/html/header.html doc/html/footer.html doc/html/style.css ! chmod +x $@ ! ! doc/latex/refman.ps: doxygen doc/latex/doxygen.sty doc/latex/header.tex ! cd doc/latex && $(MAKE) $(AM_MAKEFLAGS) ps doc/ps/@PACKAGE@-@VERSION@.ps: doc/latex/refman.ps ! if ! test -d doc/ps; then mkdir doc/ps; fi ! cp doc/latex/refman.ps doc/ps/@PACKAGE@-@VERSION@.ps ! doc/latex/refman.pdf: doxygen doc/latex/doxygen.sty doc/latex/header.tex ! cd doc/latex && $(MAKE) $(AM_MAKEFLAGS) pdf doc/pdf/@PACKAGE@-@VERSION@.pdf: doc/latex/refman.pdf ! if ! test -d doc/pdf; then mkdir doc/pdf; fi ! cp doc/latex/refman.pdf doc/pdf/@PACKAGE@-@VERSION@.pdf doc/xml/doxygen.xml: doxygen doc/xml/@PACKAGE@-@VERSION@.xml: doc/xml/doxygen.xml ! cp doc/xml/doxygen.xml doc/xml/@PACKAGE@-@VERSION@.xml doc/htmlgz/@PACKAGE@-@VERSION@.html.tar.gz: $(HTMLFILES) doc/html/style.css doc/html/comment.pl doc/html/getcomments.pl doc/html/addcomment.pl ! if ! test -d doc/htmlgz; then rm -f doc/htmlgz; mkdir doc/htmlgz; fi ! ln -s doc/html @PACKAGE@-@VERSION@.html ! $(AMTAR) chof - "@PACKAGE@-@VERSION@.html" | GZIP=$(GZIP_ENV) gzip -c >"doc/htmlgz/@PACKAGE@-@VERSION@.html.tar.gz" ! rm -rf @PACKAGE@-@VERSION@.html else doxygen.conf: doxygen.conf.tmpl $(pkginclude_HEADERS) $(librccparser_la_SOURCES) $(rccptest_SOURCES) ! $(AWK) -v have_dot=@HAVE_DOT@ \ ! '/@DOT@/ { sub( /@DOT@/, have_dot ); } /@INPUT@/ { sub( /@INPUT@/, "$(srcdir)" ); } { print }' \ $(srcdir)/doxygen.conf.tmpl > doxygen.conf --- 190,245 ---- doxygen.conf: doxygen.conf.tmpl $(pkginclude_HEADERS) $(librccparser_la_SOURCES) $(rccptest_SOURCES) header.tex ! @if test "@DOT@"; then \ ! HAVE_DOT="YES"; \ ! else \ ! HAVE_DOT="NO"; \ ! fi; \ ! $(AWK) -v have_dot=$$HAVE_DOT \ ! '/@HAVE_DOT@/ { sub( /@HAVE_DOT@/, have_dot ); } /@INPUT@/ { sub( /@INPUT@/, "$(srcdir)" ); } { print }' \ $(srcdir)/doxygen.conf.tmpl > doxygen.conf doxygen doxygen.conf ! @rm -f doc/latex/doxygen.sty $(HTMLFILES): doxygen doc/html/header.html doc/html/footer.html doc/html/style.css ! @chmod +x $@ ! @touch $@ ! doc/latex/refman.ps: doxygen doc/latex/doxygen.sty doc/latex/RC.eps ! @cd doc/latex && $(MAKE) $(AM_MAKEFLAGS) ps doc/ps/@PACKAGE@-@VERSION@.ps: doc/latex/refman.ps ! @if ! test -d doc/ps; then mkdir doc/ps; fi ! @cp doc/latex/refman.ps doc/ps/@PACKAGE@-@VERSION@.ps ! doc/latex/refman.pdf: doxygen doc/latex/doxygen.sty doc/latex/RC.pdf ! @cd doc/latex && $(MAKE) $(AM_MAKEFLAGS) pdf doc/pdf/@PACKAGE@-@VERSION@.pdf: doc/latex/refman.pdf ! @if ! test -d doc/pdf; then mkdir doc/pdf; fi ! @cp doc/latex/refman.pdf doc/pdf/@PACKAGE@-@VERSION@.pdf doc/xml/doxygen.xml: doxygen doc/xml/@PACKAGE@-@VERSION@.xml: doc/xml/doxygen.xml ! @cp doc/xml/doxygen.xml doc/xml/@PACKAGE@-@VERSION@.xml doc/htmlgz/@PACKAGE@-@VERSION@.html.tar.gz: $(HTMLFILES) doc/html/style.css doc/html/comment.pl doc/html/getcomments.pl doc/html/addcomment.pl ! @if ! test -d doc/htmlgz; then rm -f doc/htmlgz; mkdir doc/htmlgz; fi ! @ln -s doc/html @PACKAGE@-@VERSION@.html ! @$(AMTAR) chof - "@PACKAGE@-@VERSION@.html" | GZIP=$(GZIP_ENV) gzip -c >"doc/htmlgz/@PACKAGE@-@VERSION@.html.tar.gz" ! @rm -rf @PACKAGE@-@VERSION@.html else doxygen.conf: doxygen.conf.tmpl $(pkginclude_HEADERS) $(librccparser_la_SOURCES) $(rccptest_SOURCES) ! @if test "@DOT@"; then \ ! HAVE_DOT="YES"; \ ! else \ ! HAVE_DOT="NO"; \ ! fi; \ ! $(AWK) -v have_dot=$$HAVE_DOT \ ! '/@HAVE_DOT@/ { sub( /@HAVE_DOT@/, have_dot ); } /@INPUT@/ { sub( /@INPUT@/, "$(srcdir)" ); } { print }' \ $(srcdir)/doxygen.conf.tmpl > doxygen.conf Index: header.tex.tmpl =================================================================== RCS file: /cvsroot/rccparser/rccparser/src/header.tex.tmpl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** header.tex.tmpl 21 Mar 2003 16:06:52 -0000 1.1 --- header.tex.tmpl 24 Mar 2003 18:15:19 -0000 1.2 *************** *** 50,54 **** \textsl{\textbf{{\Huge @VER@}}}\\ \vspace*{1cm} ! {\LARGE @DATE@}\\ \vspace*{1cm} {\LARGE By Tom Howard}\\ --- 50,54 ---- \textsl{\textbf{{\Huge @VER@}}}\\ \vspace*{1cm} ! {\LARGE \today}\\ \vspace*{1cm} {\LARGE By Tom Howard}\\ Index: rcclexer.h =================================================================== RCS file: /cvsroot/rccparser/rccparser/src/rcclexer.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** rcclexer.h 6 Jan 2003 15:41:32 -0000 1.4 --- rcclexer.h 24 Mar 2003 18:15:19 -0000 1.5 *************** *** 28,132 **** #include <string> class RCCLexer : public yyFlexLexer { public: ! class Holder ! { ! private: ! enum Type { S_CSTR, S_INT, S_DOUB, S_BOOL, S_STR }; ! ! union ! { ! const char* m_cstr; ! int m_int; ! double m_double; ! bool m_bool; ! }; ! std::string m_str; ! Type m_type; ! ! public: ! Holder& ! operator=( const char* x ) ! { ! m_cstr = x; ! m_type = S_CSTR; ! return *this; ! } ! ! Holder& ! operator=( int x ) ! { ! m_int = x; ! m_type = S_INT; ! return *this; ! } ! ! Holder& ! operator=( double x ) ! { ! m_double = x; ! m_type = S_DOUB; ! return *this; ! } ! ! Holder& ! operator=( bool x ) ! { ! m_bool = x; ! m_type = S_BOOL; ! return *this; ! } ! ! Holder& ! operator=( const std::string& x ) ! { ! m_str = x; ! m_type = S_STR; ! return *this; ! } ! ! const char* ! getCStr() const ! { return m_cstr; } ! ! int ! getInt() const ! { return m_int; } ! ! double ! getDouble() const ! { return m_double; } ! ! bool ! getBool() const ! { return m_bool; } ! ! std::string& ! getStr() ! { return m_str; } ! ! const std::string& ! getStr() const ! { return m_str; } ! }; ! ! virtual ! int ! yylex(); ! inline ! int ! lex( Holder& holder ) ! { M_lexed_val = &holder; return yylex(); } private: ! Holder* M_lexed_val; }; namespace rcc { ! typedef RCCLexer Lexer; } --- 28,57 ---- #include <string> + #include "rccparser.h" + class RCCLexer : public yyFlexLexer { public: ! typedef rcc::Holder Holder; ! virtual ! int ! yylex(); + inline + int + lex( Holder& holder ) + { M_lexed_val = &holder; return yylex(); } private: ! Holder* M_lexed_val; }; namespace rcc { ! class Lexer ! : public RCCLexer ! { ! }; } Index: rccparse.ypp =================================================================== RCS file: /cvsroot/rccparser/rccparser/src/rccparse.ypp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** rccparse.ypp 19 Mar 2003 18:40:32 -0000 1.9 --- rccparse.ypp 24 Mar 2003 18:15:20 -0000 1.10 *************** *** 2,6 **** /*************************************************************************** ! rccparse.yy Implementation of RoboCup language parser ------------------- --- 2,6 ---- /*************************************************************************** ! rccparse.ypp Implementation of RoboCup language parser ------------------- *************** *** 21,25 **** --- 21,37 ---- %{ + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif + + #ifdef HAVE_SSTREAM + #include <sstream> + #else + #include <strstream> + #endif + #include "rccparser.h" + #include "rcclexer.h" + /* C declarations */ *************** *** 74,77 **** --- 86,108 ---- namespace rcc { + bool + Parser::parseCLang( const char* message ) + { + #ifdef HAVE_SSTREAM + std::istringstream strm( message ); + #else + std::istrstream strm( message ); + #endif + if( M_clang_parser.parse( strm ) ) + { + doParsedCLang( message ); + return true; + } + else + { + return false; + } + } + rcc::Parser::Param& getParam( void* param ) *************** *** 90,94 **** #define PARSER getParser( param ) ! #define YYSTYPE rcc::Parser::Lexer::Holder inline --- 121,125 ---- #define PARSER getParser( param ) ! #define YYSTYPE rcc::Holder inline *************** *** 96,107 **** yylex( YYSTYPE* holder, rcc::Parser::Param& param ) { ! int rval = param.getLexer().lex( *holder ); /* cout << rval << endl; */ ! return rval; } inline int ! getInt( const rcc::Parser::Lexer::Holder& holder ) { return holder.getInt(); --- 127,138 ---- yylex( YYSTYPE* holder, rcc::Parser::Param& param ) { ! int rval = param.getLexer().lex( *holder ); /* cout << rval << endl; */ ! return rval; } inline int ! getInt( const rcc::Holder& holder ) { return holder.getInt(); *************** *** 110,114 **** inline double ! getDouble( const rcc::Parser::Lexer::Holder& holder ) { return holder.getDouble(); --- 141,145 ---- inline double ! getDouble( const rcc::Holder& holder ) { return holder.getDouble(); *************** *** 117,136 **** inline const std::string& ! getString( const rcc::Parser::Lexer::Holder& holder ) { return holder.getStr(); } inline std::string& ! getString( rcc::Parser::Lexer::Holder& holder ) { return holder.getStr(); } inline const char* ! getCStr( const rcc::Parser::Lexer::Holder& holder ) { return holder.getCStr(); } inline bool ! getBool( const rcc::Parser::Lexer::Holder& holder ) { return holder.getBool(); --- 148,167 ---- inline const std::string& ! getString( const rcc::Holder& holder ) { return holder.getStr(); } inline std::string& ! getString( rcc::Holder& holder ) { return holder.getStr(); } inline const char* ! getCStr( const rcc::Holder& holder ) { return holder.getCStr(); } inline bool ! getBool( const rcc::Holder& holder ) { return holder.getBool(); Index: rccparser.h =================================================================== RCS file: /cvsroot/rccparser/rccparser/src/rccparser.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** rccparser.h 20 Mar 2003 11:58:49 -0000 1.29 --- rccparser.h 24 Mar 2003 18:15:21 -0000 1.30 *************** *** 3,7 **** /*************************************************************************** rccparser.h ! Parser template ------------------- begin : 24-MAY-2002 --- 3,7 ---- /*************************************************************************** rccparser.h ! Parser Abstract Base Class ------------------- [...1062 lines suppressed...] + * unknown OK messages. + * + * Unknown OK message only occur when the parser is used with a + * newer version of the simulator and the parser has not been + * updated. By using this function you can provide support in your + * teams for new OK messages without having to wait for the parser + * to be upgraded. + * + * \pre An entire unknown OK + * message has been parsed. + * + */ virtual void doBuildUnknownOK( const std::string& msg ) {} //@} + + }; } Index: rccptest.cpp =================================================================== RCS file: /cvsroot/rccparser/rccparser/src/rccptest.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** rccptest.cpp 10 Jan 2003 17:36:04 -0000 1.4 --- rccptest.cpp 24 Mar 2003 18:15:22 -0000 1.5 *************** *** 23,26 **** --- 23,32 ---- #endif + #ifdef HAVE_SSTREAM + #include <sstream> + #else + #include <strstream> + #endif + #include "rccparser.h" #include <stack> *************** *** 106,110 **** --- 112,120 ---- if( str.size() == 2 ) { + #ifdef HAVE_SSTREAM std::istringstream strm( str ); + #else + std::istrstream strm( str ); + #endif int offset = -1; strm >> offset; |