vrml.hpp

00001 /* A Bison parser, made by GNU Bison 2.1.  */
00002 
00003 /* C++ Skeleton parser for LALR(1) parsing with Bison,
00004    Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 2, or (at your option)
00009    any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software
00018    Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019    Boston, MA 02110-1301, USA.  */
00020 /* FIXME: This is wrong, we want computed header guards.
00021    I don't know why the macros are missing now. :( */
00022 #ifndef PARSER_HEADER_H
00023 # define PARSER_HEADER_H
00024 
00025 #include <string>
00026 #include <iostream>
00027 
00028 /* Using locations.  */
00029 #define YYLSP_NEEDED 1
00030 
00031 namespace yy
00032 {
00033   class position;
00034   class location;
00035 }
00036 
00037 /* Tokens.  */
00038    enum yytokentype {
00039      VRMLID = 258,
00040      STRING = 259,
00041      AS = 260,
00042      VRMLNULL = 261,
00043      SCRIPT = 262,
00044      VRMLTRUE = 263,
00045      VRMLFALSE = 264,
00046      PROFILE = 265,
00047      COMPONENT = 266,
00048      EXPORT = 267,
00049      IMPORT = 268,
00050      META = 269,
00051      DEF = 270,
00052      USE = 271,
00053      PROTO = 272,
00054      inputOnly = 273,
00055      outputOnly = 274,
00056      initializeOnly = 275,
00057      inputOutput = 276,
00058      EXTERNPROTO = 277,
00059      ROUTE = 278,
00060      TO = 279,
00061      IS = 280
00062    };
00063 
00064 
00065 /* Copy the first part of user declarations.  */
00066 #line 6 "vrml.bison"
00067 
00069 //    Copyright 2004, SenseGraphics AB
00070 //
00071 //    This file is part of H3D API.
00072 //
00073 //    H3D API is free software; you can redistribute it and/or modify
00074 //    it under the terms of the GNU General Public License as published by
00075 //    the Free Software Foundation; either version 2 of the License, or
00076 //    (at your option) any later version.
00077 //
00078 //    H3D API is distributed in the hope that it will be useful,
00079 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
00080 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00081 //    GNU General Public License for more details.
00082 //
00083 //    You should have received a copy of the GNU General Public License
00084 //    along with H3D API; if not, write to the Free Software
00085 //    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00086 //
00087 //    A commercial license is also available. Please contact us at 
00088 //    www.sensegraphics.com for more information.
00089 //
00090 //
00091 //
00094 //
00095 //  To generate vrml.cpp and vrml.hpp, simply run:
00096 //     bison -o vrml.cpp vrml.bison
00097 //
00098 //
00100 
00101 
00102 #include "H3DApi.h"
00103 #include "Node.h"
00104 #include "Group.h"
00105 #include "DEFNodes.h"
00106 #include "Inline.h"
00107 #include "H3DExports.h"
00108 #include "X3D.h"
00109 #include "X3DTypeFunctions.h"
00110 
00111 using namespace H3D;
00112 using namespace X3D;
00113 
00114 // For H3D API purposes, we include a copy of FlexLexer.h so that
00115 // users don't need a copy of Flex installed just to compile the
00116 // API.
00117 #include "FlexLexer.h"
00118 #include "VrmlDriver.h"
00119 
00120 #include <iostream>
00121 #include <sstream>
00122 using namespace std;
00123 
00124 
00125 #define YYERROR_VERBOSE  1
00126 
00127 int yylex (YYSTYPE* yylval, yy::location* yylloc, VrmlDriver& driver);
00128 
00129 
00130 
00131 /* Line 321 of lalr1.cc.  */
00132 #line 133 "vrml.hpp"
00133 
00134 #include "stack.hh"
00135 #include "location.hh"
00136 
00137 /* Enabling traces.  */
00138 #ifndef YYDEBUG
00139 # define YYDEBUG 1
00140 #endif
00141 
00142 /* Enabling verbose error messages.  */
00143 #ifdef YYERROR_VERBOSE
00144 # undef YYERROR_VERBOSE
00145 # define YYERROR_VERBOSE 1
00146 #else
00147 # define YYERROR_VERBOSE 1
00148 #endif
00149 
00150 #if YYERROR_VERBOSE
00151 # define YYERROR_VERBOSE_IF(x) x
00152 #else
00153 # define YYERROR_VERBOSE_IF(x) /* empty */
00154 #endif
00155 
00156 /* Enabling the token table.  */
00157 #ifndef YYTOKEN_TABLE
00158 # define YYTOKEN_TABLE 0
00159 #endif
00160 
00161 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
00162 #line 84 "vrml.bison"
00163 union YYSTYPE {
00164   char* val;
00165 };
00166 /* Line 321 of lalr1.cc.  */
00167 #line 168 "vrml.hpp"
00168 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
00169 # define YYSTYPE_IS_DECLARED 1
00170 # define YYSTYPE_IS_TRIVIAL 1
00171 #endif
00172 
00173 /* Copy the second part of user declarations.  */
00174 
00175 
00176 /* Line 321 of lalr1.cc.  */
00177 #line 178 "vrml.hpp"
00178 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
00179    If N is 0, then set CURRENT to the empty location which ends
00180    the previous symbol: RHS[0] (always defined).  */
00181 
00182 #ifndef YYLLOC_DEFAULT
00183 # define YYLLOC_DEFAULT(Current, Rhs, N)                \
00184 do {                                                    \
00185   if (N)                                                \
00186     {                                                   \
00187       (Current).begin = (Rhs)[1].begin;                 \
00188       (Current).end   = (Rhs)[N].end;                   \
00189     }                                                   \
00190   else                                                  \
00191     {                                                   \
00192       (Current).begin = (Current).end = (Rhs)[0].end;   \
00193     }                                                   \
00194 } while (0)
00195 #endif
00196 
00197 namespace yy
00198 {
00199   class VrmlParser;
00200 
00201   template <typename P>
00202   struct traits
00203   {
00204   };
00205 
00206   template <>
00207   struct traits<VrmlParser>
00208   {
00209     typedef unsigned char token_number_type;
00210     typedef signed char       rhs_number_type;
00211     typedef int state_type;
00212     typedef YYSTYPE semantic_type;
00213     typedef location location_type;
00214   };
00215 }
00216 
00217 namespace yy
00218 {
00220   class VrmlParser
00221   {
00223     typedef traits<VrmlParser>::semantic_type semantic_type;
00225     typedef traits<VrmlParser>::location_type location_type;
00226 
00227   public:
00229     VrmlParser (VrmlDriver& driver_yyarg) :
00230       yydebug_ (false),
00231       yycdebug_ (&std::cerr),
00232       driver (driver_yyarg)
00233     {
00234     }
00235 
00236     virtual ~VrmlParser ()
00237     {
00238     }
00239 
00242     virtual int parse ();
00243 
00245     std::ostream& debug_stream () const;
00247     void set_debug_stream (std::ostream &);
00248 
00250     typedef int debug_level_type;
00252     debug_level_type debug_level () const;
00254     void set_debug_level (debug_level_type l);
00255 
00256   private:
00260     virtual void error (const location_type& loc, const std::string& msg);
00261 
00264     virtual std::string yysyntax_error_ (YYERROR_VERBOSE_IF (int tok));
00265 
00266 #if YYDEBUG
00271     virtual void yysymprint_ (int yytype,
00272                               const semantic_type* yyvaluep,
00273                               const location_type* yylocationp);
00274 #endif /* ! YYDEBUG */
00275 
00276 
00278     typedef traits<VrmlParser>::state_type state_type;
00280     typedef stack<state_type>    state_stack_type;
00282     typedef stack<semantic_type> semantic_stack_type;
00284     typedef stack<location_type> location_stack_type;
00285 
00287     state_stack_type yystate_stack_;
00289     semantic_stack_type yysemantic_stack_;
00291     location_stack_type yylocation_stack_;
00292 
00294     typedef traits<VrmlParser>::token_number_type token_number_type;
00295     /* Tables.  */
00297     static const short int yypact_[];
00298     static const signed char yypact_ninf_;
00299 
00303     static const unsigned char yydefact_[];
00304 
00305     static const short int yypgoto_[];
00306     static const short int yydefgoto_[];
00307 
00313     static const short int yytable_[];
00314     static const signed char yytable_ninf_;
00315 
00316     static const short int yycheck_[];
00317 
00319     static const unsigned char yystos_[];
00320 
00322     static const unsigned char yyr1_[];
00324     static const unsigned char yyr2_[];
00325 
00326 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
00328     static const char* const yytname_[];
00329 #endif
00330 
00331 #if YYERROR_VERBOSE
00333     virtual std::string yytnamerr_ (const char *n);
00334 #endif
00335 
00336 #if YYDEBUG
00337 
00338     typedef traits<VrmlParser>::rhs_number_type rhs_number_type;
00340     static const rhs_number_type yyrhs_[];
00342     static const unsigned short int yyprhs_[];
00344     static const unsigned short int yyrline_[];
00346     static const unsigned short int yytoken_number_[];
00348     virtual void yyreduce_print_ (int r);
00350     virtual void yystack_print_ ();
00351 #endif
00352 
00354     inline token_number_type yytranslate_ (int token);
00355 
00361     inline void yydestruct_ (const char* yymsg,
00362                              int yytype,
00363                              semantic_type* yyvaluep,
00364                              location_type* yylocationp);
00365 
00367     inline void yypop_ (unsigned int n = 1);
00368 
00369     /* Constants.  */
00370     static const int yyeof_;
00371     /* LAST_ -- Last index in TABLE_.  */
00372     static const int yylast_;
00373     static const int yynnts_;
00374     static const int yyempty_;
00375     static const int yyfinal_;
00376     static const int yyterror_;
00377     static const int yyerrcode_;
00378     static const int yyntokens_;
00379     static const unsigned int yyuser_token_number_max_;
00380     static const token_number_type yyundef_token_;
00381 
00382     /* State.  */
00383     int yyn_;
00384     int yylen_;
00385     int yystate_;
00386 
00387     /* Error handling. */
00388     int yynerrs_;
00389     int yyerrstatus_;
00390 
00391     /* Debugging.  */
00392     int yydebug_;
00393     std::ostream* yycdebug_;
00394 
00395 
00396     /* User arguments.  */
00397     VrmlDriver& driver;
00398   };
00399 }
00400 
00401 #endif /* ! defined PARSER_HEADER_H */

Generated on Thu Aug 24 12:38:35 2006 for H3D API by  doxygen 1.4.5