summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-rc/ResourceScriptParser.cpp
diff options
context:
space:
mode:
authorMarek Sokolowski <mnbvmar@gmail.com>2017-08-28 21:59:54 +0000
committerMarek Sokolowski <mnbvmar@gmail.com>2017-08-28 21:59:54 +0000
commit72aa937ed8cf9a0478bc9908f80ce51e372e8ef4 (patch)
treec8a04b1e0bc5cb1987b0bfcd87a09ab6e502b04d /llvm/tools/llvm-rc/ResourceScriptParser.cpp
parentcbf969eb20c9191cafe8c18cbd7cc13da84cffba (diff)
downloadbcm5719-llvm-72aa937ed8cf9a0478bc9908f80ce51e372e8ef4.tar.gz
bcm5719-llvm-72aa937ed8cf9a0478bc9908f80ce51e372e8ef4.zip
[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
Diffstat (limited to 'llvm/tools/llvm-rc/ResourceScriptParser.cpp')
-rw-r--r--llvm/tools/llvm-rc/ResourceScriptParser.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/tools/llvm-rc/ResourceScriptParser.cpp b/llvm/tools/llvm-rc/ResourceScriptParser.cpp
index 1e9bd467c25..e4c0f2a7f7c 100644
--- a/llvm/tools/llvm-rc/ResourceScriptParser.cpp
+++ b/llvm/tools/llvm-rc/ResourceScriptParser.cpp
@@ -63,8 +63,12 @@ RCParser::ParseType RCParser::parseSingleResource() {
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 @@ RCParser::ParseType RCParser::parseLanguageResource() {
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));
OpenPOWER on IntegriCloud