diff --git a/Cargo.toml b/Cargo.toml index 5b9e848..b12f669 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "source_stream_0" +name = "source-stream-0" edition = "2024" [lib] \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 11e18c1..5af594f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,10 +24,23 @@ pub trait CollectedSubstring { fn compareKeyword(&self, kw: impl _Keyword); } -pub trait SourceStream> { - fn skip(&mut self, predicate: impl Predicate); - fn collect(&mut self, predicate: impl Predicate) -> CS; +pub enum CollectResult { + EOF, + NotMatches, + Matches(T) +} - fn pos(&mut self) -> P; - fn currentChar(&mut self) -> C; -} \ No newline at end of file +pub trait SourceStream> { + /** + * Returns `true` if the end of stream reached. + */ + fn skip(&mut self, predicate: impl Predicate) -> bool; + fn collect(&mut self, predicate: impl Predicate) -> CollectResult; + + fn pos(&self) -> P; + + fn currentChar(&self) -> Option; + fn nextChar(&mut self) -> Option; + + fn isEnded(&self) -> bool; +}