File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -97,8 +97,13 @@ auto main(int argc, char *argv[]) -> int {
9797 }
9898
9999 /* Check for symbol table errors and exit if errors exist */
100- std::vector<std::string> errors = lexer.GetUndeclaredSymbolErrors ();
101- errors.insert (errors.end (), lexer.GetDuplicateSymbolErrors ().begin (), lexer.GetDuplicateSymbolErrors ().end ());
100+ std::vector<std::string> errors;
101+ for (const auto &symbol : lexer.GetUndeclaredSymbolErrors ()) {
102+ errors.push_back (" undeclared symbol: " + symbol);
103+ }
104+ for (const auto &symbol : lexer.GetDuplicateSymbolErrors ()) {
105+ errors.push_back (" duplicate symbol: " + symbol);
106+ }
102107 if (!errors.empty ()) {
103108 std::cout << " jucc: " ;
104109 for (auto &e : errors) {
@@ -127,7 +132,6 @@ auto main(int argc, char *argv[]) -> int {
127132 }
128133
129134 /* If there are no parser errors then proceed to generate the parse tree */
130-
131135 parser.BuildParseTree ();
132136 if (!parser.WriteParseTree (output_file)) {
133137 std::cout << " jucc: could not write parse tree to " + output_file + ' \n ' ;
You can’t perform that action at this time.
0 commit comments