-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add EBNF grammar as doc comments for TerminalKind and NonterminalKind #1169
Add EBNF grammar as doc comments for TerminalKind and NonterminalKind #1169
Conversation
… .d.ts files using the `jco types` command. This command is better for our use case than `jco transpile` because it generates the declarations directly from the source .wit files, whereas `jco transpile` uses the WASM binaries to generate them. This means that `jco types` has access to the documentation that's written in the wit interfaces, and `jco transpile` does not. Since we're generating the interfaces in a separate step, I'm disabling typescript in the original `jco transpile` step. This is just a precaution to avoid confusion or possible conflicting declaration files interferring with each other.
…is correctly propagating through the build process.
…rpose of this is so that both processes use the same `CodegenFileSystem` instance. If they used separate instances, then the files generated in one function would get deleted by the next.
…the variant ID as well as the EBNF form of the kind to use as documentation. Getting the EBNF form involves creating an instance of `SpecModel` and serializing the ID using that.
…guage` field to be a `&Language` instead of an `Rc<Language>` because of some weird issue getting `KindBuilder` to instantiate properly given that `KindsModel::from_language` received a `&Rc<Language>` param. However, I realized afterwards that I could just use `to_owned` when creating the SpecModel instead of changing SpecModel everywhere.
|
… for the clippy lints `doc_markdown` and `doc_link_with_quotes`. These are "pedantic" lints that we run into issues with now that we're outputting the EBNF docs for these kinds, but the errors aren't relevant to us.
crates/codegen/runtime/cargo/crate/src/runtime/cst/terminal_kind.rs.jinja2
Outdated
Show resolved
Hide resolved
crates/codegen/runtime/cargo/wasm/src/runtime/interface/cst.wit.jinja2
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing back to you, for a few suggestions, and for resolving the conflicts with main
.
Thank you!
crates/testlang/outputs/npm/package/wasm/generated/interfaces/nomic-foundation-slang-cst.d.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the comments.
Thank you for looking into this!
looks like this needs rebasing before merge. |
Updates our JCO submodule to include the changes in NomicFoundation/jco#5. Includes one other change to fully integrate these changes, which is to change `NodeVariant` to `NodeType` in `codegen/../cst/index.mts` so that the expected imports align with the new generated exports. * [x] Depends on #1169 * [x] Depends on NomicFoundation/jco#5 Closes #1166 Closes #1171
When generating documentation for
TerminalKind
andNonterminalKind
, generate the EBNF grammar for the current variant and include that in the final output. This affects the Wit output and Rust output (using templatescst.wit.jinja2
and(terminal|nonterminal)_kind.rs.jinja2
).Closes #1165