Collapsed all crates to root since they anyway don't use any dependencies except stdlib

This commit is contained in:
Andrew Golovashevich 2025-11-19 01:35:38 +03:00
parent 1200f99e38
commit 856bb308d9
23 changed files with 47 additions and 164 deletions

View File

@ -5,7 +5,6 @@ edition = "2024"
[lib] [lib]
[workspace] [workspace]
members = ["default-streams", "converter", "ascii"]
[lints] [lints]
rust = { nonstandard_style = "allow" } rust = { nonstandard_style = "allow" }

View File

@ -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" }

View File

@ -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();
}
}

View File

@ -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;

View File

@ -1,11 +0,0 @@
[package]
name = "source-stream-0-converter-0"
edition = "2024"
[lib]
[dependencies]
source-stream-0 = { path = ".." }
[lints]
rust = { nonstandard_style = "allow" }

View File

@ -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" }

View File

@ -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;
}

View File

@ -1,5 +0,0 @@
mod iterator;
pub use iterator::PosCounter;
pub mod pos;
pub mod iterators;

View File

@ -1,7 +0,0 @@
mod index;
mod newline;
mod nop;
pub use index::IndexPosCounter;
pub use newline::PosLineCol;
pub use newline::NewLinePosCounter;

View File

@ -1,4 +1,4 @@
use crate::AsciiChar; use crate::ascii::AsciiChar;
pub trait AsciiCharConvertable { pub trait AsciiCharConvertable {
fn asAsciiChar(&self) -> AsciiChar; fn asAsciiChar(&self) -> AsciiChar;

View File

@ -1,4 +1,4 @@
use crate::{AsciiChar}; use crate::ascii::AsciiChar;
pub const fn asciiLiteral<const S: usize>( pub const fn asciiLiteral<const S: usize>(
str: &[u8; S], str: &[u8; S],

7
src/ascii/mod.rs Normal file
View File

@ -0,0 +1,7 @@
mod char;
mod converters;
mod keyword;
pub use char::AsciiChar;
pub use converters::AsciiCharConvertable;
pub use keyword::asciiLiteral;

View File

@ -1,7 +1,7 @@
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
#![allow(non_snake_case)] #![allow(non_snake_case)]
use source_stream_0::{ use crate::{
CollectedSubstring, Keyword, KeywordComparatorIterator, Pos, Predicate, SourceStream, CollectedSubstring, Keyword, KeywordComparatorIterator, Pos, Predicate, SourceStream,
}; };
use std::marker::PhantomData; use std::marker::PhantomData;

View File

@ -1,9 +1,8 @@
use crate::iterator::{PosCounter}; use crate::KeywordComparatorIterator;
use source_stream_0::{
CollectedSubstring, Keyword, KeywordComparatorIterator, Predicate, SourceStream,
};
use std::marker::PhantomData; use std::marker::PhantomData;
use std::slice::Iter; use std::slice::Iter;
use crate::{CollectedSubstring, Keyword, Predicate, SourceStream};
use crate::pos::PosCounter;
pub struct ArrayCollectedSubstring<'source, C> { pub struct ArrayCollectedSubstring<'source, C> {
pub slice: &'source [C], pub slice: &'source [C],

View File

@ -1,6 +1,6 @@
use crate::PosCounter;
use source_stream_0::{CollectedSubstring, Pos, Predicate, SourceStream};
use std::marker::PhantomData; use std::marker::PhantomData;
use crate::{CollectedSubstring, Pos, Predicate, SourceStream};
use crate::pos::PosCounter;
pub struct EmptySourceStream< pub struct EmptySourceStream<
'source, 'source,

View File

@ -1,9 +1,8 @@
use crate::iterator::{PosCounter}; use crate::KeywordComparatorIterator;
use source_stream_0::{
CollectedSubstring, Keyword, KeywordComparatorIterator, Predicate, SourceStream,
};
use std::marker::PhantomData; use std::marker::PhantomData;
use std::str::CharIndices; use std::str::CharIndices;
use crate::{CollectedSubstring, Keyword, Predicate, SourceStream};
use crate::pos::PosCounter;
pub struct StrCollectedSubstring<'source> { pub struct StrCollectedSubstring<'source> {
pub slice: &'source str, pub slice: &'source str,

View File

@ -2,6 +2,10 @@
mod _keyword_impls; mod _keyword_impls;
mod macros; mod macros;
mod default_streams;
mod ascii;
mod converter;
pub mod pos;
pub trait Predicate<C: Copy> { pub trait Predicate<C: Copy> {
fn check(&mut self, chr: C) -> bool; fn check(&mut self, chr: C) -> bool;

View File

@ -1,4 +1,4 @@
use crate::iterator::PosCounter; use crate::pos::PosCounter;
pub struct IndexPosCounter { pub struct IndexPosCounter {
index: usize, index: usize,

19
src/pos/mod.rs Normal file
View 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;

View File

@ -1,5 +1,5 @@
use crate::iterator::PosCounter; use crate::Pos;
use source_stream_0::Pos; use crate::pos::PosCounter;
pub struct PosLineCol { pub struct PosLineCol {
pub row: usize, pub row: usize,

View File

@ -1,4 +1,5 @@
use crate::iterator::PosCounter; use crate::pos::PosCounter;
pub struct NopPosCounter {} pub struct NopPosCounter {}
impl Default for NopPosCounter { impl Default for NopPosCounter {