Changes in src/main.cc [1ab4ce2:8686f31]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main.cc
r1ab4ce2 r8686f31 10 10 // Created On : Fri May 15 23:12:02 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jul 15 16:45:24201513 // Update Count : 14512 // Last Modified On : Mon Jul 06 15:01:26 2015 13 // Update Count : 79 14 14 // 15 15 … … 54 54 if ( errorp ) std::cerr << x << std::endl; 55 55 56 static void parse( FILE * input, LinkageSpec::Type t, bool shouldExit = false ); 57 static void dump( std::list< Declaration * > & translationUnit ); 56 void parse( FILE * input, LinkageSpec::Type t, bool shouldExit = false ); 58 57 59 58 bool … … 65 64 libcfap = false, 66 65 nopreludep = false, 67 noprotop = false,66 protop = false, 68 67 parsep = false, 69 68 resolvep = false, // used in AlternativeFinder … … 82 81 { "grammar", no_argument, 0, Grammar }, 83 82 { "libcfa", no_argument, 0, LibCFA }, 84 { "no -preamble", no_argument, 0, Nopreamble },83 { "nopreamble", no_argument, 0, Nopreamble }, 85 84 { "parse", no_argument, 0, Parse }, 86 { " no-prototypes", no_argument, 0, Prototypes },85 { "prototypes", no_argument, 0, Prototypes }, 87 86 { "resolver", no_argument, 0, Resolver }, 88 87 { "symbol", no_argument, 0, Symbol }, … … 132 131 case Prototypes: 133 132 case 'p': // generate prototypes for preamble functions 134 noprotop = true;133 protop = true; 135 134 break; 136 135 case Parse: … … 222 221 Parser::get_parser().freeTree(); 223 222 if ( astp ) { 224 dump( translationUnit );223 printAll( translationUnit, std::cout ); 225 224 return 0; 226 225 } // if … … 243 242 244 243 if ( validp ) { 245 dump( translationUnit );244 printAll( translationUnit, std::cout ); 246 245 return 0; 247 246 } // if … … 253 252 254 253 if ( libcfap ) { 254 protop = true; 255 255 // generate the bodies of cfa library functions 256 256 LibCfa::makeLibCfa( translationUnit ); … … 258 258 259 259 if ( bresolvep ) { 260 dump( translationUnit );260 printAll( translationUnit, std::cout ); 261 261 return 0; 262 262 } // if … … 265 265 ResolvExpr::resolve( translationUnit ); 266 266 if ( exprp ) { 267 dump( translationUnit );267 printAll( translationUnit, std::cout ); 268 268 } 269 269 … … 279 279 // print tree right before code generation 280 280 if ( codegenp ) { 281 dump( translationUnit );282 return 0; 283 } // if 284 285 CodeGen::generate( translationUnit, *output, ! noprotop );281 printAll( translationUnit, std::cout ); 282 return 0; 283 } // if 284 285 CodeGen::generate( translationUnit, *output, true ); //protop ); 286 286 287 287 if ( output != &std::cout ) { … … 290 290 } catch ( SemanticError &e ) { 291 291 if ( errorp ) { 292 dump( translationUnit);292 printAll( translationUnit, std::cerr ); 293 293 } 294 294 e.print( std::cerr ); … … 315 315 } // main 316 316 317 staticvoid parse( FILE * input, LinkageSpec::Type linkage, bool shouldExit ) {317 void parse( FILE * input, LinkageSpec::Type linkage, bool shouldExit ) { 318 318 Parser::get_parser().set_linkage( linkage ); 319 319 Parser::get_parser().parse( input ); … … 325 325 } 326 326 327 static bool notPrelude( Declaration * decl ) {328 return ! LinkageSpec::isBuiltin( decl->get_linkage() );329 }330 331 static void dump( std::list< Declaration * > & translationUnit ) {332 std::list< Declaration * > decls;333 if ( noprotop ) {334 filter( translationUnit.begin(), translationUnit.end(),335 std::back_inserter( decls ), notPrelude );336 } else {337 decls = translationUnit;338 }339 340 printAll( decls, std::cout );341 }342 343 344 327 // Local Variables: // 345 328 // tab-width: 4 //
Note:
See TracChangeset
for help on using the changeset viewer.