From 7be7855f926003b79f5c327ad3d81a015d510125 Mon Sep 17 00:00:00 2001 From: Asuka Minato Date: Sat, 13 Jul 2024 22:48:38 +0900 Subject: [PATCH 1/4] fix part of https://github.com/roogle-rs/roogle/issues/18 --- roogle-engine/src/query/parse.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roogle-engine/src/query/parse.rs b/roogle-engine/src/query/parse.rs index a336a68..f9ee3b4 100644 --- a/roogle-engine/src/query/parse.rs +++ b/roogle-engine/src/query/parse.rs @@ -2,7 +2,7 @@ use nom::{ branch::alt, bytes::complete::{tag, take_while1}, character::complete::char, - character::complete::{alpha1, alphanumeric1, multispace0, multispace1}, + character::complete::{alpha1, alphanumeric1, multispace0}, combinator::{eof, fail, map, not, opt, recognize, value}, error::{ContextError, ParseError}, multi::{many0, separated_list0}, @@ -37,7 +37,7 @@ 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)?; From 0ba1c451c915cb5b84cfb520cdb5205fb719cdea Mon Sep 17 00:00:00 2001 From: Asuka Minato Date: Sat, 13 Jul 2024 23:12:02 +0900 Subject: [PATCH 2/4] fix space --- roogle-engine/src/query/parse.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roogle-engine/src/query/parse.rs b/roogle-engine/src/query/parse.rs index f9ee3b4..a1b646f 100644 --- a/roogle-engine/src/query/parse.rs +++ b/roogle-engine/src/query/parse.rs @@ -40,7 +40,7 @@ where 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 { From acedd385ed6f73c8e897007c5d12105fda0b1a68 Mon Sep 17 00:00:00 2001 From: Asuka Minato Date: Sat, 13 Jul 2024 23:28:53 +0900 Subject: [PATCH 3/4] add query syntax in readme fix all #18 --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 8805897..3ec91e1 100644 --- a/README.md +++ b/README.md @@ -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) From 6e1a6dc0c749ffb03e3f03c4befec5bf246aea55 Mon Sep 17 00:00:00 2001 From: Asuka Minato Date: Tue, 23 Jul 2024 02:30:29 +0900 Subject: [PATCH 4/4] fix missing import --- roogle-engine/src/query/parse.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roogle-engine/src/query/parse.rs b/roogle-engine/src/query/parse.rs index a1b646f..88c0760 100644 --- a/roogle-engine/src/query/parse.rs +++ b/roogle-engine/src/query/parse.rs @@ -2,7 +2,7 @@ use nom::{ branch::alt, bytes::complete::{tag, take_while1}, character::complete::char, - character::complete::{alpha1, alphanumeric1, multispace0}, + character::complete::{alpha1, alphanumeric1, multispace0, multispace1}, combinator::{eof, fail, map, not, opt, recognize, value}, error::{ContextError, ParseError}, multi::{many0, separated_list0},