Skip to content

fix(input): align canonical availability grammar - #7823

Open
Stardust0831 wants to merge 2 commits into
deepmodeling:developfrom
Stardust0831:availability-canonical-grammar
Open

fix(input): align canonical availability grammar#7823
Stardust0831 wants to merge 2 commits into
deepmodeling:developfrom
Stardust0831:availability-canonical-grammar

Conversation

@Stardust0831

Copy link
Copy Markdown
Collaborator

This is a follow-up to #7783 and is related to #7822. It aligns the documented availability grammar with the canonical syntax enforced by the parser and setter. The public parser now rejects non-canonical spellings by comparing the input with the AST serializer output, the setter no longer duplicates that check, and the parser no longer accepts a comma as an alternative spelling of and.

The developer guide now states the exact spacing rules and gives explicit valid and invalid examples, including mode in [a, b] versus mode in [a,b]. Tests cover non-canonical whitespace, list separators, redundant parentheses, and comma conjunctions.

Verification: a strict local parser smoke test passed; the remote non-MPI, non-LCAO build completed successfully; and the full parameter registry generated parameters.yaml successfully. The dedicated GoogleTest target was not run because the build node could not download GoogleTest from GitHub.

expression := or-expression
or-expression := and-expression ("or" and-expression)*
and-expression := primary (("and" | ",") primary)*
or-expression := and-expression (" or " and-expression)*

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The check now aligns parse_availability() with set_availability(), but the documented grammar is still broader than the accepted canonical language. For example, the grammar admits

(basis_type==pw)

and

basis_type==pw and calculation==scf or esolver_type==sdft

while the new tests explicitly reject both. Likewise, the grammar permits "pw" as a quoted value, but the serializer normalizes it to pw.

Referring to “the spelling produced by the AST serializer” does not precisely document the accepted syntax. Could you update the grammar to describe the serializer’s canonical language explicitly, including the required parentheses around compound subexpressions and the canonical quoting rules for values? The current strict parser behavior should be preserved, in my opinion.

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.

2 participants