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

add typedef and namespace #7

Merged
merged 10 commits into from
Feb 23, 2025

Conversation

ygdrasil-io
Copy link
Contributor

No description provided.

Introduced support for parsing `typedef` elements in WebIDL. Implemented a `TypeDefParser` class, updated `WebIdlParserType` to include `TypeDef`, and added a new `IdlTypeDef` model for improved functionality.
Replaced `parseChildren(termToken: String?)` with a simplified overload in `ElementParser` and updated its usage in `TypeDefParser`. This improves code clarity and avoids unnecessary parameter passing where not required.
Introduce typedef parsing functionality to the WebIDL parser, including updates to the `TypeDefParser` and `IdlModel` classes to handle typedef definitions. Added corresponding test cases to verify the parsing logic, ensuring typedefs are correctly modeled and included in the overall structure.
Introduces parsing and model support for namespaces and their constants in the WebIDL parser. Updates include adding `NamespaceParser`, `ConstantParser`, and relevant model adjustments to handle namespaces and constant definitions. Tests and IDL resources are updated to validate the new functionality.
@ygdrasil-io ygdrasil-io mentioned this pull request Feb 23, 2025
16 tasks
Removed the `parentDictionary` property and associated logic, which were unused in the `IdlConstant` class. Additionally, changed `defaultValue` initialization to `lateinit` to streamline builder usage.
The 'sourcePackage' property and its related code were redundant and served no functional purpose. This cleanup improves code clarity and removes unnecessary complexity in the NamespaceParser and IdlNamespace classes.
The `finishModel` function was removed as it was not being used anywhere in the code. This cleanup simplifies the class and reduces unnecessary code, improving maintainability.
Updated variable and method names from 'constantes' to 'constants' in both `ParserTest` and `IdlNamespace` classes. This ensures alignment with standard naming conventions and improves code readability.
ATypeDef3 was commented out and left unused in the file. Removing it simplifies the code and avoids unnecessary clutter in the test resource.
@ygdrasil-io ygdrasil-io marked this pull request as ready for review February 23, 2025 11:06
override suspend fun parse(): String {
popToken("const")
val type = parseType()
val tokens = popUntilPattern(";") ?: parserException("Failed parsing member")
Copy link
Owner

Choose a reason for hiding this comment

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

I assume the exception message should be "Failed parsing constant"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Adjusted the error message for parsing failure from "member" to "constant" to improve clarity and accuracy. This ensures the message aligns with the context of parsing constants.
@fabmax fabmax merged commit 6836e26 into fabmax:main Feb 23, 2025
2 checks passed
@ygdrasil-io ygdrasil-io deleted the feature/add-typedef-and-namespace branch February 23, 2025 16:53
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