Skip to content

libgraphqlpeg can't parse float with fractional and exponential parts #306

Closed
@gruzdev

Description

@gruzdev

My test case:

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";
}

The error:
parse error matching tao::graphqlpeg::ascii::one<')'>" thrown in the test body.

What helps is using this rule for the float_value:
struct float_value : seq<integer_part, sor<seq<fractional_part, opt<exponent_part>>, exponent_part>>
But the original rule looks correct . Not sure what is going wrong here.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions