Skip to content

Commit

Permalink
fix: #306
Browse files Browse the repository at this point in the history
  • Loading branch information
wravery committed Aug 15, 2024
1 parent aa02e66 commit 29f729b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
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";
}

0 comments on commit 29f729b

Please sign in to comment.