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/ResourceScriptParser.h | |
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/ResourceScriptParser.h')
-rw-r--r-- | llvm/tools/llvm-rc/ResourceScriptParser.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/tools/llvm-rc/ResourceScriptParser.h b/llvm/tools/llvm-rc/ResourceScriptParser.h index 132106f0c4e..56042f79d5f 100644 --- a/llvm/tools/llvm-rc/ResourceScriptParser.h +++ b/llvm/tools/llvm-rc/ResourceScriptParser.h @@ -77,12 +77,18 @@ private: // The following methods try to read a single token, check if it has the // correct type and then parse it. + // Each integer can be written as an arithmetic expression producing an + // unsigned 32-bit integer. Expected<uint32_t> readInt(); // Parse an integer. Expected<StringRef> readString(); // Parse a string. Expected<StringRef> readIdentifier(); // Parse an identifier. Expected<IntOrString> readIntOrString(); // Parse an integer or a string. Expected<IntOrString> readTypeOrName(); // Parse an integer or an identifier. + // Helper integer expression parsing methods. + Expected<uint32_t> parseIntExpr1(); + Expected<uint32_t> parseIntExpr2(); + // Advance the state by one, discarding the current token. // If the discarded token had an incorrect type, fail. Error consumeType(Kind TokenKind); |