}
void ScriptParser::readVersionScriptCommand() {
- if (skip("{")) {
+ if (consume("{")) {
readVersionDeclaration("");
return;
}
expect("(");
bool Orig = Config->AsNeeded;
Config->AsNeeded = true;
- while (!Error && !skip(")"))
+ while (!Error && !consume(")"))
addFile(unquote(next()));
Config->AsNeeded = Orig;
}
void ScriptParser::readExtern() {
expect("(");
- while (!Error && !skip(")"))
+ while (!Error && !consume(")"))
Config->Undefined.push_back(next());
}
void ScriptParser::readGroup() {
expect("(");
- while (!Error && !skip(")")) {
+ while (!Error && !consume(")")) {
StringRef Tok = next();
if (Tok == "AS_NEEDED")
readAsNeeded();
void ScriptParser::readPhdrs() {
expect("{");
- while (!Error && !skip("}")) {
+ while (!Error && !consume("}")) {
StringRef Tok = next();
Opt.PhdrsCommands.push_back(
{Tok, PT_NULL, false, false, UINT_MAX, nullptr});
void ScriptParser::readSections() {
Opt.HasSections = true;
expect("{");
- while (!Error && !skip("}")) {
+ while (!Error && !consume("}")) {
StringRef Tok = next();
BaseCommand *Cmd = readProvideOrAssignment(Tok, true);
if (!Cmd) {
Regex ScriptParser::readFilePatterns() {
std::vector<StringRef> V;
- while (!Error && !skip(")"))
+ while (!Error && !consume(")"))
V.push_back(next());
return compileGlobPatterns(V);
}
SortSectionPolicy ScriptParser::readSortKind() {
- if (skip("SORT") || skip("SORT_BY_NAME"))
+ if (consume("SORT") || consume("SORT_BY_NAME"))
return SortSectionPolicy::Name;
- if (skip("SORT_BY_ALIGNMENT"))
+ if (consume("SORT_BY_ALIGNMENT"))
return SortSectionPolicy::Alignment;
- if (skip("SORT_BY_INIT_PRIORITY"))
+ if (consume("SORT_BY_INIT_PRIORITY"))
return SortSectionPolicy::Priority;
- if (skip("SORT_NONE"))
+ if (consume("SORT_NONE"))
return SortSectionPolicy::None;
return SortSectionPolicy::Default;
}
std::vector<SectionPattern> Ret;
while (!Error && peek() != ")") {
Regex ExcludeFileRe;
- if (skip("EXCLUDE_FILE")) {
+ if (consume("EXCLUDE_FILE")) {
expect("(");
ExcludeFileRe = readFilePatterns();
}
ScriptParser::readInputSectionRules(StringRef FilePattern) {
auto *Cmd = new InputSectionDescription(FilePattern);
expect("(");
- while (!HasError && !skip(")")) {
+ while (!HasError && !consume(")")) {
SortSectionPolicy Outer = readSortKind();
SortSectionPolicy Inner = SortSectionPolicy::Default;
std::vector<SectionPattern> V;
expect(":");
- if (skip("AT"))
+ if (consume("AT"))
Cmd->LMAExpr = readParenExpr();
- if (skip("ALIGN"))
+ if (consume("ALIGN"))
Cmd->AlignExpr = readParenExpr();
- if (skip("SUBALIGN"))
+ if (consume("SUBALIGN"))
Cmd->SubalignExpr = readParenExpr();
// Parse constraints.
- if (skip("ONLY_IF_RO"))
+ if (consume("ONLY_IF_RO"))
Cmd->Constraint = ConstraintKind::ReadOnly;
- if (skip("ONLY_IF_RW"))
+ if (consume("ONLY_IF_RW"))
Cmd->Constraint = ConstraintKind::ReadWrite;
expect("{");
- while (!Error && !skip("}")) {
+ while (!Error && !consume("}")) {
StringRef Tok = next();
if (SymbolAssignment *Assignment = readProvideOrAssignment(Tok, false))
Cmd->Commands.emplace_back(Assignment);
}
Cmd->Phdrs = readOutputSectionPhdrs();
- if (skip("="))
+ if (consume("="))
Cmd->Filler = readOutputSectionFiller(next());
else if (peek().startswith("="))
Cmd->Filler = readOutputSectionFiller(next().drop_front());
bool IsAbsolute = false;
Expr E;
assert(Op == "=" || Op == "+=");
- if (skip("ABSOLUTE")) {
+ if (consume("ABSOLUTE")) {
E = readParenExpr();
IsAbsolute = true;
} else {
size_t VersionId = Config->VersionDefinitions.size() + 2;
Config->VersionDefinitions.push_back({VerStr, VersionId});
- if (skip("global:") || peek() != "local:")
+ if (consume("global:") || peek() != "local:")
readGlobal(VerStr);
- if (skip("local:"))
+ if (consume("local:"))
readLocal();
expect("}");
Globals = &Config->VersionDefinitions.back().Globals;
for (;;) {
- if (skip("extern"))
+ if (consume("extern"))
readExtern(Globals);
StringRef Cur = peek();