chore: avoid reserved name
TODO: update state0 and cleanup
This commit is contained in:
parent
8d2adf521d
commit
2c8fd7fb95
5 changed files with 13 additions and 7 deletions
|
|
@ -42,7 +42,8 @@ private def isNamedDef (stx : Syntax) : Bool :=
|
|||
let decl := stx[1]
|
||||
let k := decl.getKind
|
||||
k == ``Lean.Parser.Command.abbrev ||
|
||||
k == ``Lean.Parser.Command.def ||
|
||||
k == ``Lean.Parser.Command.definition ||
|
||||
k == ``Lean.Parser.Command.def || -- TODO: delete
|
||||
k == ``Lean.Parser.Command.theorem ||
|
||||
k == ``Lean.Parser.Command.opaque ||
|
||||
k == ``Lean.Parser.Command.axiom ||
|
||||
|
|
|
|||
|
|
@ -142,7 +142,8 @@ def mkDefViewOfExample (modifiers : Modifiers) (stx : Syntax) : DefView :=
|
|||
def isDefLike (stx : Syntax) : Bool :=
|
||||
let declKind := stx.getKind
|
||||
declKind == ``Parser.Command.abbrev ||
|
||||
declKind == ``Parser.Command.def ||
|
||||
declKind == ``Parser.Command.definition ||
|
||||
declKind == ``Parser.Command.def || -- TODO: delete
|
||||
declKind == ``Parser.Command.theorem ||
|
||||
declKind == ``Parser.Command.opaque ||
|
||||
declKind == ``Parser.Command.instance ||
|
||||
|
|
@ -152,7 +153,9 @@ def mkDefView (modifiers : Modifiers) (stx : Syntax) : CommandElabM DefView :=
|
|||
let declKind := stx.getKind
|
||||
if declKind == ``Parser.Command.«abbrev» then
|
||||
return mkDefViewOfAbbrev modifiers stx
|
||||
else if declKind == ``Parser.Command.def then
|
||||
else if declKind == ``Parser.Command.definition then
|
||||
return mkDefViewOfDef modifiers stx
|
||||
else if declKind == ``Parser.Command.def then -- TODO: delete
|
||||
return mkDefViewOfDef modifiers stx
|
||||
else if declKind == ``Parser.Command.theorem then
|
||||
return mkDefViewOfTheorem modifiers stx
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ def declModifiersPubNoDoc (mods : Syntax) : Bool :=
|
|||
|
||||
def lintDeclHead (k : SyntaxNodeKind) (id : Syntax) : CommandElabM Unit := do
|
||||
if k == ``«abbrev» then lintNamed id "public abbrev"
|
||||
else if k == ``«def» then lintNamed id "public def"
|
||||
else if k == ``definition then lintNamed id "public def"
|
||||
else if k == ``«opaque» then lintNamed id "public opaque"
|
||||
else if k == ``«axiom» then lintNamed id "public axiom"
|
||||
else if k == ``«inductive» then lintNamed id "public inductive"
|
||||
|
|
|
|||
|
|
@ -114,7 +114,9 @@ def «abbrev» := leading_parser
|
|||
"abbrev " >> declId >> ppIndent optDeclSig >> declVal
|
||||
def optDefDeriving :=
|
||||
optional (ppDedent ppLine >> atomic ("deriving " >> notSymbol "instance") >> sepBy1 ident ", ")
|
||||
def «def» := leading_parser
|
||||
def definition := leading_parser
|
||||
"def " >> recover declId skipUntilWsOrDelim >> ppIndent optDeclSig >> declVal >> optDefDeriving
|
||||
def «def» := leading_parser -- TODO: delete
|
||||
"def " >> recover declId skipUntilWsOrDelim >> ppIndent optDeclSig >> declVal >> optDefDeriving
|
||||
def «theorem» := leading_parser
|
||||
"theorem " >> recover declId skipUntilWsOrDelim >> ppIndent declSig >> declVal
|
||||
|
|
@ -198,7 +200,7 @@ def «structure» := leading_parser
|
|||
optDeriving
|
||||
@[builtin_command_parser] def declaration := leading_parser
|
||||
declModifiers false >>
|
||||
(«abbrev» <|> «def» <|> «theorem» <|> «opaque» <|> «instance» <|> «axiom» <|> «example» <|>
|
||||
(«abbrev» <|> definition <|> «def» <|> «theorem» <|> «opaque» <|> «instance» <|> «axiom» <|> «example» <|>
|
||||
«inductive» <|> classInductive <|> «structure»)
|
||||
@[builtin_command_parser] def «deriving» := leading_parser
|
||||
"deriving " >> "instance " >> derivingClasses >> " for " >> sepBy1 (recover ident skip) ", "
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ options get_default_options() {
|
|||
// switch to `true` for ABI-breaking changes affecting meta code
|
||||
opts = opts.update({"interpreter", "prefer_native"}, false);
|
||||
// switch to `true` for changing built-in parsers used in quotations
|
||||
opts = opts.update({"internal", "parseQuotWithCurrentStage"}, false);
|
||||
opts = opts.update({"internal", "parseQuotWithCurrentStage"}, true);
|
||||
// toggling `parseQuotWithCurrentStage` may also require toggling the following option if macros/syntax
|
||||
// with custom precheck hooks were affected
|
||||
opts = opts.update({"quotPrecheck"}, true);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue