From 55794c3e6d9944a3062867dc0f0fd3c287719c7d Mon Sep 17 00:00:00 2001
From: "Prof. Ronald Moore" <ronald.moore@h-da.de>
Date: Fri, 23 Apr 2021 19:42:22 +0200
Subject: [PATCH] Fix for Issue#1

---
 recursiveDescentParsers/cplusplus/halfBakedCompiler/lexer.cpp | 2 +-
 recursiveDescentParsers/cplusplus/halfBakedCompiler/lexer.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/recursiveDescentParsers/cplusplus/halfBakedCompiler/lexer.cpp b/recursiveDescentParsers/cplusplus/halfBakedCompiler/lexer.cpp
index f09c571..ed60b21 100644
--- a/recursiveDescentParsers/cplusplus/halfBakedCompiler/lexer.cpp
+++ b/recursiveDescentParsers/cplusplus/halfBakedCompiler/lexer.cpp
@@ -113,7 +113,7 @@ Token gettok( ) {
 			};
 			// else if strtod found a real number (or at least a double)
 			result.first = tok_number;
-			result.second = tmpValue;  // let C++ do any converisons
+			result.second = static_cast<numberType>(tmpValue);
 			currentColumnNumber += (omega - alpha) -1;
 			// minus one because we incremented it before the switch
 	
diff --git a/recursiveDescentParsers/cplusplus/halfBakedCompiler/lexer.h b/recursiveDescentParsers/cplusplus/halfBakedCompiler/lexer.h
index 6dd7458..4c47d44 100644
--- a/recursiveDescentParsers/cplusplus/halfBakedCompiler/lexer.h
+++ b/recursiveDescentParsers/cplusplus/halfBakedCompiler/lexer.h
@@ -27,7 +27,7 @@
 namespace lex {
 	
 // Utility Types
-typedef double numberType; // feel fee to change this to something else like int or float or bigint....
+typedef double numberType; // also works with (at least) float or long
 
 // See https://en.cppreference.com/w/cpp/numeric/math/nan
 static const numberType	bad_number = std::nan( "1" ); 
-- 
GitLab