Skip to content

Conversation

@stan-leetasi
Copy link
Contributor

@stan-leetasi stan-leetasi commented May 18, 2025

This PR extends the JSON library's functionality by enabling it to print decimal numbers. Numeric values are now printed in a form that matches their type: whole numbers are printed without a decimal point, and decimal numbers retain their fractional part. The Value enum value was split into Integer and Float. The value field was also replaced, with intValue and floatValue fields. Tests for this new functionality were also added to json_test.cpp

@fruffy fruffy added the core Topics concerning the core segments of the compiler (frontend, midend, parser) label May 18, 2025
@fruffy fruffy requested a review from ChrisDodd May 18, 2025 18:19
Copy link
Contributor

@ChrisDodd ChrisDodd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any backend that needs floating point values in json?

@stan-leetasi
Copy link
Contributor Author

Is there any backend that needs floating point values in json?

The decimal point support is utilized by a new extension to the frontend, which collects and exports code metrics: #5250. Some metric values are floats, so I decided to extend the JSON library to support this functionality.

@stan-leetasi
Copy link
Contributor Author

Are there any other changes that need to be made, or can this PR be merged?

@fruffy fruffy added this pull request to the merge queue May 23, 2025
@fruffy
Copy link
Collaborator

fruffy commented May 23, 2025

Are there any other changes that need to be made, or can this PR be merged?

Seems like no one else has concerns so we can merge it.

Merged via the queue into p4lang:main with commit 6f6048a May 23, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Topics concerning the core segments of the compiler (frontend, midend, parser)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants