Skip to content

Conversation

@AryaHassanli
Copy link
Contributor

@AryaHassanli AryaHassanli commented Nov 17, 2025

This PR adds "" as a possible value for empty limit/default/fallbacks.
Fixes: #23

parser.go is a generated file. The diff is huge probably due to the version change of pigeon. The functionality remained the same except for the intended fix (tested manually by generating v1.5 files).

Output example:
image

@AryaHassanli AryaHassanli requested a review from a team as a code owner November 17, 2025 20:08
@gemini-code-assist
Copy link

Summary of Changes

Hello @AryaHassanli, 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 introduces a minor yet significant enhancement to the system's parsing capabilities by allowing an empty string literal to be interpreted as an 'empty' limit. This modification broadens the acceptable input formats for defining empty constraints, making the system more adaptable to diverse data representations and improving its robustness when handling configuration or input values.

Highlights

  • Grammar Enhancement: The parsing grammar for 'EmptyLimit' has been updated to recognize an empty string literal ("") as a valid representation for an empty limit.
  • Improved Flexibility: This change provides more flexibility in how empty limits, defaults, or fallbacks can be specified, aligning with common programming practices.
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 "" as a syntax for an empty limit. The change in the grammar appears correct. However, I've noticed a lack of tests for EmptyLimit. I've added a comment suggesting the addition of test cases for all supported syntaxes of EmptyLimit to ensure correctness and prevent future regressions.

}

EmptyLimit <- ("empty" / "[]") {
EmptyLimit <- ("empty" / "[]" / "\"\"") {

Choose a reason for hiding this comment

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

high

While this change correctly adds "" as a syntax for EmptyLimit, I've noticed that there are no existing tests for EmptyLimit in matter/constraint/constraint_test.go. It's important to add tests to cover this functionality, especially when modifying the grammar.

Please add test cases for all three variants of EmptyLimit (empty, [], and the new "") to constraintTests in matter/constraint/constraint_test.go. This will ensure the parser behaves as expected and prevent future regressions.

Here are some suggested test cases:

	{
		constraint: "empty",
		dataType:   &types.DataType{BaseType: types.BaseDataTypeList},
		min:        types.DataTypeExtreme{Type: types.DataTypeExtremeTypeEmptyList, Format: types.NumberFormatHex},
		max:        types.DataTypeExtreme{Type: types.DataTypeExtremeTypeEmptyList, Format: types.NumberFormatHex},
	},
	{
		constraint: "[]",
		asciiDoc:   "empty",
		dataType:   &types.DataType{BaseType: types.BaseDataTypeList},
		min:        types.DataTypeExtreme{Type: types.DataTypeExtremeTypeEmptyList, Format: types.NumberFormatHex},
		max:        types.DataTypeExtreme{Type: types.DataTypeExtremeTypeEmptyList, Format: types.NumberFormatHex},
	},
	{
		constraint: `""`,
		asciiDoc:   "empty",
		dataType:   &types.DataType{BaseType: types.BaseDataTypeList},
		min:        types.DataTypeExtreme{Type: types.DataTypeExtremeTypeEmptyList, Format: types.NumberFormatHex},
		max:        types.DataTypeExtreme{Type: types.DataTypeExtremeTypeEmptyList, Format: types.NumberFormatHex},
	},

You might need to adjust them, for example by adding zapMin and zapMax values if applicable.

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.

Should alchemy adjust for the random ways spec authors write "empty"

1 participant