Skip to content

Commit 9b4627d

Browse files
Add new variation of query syntax
Close #18
1 parent e548ac8 commit 9b4627d

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,12 @@ $ curl -X GET \
3636
"localhost:8000/search?scope=set:libstd"
3737
```
3838

39+
## Query Syntax
40+
41+
- `fn f(type) -> type`
42+
- `fn (type) -> type`
43+
- `fn(type) -> type`
44+
- `(type) -> type`
45+
3946
## Related Project
4047
- [cargo-roogle](https://github.com/roogle-rs/cargo-roogle)

roogle-engine/src/query/parse.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ where
3737
{
3838
let (i, f) = opt(tag("fn"))(i)?;
3939
let (i, _) = match f {
40-
Some(_) => multispace1(i)?,
40+
Some(_) => multispace0(i)?,
4141
None => multispace0(i)?,
4242
};
43-
let (i, name) = opt(parse_symbol)(i)?;
43+
let (i, name) = opt(preceded(multispace1, parse_symbol))(i)?;
4444
let (i, decl) = opt(parse_function)(i)?;
4545

4646
let query = Query {

0 commit comments

Comments
 (0)