diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-28 21:23:25 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-28 21:23:25 +0000 |
| commit | ae1a339de31cf4065777531959a11e55a2e5fa00 (patch) | |
| tree | ae204c76257fe2799a8fdc5fcb12a2523805c7c8 /ELF/ScriptLexer.cpp | |
| parent | e30c72b844bec93f6c197ea6c7c8cd0188964208 (diff) | |
Notes
Diffstat (limited to 'ELF/ScriptLexer.cpp')
| -rw-r--r-- | ELF/ScriptLexer.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/ELF/ScriptLexer.cpp b/ELF/ScriptLexer.cpp index 9f33c16f36b0e..ef5a1cff7590d 100644 --- a/ELF/ScriptLexer.cpp +++ b/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. |
