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

Allow crate-relative imports in grammars #213

Merged
merged 2 commits into from
Nov 21, 2019
Merged

Allow crate-relative imports in grammars #213

merged 2 commits into from
Nov 21, 2019

Conversation

dario23
Copy link

@dario23 dario23 commented Nov 21, 2019

fixes #212

@kevinmehall
Copy link
Owner

Thanks!

Updated it to fix a few things:

  • Changed the rule to ("crate" "::")? IDENT() ++ "::", using ? to simplify the optional part, and splitting "crate::" into two tokens because use crate :: foo is valid Rust syntax. (this is a feature of the implementation of the Parse traits for TokenTree used in the macro; when writing a grammar for &str they'd be equivalent).
  • Added a #[derive] needed to make the test compile
  • Updated the compiled grammar with ./bootstrap.sh -- I'll add a development guide to the readme.

@kevinmehall kevinmehall merged commit bef5f06 into kevinmehall:master Nov 21, 2019
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.

Cannot use crate::types::* in parser mod in 0.6
2 participants