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

Implementation of modules/use statements #660

Closed
wants to merge 1 commit into from

Conversation

bobbbay
Copy link
Contributor

@bobbbay bobbbay commented Jul 22, 2022

This is an initial draft implementation for modules, that I picked up about a week ago. Hopefully, this will lead to use statements and eventually, a standard library.

Syntax

A module can be defined similarly to Rust:

mod x {
  y = ...
}

Any element in a module should be referenced with the module prefix:

a = { x::y }

Unless imported into scope.

use x::y
a = { y }

Additionally, pest searches a default location for its standard library, which is added as the std module.

use std::...

Copy link
Contributor

@CAD97 CAD97 left a comment

Choose a reason for hiding this comment

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

👀

};
iter.iterate_expr(expr.clone());
iter
}

fn iterate_expr(&mut self, expr: Expr) {
self.current = Some(expr.clone());
dbg!("Running iter_expr on {:?} {:?}", &self.current, &self.next);
Copy link
Contributor

Choose a reason for hiding this comment

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

Tracking: should be removed or replaced with a log (or tracing) trace!

@tomtau
Copy link
Contributor

tomtau commented Jul 23, 2022

relevant issues:
#197
#333

@bobbbay bobbbay closed this Sep 18, 2022
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.

3 participants