source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
+[[package]]
+name = "itertools"
+version = "0.14.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
+dependencies = [
+ "either",
+]
+
[[package]]
name = "itoa"
version = "1.0.11"
"float_next_after",
"hexplay",
"indexmap",
+ "itertools",
"lazy_static",
"libc",
"libm",
let ident = &variant.ident;
let field_attrs = FieldAttrs::parse(&variant.attrs)?;
let selector = field_attrs.selector.unwrap_or(struct_attrs.selector);
- let construction = construct_fields(&variant.fields, quote! { #name::#ident }, selector, None);
+ let construction =
+ construct_fields(&variant.fields, quote! { #name::#ident }, selector, None);
let fnname = format_ident!("construct_{ident}");
body.extend(quote! {
fn #fnname #impl_generics(input: &TokenSlice) -> ParseResult<#name #ty_generics> #where_clause { let input = input.clone(); #construction }
});
}
- for variant in &e.variants {
+ for variant in &e.variants {
let ident = &variant.ident;
let fnname = format_ident!("construct_{ident}");
let field_attrs = FieldAttrs::parse(&variant.attrs)?;
use std::collections::HashMap;
use tokio::sync::Mutex;
-use tower_lsp::{
- jsonrpc::Result,
- lsp_types::*,
- Client, LanguageServer, LspService, Server,
-};
+use tower_lsp::{jsonrpc::Result, lsp_types::*, Client, LanguageServer, LspService, Server};
#[tokio::main]
async fn main() {
smallvec = { version = "1.13.2", features = ["const_generics", "write"] }
libm = "0.2.11"
smallstr = "0.3.0"
+itertools = "0.14.0"
[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.48.0", features = ["Win32_Globalization"] }
//! are the same as the tokens used by the PSPP parser with a few additional
//! types.
-pub mod segment;
-pub mod scan;
pub mod command_name;
-pub mod token;
pub mod lexer;
+pub mod scan;
+pub mod segment;
+pub mod token;
use crate::identifier::{Identifier, ReservedWord};
use super::{
- segment::{Syntax, Segment, Segmenter},
+ segment::{Segment, Segmenter, Syntax},
token::{Punct, Token},
};
use std::collections::VecDeque;
return Some(token);
}
self.input = rest;
- return Some(ScanToken::Error(error))
- },
+ return Some(ScanToken::Error(error));
+ }
Some(ScanToken::Token(token)) => {
self.tokens.push_back(token);
}
}
return Ok(Some((rest, Segment::DoRepeatCommand)));
}
- fn parse_do_repeat_4<'a>(&mut self, input: &'a str) -> Result<Option<(&'a str, Segment)>, Incomplete> {
+ fn parse_do_repeat_4<'a>(
+ &mut self,
+ input: &'a str,
+ ) -> Result<Option<(&'a str, Segment)>, Incomplete> {
self.state.0 = State::DoRepeat3;
Ok(Some((input, Segment::DoRepeatOverflow)))
}
use crate::prompt::PromptStyle;
-use super::{Syntax, Segment, Segmenter};
+use super::{Segment, Segmenter, Syntax};
fn push_segment<'a>(
segmenter: &mut Segmenter,
mod define {
use crate::{
- lex::segment::{Syntax, Segment},
+ lex::segment::{Segment, Syntax},
prompt::PromptStyle,
};
-use std::{borrow::Cow, fmt::Display, fs::File, io::{Error, Write}, sync::Arc};
+use std::{
+ borrow::Cow,
+ fmt::Display,
+ fs::File,
+ io::{Error, Write},
+ sync::Arc,
+};
use crate::output::pivot::Coord2;
use std::cmp::max;
use std::collections::HashMap;
+use std::iter::once;
use std::ops::Range;
use std::sync::Arc;
use enum_map::EnumMap;
+use itertools::interleave;
use smallvec::SmallVec;
use super::pivot::{Axis2, BorderStyle, Coord2, Look, PivotTable, Rect2, Stroke};
}
fn use_row_widths(rows: &[usize], rules: &[usize]) -> Vec<usize> {
- debug_assert_eq!(rows.len() + 1, rules.len());
- let mut cp = Vec::with_capacity(2 * (rows.len()) + 1);
-
- cp.push(0);
- for (rule, row) in rules.iter().zip(rows.iter()) {
- cp.push(*rule);
- cp.push(*row);
- }
- cp.push(*rules.last().unwrap());
-
- Self::accumulate_vec(cp)
+ once(0).chain(interleave(rules, rows).copied()).collect()
}
fn interpolate_row_widths(