diff options
author | Marek Sokolowski <mnbvmar@gmail.com> | 2017-09-28 23:53:25 +0000 |
---|---|---|
committer | Marek Sokolowski <mnbvmar@gmail.com> | 2017-09-28 23:53:25 +0000 |
commit | 7e89ee7fdc428900dd362703e80d4644b28058f7 (patch) | |
tree | f2561e5c799958dd702a5329e9bb9fad82f77cdd /llvm/tools/llvm-rc/ResourceScriptToken.cpp | |
parent | 919991690c32345a9e42fcf2aebe17c36f59a492 (diff) | |
download | bcm5719-llvm-7e89ee7fdc428900dd362703e80d4644b28058f7.tar.gz bcm5719-llvm-7e89ee7fdc428900dd362703e80d4644b28058f7.zip |
[llvm-rc] Add integer expressions parsing ability. [7/8]
This allows the ints to be written as integer expressions evaluating to
unsigned 16-bit/32-bit integers.
All the expressions may use the following operators: + - & | ~, and
parentheses. Minus token - can be also unary. There is no precedence of
the operators other than the unary operators binding stronger than their
binary counterparts.
Differential Revision: https://reviews.llvm.org/D37022
llvm-svn: 314477
Diffstat (limited to 'llvm/tools/llvm-rc/ResourceScriptToken.cpp')
-rw-r--r-- | llvm/tools/llvm-rc/ResourceScriptToken.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/tools/llvm-rc/ResourceScriptToken.cpp b/llvm/tools/llvm-rc/ResourceScriptToken.cpp index ba1ed5d416a..df9e3d9caab 100644 --- a/llvm/tools/llvm-rc/ResourceScriptToken.cpp +++ b/llvm/tools/llvm-rc/ResourceScriptToken.cpp @@ -60,6 +60,18 @@ StringRef RCToken::value() const { return TokenValue; } Kind RCToken::kind() const { return TokenKind; } +bool RCToken::isBinaryOp() const { + switch (TokenKind) { + case Kind::Plus: + case Kind::Minus: + case Kind::Pipe: + case Kind::Amp: + return true; + default: + return false; + } +} + static Error getStringError(const Twine &message) { return make_error<StringError>("Error parsing file: " + message, inconvertibleErrorCode()); |