00001
00002
00003 #if !defined(PROPERTYCOMPILER_INCLUDED)
00004 #define PROPERTYCOMPILER_INCLUDED
00005
00006
00007 #include <string>
00008 #include <fstream>
00009 #include "JobOptionsCatalogue.h"
00010 #include "GaudiKernel/StatusCode.h"
00011 #include "GaudiKernel/MsgStream.h"
00012 #include "UnitsExtension.h"
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 class PropertyCompiler
00028 {
00029 public:
00030
00031 PropertyCompiler(std::string sourcefile,
00032 MsgStream& my_log,
00033 JobOptionsCatalogue& myCat,
00034 PropertyCompiler* parent=0);
00035
00036 virtual ~PropertyCompiler();
00037
00038
00039 StatusCode startCompiler();
00040
00041 private:
00042
00043 std::vector <std::string>* includeFiles;
00044 bool unitsDefined, hasParent;
00045 UnitsExtension* units;
00046
00047
00048 enum Symbols { BOFSy, EOFSy, assignSy, semicolonSy, commaSy, stringSy, numberSy, realSy, dotSy, noSy,
00049 identifierSy, booleanSy, includeSy, minusSy, plusSy, vectorStartSy, vectorEndSy, appendSy,
00050 ifDefSy, ifNDefSy, endIfSy, elseSy, unitsSy, envSy, propSy };
00051
00052 enum Operations { assign, append, noOperation, clear };
00053
00054 char m_ch;
00055 unsigned int m_lnr,m_cnr;
00056 unsigned int m_tokenlnr,m_tokencnr;
00057 std::string m_identStr;
00058 std::string m_srcName;
00059 std::string m_srcLine;
00060 std::string m_compiledLine;
00061 Symbols m_sy;
00062 bool m_error;
00063 int m_errorCount,m_warningCount;
00064 std::ifstream *m_in;
00065 MsgStream* m_log;
00066 JobOptionsCatalogue* m_Cat;
00067
00068
00069 std::string resolveEnv(const std::string& sourcefile);
00070
00071
00072 void ignorePlatformDependendLines();
00073 void getEntryPointOfDependendLines();
00074
00075
00076 void newCh();
00077
00078 std::string newSy();
00079
00080 bool isNextEntryPoint();
00081
00082 Symbols getValueType(std::string& valueStr);
00083
00084 StatusCode checkSyntax();
00085 };
00086 #endif