Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not all named sub-expressions produce their own RuleKind #339

Closed
OmarTawfik opened this issue Feb 28, 2023 · 2 comments · Fixed by #486
Closed

not all named sub-expressions produce their own RuleKind #339

OmarTawfik opened this issue Feb 28, 2023 · 2 comments · Fixed by #486
Assignees

Comments

@OmarTawfik
Copy link
Contributor

OmarTawfik commented Feb 28, 2023

I noticed an issue with the current parser codegen. Named sub-expressions no longer generate a RuleKind. To repro, adding ContractName to ContractDefinition below, doesn't add the new kind or change the CST. Test snapshots are unchanged as well.

NOTE: This also happens with choice: nodes, and possibly other types.

- name: "ContractDefinition"
  kind: "Rule"
  unversioned:
    sequence:
      - optional:
          terminal: "abstract"
      - terminal: "contract"
      - name: "ContractName"
        reference: "Identifier"
      - optional:
          reference: "InheritanceSpecifierList"
      - delimitedBy:
          open: "{"
          expression:
            zeroOrMore:
              reference: "ContractBodyElement"
          close: "}"
@OmarTawfik OmarTawfik added this to the 1️⃣ Alpha Preview milestone Feb 28, 2023
@OmarTawfik OmarTawfik moved this to ⏲ Todo in Slang - 2023 H1 Feb 28, 2023
@OmarTawfik OmarTawfik changed the title named references don't produce their own RuleKind not all named sub-expressions produce their own RuleKind Feb 28, 2023
@AntonyBlakey
Copy link
Contributor

AntonyBlakey commented Mar 6, 2023

Purposely doesn't work for choice:, optional:, or reference:. Not clear what it would mean in those cases.

@OmarTawfik
Copy link
Contributor Author

Not clear what it would mean in those cases.

I would have thought they would be able to generate their own RuleKind, and insert a node with such kind in the CST.

  • For reference: and choice:, this is for readability, as we might have two nodes of the same kind in succession, and we need to differentiate which is which.
  • For things like optional: this is even more important, since we don't generate null/empty nodes, so in order to maintain a consistent CST shape, we need to have a named parent (with 0-1 children).

@OmarTawfik OmarTawfik modified the milestones: 1️⃣ Alpha Preview, 2️⃣ Beta Preview Mar 17, 2023
@OmarTawfik OmarTawfik self-assigned this May 23, 2023
@github-project-automation github-project-automation bot moved this from ⏲ Todo to ✅ Done in Slang - 2023 H1 Jun 1, 2023
@OmarTawfik OmarTawfik added this to the 1️⃣ Alpha Preview milestone Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants