static void Main(string[] args) { Console.Write("\n Testing semiExp Operations"); CSemiExp test = new CSemiExp(); test.returnNewLines = true; test.displayNewLines = true; /* If the package is run as stand alone application * then add the default values for the member variables */ try { string testFile = "Parser.cs"; if (!test.open(testFile)) { Console.Write("\n Can't open file {0}", testFile); } while (test.getSemi()) { test.display(); } test.initialize(); test.insert(0, "this"); test.insert(1, "is"); test.display(); Console.Write("\n removing first token:"); test.remove(0); test.display(); Console.Write("\n removing token \"test\":"); test.remove("test"); test.display(); Console.Write("\n making copy of semiExpression:"); CSemiExp copy = test.clone(); copy.display(); if (args.Length == 0) { Console.Write("\n Please enter name of file to analyze\n\n"); return; } CSemiExp semi = new CSemiExp(); semi.returnNewLines = true; if (!semi.open(args[0])) { Console.Write("\n can't open file {0}\n\n", args[0]); return; } Console.Write("\n Analyzing file {0}", args[0]); while (semi.getSemi()) { semi.display(); } semi.close(); Console.ReadLine(); } catch { Console.WriteLine("Error in semi module"); } }
//----< Test Stub >-------------------------------------------------- #if (TEST_PARSER) static void Main(string[] args) { Console.Write("\n Demonstrating Parser"); Console.Write("\n ======================\n"); ShowCommandLine(args); List <string> files = TestParser.ProcessCommandline(args); foreach (object file in files) { Console.Write("\n Processing file {0}\n", file as string); CSsemi.CSemiExp semi = new CSsemi.CSemiExp(); semi.displayNewLines = false; if (!semi.open(file as string)) { Console.Write("\n Can't open {0}\n\n", args[0]); return; } Console.Write("\n Type and Function Analysis"); Console.Write("\n ----------------------------\n"); BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi); Parser parser = builder.build(); try { while (semi.getSemi()) { parser.parse(semi); } Console.Write("\n\n locations table contains:"); } catch (Exception ex) { Console.Write("\n\n {0}\n", ex.Message); } Repository rep = Repository.getInstance(); List <Elem> table = rep.locations; foreach (Elem e in table) { Console.Write("\n {0,10}, {1,25}, {2,5}, {3,5}", e.type, e.name, e.begin, e.end); } Console.WriteLine(); Console.Write("\n\n That's all folks!\n\n"); semi.close(); Console.ReadLine(); } }
// get back the Tyeptable for other program using public TypeTable getTypeTable(string[] args) { TestParser tp = new TestParser(); TypeTable tt = new TypeTable(); string ns = ""; foreach (string file in args) { CSsemi.CSemiExp semi = new CSsemi.CSemiExp(); semi.displayNewLines = false; if (!semi.open(file as string)) { Console.Write("\n Can't open {0}\n\n", args[0]); } BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi); Parser parser = builder.build(); try { while (semi.getSemi()) { parser.parse(semi); } } catch (Exception ex) { Console.Write("\n\n {0}\n", ex.Message); } Repository rep = Repository.getInstance(); List <Elem> table = rep.locations; foreach (Elem e in table) { if (e.type == "namespace") { ns = e.name; } if (e.type == "interface" || e.type == "class" || e.type == "struct" || e.type == "enum" || e.type == "delegate") { tt.add(e.name, Path.GetFileName(file), ns); } } semi.close(); } return(tt); }
static void Main(string[] args) { Console.Write("\n Testing semiExp Operations"); Console.Write("\n ============================\n"); CSemiExp test = new CSemiExp(); test.returnNewLines = true; test.displayNewLines = true; string testFile = "Parser.cs"; if (!test.open(testFile)) { Console.Write("\n Can't open file {0}", testFile); } while (test.getSemi()) { test.display(); } test.initialize(); test.insert(0, "this"); test.insert(1, "is"); test.insert(2, "a"); test.insert(3, "test"); test.display(); Console.Write("\n 2nd token = \"{0}\"\n", test[1]); Console.Write("\n removing first token:"); test.remove(0); test.display(); Console.Write("\n"); Console.Write("\n removing token \"test\":"); test.remove("test"); test.display(); Console.Write("\n"); }
//----< Test Stub >-------------------------------------------------- #if(TEST_PARSER) static void Main(string[] args) { Console.Write("\n Demonstrating Parser"); Console.Write("\n ======================\n"); ShowCommandLine(args); List<string> files = TestParser.ProcessCommandline(args); foreach (object file in files) { Console.Write("\n Processing file {0}\n", file as string); CSsemi.CSemiExp semi = new CSsemi.CSemiExp(); semi.displayNewLines = false; if (!semi.open(file as string)) { Console.Write("\n Can't open {0}\n\n", args[0]); return; } Console.Write("\n Type and Function Analysis"); Console.Write("\n ----------------------------\n"); BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi); Parser parser = builder.build(); try { while (semi.getSemi()) parser.parse(semi); Console.Write("\n\n locations table contains:"); } catch (Exception ex) { Console.Write("\n\n {0}\n", ex.Message); } Repository rep = Repository.getInstance(); List<Elem> table = rep.locations; foreach (Elem e in table) { Console.Write("\n {0,10}, {1,25}, {2,5}, {3,5}", e.type, e.name, e.begin, e.end); } Console.WriteLine(); Console.Write("\n\n That's all folks!\n\n"); semi.close(); Console.ReadLine(); } }
static void Main(string[] args) { Console.Write("\n Testing semiExp Operations"); Console.Write("\n ============================\n"); CSemiExp test = new CSemiExp(); test.returnNewLines = true; test.displayNewLines = true; string testFile = "../../testSemi.txt"; if (!test.open(testFile)) { Console.Write("\n Can't open file {0}", testFile); } while (test.getSemi()) { test.display(); } test.initialize(); test.insert(0, "this"); test.insert(1, "is"); test.insert(2, "a"); test.insert(3, "test"); test.display(); Console.Write("\n 2nd token = \"{0}\"\n", test[1]); Console.Write("\n removing first token:"); test.remove(0); test.display(); Console.Write("\n"); Console.Write("\n removing token \"test\":"); test.remove("test"); test.display(); Console.Write("\n"); Console.Write("\n making copy of semiExpression:"); CSemiExp copy = test.clone(); copy.display(); Console.Write("\n"); if (args.Length == 0) { Console.Write("\n Please enter name of file to analyze\n\n"); return; } CSemiExp semi = new CSemiExp(); semi.returnNewLines = true; if (!semi.open(args[0])) { Console.Write("\n can't open file {0}\n\n", args[0]); return; } Console.Write("\n Analyzing file {0}", args[0]); Console.Write("\n ----------------------------------\n"); while (semi.getSemi()) { semi.display(); } semi.close(); }
static void Main(string[] args) { Console.Write("\n Testing semiExp Operations"); Console.Write("\n ============================\n"); CSemiExp test = new CSemiExp(); test.returnNewLines = true; test.displayNewLines = true; string testFile = "../../testSemi.txt"; if(!test.open(testFile)) Console.Write("\n Can't open file {0}",testFile); while(test.getSemi()) test.display(); test.initialize(); test.insert(0,"this"); test.insert(1,"is"); test.insert(2,"a"); test.insert(3,"test"); test.display(); Console.Write("\n 2nd token = \"{0}\"\n",test[1]); Console.Write("\n removing first token:"); test.remove(0); test.display(); Console.Write("\n"); Console.Write("\n removing token \"test\":"); test.remove("test"); test.display(); Console.Write("\n"); Console.Write("\n making copy of semiExpression:"); CSemiExp copy = test.clone(); copy.display(); Console.Write("\n"); if(args.Length == 0) { Console.Write("\n Please enter name of file to analyze\n\n"); return; } CSemiExp semi = new CSemiExp(); semi.returnNewLines = true; if(!semi.open(args[0])) { Console.Write("\n can't open file {0}\n\n",args[0]); return; } Console.Write("\n Analyzing file {0}",args[0]); Console.Write("\n ----------------------------------\n"); while(semi.getSemi()) semi.display(); semi.close(); }
public void show_result(string[] args) { Console.WriteLine("below is the all processing files : "); Console.WriteLine("\n"); foreach (var csfile in args) { Console.WriteLine(csfile); } Console.Write("\n ======================\n"); TestParser tp = new TestParser(); foreach (string file in args) { Console.Write("\n Processing file {0}\n", System.IO.Path.GetFileName(file)); CSsemi.CSemiExp semi = new CSsemi.CSemiExp(); semi.displayNewLines = false; if (!semi.open(file as string)) { Console.Write("\n Can't open {0}\n\n", args[0]); } Console.Write("\n Type and Function Analysis"); Console.Write("\n ----------------------------"); BuildCodeAnalyzer builder = new BuildCodeAnalyzer(semi); Parser parser = builder.build(); try { while (semi.getSemi()) { parser.parse(semi); } Console.Write("\n locations table contains:"); } catch (Exception ex) { Console.Write("\n\n {0}\n", ex.Message); } Repository rep = Repository.getInstance(); List <Elem> table = rep.locations; Console.Write( "\n {0,10}, {1,25}, {2,5}, {3,5}, {4,5}, {5,5}, {6,5}, {7,5}", "category", "name", "bLine", "eLine", "bScop", "eScop", "size", "cmplx" ); Console.Write( "\n {0,10}, {1,25}, {2,5}, {3,5}, {4,5}, {5,5}, {6,5}, {7,5}", "--------", "----", "-----", "-----", "-----", "-----", "----", "-----" ); foreach (Elem e in table) { if (e.type == "class" || e.type == "struct") { Console.Write("\n"); } Console.Write( "\n {0,10}, {1,25}, {2,5}, {3,5}, {4,5}, {5,5}, {6,5}, {7,5}", e.type, e.name, e.beginLine, e.endLine, e.beginScopeCount, e.endScopeCount + 1, e.endLine - e.beginLine + 1, e.endScopeCount - e.beginScopeCount + 1 ); } Console.Write("\n"); semi.close(); } }
static void Main(string[] args) { Console.Write("\n Testing semiExp Operations"); Console.Write("\n ============================\n"); CSemiExp test = new CSemiExp(); test.returnNewLines = true; test.displayNewLines = true; string testFile = "Parser.cs"; if (!test.open(testFile)) Console.Write("\n Can't open file {0}", testFile); while (test.getSemi()) test.display(); test.initialize(); test.insert(0, "this"); test.insert(1, "is"); test.insert(2, "a"); test.insert(3, "test"); test.display(); Console.Write("\n 2nd token = \"{0}\"\n", test[1]); Console.Write("\n removing first token:"); test.remove(0); test.display(); Console.Write("\n"); Console.Write("\n removing token \"test\":"); test.remove("test"); test.display(); Console.Write("\n"); }