Skip to content

Implement the component-model lexing rules for identifiers.#382

Merged
alexcrichton merged 4 commits intobytecodealliance:mainfrom
sunfishcode:sunfishcode/kebab-case
Oct 19, 2022
Merged

Implement the component-model lexing rules for identifiers.#382
alexcrichton merged 4 commits intobytecodealliance:mainfrom
sunfishcode:sunfishcode/kebab-case

Conversation

@sunfishcode
Copy link
Copy Markdown
Member

The component-model grammer for kebab-case identifiers now looks like this:

name           ::= <word>
                 | <name>-<word>
word           ::= [a-z][0-9a-z]*
                 | [A-Z][0-9A-Z]*

Implement the rules. This continues to use XID rules for the initial lexing, as that corresponds to what users might accidentally use, so that we can issue appropriate errors in those cases. The precise grammer is validated in a separate step.

@alexcrichton
Copy link
Copy Markdown
Member

Given the current CI errors, I think one of two things needs to happen:

  • Specify upstream in the component model uppercase isn't allowed for now
  • Disallow overlapping identifiers which only overlap in case in wit-bindgen

I'd sort of prefer to avoid having to generate separate bindings for apple and APPLE and support that within wit-bindgen since that'd be a lot of changes for not a ton of benefit.

@sunfishcode
Copy link
Copy Markdown
Member Author

I think we should do something in the upstream component model definition. I filed WebAssembly/component-model#118 to track this.

@alexcrichton
Copy link
Copy Markdown
Member

Ok sounds good to me, want to update the test to not exercise this casing collision to merge?

The [component-model grammer] for kebab-case identifiers now looks
like this:

```
name           ::= <word>
                 | <name>-<word>
word           ::= [a-z][0-9a-z]*
                 | [A-Z][0-9A-Z]*
```

Implement the rules. This continues to use XID rules for the initial
lexing, as that corresponds to what users might accidentally use, so
that we can issue appropriate errors in those cases. The precise
grammer is validated in a separate step.

[component-model grammer]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#instance-definitions
@sunfishcode sunfishcode force-pushed the sunfishcode/kebab-case branch from 5f5423c to b95cf82 Compare October 19, 2022 14:31
@alexcrichton alexcrichton merged commit 00a82e6 into bytecodealliance:main Oct 19, 2022
@sunfishcode sunfishcode deleted the sunfishcode/kebab-case branch October 19, 2022 17:44
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