From: Ben Pfaff Date: Sat, 24 Aug 2024 15:45:37 +0000 (-0700) Subject: tests pass again X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=99fc00b6960392336d5afa7d3722eb41b6b96ade;p=pspp tests pass again --- diff --git a/rust/pspp/src/command.rs b/rust/pspp/src/command.rs index ce6bde716c..a4051a2f55 100644 --- a/rust/pspp/src/command.rs +++ b/rust/pspp/src/command.rs @@ -1,3 +1,4 @@ +#![allow(dead_code)] use std::{fmt::Write, sync::OnceLock}; use flagset::{flags, FlagSet}; @@ -233,7 +234,7 @@ fn parse_in_state(lexer: &mut Lexer, error: &Box, _state: St println!("{}:{}", file!(), line!()); (command.run)(&mut context); println!("{}:{}", file!(), line!()); - end_of_command(&context); + let _ = end_of_command(&context); println!("{}:{}", file!(), line!()); } println!("{}:{}", file!(), line!()); diff --git a/rust/pspp/src/format.rs b/rust/pspp/src/format.rs index bafdf2726c..956e139495 100644 --- a/rust/pspp/src/format.rs +++ b/rust/pspp/src/format.rs @@ -1,3 +1,4 @@ +#![allow(dead_code)] use std::{ fmt::{Display, Formatter, Result as FmtResult}, ops::RangeInclusive, diff --git a/rust/pspp/src/lex/command_name.rs b/rust/pspp/src/lex/command_name.rs index bccea1483b..a954bee6a2 100644 --- a/rust/pspp/src/lex/command_name.rs +++ b/rust/pspp/src/lex/command_name.rs @@ -5,10 +5,6 @@ pub struct Match { pub missing_words: isize, } -fn count_words(s: &str) -> isize { - s.split_whitespace().count() as isize -} - /// Compares `string` obtained from the user against the full name of a `command`, /// using this algorithm: /// diff --git a/rust/pspp/src/lex/lexer.rs b/rust/pspp/src/lex/lexer.rs index 928115af61..c3e273037c 100644 --- a/rust/pspp/src/lex/lexer.rs +++ b/rust/pspp/src/lex/lexer.rs @@ -69,6 +69,7 @@ pub struct Source { error_handling: ErrorHandling, /// Encoding. + #[allow(dead_code)] encoding: &'static Encoding, /// `None` if this reader is not associated with a file. diff --git a/rust/pspp/src/lex/scan/mod.rs b/rust/pspp/src/lex/scan/mod.rs index c4d0814835..568f3e1f1d 100644 --- a/rust/pspp/src/lex/scan/mod.rs +++ b/rust/pspp/src/lex/scan/mod.rs @@ -399,15 +399,21 @@ impl<'a> Iterator for StringScanner<'a> { return self.merge(true).unwrap(); }; let (s, rest) = self.input.split_at(seg_len); - self.input = rest; match ScanToken::from_segment(s, seg_type) { - Some(ScanToken::Error(error)) => return Some(ScanToken::Error(error)), + Some(ScanToken::Error(error)) => { + if let Ok(Some(token)) = self.merge(true) { + return Some(token); + } + self.input = rest; + return Some(ScanToken::Error(error)) + }, Some(ScanToken::Token(token)) => { self.tokens.push_back(token); } None => (), } + self.input = rest; } } } diff --git a/rust/pspp/src/lex/scan/test.rs b/rust/pspp/src/lex/scan/test.rs index 1e0f1007e2..888f579857 100644 --- a/rust/pspp/src/lex/scan/test.rs +++ b/rust/pspp/src/lex/scan/test.rs @@ -1044,7 +1044,6 @@ content line 2 ScanToken::Token(Token::String(String::from("content line 1"))), ScanToken::Token(Token::String(String::from("content line 2"))), ScanToken::Token(Token::End), - ScanToken::Token(Token::End), ], ); } diff --git a/rust/pspp/src/macros.rs b/rust/pspp/src/macros.rs index 85671b05a5..b1e2f56a35 100644 --- a/rust/pspp/src/macros.rs +++ b/rust/pspp/src/macros.rs @@ -1,3 +1,4 @@ +#![allow(dead_code)] use lazy_static::lazy_static; use num::Integer; use std::{ diff --git a/rust/pspp/src/output/mod.rs b/rust/pspp/src/output/mod.rs index 944cbe75d9..3c9392d3a6 100644 --- a/rust/pspp/src/output/mod.rs +++ b/rust/pspp/src/output/mod.rs @@ -1,3 +1,4 @@ +#![allow(dead_code)] use std::sync::Arc; use self::pivot::Value;