Code format

This commit is contained in:
yhirose 2021-01-15 23:37:27 -05:00
parent 4540874e7e
commit 6171d3bf6e

View File

@ -2922,7 +2922,8 @@ private:
g["Expression"] <= seq(g["Sequence"], zom(seq(g["SLASH"], g["Sequence"]))); g["Expression"] <= seq(g["Sequence"], zom(seq(g["SLASH"], g["Sequence"])));
g["Sequence"] <= zom(g["Prefix"]); g["Sequence"] <= zom(g["Prefix"]);
g["Prefix"] <= seq(opt(cho(g["AND"], g["NOT"])), g["SuffixWithLabel"]); g["Prefix"] <= seq(opt(cho(g["AND"], g["NOT"])), g["SuffixWithLabel"]);
g["SuffixWithLabel"] <= seq(g["Suffix"], opt(seq(g["HAT"], g["Identifier"]))); g["SuffixWithLabel"] <=
seq(g["Suffix"], opt(seq(g["HAT"], g["Identifier"])));
g["Suffix"] <= seq(g["Primary"], opt(g["Loop"])); g["Suffix"] <= seq(g["Primary"], opt(g["Loop"]));
g["Loop"] <= cho(g["QUESTION"], g["STAR"], g["PLUS"], g["Repetition"]); g["Loop"] <= cho(g["QUESTION"], g["STAR"], g["PLUS"], g["Repetition"]);
g["Primary"] <= g["Primary"] <=
@ -3033,10 +3034,7 @@ private:
// Instruction grammars // Instruction grammars
g["Instruction"] <= g["Instruction"] <=
seq(g["BeginBlacket"], seq(g["BeginBlacket"],
cho( cho(cho(g["PrecedenceClimbing"]), cho(g["ErrorMessage"])),
cho(g["PrecedenceClimbing"]),
cho(g["ErrorMessage"])
),
g["EndBlacket"]); g["EndBlacket"]);
~g["SpacesZom"] <= zom(g["Space"]); ~g["SpacesZom"] <= zom(g["Space"]);
@ -3057,9 +3055,8 @@ private:
g["PrecedenceAssoc"] <= cls("LR"); g["PrecedenceAssoc"] <= cls("LR");
// Error message instruction // Error message instruction
g["ErrorMessage"] <= seq(lit("message"), g["SpacesOom"], g["ErrorMessage"] <=
g["LiteralD"], seq(lit("message"), g["SpacesOom"], g["LiteralD"], g["SpacesZom"]);
g["SpacesZom"]);
// Set definition names // Set definition names
for (auto &x : g) { for (auto &x : g) {
@ -3164,7 +3161,8 @@ private:
auto &data = *std::any_cast<Data *>(dt); auto &data = *std::any_cast<Data *>(dt);
const auto &ident = std::any_cast<std::string>(vs[1]); const auto &ident = std::any_cast<std::string>(vs[1]);
auto label = ref(*data.grammar, ident, vs.sv().data(), false, {}); auto label = ref(*data.grammar, ident, vs.sv().data(), false, {});
auto recovery = rec(ref(*data.grammar, RECOVER_DEFINITION_NAME, vs.sv().data(), true, {label})); auto recovery = rec(ref(*data.grammar, RECOVER_DEFINITION_NAME,
vs.sv().data(), true, {label}));
return cho(ope, recovery); return cho(ope, recovery);
} }
}; };
@ -3373,7 +3371,6 @@ private:
g["PrecedenceOpe"] = [](const SemanticValues &vs) { return vs.token(); }; g["PrecedenceOpe"] = [](const SemanticValues &vs) { return vs.token(); };
g["PrecedenceAssoc"] = [](const SemanticValues &vs) { return vs.token(); }; g["PrecedenceAssoc"] = [](const SemanticValues &vs) { return vs.token(); };
g["ErrorMessage"] = [](const SemanticValues &vs) { g["ErrorMessage"] = [](const SemanticValues &vs) {
Instruction instruction; Instruction instruction;
instruction.type = "message"; instruction.type = "message";