Skip to content

Commit

Permalink
Remove need for NLL - now compiles on 1.28.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gyscos committed Aug 7, 2019
1 parent 9c19771 commit 9e75f8b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ matrix:
- rust: stable
- rust: beta
- rust: nightly
- rust: 1.17.0
script: cargo build
- rust: 1.24.1
- rust: 1.28.0
- rust: nightly
env: CLIPPY
script: |
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
install:
- ps: Start-FileDownload 'https://static.rust-lang.org/dist/rust-1.24.1-i686-pc-windows-gnu.exe'
- rust-1.24.1-i686-pc-windows-gnu.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust"
- ps: Start-FileDownload 'https://static.rust-lang.org/dist/rust-1.28.0-i686-pc-windows-gnu.exe'
- rust-1.28.0-i686-pc-windows-gnu.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust"
- SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin
- SET PATH=%PATH%;C:\MinGW\bin
- rustc -V
Expand Down
23 changes: 19 additions & 4 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,23 +367,38 @@ impl<T: Iterator<Item = char>> Parser<T> {
}

fn parser_process_directives(&mut self) -> Result<(), ScanError> {
enum DirectiveAction {
None,
Tag { handle: String, prefix: String },
}

loop {
match self.peek_token()?.1 {
// Without NLL, split the peek and the action
let action = match self.peek_token()?.1 {
TokenType::VersionDirective(_, _) => {
// XXX parsing with warning according to spec
//if major != 1 || minor > 2 {
// return Err(ScanError::new(tok.0,
// "found incompatible YAML document"));
//}
DirectiveAction::None
}
TokenType::TagDirective(ref handle, ref prefix) => {
let handle = String::from(handle);
let mut prefix = String::from(prefix);
let handle = String::clone(handle);
let mut prefix = String::clone(prefix);
prefix.pop();
self.tag_directives.insert(handle, prefix);
DirectiveAction::Tag { handle, prefix }
}
_ => break,
};

match action {
DirectiveAction::Tag { handle, prefix } => {
self.tag_directives.insert(handle, prefix);
}
_ => (),
}

self.skip();
}
Ok(())
Expand Down

0 comments on commit 9e75f8b

Please sign in to comment.