[llvm-rc] Add ICON and HTML parsing ability (parser, pt 2/8).

This extends the current llvm-rc parser by ICON and HTML resources.
Moreover, some tests have been slightly rewritten.

Thanks for Nico Weber for his original work in this area.

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

llvm-svn: 311939
diff --git a/llvm/tools/llvm-rc/ResourceScriptParser.cpp b/llvm/tools/llvm-rc/ResourceScriptParser.cpp
index 1e9bd46..e4c0f2a 100644
--- a/llvm/tools/llvm-rc/ResourceScriptParser.cpp
+++ b/llvm/tools/llvm-rc/ResourceScriptParser.cpp
@@ -63,8 +63,12 @@
   ParseType Result = std::unique_ptr<RCResource>();
   (void)!Result;
 
-  if (TypeToken->equalsLower("ICON"))
+  if (TypeToken->equalsLower("CURSOR"))
+    Result = parseCursorResource();
+  else if (TypeToken->equalsLower("ICON"))
     Result = parseIconResource();
+  else if (TypeToken->equalsLower("HTML"))
+    Result = parseHTMLResource();
   else
     return getExpectedError("resource type", /* IsAlreadyRead = */ true);
 
@@ -219,11 +223,21 @@
   return parseLanguageStmt();
 }
 
+RCParser::ParseType RCParser::parseCursorResource() {
+  ASSIGN_OR_RETURN(Arg, readString());
+  return make_unique<CursorResource>(*Arg);
+}
+
 RCParser::ParseType RCParser::parseIconResource() {
   ASSIGN_OR_RETURN(Arg, readString());
   return make_unique<IconResource>(*Arg);
 }
 
+RCParser::ParseType RCParser::parseHTMLResource() {
+  ASSIGN_OR_RETURN(Arg, readString());
+  return make_unique<HTMLResource>(*Arg);
+}
+
 RCParser::ParseType RCParser::parseStringTableResource() {
   ASSIGN_OR_RETURN(OptStatements, parseOptionalStatements());
   RETURN_IF_ERROR(consumeType(Kind::BlockBegin));