From c679565893f1480205eb4438cf60aca1514f5cdc Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Thu, 16 Sep 2021 18:06:46 +0200 Subject: [PATCH] Make names starting with digits use normal name parsing code --- CHANGELOG.md | 1 + components/compiler/scanner.cpp | 25 +++---------------------- components/compiler/scanner.hpp | 2 +- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b9ea47c56..73588cb749 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ Bug #6184: Command and Calm and Demoralize and Frenzy and Rally magic effects inconsistencies with vanilla Bug #6197: Infinite Casting Loop Bug #6273: Respawning NPCs rotation is inconsistent + Bug #6282: Laura craft doesn't follow the player character Bug #6289: Keyword search in dialogues expected the text to be all ASCII characters Feature #2554: Modifying an object triggers the instances table to scroll to the corresponding record Feature #2780: A way to see current OpenMW version in the console diff --git a/components/compiler/scanner.cpp b/components/compiler/scanner.cpp index cd607b2e73..1054e2e269 100644 --- a/components/compiler/scanner.cpp +++ b/components/compiler/scanner.cpp @@ -164,8 +164,6 @@ namespace Compiler std::string value; c.appendTo(value); - bool error = false; - while (get (c)) { if (c.isDigit()) @@ -174,16 +172,11 @@ namespace Compiler } else if (!c.isMinusSign() && isStringCharacter (c)) { - error = true; - c.appendTo(value); + /// workaround that allows names to begin with digits + return scanName(c, parser, cont, value); } else if (c=='.') { - if (error) - { - putback (c); - break; - } return scanFloat (value, parser, cont); } else @@ -193,17 +186,6 @@ namespace Compiler } } - if (error) - { - /// workaround that allows names to begin with digits - /// \todo disable - TokenLoc loc (mLoc); - mLoc.mLiteral.clear(); - cont = parser.parseName (value, loc, *this); - return true; -// return false; - } - TokenLoc loc (mLoc); mLoc.mLiteral.clear(); @@ -268,9 +250,8 @@ namespace Compiler nullptr }; - bool Scanner::scanName (MultiChar& c, Parser& parser, bool& cont) + bool Scanner::scanName (MultiChar& c, Parser& parser, bool& cont, std::string name) { - std::string name; c.appendTo(name); if (!scanName (name)) diff --git a/components/compiler/scanner.hpp b/components/compiler/scanner.hpp index 7901297325..8ee2672132 100644 --- a/components/compiler/scanner.hpp +++ b/components/compiler/scanner.hpp @@ -236,7 +236,7 @@ namespace Compiler bool scanFloat (const std::string& intValue, Parser& parser, bool& cont); - bool scanName (MultiChar& c, Parser& parser, bool& cont); + bool scanName (MultiChar& c, Parser& parser, bool& cont, std::string name = {}); /// \param name May contain the start of the name (one or more characters) bool scanName (std::string& name);