Collapsed all crates to root since they anyway don't use any dependencies except stdlib
This commit is contained in:
parent
1200f99e38
commit
856bb308d9
@ -5,7 +5,6 @@ edition = "2024"
|
||||
[lib]
|
||||
|
||||
[workspace]
|
||||
members = ["default-streams", "converter", "ascii"]
|
||||
|
||||
[lints]
|
||||
rust = { nonstandard_style = "allow" }
|
||||
@ -1,15 +0,0 @@
|
||||
[package]
|
||||
name = "source-stream-0-ascii-0"
|
||||
edition = "2024"
|
||||
|
||||
[lib]
|
||||
|
||||
[dependencies]
|
||||
|
||||
[dev-dependencies]
|
||||
source-stream-0 = { path = ".." }
|
||||
source-stream-0-default-streams-0 = { path = "../default-streams" }
|
||||
source-stream-0-converter-0 = { path = "../converter" }
|
||||
|
||||
[lints]
|
||||
rust = { nonstandard_style = "allow" }
|
||||
@ -1,79 +0,0 @@
|
||||
#[cfg(test)]
|
||||
|
||||
use crate::{AsciiChar, AsciiCharConvertable};
|
||||
use source_stream_0::{CollectResult, CollectedSubstring, Pos, SourceStream};
|
||||
use source_stream_0_converter_0::{
|
||||
ConvertedSourceStream, StreamConverter, StreamConverter_Char, StreamConverter_Pos,
|
||||
StreamConverter_Pos_Noop, StreamConverter_Substring,
|
||||
};
|
||||
use source_stream_0_default_streams_0::SourceStreamOverIterator;
|
||||
use source_stream_0_default_streams_0::iterators::{
|
||||
ArrayCollectedSubstring, ArraySourceStream, StrSourceStream,
|
||||
};
|
||||
use source_stream_0_default_streams_0::pos::IndexPosCounter;
|
||||
use std::marker::PhantomData;
|
||||
use crate::asciiLiteral;
|
||||
|
||||
struct ConverterImpl {}
|
||||
|
||||
impl StreamConverter_Char<char> for ConverterImpl {
|
||||
type WC = AsciiChar;
|
||||
|
||||
fn convertChar(&self, c: char) -> Self::WC {
|
||||
return c.asAsciiChar();
|
||||
}
|
||||
}
|
||||
|
||||
impl<'pos, P: Pos<'pos>> StreamConverter_Pos_Noop<'pos, P> for ConverterImpl {}
|
||||
|
||||
impl<'source, CS: CollectedSubstring<'source, C = char>>
|
||||
StreamConverter_Substring<'source, char, CS> for ConverterImpl
|
||||
{
|
||||
type WCS = ArrayCollectedSubstring<'source, AsciiChar>;
|
||||
|
||||
fn convertSubstring(&self, wcs: CS) -> Self::WCS {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
fn printAscii(a: Option<AsciiChar>) {
|
||||
match a {
|
||||
None => println!("_"),
|
||||
Some(aa) => match aa {
|
||||
AsciiChar::NOT_ASCII => println!("#"),
|
||||
AsciiChar::ASCII(c) => println!("{}", c as char),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn sandbox() {
|
||||
let src8 = SourceStreamOverIterator::wrap(StrSourceStream::start(
|
||||
"qwяtr",
|
||||
IndexPosCounter::default(),
|
||||
));
|
||||
|
||||
let cvt = ConverterImpl {};
|
||||
let mut src = ConvertedSourceStream::convert(src8, cvt);
|
||||
|
||||
/* let cs = src.collect();
|
||||
|
||||
|
||||
match cs {
|
||||
CollectResult::EOF => {}
|
||||
CollectResult::NotMatches => {}
|
||||
CollectResult::Matches(z) => {
|
||||
z.compareKeyword(&asciiLiteral(b"azboba"));
|
||||
();
|
||||
}
|
||||
}
|
||||
*/
|
||||
for _ in 0..10 {
|
||||
// println!("{}", src.pos());
|
||||
printAscii(src.currentChar());
|
||||
src.nextChar();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
mod _sandbox;
|
||||
mod char;
|
||||
mod converters;
|
||||
mod keyword;
|
||||
|
||||
pub use crate::char::AsciiChar;
|
||||
pub use crate::converters::AsciiCharConvertable;
|
||||
pub use crate::keyword::asciiLiteral;
|
||||
@ -1,11 +0,0 @@
|
||||
[package]
|
||||
name = "source-stream-0-converter-0"
|
||||
edition = "2024"
|
||||
|
||||
[lib]
|
||||
|
||||
[dependencies]
|
||||
source-stream-0 = { path = ".." }
|
||||
|
||||
[lints]
|
||||
rust = { nonstandard_style = "allow" }
|
||||
@ -1,11 +0,0 @@
|
||||
[package]
|
||||
name = "source-stream-0-default-streams-0"
|
||||
edition = "2024"
|
||||
|
||||
[lib]
|
||||
|
||||
[dependencies]
|
||||
source-stream-0 = { path = ".." }
|
||||
|
||||
[lints]
|
||||
rust = { nonstandard_style = "allow" }
|
||||
@ -1,9 +0,0 @@
|
||||
use source_stream_0::Pos;
|
||||
|
||||
pub trait PosCounter<'pos, C: Copy> {
|
||||
type P: Pos<'pos>;
|
||||
|
||||
fn update(&mut self, c: C);
|
||||
|
||||
fn export(&self) -> Self::P;
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
mod iterator;
|
||||
pub use iterator::PosCounter;
|
||||
|
||||
pub mod pos;
|
||||
pub mod iterators;
|
||||
@ -1,7 +0,0 @@
|
||||
mod index;
|
||||
mod newline;
|
||||
mod nop;
|
||||
|
||||
pub use index::IndexPosCounter;
|
||||
pub use newline::PosLineCol;
|
||||
pub use newline::NewLinePosCounter;
|
||||
@ -1,4 +1,4 @@
|
||||
use crate::AsciiChar;
|
||||
use crate::ascii::AsciiChar;
|
||||
|
||||
pub trait AsciiCharConvertable {
|
||||
fn asAsciiChar(&self) -> AsciiChar;
|
||||
@ -1,4 +1,4 @@
|
||||
use crate::{AsciiChar};
|
||||
use crate::ascii::AsciiChar;
|
||||
|
||||
pub const fn asciiLiteral<const S: usize>(
|
||||
str: &[u8; S],
|
||||
@ -6,7 +6,7 @@ pub const fn asciiLiteral<const S: usize>(
|
||||
let mut out: [AsciiChar; S] = [AsciiChar::NOT_ASCII; S];
|
||||
let mut i = 0usize;
|
||||
while i < S {
|
||||
let a = str[i] as u32;
|
||||
let a = str[i] as u32;
|
||||
if a >= 128 {
|
||||
panic!("Not ascii char in literal");
|
||||
}
|
||||
7
src/ascii/mod.rs
Normal file
7
src/ascii/mod.rs
Normal file
@ -0,0 +1,7 @@
|
||||
mod char;
|
||||
mod converters;
|
||||
mod keyword;
|
||||
|
||||
pub use char::AsciiChar;
|
||||
pub use converters::AsciiCharConvertable;
|
||||
pub use keyword::asciiLiteral;
|
||||
@ -1,7 +1,7 @@
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use source_stream_0::{
|
||||
use crate::{
|
||||
CollectedSubstring, Keyword, KeywordComparatorIterator, Pos, Predicate, SourceStream,
|
||||
};
|
||||
use std::marker::PhantomData;
|
||||
@ -1,9 +1,8 @@
|
||||
use crate::iterator::{PosCounter};
|
||||
use source_stream_0::{
|
||||
CollectedSubstring, Keyword, KeywordComparatorIterator, Predicate, SourceStream,
|
||||
};
|
||||
use crate::KeywordComparatorIterator;
|
||||
use std::marker::PhantomData;
|
||||
use std::slice::Iter;
|
||||
use crate::{CollectedSubstring, Keyword, Predicate, SourceStream};
|
||||
use crate::pos::PosCounter;
|
||||
|
||||
pub struct ArrayCollectedSubstring<'source, C> {
|
||||
pub slice: &'source [C],
|
||||
@ -1,6 +1,6 @@
|
||||
use crate::PosCounter;
|
||||
use source_stream_0::{CollectedSubstring, Pos, Predicate, SourceStream};
|
||||
use std::marker::PhantomData;
|
||||
use crate::{CollectedSubstring, Pos, Predicate, SourceStream};
|
||||
use crate::pos::PosCounter;
|
||||
|
||||
pub struct EmptySourceStream<
|
||||
'source,
|
||||
@ -1,9 +1,8 @@
|
||||
use crate::iterator::{PosCounter};
|
||||
use source_stream_0::{
|
||||
CollectedSubstring, Keyword, KeywordComparatorIterator, Predicate, SourceStream,
|
||||
};
|
||||
use crate::KeywordComparatorIterator;
|
||||
use std::marker::PhantomData;
|
||||
use std::str::CharIndices;
|
||||
use crate::{CollectedSubstring, Keyword, Predicate, SourceStream};
|
||||
use crate::pos::PosCounter;
|
||||
|
||||
pub struct StrCollectedSubstring<'source> {
|
||||
pub slice: &'source str,
|
||||
@ -2,6 +2,10 @@
|
||||
|
||||
mod _keyword_impls;
|
||||
mod macros;
|
||||
mod default_streams;
|
||||
mod ascii;
|
||||
mod converter;
|
||||
pub mod pos;
|
||||
|
||||
pub trait Predicate<C: Copy> {
|
||||
fn check(&mut self, chr: C) -> bool;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use crate::iterator::PosCounter;
|
||||
use crate::pos::PosCounter;
|
||||
|
||||
pub struct IndexPosCounter {
|
||||
index: usize,
|
||||
19
src/pos/mod.rs
Normal file
19
src/pos/mod.rs
Normal file
@ -0,0 +1,19 @@
|
||||
use crate::Pos;
|
||||
|
||||
pub trait PosCounter<'pos, C: Copy> {
|
||||
type P: Pos<'pos>;
|
||||
|
||||
fn update(&mut self, c: C);
|
||||
|
||||
fn export(&self) -> Self::P;
|
||||
}
|
||||
|
||||
|
||||
mod index;
|
||||
mod newline;
|
||||
mod nop;
|
||||
|
||||
pub use index::IndexPosCounter;
|
||||
pub use newline::PosLineCol;
|
||||
pub use newline::NewLinePosCounter;
|
||||
pub use nop::NopPosCounter;
|
||||
@ -1,5 +1,5 @@
|
||||
use crate::iterator::PosCounter;
|
||||
use source_stream_0::Pos;
|
||||
use crate::Pos;
|
||||
use crate::pos::PosCounter;
|
||||
|
||||
pub struct PosLineCol {
|
||||
pub row: usize,
|
||||
@ -1,4 +1,5 @@
|
||||
use crate::iterator::PosCounter;
|
||||
use crate::pos::PosCounter;
|
||||
|
||||
pub struct NopPosCounter {}
|
||||
|
||||
impl Default for NopPosCounter {
|
||||
Loading…
Reference in New Issue
Block a user