Skip to content

Commit 6afb09c

Browse files
committed
main
1 parent 9f26a25 commit 6afb09c

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Pegy - derive based Parser in Rust
22

3+
[![Docs](https://docs.rs/pegy/badge.svg)](https://docs.rs/pegy)
4+
[![Crates.io](https://img.shields.io/crates/v/pegy)](https://crates.io/crates/pegy)
5+
[![Crates.io](https://img.shields.io/crates/d/pegy)](https://crates.io/crates/pegy)
6+
37
## Features
48
- derive based parser generation
59
- async api for parsing
@@ -58,4 +62,4 @@ pub fn main(){
5862
- `( alternatives )` - group: matches the terms and returns a `Span`.
5963
- `terms | terms | terms` - alternatives: trys to match the first terms, if failed, matches the second one and so on until a match is found. returns a `Span`.
6064
- `!term` - negative lookahead: matches the term without consuming any characters.
61-
- `_ term` - quiet: matches the term and returns `()`.
65+
- `_ term` - quiet: matches the term and returns `()`.

pegy/Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pegy/src/util.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ impl Parse for EOF{
1818
}
1919
}
2020

21+
#[derive(Debug, Default, PartialEq, Eq, Hash)]
22+
pub struct SOF;
23+
24+
impl Parse for SOF{
25+
type Output = ();
26+
async fn parse<S:crate::Source>(src: &mut S) -> Result<Self::Output, Error> {
27+
if src.current_position() != 0{
28+
let pos = src.current_position();
29+
return Err(Error::new(Span::new(pos, pos), "expected EOF"));
30+
}
31+
return Ok(())
32+
}
33+
}
34+
2135
#[derive(Debug, Default, PartialEq, Eq, Hash)]
2236
pub struct MatchChar<const CH: char>;
2337

0 commit comments

Comments
 (0)