Skip to content

Under YAML 1.1, 3E0 should be treated as a string - #736

Open
datho7561 wants to merge 1 commit into
eemeli:v2from
datho7561:735-scientific-notation-without-decimal-1.1
Open

datho7561 wants to merge 1 commit into
eemeli:v2from
datho7561:735-scientific-notation-without-decimal-1.1

Conversation

@datho7561

Copy link
Copy Markdown
Contributor

Issue

Fixes #735

LLM Use

No LLMs were used in writing or working on the code, comments, or PR description.

Description

Adjust the regular expression used to identify float point numbers in scientific notation to require that they have a decimal point. This aligns with the YAML 1.1 spec, and results in 3E0 being treated as a string rather than a floating point number.

I've tested this in vscode-yaml, which uses the type information provided by this library to validate YAML files against a JSON schema. Before this change, 3E0 was being treated as a number for type validation under YAML 1.1, and after, it's being treated as a string.

  • This needs a test case, but I'm not quite sure how to add one

This needs a test case, but I'm not sure how to add one

Fixes eemeli#735

Signed-off-by: David Thompson <davthomp@redhat.com>
@datho7561
datho7561 marked this pull request as draft October 21, 2026 20:50
@datho7561
datho7561 marked this pull request as ready for review October 26, 2026 13:07
@datho7561

Copy link
Copy Markdown
Contributor Author

@eemeli if you think this fix is correct, feel free to take over this PR and add tests/whatever else is needed to get it merged.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant