From 01500e979a09cb4d2012a20a207cab85e367fbc2 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Thu, 5 Apr 2012 14:27:39 +0200 Subject: [PATCH] another fix for optional arguments --- components/compiler/parser.cpp | 11 +++++++++++ components/compiler/stringparser.cpp | 5 ----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/components/compiler/parser.cpp b/components/compiler/parser.cpp index 73cadfeba..90368eee0 100644 --- a/components/compiler/parser.cpp +++ b/components/compiler/parser.cpp @@ -7,6 +7,7 @@ #include "errorhandler.hpp" #include "exception.hpp" +#include "scanner.hpp" namespace Compiler { @@ -81,6 +82,8 @@ namespace Compiler { if (!(mOptional && mEmpty)) reportSeriousError ("Unexpected numeric value", loc); + else + scanner.putbackInt (value, loc); return false; } @@ -94,6 +97,8 @@ namespace Compiler { if (!(mOptional && mEmpty)) reportSeriousError ("Unexpected floating point value", loc); + else + scanner.putbackFloat (value, loc); return false; } @@ -108,6 +113,8 @@ namespace Compiler { if (!(mOptional && mEmpty)) reportSeriousError ("Unexpected name", loc); + else + scanner.putbackName (name, loc); return false; } @@ -121,6 +128,8 @@ namespace Compiler { if (!(mOptional && mEmpty)) reportSeriousError ("Unexpected keyword", loc); + else + scanner.putbackKeyword (keyword, loc); return false; } @@ -134,6 +143,8 @@ namespace Compiler { if (!(mOptional && mEmpty)) reportSeriousError ("Unexpected special token", loc); + else + scanner.putbackSpecial (code, loc); return false; } diff --git a/components/compiler/stringparser.cpp b/components/compiler/stringparser.cpp index fe7bd30b9..396a88c78 100644 --- a/components/compiler/stringparser.cpp +++ b/components/compiler/stringparser.cpp @@ -39,11 +39,6 @@ namespace Compiler mState = CommaState; return true; } - else if (code==Scanner::S_newline && mState==StartState) - { - scanner.putbackSpecial (code, loc); - return false; - } return Parser::parseSpecial (code, loc, scanner); }