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

#[derive(AST)] for CST Enums #33

Closed
Tracked by #27
atahanyorganci opened this issue Feb 7, 2022 · 0 comments
Closed
Tracked by #27

#[derive(AST)] for CST Enums #33

atahanyorganci opened this issue Feb 7, 2022 · 0 comments
Labels
M - Macros Related to procedural macros expored from `alloy-macros`

Comments

@atahanyorganci
Copy link
Owner

Current AST implementation in Alloy includes enums such as Expression that is discriminated union of BinaryExpression, UnaryExpression etc.

// src/ast/expression/mod.rs:21
pub enum Expression {
    Value(Value),
    Binary(BinaryExpression),
    Unary(UnaryExpression),
    Identifier(IdentifierExpression),
}

This AST enum has to be derived from CST one candidate CST that can be used to generate Expression AST is provided below.

#[derive(AST)]
pub enum ExpressionCST {
    Value(Spanned<Value>),
    Binary(BinaryExpressionCST),
    Unary(UnaryExpressionCST),
    Identifier(IdentifierExpressionCST),
}

Originally posted by @atahanyorganci in #24 (comment)

@atahanyorganci atahanyorganci added the M - Macros Related to procedural macros expored from `alloy-macros` label Feb 7, 2022
atahanyorganci added a commit that referenced this issue Feb 7, 2022
CST fields are fields that have 'CST' suffix i.e. `IdentifierCST`.
Further work has to be done for mapping `Spanned<T>` in enum fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M - Macros Related to procedural macros expored from `alloy-macros`
Projects
None yet
Development

No branches or pull requests

1 participant