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

Many acts as it is consumed if passed a consumed input #4

Closed
Marwes opened this issue Jan 28, 2015 · 0 comments · Fixed by #7
Closed

Many acts as it is consumed if passed a consumed input #4

Marwes opened this issue Jan 28, 2015 · 0 comments · Fixed by #7

Comments

@Marwes
Copy link
Owner

Marwes commented Jan 28, 2015

Bug found by @avwhite with a minimal reproducing example.

Should be able to fix this later today.

EDIT: Example is actually wrong since you should expect it to return Consumed due to spaces consuming one char. Updated with correct example (which needs to manually create a state or this wont work).

extern crate "parser-combinators" as parser;

use parser::{many, any_char, Parser};
use parser::primitives::{State, Consumed, SourcePosition};

fn main() {
        let state = State { position: SourcePosition { line: 1, column: 1 }, input: "", consumed: Consumed::Consumed };
        let result = many(any_char as fn (_) -> _)
            .parse_state(state);

        assert!(result.is_ok());
        assert_eq!(result.unwrap().1.consumed, Consumed::Empty);

} 
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 a pull request may close this issue.

1 participant