Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #306 #307

Merged
merged 1 commit into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions include/graphqlservice/internal/Grammar.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ struct exponent_part : if_must<exponent_indicator, exponent_part_content>
};

// https://spec.graphql.org/October2021/#FloatValue
struct float_value
: seq<integer_part, sor<fractional_part, exponent_part, seq<fractional_part, exponent_part>>>
struct float_value : seq<integer_part, sor<seq<fractional_part, opt<exponent_part>>, exponent_part>>
{
};

Expand Down
10 changes: 10 additions & 0 deletions test/PegtlExecutableTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,14 @@ TEST(PegtlExecutableCase, ParserDepthLimitExceeded)

EXPECT_TRUE(caughtException) << "should catch a parse exception";
EXPECT_FALSE(parsedQuery) << "should not successfully parse the query";
}

TEST(PegtlExecutableCase, ParseFloatWithFractionalAndExponentialParts)
{
memory_input<> input(R"gql({ field(value: 1.1e1) })gql",
"ParseFloatWithFractionalAndExponentialParts");

const bool result = parse<executable_document>(input);

ASSERT_TRUE(result) << "we should be able to parse the doc";
}