Panda3D
|
00001 // Filename: xParserDefs.h 00002 // Created by: drose (03Oct04) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef XPARSERDEFS_H 00016 #define XPARSERDEFS_H 00017 00018 #include "pandatoolbase.h" 00019 #include "windowsGuid.h" 00020 #include "xFileDataDef.h" 00021 #include "pta_int.h" 00022 #include "pta_double.h" 00023 00024 class XFile; 00025 class XFileNode; 00026 00027 void x_init_parser(istream &in, const string &filename, XFile &file); 00028 void x_cleanup_parser(); 00029 int xyyparse(); 00030 00031 // This structure holds the return value for each token. 00032 // Traditionally, this is a union, and is declared with the %union 00033 // declaration in the parser.y file, but unions are pretty worthless 00034 // in C++ (you can't include an object that has member functions in a 00035 // union), so we'll use a class instead. That means we need to 00036 // declare it externally, here. 00037 00038 class XTokenType { 00039 public: 00040 union U { 00041 int number; 00042 XFileNode *node; 00043 XFileDataDef::Type primitive_type; 00044 } u; 00045 string str; 00046 WindowsGuid guid; 00047 PTA_double double_list; 00048 PTA_int int_list; 00049 }; 00050 00051 // The yacc-generated code expects to use the symbol 'YYSTYPE' to 00052 // refer to the above class. 00053 #define YYSTYPE XTokenType 00054 00055 #endif