-
Notifications
You must be signed in to change notification settings - Fork 72
Create a "correct" SyntaxNode API #432
Copy link
Copy link
Open
Labels
vhdl-syntaxRelevant for the vhdl-syntax crateRelevant for the vhdl-syntax crate
Description
We currently have the SyntaxNode API in the vhdl-syntax crate.
This API has the disadvantage that every node is optional. Getting nodes is, therefore, a pain point.
We should introduce a "correct" API that enables clean access to the AST.
Example API
struct CorrectArchitectureEpilogue(SyntaxNode);
impl CorrectArchitectureEpilogue {
// Returns the node, if the passed `SyntaxNode` is correct. Otherwise, returns some result data structure that reports
// missing and superfluous fields.
pub fn new(node: SyntaxNode) -> Result< CorrectArchitectureEpilogue, MissingAndSuperfluousFields> {
// implementation details
}
// Not optional, is always present
pub fn end_keyword() -> SyntaxToken {
// implementation details
}
// optional since this is also optional in the LRM
pub fn architecture_token() -> Option<SyntaxToken> {
// implementation details
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
vhdl-syntaxRelevant for the vhdl-syntax crateRelevant for the vhdl-syntax crate