OSDN Git Service

[llvm-rc] Allow optional commas between the string table index and value
authorMartin Storsjo <martin@martin.st>
Mon, 7 May 2018 20:27:28 +0000 (20:27 +0000)
committerMartin Storsjo <martin@martin.st>
Mon, 7 May 2018 20:27:28 +0000 (20:27 +0000)
This form is even used in one of the examples at
https://msdn.microsoft.com/en-us/library/windows/desktop/aa381050(v=vs.85).aspx.

Differential Revision: https://reviews.llvm.org/D46508

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331669 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-rc/Inputs/tag-stringtable-basic.rc
tools/llvm-rc/ResourceScriptParser.cpp

index 9847dab..afda2f3 100644 (file)
@@ -4,9 +4,10 @@ CHARACTERISTICS 0x32 {
   0 "a"
 }
 
+// Commas are optional, so we make sure to test both cases.
 STRINGTABLE {
-  1 "b"
-  16 "bb"
+  1, "b"
+  16, "bb"
 }
 
 STRINGTABLE
index 14fe4b4..d8398b7 100644 (file)
@@ -573,6 +573,7 @@ RCParser::ParseType RCParser::parseStringTableResource() {
     // Some examples in documentation suggest that there might be a comma in
     // between, however we strictly adhere to the single statement definition.
     ASSIGN_OR_RETURN(IDResult, readInt());
+    consumeOptionalType(Kind::Comma);
     ASSIGN_OR_RETURN(StrResult, readString());
     Table->addString(*IDResult, *StrResult);
   }