Skip to content

Commit

Permalink
Add new variation of query syntax
Browse files Browse the repository at this point in the history
Close #18
  • Loading branch information
asukaminato0721 authored Aug 5, 2024
1 parent e548ac8 commit 9b4627d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,12 @@ $ curl -X GET \
"localhost:8000/search?scope=set:libstd"
```

## Query Syntax

- `fn f(type) -> type`
- `fn (type) -> type`
- `fn(type) -> type`
- `(type) -> type`

## Related Project
- [cargo-roogle](https://github.com/roogle-rs/cargo-roogle)
4 changes: 2 additions & 2 deletions roogle-engine/src/query/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ where
{
let (i, f) = opt(tag("fn"))(i)?;
let (i, _) = match f {
Some(_) => multispace1(i)?,
Some(_) => multispace0(i)?,
None => multispace0(i)?,
};
let (i, name) = opt(parse_symbol)(i)?;
let (i, name) = opt(preceded(multispace1, parse_symbol))(i)?;
let (i, decl) = opt(parse_function)(i)?;

let query = Query {
Expand Down

0 comments on commit 9b4627d

Please sign in to comment.