From 268b327622c5fcc03cfd9132442de738f024ef7d Mon Sep 17 00:00:00 2001
From: "Prof. Ronald Moore" <ronald.moore@h-da.de>
Date: Fri, 23 Apr 2021 17:58:40 +0200
Subject: [PATCH] Updated for Summer 2021

Signed-off-by: Prof. Ronald Moore <ronald.moore@h-da.de>
---
 .../cplusplus/interpreter/Makefile            |  4 ++-
 .../cplusplus/interpreter/badTest.reference   | 27 ++++++++++++-------
 .../cplusplus/interpreter/interpreter.cpp     |  2 +-
 3 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/recursiveDescentParsers/cplusplus/interpreter/Makefile b/recursiveDescentParsers/cplusplus/interpreter/Makefile
index bd7ef7e..fe0642a 100644
--- a/recursiveDescentParsers/cplusplus/interpreter/Makefile
+++ b/recursiveDescentParsers/cplusplus/interpreter/Makefile
@@ -13,8 +13,10 @@ TESTINPUT := goodTest.input badTest.input
 CC := clang++
 
 ## Add your own CFLAGS if you find them necessary... such as -O3 or so... 
-CFLAGS :=   -g -std=c++17 -Wall 
+CFLAGS :=   -g -std=c++20 -Wall 
 
+# By the way, it should also work with -std=c++17
+# (there's nothing here that requires c++20.
 
 ## More preliminaries
 # See https://www.gnu.org/software/make/manual/html_node/Special-Targets.html
diff --git a/recursiveDescentParsers/cplusplus/interpreter/badTest.reference b/recursiveDescentParsers/cplusplus/interpreter/badTest.reference
index c2830f4..bb25339 100644
--- a/recursiveDescentParsers/cplusplus/interpreter/badTest.reference
+++ b/recursiveDescentParsers/cplusplus/interpreter/badTest.reference
@@ -1,33 +1,42 @@
 0:42?
 INTERPRETER: 42
 ERROR on line 0, column 3 : Bad Character(s) found.
-42?--^
+42?
+--^
 1:42^2
 INTERPRETER: 42
 ERROR on line 1, column 3 : Bad Character(s) found.
-42^2--^
+42^2
+--^
 1:42^2
 INTERPRETER: 2
 2:(42))
 INTERPRETER: 42
 2:(42))
 ERROR on line 2, column 5 : Expected Left Parenthesis or number
-(42))----^
+(42))
+----^
 INTERPRETER: 0
 3:((42
 ERROR on line 4, column 1 : Expected Right Parenthesis
-(42 / 0)^
+(42 / 0)
+^
 ERROR on line 4, column 3 : Expected Right Parenthesis
-(42 / 0)--^
+(42 / 0)
+--^
 ERROR on line 4, column 8 : Division by zero!
-(42 / 0)-------^
+(42 / 0)
+-------^
 INTERPRETER: 0
 5:(42 / (1-1))
 ERROR on line 5, column 12 : Division by zero!
-(42 / (1-1))-----------^
+(42 / (1-1))
+-----------^
 ERROR on line 6, column 2 : Expected Right Parenthesis
-42 +/- 3.14159-^
+42 +/- 3.14159
+-^
 ERROR on line 6, column 5 : Expected Left Parenthesis or number
-42 +/- 3.14159----^
+42 +/- 3.14159
+----^
 INTERPRETER: -3.14159
 End Of File!
diff --git a/recursiveDescentParsers/cplusplus/interpreter/interpreter.cpp b/recursiveDescentParsers/cplusplus/interpreter/interpreter.cpp
index 6753b12..8f24ace 100644
--- a/recursiveDescentParsers/cplusplus/interpreter/interpreter.cpp
+++ b/recursiveDescentParsers/cplusplus/interpreter/interpreter.cpp
@@ -114,7 +114,7 @@ static void printErrorMsg( const std::string Error )
 	std::cout << "ERROR on line " << currentLineNumber
 	          << ", column " << currentColumnNumber << " : " 
 	          << Error << std::endl;
-	std::cout << currentLine;
+	std::cout << currentLine << std::endl;
 	for ( int col = 0; col < currentColumnNumber-1; col++ )
 		std::cout << '-';
 	std::cout << '^' << std::endl;
-- 
GitLab