Skip to content

Commit

Permalink
Merge pull request #7 from leanprover-community/loogle_nonreserved
Browse files Browse the repository at this point in the history
loogle syntax with nonreserved
  • Loading branch information
siddhartha-gadgil authored Sep 18, 2024
2 parents 3e9460c + ef3288d commit 565ce2c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion LeanSearchClient.lean
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
-- Import modules here that should be built as part of the library.
import LeanSearchClient.Basic
import LeanSearchClient.Syntax
-- import LeanSearchClient.LoogleSyntax
import LeanSearchClient.LoogleSyntax
8 changes: 7 additions & 1 deletion LeanSearchClient/LoogleSyntax.lean
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Siddhartha Gadgil
-/
import Lean.Elab.Tactic.Meta
import Lean.Parser.Basic
import Lean.Meta.Tactic.TryThis
import LeanSearchClient.Basic
import LeanSearchClient.Syntax
Expand Down Expand Up @@ -126,8 +127,13 @@ If you pass more than one such search filter, separated by commas Loogle will re
🔍 Real.sin, \"two\", tsum, _ * _, _ ^ _, |- _ < _ → _
woould find all lemmas which mention the constants Real.sin and tsum, have \"two\" as a substring of the lemma name, include a product and a power somewhere in the type, and have a hypothesis of the form _ < _ (if there were any such lemmas). Metavariables (?a) are assigned independently in each filter."

open Lean.Parser
private def unicode_turnstile := nonReservedSymbol "⊢ "
private def ascii_turnstile := nonReservedSymbol "|- "

/-- The turnstyle uesd bin `#find`, unicode or ascii allowed -/
syntax turnstyle := patternIgnore("⊢ " <|> "|- ")
syntax turnstyle := patternIgnore(unicode_turnstile <|> ascii_turnstile)

/-- a single `#find` filter. The `term` can also be an ident or a strlit,
these are distinguished in `parseFindFilters` -/
syntax loogle_filter := (turnstyle term) <|> term
Expand Down
2 changes: 0 additions & 2 deletions LeanSearchClientTest/LoogleExamples.lean
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,3 @@ set_option loogle.queries 1
example : 35 := by
#loogle Nat.succ_le_succ
sorry

#loogle List ?a → ?b

0 comments on commit 565ce2c

Please sign in to comment.