View Issue Details

IDProjectCategoryView StatusLast Update
0004115The Dark ModCodingpublic17.03.2016 11:21
ReporterVanishedOne Assigned ToSteveL  
PrioritynormalSeveritynormalReproducibilityalways
Status resolvedResolutionfixed 
Product VersionTDM 2.03 
Target VersionTDM 2.04Fixed in VersionTDM 2.04 
Summary0004115: Mixing single and double quotes in a readable can break it
DescriptionSee test case here: http://forums.thedarkmod.com/topic/16938-dunedain19s-stuff/?p=367566 The readable fails to display in-game and produces console errors.
TagsNo tags attached.

Activities

SteveL

SteveL

11.03.2015 00:24

reporter   ~0007455

Last edited: 18.03.2015 00:04

The problem is in idDeclFile::LoadAndParse

The original doom3 engine lacked 3 types of decl that TDM supports. One of the three is the xdata decl.

All decls are loaded by idLexer, which is used twice: once during game startup by the generic decl file loader used for all decl types, which loads the raw text of all definitions in all decl files, and again to parse the needed ones while a map is loading. By default, the generic decl loading procedure sets idLexer to disallow escape characters (e.g. \") in strings while loading a file. When it comes to parsing the xdata decls, an xdata-specific parser is used which *does* allow escape characters in strings.

Whoever tested the xdata procedure evidently didn't try mixing single quotes with escaped double quotes in a single string. Just using escaped double quotes doesn't cause a problem, because the generic loader isn't trying to capture the string content, it's only looking for the closing brace } at the end of the xdata definition, trying to find the first one that's *not* embedded in a string. When it sees a string like "\n\n\"Im a bug test case\"" (no single quote in there), it interprets
   "\n\n\"
as a string, then
   Im a bug test case\
as a series of keywords which it doesn't try to parse, then
   ""
as an empty string.

It chokes on "\n\n\"I'm a bug test case\"" (with the single quote) because the single quote occurs outside of what it thinks is the string, so it interpets it as the start of a new single quoted string which isn't closed before the end of the line.

Adding an extra single quote to balance it, e.g. "\n\n\"I'm a b'ug test case\"" makes it work ok again.

SteveL

SteveL

11.03.2015 01:07

reporter   ~0007456

Fortunately the generic loader is aware of the individual decl type, including xdata, so we can allow escape chars in strings for xdata decls without changing the loading of any other decl type.
SteveL

SteveL

11.03.2015 01:56

reporter   ~0007457

At rev 6476: DeclManager.cpp

Issue History

Date Modified Username Field Change
10.03.2015 16:01 VanishedOne New Issue
10.03.2015 20:50 SteveL Assigned To => SteveL
10.03.2015 20:50 SteveL Status new => assigned
11.03.2015 00:24 SteveL Note Added: 0007455
11.03.2015 00:25 SteveL Note Edited: 0007455
11.03.2015 01:07 SteveL Note Added: 0007456
11.03.2015 01:56 SteveL Note Added: 0007457
11.03.2015 01:56 SteveL Status assigned => resolved
11.03.2015 01:56 SteveL Fixed in Version => TDM 2.04
11.03.2015 01:56 SteveL Resolution open => fixed
18.03.2015 00:04 SteveL Note Edited: 0007455
17.03.2016 11:21 SteveL Target Version => TDM 2.04