fix: use patternIgnore(...) in grind syntax (#9158)
This PR fixes the syntax of `grind` modifiers to use `patternIgnore` for cases where both unicode and ascii variants are matched. This fixes an issue where several variants of grind syntax weren't accepted (e.g. `@[grind ← gen]`). Additionally, this reduces the chance that we get another syntax matching bootstrap hell.
This commit is contained in:
parent
7aca460c11
commit
3ede96accc
4 changed files with 13 additions and 13 deletions
|
|
@ -72,11 +72,11 @@ syntax grindGen := ppSpace &"gen"
|
|||
syntax grindEq := "=" (grindGen)?
|
||||
syntax grindEqBoth := atomic("_" "=" "_") (grindGen)?
|
||||
syntax grindEqRhs := atomic("=" "_") (grindGen)?
|
||||
syntax grindEqBwd := atomic("←" "=") <|> atomic("<-" "=")
|
||||
syntax grindBwd := ("←" <|> "<-") (grindGen)?
|
||||
syntax grindFwd := "→" <|> "->"
|
||||
syntax grindRL := "⇐" <|> "<="
|
||||
syntax grindLR := "⇒" <|> "=>"
|
||||
syntax grindEqBwd := patternIgnore(atomic("←" "=") <|> atomic("<-" "="))
|
||||
syntax grindBwd := patternIgnore("←" <|> "<-") (grindGen)?
|
||||
syntax grindFwd := patternIgnore("→" <|> "->")
|
||||
syntax grindRL := patternIgnore("⇐" <|> "<=")
|
||||
syntax grindLR := patternIgnore("⇒" <|> "=>")
|
||||
syntax grindUsr := &"usr"
|
||||
syntax grindCases := &"cases"
|
||||
syntax grindCasesEager := atomic(&"cases" &"eager")
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ import Lean.Elab.MutualDef
|
|||
import Lean.Elab.Tactic.Basic
|
||||
import Lean.Elab.Tactic.Config
|
||||
|
||||
set_option interpreter.prefer_native false -- TODO: remove
|
||||
|
||||
namespace Lean.Elab.Tactic
|
||||
open Meta
|
||||
|
||||
|
|
|
|||
|
|
@ -17,24 +17,22 @@ inductive AttrKind where
|
|||
| infer
|
||||
| ext
|
||||
|
||||
set_option interpreter.prefer_native false -- TODO: remove
|
||||
|
||||
/-- Return theorem kind for `stx` of the form `Attr.grindThmMod` -/
|
||||
def getAttrKindCore (stx : Syntax) : CoreM AttrKind := do
|
||||
match stx with
|
||||
| `(Parser.Attr.grindMod|=) => return .ematch (.eqLhs false)
|
||||
| `(Parser.Attr.grindMod|= gen) => return .ematch (.eqLhs true)
|
||||
| `(Parser.Attr.grindMod|→)
|
||||
| `(Parser.Attr.grindMod|->) => return .ematch .fwd
|
||||
| `(Parser.Attr.grindMod|←)
|
||||
| `(Parser.Attr.grindMod|<-) => return .ematch (.bwd false)
|
||||
| `(Parser.Attr.grindMod|<- gen) => return .ematch (.bwd true)
|
||||
| `(Parser.Attr.grindMod|→) => return .ematch .fwd
|
||||
| `(Parser.Attr.grindMod|←) => return .ematch (.bwd false)
|
||||
| `(Parser.Attr.grindMod|← gen) => return .ematch (.bwd true)
|
||||
| `(Parser.Attr.grindMod|=_) => return .ematch (.eqRhs false)
|
||||
| `(Parser.Attr.grindMod|=_ gen) => return .ematch (.eqRhs true)
|
||||
| `(Parser.Attr.grindMod|_=_) => return .ematch (.eqBoth false)
|
||||
| `(Parser.Attr.grindMod|_=_ gen) => return .ematch (.eqBoth true)
|
||||
| `(Parser.Attr.grindMod|←=) => return .ematch .eqBwd
|
||||
| `(Parser.Attr.grindMod|⇒)
|
||||
| `(Parser.Attr.grindMod|=>) => return .ematch .leftRight
|
||||
| `(Parser.Attr.grindMod|⇐)
|
||||
| `(Parser.Attr.grindMod|<=) => return .ematch .rightLeft
|
||||
| `(Parser.Attr.grindMod|usr) => return .ematch .user
|
||||
| `(Parser.Attr.grindMod|gen) => return .ematch (.default true)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ options get_default_options() {
|
|||
opts = opts.update({"debug", "terminalTacticsAsSorry"}, false);
|
||||
// switch to `true` for ABI-breaking changes affecting meta code;
|
||||
// see also next option!
|
||||
opts = opts.update({"interpreter", "prefer_native"}, false);
|
||||
opts = opts.update({"interpreter", "prefer_native"}, true);
|
||||
// switch to `false` when enabling `prefer_native` should also affect use
|
||||
// of built-in parsers in quotations; this is usually the case, but setting
|
||||
// both to `true` may be necessary for handling non-builtin parsers with
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue