tests pass again
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 24 Aug 2024 15:45:37 +0000 (08:45 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 24 Aug 2024 15:45:37 +0000 (08:45 -0700)
rust/pspp/src/command.rs
rust/pspp/src/format.rs
rust/pspp/src/lex/command_name.rs
rust/pspp/src/lex/lexer.rs
rust/pspp/src/lex/scan/mod.rs
rust/pspp/src/lex/scan/test.rs
rust/pspp/src/macros.rs
rust/pspp/src/output/mod.rs

index ce6bde716c00f530f61527a8f9322694819e7289..a4051a2f55c392321af6921a5a893b91980a1e6b 100644 (file)
@@ -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<dyn Fn(Diagnostic)>, _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!());
index bafdf2726c908a1fca64db4616179efb5bc84e96..956e13949504d25df200c46adab389635ec3e0c5 100644 (file)
@@ -1,3 +1,4 @@
+#![allow(dead_code)]
 use std::{
     fmt::{Display, Formatter, Result as FmtResult},
     ops::RangeInclusive,
index bccea1483b2aa0d53c0a27411bb0ba9fb43e8347..a954bee6a2b9d1afe89d603d33f4a778145fdb55 100644 (file)
@@ -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:
 ///
index 928115af616524927a1ba4f74c3e3b8ce6ab8d91..c3e273037c33cff4fb68f7736ddd5a1ed3487d07 100644 (file)
@@ -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.
index c4d081483509968431a2e2198497785a8a8d744e..568f3e1f1d2a65bd117df6679c850675e824d483 100644 (file)
@@ -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;
         }
     }
 }
index 1e0f1007e2c51900a285cad7473b37b225b3205f..888f579857af9356f3e41e87b31177fe4a902197 100644 (file)
@@ -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),
             ],
         );
     }
index 85671b05a53f7463cb225940d5311e4a352528a3..b1e2f56a35082dd31bf6cc1eec12655f6cd42270 100644 (file)
@@ -1,3 +1,4 @@
+#![allow(dead_code)]
 use lazy_static::lazy_static;
 use num::Integer;
 use std::{
index 944cbe75d96469f9c6ad6444eb41a7cd323d15e9..3c9392d3a6edb747c92310979facce1eff60cd0c 100644 (file)
@@ -1,3 +1,4 @@
+#![allow(dead_code)]
 use std::sync::Arc;
 
 use self::pivot::Value;