///////////////////////////////////////////////////////////////////// // demoFiles.cpp - demonstrate grammar using semiExpressions // // // // Jim Fawcett, CSE687 - Object Oriented Design, Spring 2002 // ///////////////////////////////////////////////////////////////////// #include #include #include "semi.h" using namespace std; void main(int argc, char *argv[]) { ifstream in; if(argc == 1) { cout << "\n please enter names of files to process\n"; return; } cout << "\n Demonstrate Grammar Processing and File Manipulations " << "\n =======================================================\n"; int i; for(i=1; i 2) { //////////////////////////////////////// // we are starting to include files // so prologue is finished cout << "\n prologue length = " << (se.lines() - preProcCount - lineCount - 1) << "\n\n"; break; } } else if(se[0] == "\n") // prologue contains newlines continue; else { //////////////////////////////////////////// // we've encountered a semiexpression that // is not a preproc - remember that comments // are thrown away though their newlines are // counted - so this must be part of the code cout << "\n prologue length = " << (se.lines() - preProcCount - lineCount - 1) << "\n\n"; break; } se.display(); se.flush(); } in.close(); in.clear(); } cout << "\n\n"; }