1 //===- ScriptLexer.h --------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLD_ELF_SCRIPT_LEXER_H
10 #define LLD_ELF_SCRIPT_LEXER_H
12 #include "lld/Common/LLVM.h"
13 #include "llvm/ADT/StringRef.h"
14 #include "llvm/Support/MemoryBuffer.h"
23 explicit ScriptLexer(MemoryBufferRef mb);
25 void setError(const Twine &msg);
26 void tokenize(MemoryBufferRef mb);
27 static StringRef skipSpace(StringRef s);
33 bool consume(StringRef tok);
34 void expect(StringRef expect);
35 bool consumeLabel(StringRef tok);
36 std::string getCurrentLocation();
38 std::vector<MemoryBufferRef> mbs;
39 std::vector<StringRef> tokens;
44 void maybeSplitExpr();
46 size_t getLineNumber();
47 size_t getColumnNumber();
49 MemoryBufferRef getCurrentMB();