From 166d757a196f8ab56992821934cf71f7f6496942 Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Wed, 16 Jan 2019 00:08:42 +0300 Subject: [PATCH] Allow stray special characters before a begin statement --- CHANGELOG.md | 1 + components/compiler/fileparser.cpp | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa5a91a9d..44e6aa3c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ Bug #4775: Slowfall effect resets player jumping flag Bug #4778: Interiors of Illusion puzzle in Sotha Sil Expanded mod is broken Bug #4800: Standing collisions are not updated immediately when an object is teleported without a cell change + Bug #4803: Stray special characters before begin statement break script compilation Feature #2229: Improve pathfinding AI Feature #3442: Default values for fallbacks from ini file Feature #3610: Option to invert X axis diff --git a/components/compiler/fileparser.cpp b/components/compiler/fileparser.cpp index c9e205b8a..8b2f1fe08 100644 --- a/components/compiler/fileparser.cpp +++ b/components/compiler/fileparser.cpp @@ -94,14 +94,16 @@ namespace Compiler bool FileParser::parseSpecial (int code, const TokenLoc& loc, Scanner& scanner) { - if (code==Scanner::S_newline) + // Ignore any junk special characters + if (mState == BeginState) { - if (mState==BeginState) - { - // ignore empty lines - return true; - } + if (code != Scanner::S_newline) + reportWarning ("Ignoring stray special character before begin statement", loc); + return true; + } + if (code==Scanner::S_newline) + { if (mState==BeginCompleteState) { // parse the script body