src/Main.cc

changeset 105
6dbac3305614
parent 88
5def6ff8b466
child 106
9174be9ac686
equal deleted inserted replaced
104:62da929f7814 105:6dbac3305614
28 28
29 #include "Main.h" 29 #include "Main.h"
30 #include "Events.h" 30 #include "Events.h"
31 #include "Commands.h" 31 #include "Commands.h"
32 #include "StringTable.h" 32 #include "StringTable.h"
33 #include "Variables.h"
34 #include "DataBuffer.h" 33 #include "DataBuffer.h"
35 #include "Parser.h" 34 #include "Parser.h"
36 #include "Lexer.h" 35 #include "Lexer.h"
37 #include "GitInformation.h" 36 #include "GitInformation.h"
38 37
96 Print ("Parsing script...\n"); 95 Print ("Parsing script...\n");
97 parser->ParseBotscript (argv[1]); 96 parser->ParseBotscript (argv[1]);
98 Print ("Script parsed successfully.\n"); 97 Print ("Script parsed successfully.\n");
99 98
100 // Parse done, print statistics and write to file 99 // Parse done, print statistics and write to file
101 int globalcount = g_GlobalVariables.Size(); 100 int globalcount = parser->GetScope (0).globalVariables.Size();
102 int stringcount = CountStringsInTable(); 101 int stringcount = CountStringsInTable();
103 Print ("%1 / %2 strings written\n", stringcount, gMaxStringlistSize); 102 Print ("%1 / %2 strings\n", stringcount, gMaxStringlistSize);
104 Print ("%1 / %2 global variables\n", globalcount, gMaxGlobalVars); 103 Print ("%1 / %2 global variable indices\n", globalcount, gMaxGlobalVars);
105 Print ("%1 / %2 events\n", parser->GetNumEvents(), gMaxEvents); 104 Print ("%1 / %2 events\n", parser->GetNumEvents(), gMaxEvents);
106 Print ("%1 state%s1\n", parser->GetNumStates()); 105 Print ("%1 state%s1\n", parser->GetNumStates());
107 106
108 parser->WriteToFile (outfile); 107 parser->WriteToFile (outfile);
109
110 // Clear out the junk
111 delete parser; 108 delete parser;
112 109 return 0;
113 // Done!
114 exit (0);
115 } 110 }
116 catch (ScriptError& e) 111 catch (ScriptError& e)
117 { 112 {
118 PrintTo (stderr, "error: %1\n", e.what()); 113 PrintTo (stderr, "error: %1\n", e.what());
114 return 1;
119 } 115 }
120 } 116 }
121 117
122 // ============================================================================ 118 // ============================================================================
123 // 119 //

mercurial