summaryrefslogtreecommitdiff
path: root/lld/ELF/ScriptLexer.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2017-12-26 10:13:10 +0000
committerRui Ueyama <ruiu@google.com>2017-12-26 10:13:10 +0000
commitcffe939edd013be1f206a97ffd1f7bcb4589dfae (patch)
treeb88088c5979c64d508b4daae4491e314c40d3d9d /lld/ELF/ScriptLexer.cpp
parenta214978c2c3e41e0616963e3bcf32de16676a888 (diff)
Simplify script lexer.
Differential Revision: https://reviews.llvm.org/D41577
Diffstat (limited to 'lld/ELF/ScriptLexer.cpp')
-rw-r--r--lld/ELF/ScriptLexer.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lld/ELF/ScriptLexer.cpp b/lld/ELF/ScriptLexer.cpp
index 9f33c16f36b..ef5a1cff759 100644
--- a/lld/ELF/ScriptLexer.cpp
+++ b/lld/ELF/ScriptLexer.cpp
@@ -115,11 +115,19 @@ void ScriptLexer::tokenize(MemoryBufferRef MB) {
continue;
}
+ // ">foo" is parsed to ">" and "foo", but ">>" is parsed to ">>".
+ if (S.startswith("<<") || S.startswith("<=") || S.startswith(">>") ||
+ S.startswith(">=")) {
+ Vec.push_back(S.substr(0, 2));
+ S = S.substr(2);
+ continue;
+ }
+
// Unquoted token. This is more relaxed than tokens in C-like language,
// so that you can write "file-name.cpp" as one bare token, for example.
size_t Pos = S.find_first_not_of(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
- "0123456789_.$/\\~=+[]*?-!<>^:");
+ "0123456789_.$/\\~=+[]*?-!^:");
// A character that cannot start a word (which is usually a
// punctuation) forms a single character token.