Skip to content

Commit 5db9361

Browse files
committed
[Bug] Generate $c to a _parenthesize_ expression to safely concatenate member reference with '.' right after
1 parent 5436d83 commit 5db9361

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

ParserGen/Output.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ void FC_Output::addParserMap(C_RenderReduction &rr, const std::string &className
11921192
{
11931193
std::string c = ARG_NAME_PARSER ".userData()";
11941194
if (hasContext())
1195-
c = fmt::format("*static_cast<{}::C_Context*>({})", className, c);
1195+
c = "(*static_cast<" + className + "::C_Context*>(" + c + "))";
11961196

11971197
rr.addMap("c", c, 1<<argInd);
11981198
}

example/BisonGLR/Parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ void C_ParserPolicy::getReduceInfo(size_t id, C_ReduceInfo &info) const
554554
void C_ParserPolicy::onError(bux::GLR::C_Parser &_paRSeR_, const bux::C_SourcePos &pos, std::string_view message) const
555555
{
556556
// Grammar %ON_ERROR begins
557-
*static_cast<::C_Parser::C_Context*>(_paRSeR_.userData()) <<"COL#" <<pos.m_Col <<": " <<message <<'\n';
557+
(*static_cast<::C_Parser::C_Context*>(_paRSeR_.userData())) <<"COL#" <<pos.m_Col <<": " <<message <<'\n';
558558
// Grammar %ON_ERROR ends
559559
}
560560

0 commit comments

Comments
 (0)