Skip to content

Commit 0939b52

Browse files
committed
refactor: simplify Result construction in ExpressionParser methods for clarity
1 parent 83e9c90 commit 0939b52

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

cucumber_cpp/library/cucumber_expression/ExpressionParser.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ namespace cucumber_cpp::library::cucumber_expression
151151
return { 0, std::nullopt };
152152

153153
auto token = tokens[parser.current];
154-
return Result(1, Node{
155-
NodeType::alternative,
156-
token.Start(),
157-
token.End(),
158-
token.Text(),
159-
});
154+
return { 1, Node{
155+
NodeType::alternative,
156+
token.Start(),
157+
token.End(),
158+
token.Text(),
159+
} };
160160
} };
161161

162162
ExpressionParser::SubParser parseAlternation = { [this](const ExpressionParser::ParserState& parser, const SubParser& subParser) -> ExpressionParser::Result
@@ -202,7 +202,7 @@ namespace cucumber_cpp::library::cucumber_expression
202202
auto subParser = SubParser{ [this, type, beginToken, endToken](ParserState parser, const SubParser& subParser) -> Result
203203
{
204204
if (!LookingAt(parser.tokens, parser.current, beginToken))
205-
return Result{ 0, std::nullopt };
205+
return { 0, std::nullopt };
206206

207207
auto subCurrent = parser.current + 1;
208208
auto [consumed, ast] = ParseTokensUntil(parser.expression, subParser.subParsers, parser.tokens, subCurrent, { endToken, TokenType::endOfLine });

0 commit comments

Comments
 (0)