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

Basic macro support. #7238

Open
wants to merge 1 commit into
base: high-level-inline-macros
Choose a base branch
from

Conversation

gilbens-starkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewed 8 of 17 files at r1, all commit messages.
Reviewable status: 8 of 17 files reviewed, 6 unresolved discussions (waiting on @mkaput)


crates/cairo-lang-semantic/src/items/macro_declaration.rs line 24 at r1 (raw file):

    resolver_data: Arc<ResolverData>,
    rules: Vec<MacroRuleData>,
}

doc and:

Suggestion:

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MacroDeclarationData {
    rules: Vec<MacroRuleData>,
    attributes: Vec<Attribute>,
    diagnostics: Diagnostics<SemanticDiagnostic>,
    resolver_data: Arc<ResolverData>,
}

crates/cairo-lang-semantic/src/items/macro_declaration.rs line 33 at r1 (raw file):

#[derive(Debug, Clone, PartialEq, Eq)]
enum PlaceholderKind {

doc


crates/cairo-lang-semantic/src/items/macro_declaration.rs line 48 at r1 (raw file):

}

pub fn priv_macro_declaration_data(

[pointback] doc.


crates/cairo-lang-semantic/src/items/macro_declaration.rs line 175 at r1 (raw file):

}

pub fn expand_macro_rule_ex(

doc


corelib/src/test/language_features/macro_test.cairo line 14 at r1 (raw file):

    };
}

can you add a non - comma seperator or lack of seperators as another test examples?


crates/cairo-lang-semantic/src/expr/compute.rs line 455 at r1 (raw file):

        (true, true) => {
            return Err(ctx.diagnostics.report(syntax, AmbiguousInlineMacro(macro_name.into())));
        }

probably user-defined should just win against external definition.
external is basically "prelude".

probably should have extern for them in the end or something of that manner.

Code quote:

    match (inline_macro_plugin_found, is_user_defined_macro_found) {
        (true, true) => {
            return Err(ctx.diagnostics.report(syntax, AmbiguousInlineMacro(macro_name.into())));
        }

Copy link
Member

@mkaput mkaput left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 17 of 17 files at r1, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @gilbens-starkware)

@gilbens-starkware gilbens-starkware force-pushed the gil/macros_3 branch 3 times, most recently from b7fa0c4 to 023c9fe Compare February 13, 2025 11:34
Copy link
Contributor Author

@gilbens-starkware gilbens-starkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 12 of 19 files reviewed, 6 unresolved discussions (waiting on @mkaput and @orizi)


corelib/src/test/language_features/macro_test.cairo line 14 at r1 (raw file):

Previously, orizi wrote…

can you add a non - comma seperator or lack of seperators as another test examples?

Done.


crates/cairo-lang-semantic/src/expr/compute.rs line 455 at r1 (raw file):

Previously, orizi wrote…

probably user-defined should just win against external definition.
external is basically "prelude".

probably should have extern for them in the end or something of that manner.

Done.


crates/cairo-lang-semantic/src/items/macro_declaration.rs line 24 at r1 (raw file):

Previously, orizi wrote…

doc and:

Done.


crates/cairo-lang-semantic/src/items/macro_declaration.rs line 33 at r1 (raw file):

Previously, orizi wrote…

doc

Done.


crates/cairo-lang-semantic/src/items/macro_declaration.rs line 48 at r1 (raw file):

Previously, orizi wrote…

[pointback] doc.

Done.


crates/cairo-lang-semantic/src/items/macro_declaration.rs line 175 at r1 (raw file):

Previously, orizi wrote…

doc

Done.

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 7 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @gilbens-starkware)


crates/cairo-lang-semantic/src/items/macro_declaration.rs line 24 at r1 (raw file):

Previously, gilbens-starkware (Gil Ben-Shachar) wrote…

Done.

doc.


crates/cairo-lang-semantic/src/items/macro_declaration.rs line 175 at r1 (raw file):

Previously, gilbens-starkware (Gil Ben-Shachar) wrote…

Done.

but what does it do?


crates/cairo-lang-semantic/src/items/macro_declaration.rs line 27 at r3 (raw file):

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct MacroRuleData {

doc

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.

4 participants