Skip to content

add parser support for non-finite numbers#97

Merged
tayloraswift merged 1 commit intomasterfrom
nonfinite-numbers
Jan 19, 2026
Merged

add parser support for non-finite numbers#97
tayloraswift merged 1 commit intomasterfrom
nonfinite-numbers

Conversation

@tayloraswift
Copy link
Member

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @tayloraswift, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the JSON parser by introducing explicit support for non-finite numerical values, specifically Not-a-Number (NaN) and positive/negative Infinity. By integrating these values into the AST and implementing dedicated parsing rules, the library can now correctly interpret and represent data formats that extend standard JSON numbers, broadening its utility for various data interchange scenarios.

Highlights

  • Extended Number Support: The JSON Abstract Syntax Tree (AST) now supports non-finite numbers by introducing a new numberExtension_ case within the JSON.Node enum.
  • New NumberExtension_ Enum: A dedicated NumberExtension_ enum has been added to represent NaN (Not-a-Number) and infinity (positive and negative), providing a structured way to handle these values.
  • Parsing Rules Implemented: New parsing rules have been added to the JSONParsing module to correctly identify and parse the string representations of 'NaN', 'inf', and '-inf' into their corresponding NumberExtension_ values.
  • Typecast Error Handling: The JSON.TypecastError initializer has been updated to correctly categorize numberExtension_ values as .number when typecasting errors occur, ensuring consistent error reporting.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for parsing non-finite numbers like NaN and inf. The changes are well-structured, adding new parsing rules and integrating them into the existing system. I have a couple of suggestions regarding naming conventions and code clarity to improve maintainability. Specifically, I recommend renaming the new NumberExtension_ type and avoiding the use of self for associated values in switch statements to prevent confusion.

@tayloraswift tayloraswift merged commit 503c206 into master Jan 19, 2026
8 checks passed
@tayloraswift tayloraswift deleted the nonfinite-numbers branch January 19, 2026 20:48
tayloraswift added a commit that referenced this pull request Mar 15, 2026
add parser support for non-finite numbers
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