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

error: OrParser does not name a structure #2

Open
bjadamson opened this issue Nov 17, 2014 · 8 comments
Open

error: OrParser does not name a structure #2

bjadamson opened this issue Nov 17, 2014 · 8 comments

Comments

@bjadamson
Copy link

Hey, I'm getting this error when trying to combine my own parser using any of the macros, do you have any ideas on maybe I'm doing incorrectly?

#[phase(plugin)] 
extern crate peruse;
extern crate peruse;
use self::peruse::parsers::literal;

fn mm() {
    let dddd = or!(literal(A), literal(B));
}

The full error I get from trying to compile this:

badamson@406c8f2a3866 ~/D/r/myproject-rs> cargo build --verbose
       Fresh peruse v0.1.0 (https://github.com/DanSimon/peruse.git#5915d6fa)
   Compiling myproject-rs v0.0.1 (file:///Users/badamson/Documents/rust/myproject-rs)
     Running `rustc /Users/badamson/Documents/rust/myproject-rs/src/main.rs --crate-name myproject-rs --crate-type bin -g --out-dir /Users/badamson/Documents/rust/myproject-rs/target --dep-info /Users/badamson/Documents/rust/myproject-rs/target/.fingerprint/myproject-rs-030fbdb89d7c4fb3/dep-bin-myproject-rs -L /Users/badamson/Documents/rust/myproject-rs/target -L /Users/badamson/Documents/rust/myproject-rs/target/deps --extern peruse=/Users/badamson/Documents/rust/myproject-rs/target/deps/libperuse-1cb3ff65831a86b2.rlib`
<peruse macros>:3:5: 3:13 error: `OrParser` does not name a structure
<peruse macros>:3     OrParser{
                      ^~~~~~~~
<peruse macros>:1:1: 18:2 note: in expansion of or!
/Users/badamson/Documents/rust/myproject-rs/src/lexer/lexer.rs:43:13: 43:41 note: expansion site
error: aborting due to previous error
Could not compile `myproject-rs`.

Caused by:
  Process didn't exit successfully: `rustc /Users/badamson/Documents/rust/myproject-rs/src/main.rs --crate-name myproject-rs --crate-type bin -g --out-dir /Users/badamson/Documents/rust/myproject-rs/target --dep-info /Users/badamson/Documents/rust/myproject-rs/target/.fingerprint/myproject-rs-030fbdb89d7c4fb3/dep-bin-myproject-rs -L /Users/badamson/Documents/rust/myproject-rs/target -L /Users/badamson/Documents/rust/myproject-rs/target/deps --extern peruse=/Users/badamson/Documents/rust/myproject-rs/target/deps/libperuse-1cb3ff65831a86b2.rlib` (status=101)
@bjadamson
Copy link
Author

badamson@406c8f2a3866 ~/D/r/myproject-rs> rustc -v
rustc 0.13.0-nightly (d91a015ab 2014-11-14 23:37:27 +0000)

@DanSimon
Copy link
Owner

Yeah that's a bug with the macros not properly namespacing the parsers. I'll have that fixed shortly.

@bjadamson
Copy link
Author

Oh, okay. Thanks, is there any way to work around it in the meantime?

@DanSimon
Copy link
Owner

I just pushed a fix to master that should resolve the issue.

@bjadamson
Copy link
Author

Ok I pulled in your patch (thanks btw!) and got this:

let p = or!(literal(A), literal(B));
<peruse macros>:3:5: 3:11 error: failed to resolve. Did you mean `self::peruse::parsers`?
<peruse macros>:3     ::peruse::parsers::OrParser{
                      ^~~~~~
<peruse macros>:1:1: 18:2 note: in expansion of or!
/Users/badamson/Documents/rust/myproject-rs/src/lexer/lexer.rs:38:11: 38:39 note: expansion site
<peruse macros>:3:5: 3:32 error: `peruse::parsers::OrParser` does not name a structure
<peruse macros>:3     ::peruse::parsers::OrParser{
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
<peruse macros>:1:1: 18:2 note: in expansion of or!
/Users/badamson/Documents/rust/myproject-rs/src/lexer/lexer.rs:38:11: 38:39 note: expansion site
error: aborting due to 2 previous errors
Could not compile `myproject-rs`.

@DanSimon
Copy link
Owner

Very odd, I'm not able to reproduce this error. Try doing cargo clean and then cargo build. I've run into issues before when updating without doing a clean.

@bjadamson
Copy link
Author

Tried it, no dice! I have this though, could you try it on your box?
http://is.gd/ILt8I1

@DanSimon
Copy link
Owner

Weird, that works fine for me. The only changes I had to make to your code were add #![feature(plugin)] at the top and a main fn. Also my Cargo.toml looks like:

[package]

name = "test"
version = "0.0.1"
authors = [ "Your name <you@example.com>" ]

[[bin]]

name = "test"
path = "src/test.rs"

[dependencies.peruse]

git = "https://github.com/DanSimon/peruse.git"

Also just a heads up, the latest Rust nightly just broke peruse because of the new enum namespacing, I'll have that fixed soon fixed.

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

No branches or pull requests

2 participants