Skip to content
Snippets Groups Projects

Enrich code with comments and explanations

Closed Ghost User requested to merge (removed):master into master
5 files
+ 72
18
Compare changes
  • Side-by-side
  • Inline
Files
5
@@ -6,7 +6,10 @@
int
main (int argc, char *argv[])
{
// we build an interpreter,
// hence we return an int as the result of the expressions we evaluate
int res = 0;
driver drv;
for (int i = 1; i < argc; ++i)
if (argv[i] == std::string ("-p"))
@@ -14,9 +17,11 @@ main (int argc, char *argv[])
else if (argv[i] == std::string ("-s"))
drv.trace_scanning = true;
else if (!drv.parse (argv[i]))
// parse() returns 1 if it ran into an error
// so with !drv.parse we are here if everything was fine
std::cout << drv.result << '\n';
else
// error while parsing
res = 1;
return res;
}
Loading