Skip to content

Commit

Permalink
loogle syntax with nonreserved
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhartha-gadgil committed Sep 18, 2024
1 parent 3e9460c commit 860de61
Show file tree
Hide file tree
Showing 3 changed files with 10 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
10 changes: 9 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,15 @@ 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."

#check Lean.Parser.nonReservedSymbol

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 860de61

Please sign in to comment.