Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

source.cc

Go to the documentation of this file.
00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT!         -*- c++ -*-
00002 
00003 #include "source.h"
00004 #include "source_i.h"
00005 
00006 #line 56 "source.cpp"
00007 
00008 using namespace std;
00009 
00010 #line 61 "source.cpp"
00011 
00012 
00013 Source&
00014 Source::instance()
00015 {
00016   return Source_i::Instance();
00017 }
00018 
00019 #line 68 "source.cpp"
00020 
00021 
00022 Source::Source()
00023   : _src_prog(0), _lex(0), _parser (0), _def (0)
00024 {}
00025 
00026 #line 73 "source.cpp"
00027 
00028 
00029 Source::~Source()
00030 {}
00031 
00032 #line 77 "source.cpp"
00033 
00034 void
00035 Source::parse(const char* filename)
00036 {
00037   ifstream src_stream (filename);
00038   if(!src_stream)
00039     throw string (filename) + ": " + strerror (errno);
00040 
00041   parse (filename, new ProgramFile(src_stream));
00042 }
00043 
00044 #line 87 "source.cpp"
00045 
00046 void
00047 Source::parse(const char* filename, Program* program)
00048 {
00049   _src_prog = program;
00050   _lex = new Lex (_src_prog);
00051   _parser = new Parser (_lex);
00052 
00053   Ptree *program_fragment;
00054 
00055   while(_parser->rProgram(program_fragment))
00056     {
00057       _def.Append (program_fragment);
00058     }
00059 
00060   if (_parser->NumOfErrors() != 0)
00061     {
00062       throw (Sstring() << _parser->NumOfErrors() << " found.\n").str();
00063     }
00064 
00065   return;
00066 }
00067 
00068 #line 109 "source.cpp"
00069 
00070 void
00071 Source::dump()
00072 {
00073   _def.All()->Display2 (cout);
00074 }
00075 
00076 #line 115 "source.cpp"
00077 
00078 Parser*
00079 Source::parser()
00080 {
00081   return _parser;
00082 }
00083 
00084 #line 121 "source.cpp"
00085 
00086 Ptree*
00087 Source::translate(Walker *w)
00088 {
00089   PtreeArray* a = new PtreeArray;
00090 
00091   PtreeIter i (_def.All());
00092   while (*i) 
00093     {
00094       a->Append (w->Translate(*i));
00095       i++;
00096     }
00097 
00098   return a->All();
00099 }
00100 
00101 #line 136 "source.cpp"
00102 
00103 Program*
00104 Source::program()
00105 {
00106   return _src_prog;
00107 }

Generated on Mon Feb 10 17:32:56 2003 for VFiasco Semantics Compiler by doxygen1.2.15