Panda3D
|
00001 // Filename: dcParserDefs.h 00002 // Created by: drose (05Oct00) 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 DCPARSERDEFS_H 00016 #define DCPARSERDEFS_H 00017 00018 #include "dcbase.h" 00019 #include "dcSubatomicType.h" 00020 00021 class DCFile; 00022 class DCClass; 00023 class DCSwitch; 00024 class DCField; 00025 class DCAtomicField; 00026 class DCParameter; 00027 class DCKeyword; 00028 class DCPacker; 00029 00030 void dc_init_parser(istream &in, const string &filename, DCFile &file); 00031 void dc_init_parser_parameter_value(istream &in, const string &filename, 00032 DCPacker &packer); 00033 void dc_init_parser_parameter_description(istream &in, const string &filename, 00034 DCFile *file); 00035 DCField *dc_get_parameter_description(); 00036 void dc_cleanup_parser(); 00037 int dcyyparse(); 00038 00039 extern DCFile *dc_file; 00040 00041 // This structure holds the return value for each token. 00042 // Traditionally, this is a union, and is declared with the %union 00043 // declaration in the parser.y file, but unions are pretty worthless 00044 // in C++ (you can't include an object that has member functions in a 00045 // union), so we'll use a class instead. That means we need to 00046 // declare it externally, here. 00047 00048 class DCTokenType { 00049 public: 00050 union U { 00051 int s_int; 00052 unsigned int s_uint; 00053 PN_int64 int64; 00054 PN_uint64 uint64; 00055 double real; 00056 bool flag; 00057 DCClass *dclass; 00058 DCSwitch *dswitch; 00059 DCField *field; 00060 DCAtomicField *atomic; 00061 DCSubatomicType subatomic; 00062 DCParameter *parameter; 00063 const DCKeyword *keyword; 00064 } u; 00065 string str; 00066 }; 00067 00068 // The yacc-generated code expects to use the symbol 'YYSTYPE' to 00069 // refer to the above class. 00070 #define YYSTYPE DCTokenType 00071 00072 #endif