diff --git a/stage0/src/Lean/Elab.lean b/stage0/src/Lean/Elab.lean index f53a128296..537b9c061b 100644 --- a/stage0/src/Lean/Elab.lean +++ b/stage0/src/Lean/Elab.lean @@ -25,3 +25,4 @@ import Lean.Elab.Structure import Lean.Elab.Print import Lean.Elab.MutualDef import Lean.Elab.PreDefinition +import Lean.Elab.Deriving diff --git a/stage0/src/Lean/Elab/Deriving.lean b/stage0/src/Lean/Elab/Deriving.lean new file mode 100644 index 0000000000..79cfa2577c --- /dev/null +++ b/stage0/src/Lean/Elab/Deriving.lean @@ -0,0 +1,6 @@ +/- +Copyright (c) 2020 Microsoft Corporation. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Leonardo de Moura +-/ +import Lean.Elab.Deriving.Basic diff --git a/stage0/src/Lean/Elab/Deriving/Basic.lean b/stage0/src/Lean/Elab/Deriving/Basic.lean new file mode 100644 index 0000000000..7beb00532f --- /dev/null +++ b/stage0/src/Lean/Elab/Deriving/Basic.lean @@ -0,0 +1,38 @@ +/- +Copyright (c) 2020 Microsoft Corporation. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +Authors: Leonardo de Moura +-/ +import Lean.Elab.Command + +namespace Lean +namespace Elab +open Command + +def DerivingHandler := (typeNames : List Name) → CommandElabM Bool + +builtin_initialize derivingHandlersRef : IO.Ref (NameMap DerivingHandler) ← IO.mkRef {} + +def registerBuiltinDerivingHandler (className : Name) (handler : DerivingHandler) : IO Unit := do + let initializing ← IO.initializing + unless initializing do + throw (IO.userError "failed to register deriving handler, it can only be registered during initialization") + if (← derivingHandlersRef.get).contains className then + throw (IO.userError s!"failed to register deriving handler, a handler has already been registered for '{className}'") + derivingHandlersRef.modify fun m => m.insert className handler + +def defaultHandler (className : Name) (typeNames : List Name) : CommandElabM Unit := do + throwError! "default handlers have not been implemented yet, {typeNames}" + +def applyDerivingHandlers (className : Name) (typeNames : List Name) : CommandElabM Unit := do + match (← derivingHandlersRef.get).find? className with + | some handler => + unless (← handler typeNames) do + defaultHandler className typeNames + | none => defaultHandler className typeNames + + + + +end Elab +end Lean diff --git a/stage0/src/Lean/Parser/Command.lean b/stage0/src/Lean/Parser/Command.lean index b369b9b056..1a3a816cee 100644 --- a/stage0/src/Lean/Parser/Command.lean +++ b/stage0/src/Lean/Parser/Command.lean @@ -65,7 +65,7 @@ def «structure» := parser! >> optDeriving @[builtinCommandParser] def declaration := parser! declModifiers false >> («abbrev» <|> «def» <|> «theorem» <|> «constant» <|> «instance» <|> «axiom» <|> «example» <|> «inductive» <|> classInductive <|> «structure») -@[builtinCommandParser] def «deriving» := parser! "deriving " >> "instance " >> sepBy1 ident ", " >> " for " >> ident +@[builtinCommandParser] def «deriving» := parser! "deriving " >> "instance " >> sepBy1 ident ", " >> " for " >> sepBy1 ident ", " @[builtinCommandParser] def «section» := parser! "section " >> optional ident @[builtinCommandParser] def «namespace» := parser! "namespace " >> ident @[builtinCommandParser] def «end» := parser! "end " >> optional ident diff --git a/stage0/stdlib/CMakeLists.txt b/stage0/stdlib/CMakeLists.txt index f7755c84da..e8cf73b60f 100644 --- a/stage0/stdlib/CMakeLists.txt +++ b/stage0/stdlib/CMakeLists.txt @@ -1 +1 @@ -add_library (stage0 OBJECT ./Init.c ./Init/Classical.c ./Init/Coe.c ./Init/Control.c ./Init/Control/Basic.c ./Init/Control/EState.c ./Init/Control/Except.c ./Init/Control/Id.c ./Init/Control/Option.c ./Init/Control/Reader.c ./Init/Control/State.c ./Init/Control/StateRef.c ./Init/Core.c ./Init/Data.c ./Init/Data/Array.c ./Init/Data/Array/Basic.c ./Init/Data/Array/BinSearch.c ./Init/Data/Array/QSort.c ./Init/Data/Array/Subarray.c ./Init/Data/Basic.c ./Init/Data/ByteArray.c ./Init/Data/ByteArray/Basic.c ./Init/Data/Char.c ./Init/Data/Char/Basic.c ./Init/Data/Fin.c ./Init/Data/Fin/Basic.c ./Init/Data/Float.c ./Init/Data/FloatArray.c ./Init/Data/FloatArray/Basic.c ./Init/Data/Hashable.c ./Init/Data/Int.c ./Init/Data/Int/Basic.c ./Init/Data/List.c ./Init/Data/List/Basic.c ./Init/Data/List/BasicAux.c ./Init/Data/List/Control.c ./Init/Data/Nat.c ./Init/Data/Nat/Basic.c ./Init/Data/Nat/Bitwise.c ./Init/Data/Nat/Control.c ./Init/Data/Nat/Div.c ./Init/Data/OfScientific.c ./Init/Data/Option.c ./Init/Data/Option/Basic.c ./Init/Data/Option/BasicAux.c ./Init/Data/Option/Instances.c ./Init/Data/Random.c ./Init/Data/Range.c ./Init/Data/Repr.c ./Init/Data/String.c ./Init/Data/String/Basic.c ./Init/Data/String/Extra.c ./Init/Data/ToString.c ./Init/Data/ToString/Basic.c ./Init/Data/ToString/Macro.c ./Init/Data/UInt.c ./Init/Fix.c ./Init/Meta.c ./Init/Notation.c ./Init/NotationExtra.c ./Init/Prelude.c ./Init/SizeOf.c ./Init/System.c ./Init/System/FilePath.c ./Init/System/IO.c ./Init/System/IOError.c ./Init/System/Platform.c ./Init/System/ST.c ./Init/Util.c ./Init/WF.c ./Lean.c ./Lean/Attributes.c ./Lean/AuxRecursor.c ./Lean/Class.c ./Lean/Compiler.c ./Lean/Compiler/BorrowedAnnotation.c ./Lean/Compiler/ClosedTermCache.c ./Lean/Compiler/ConstFolding.c ./Lean/Compiler/ExportAttr.c ./Lean/Compiler/ExternAttr.c ./Lean/Compiler/IR.c ./Lean/Compiler/IR/Basic.c ./Lean/Compiler/IR/Borrow.c ./Lean/Compiler/IR/Boxing.c ./Lean/Compiler/IR/Checker.c ./Lean/Compiler/IR/CompilerM.c ./Lean/Compiler/IR/CtorLayout.c ./Lean/Compiler/IR/ElimDeadBranches.c ./Lean/Compiler/IR/ElimDeadVars.c ./Lean/Compiler/IR/EmitC.c ./Lean/Compiler/IR/EmitUtil.c ./Lean/Compiler/IR/ExpandResetReuse.c ./Lean/Compiler/IR/Format.c ./Lean/Compiler/IR/FreeVars.c ./Lean/Compiler/IR/LiveVars.c ./Lean/Compiler/IR/NormIds.c ./Lean/Compiler/IR/PushProj.c ./Lean/Compiler/IR/RC.c ./Lean/Compiler/IR/ResetReuse.c ./Lean/Compiler/IR/SimpCase.c ./Lean/Compiler/IR/UnboxResult.c ./Lean/Compiler/ImplementedByAttr.c ./Lean/Compiler/InitAttr.c ./Lean/Compiler/InlineAttrs.c ./Lean/Compiler/NameMangling.c ./Lean/Compiler/NeverExtractAttr.c ./Lean/Compiler/Specialize.c ./Lean/Compiler/Util.c ./Lean/CoreM.c ./Lean/Data.c ./Lean/Data/Format.c ./Lean/Data/Json.c ./Lean/Data/Json/Basic.c ./Lean/Data/Json/FromToJson.c ./Lean/Data/Json/Parser.c ./Lean/Data/Json/Printer.c ./Lean/Data/Json/Stream.c ./Lean/Data/JsonRpc.c ./Lean/Data/KVMap.c ./Lean/Data/LBool.c ./Lean/Data/LOption.c ./Lean/Data/Lsp.c ./Lean/Data/Lsp/Basic.c ./Lean/Data/Lsp/Capabilities.c ./Lean/Data/Lsp/Communication.c ./Lean/Data/Lsp/Diagnostics.c ./Lean/Data/Lsp/Hover.c ./Lean/Data/Lsp/InitShutdown.c ./Lean/Data/Lsp/TextSync.c ./Lean/Data/Lsp/Utf16.c ./Lean/Data/Lsp/Workspace.c ./Lean/Data/Name.c ./Lean/Data/NameTrie.c ./Lean/Data/Occurrences.c ./Lean/Data/OpenDecl.c ./Lean/Data/Options.c ./Lean/Data/Position.c ./Lean/Data/PrefixTree.c ./Lean/Data/SMap.c ./Lean/Data/Trie.c ./Lean/Declaration.c ./Lean/Elab.c ./Lean/Elab/App.c ./Lean/Elab/Attributes.c ./Lean/Elab/Binders.c ./Lean/Elab/BuiltinNotation.c ./Lean/Elab/CollectFVars.c ./Lean/Elab/Command.c ./Lean/Elab/DeclModifiers.c ./Lean/Elab/DeclUtil.c ./Lean/Elab/Declaration.c ./Lean/Elab/DefView.c ./Lean/Elab/Do.c ./Lean/Elab/Exception.c ./Lean/Elab/Frontend.c ./Lean/Elab/Import.c ./Lean/Elab/Inductive.c ./Lean/Elab/LetRec.c ./Lean/Elab/Level.c ./Lean/Elab/Log.c ./Lean/Elab/Match.c ./Lean/Elab/MutualDef.c ./Lean/Elab/PreDefinition.c ./Lean/Elab/PreDefinition/Basic.c ./Lean/Elab/PreDefinition/Main.c ./Lean/Elab/PreDefinition/MkInhabitant.c ./Lean/Elab/PreDefinition/Structural.c ./Lean/Elab/PreDefinition/WF.c ./Lean/Elab/Print.c ./Lean/Elab/Quotation.c ./Lean/Elab/Quotation/Util.c ./Lean/Elab/StructInst.c ./Lean/Elab/Structure.c ./Lean/Elab/Syntax.c ./Lean/Elab/SyntheticMVars.c ./Lean/Elab/Tactic.c ./Lean/Elab/Tactic/Basic.c ./Lean/Elab/Tactic/Binders.c ./Lean/Elab/Tactic/ElabTerm.c ./Lean/Elab/Tactic/Generalize.c ./Lean/Elab/Tactic/Induction.c ./Lean/Elab/Tactic/Injection.c ./Lean/Elab/Tactic/Location.c ./Lean/Elab/Tactic/Match.c ./Lean/Elab/Tactic/Rewrite.c ./Lean/Elab/Term.c ./Lean/Elab/Util.c ./Lean/Environment.c ./Lean/Eval.c ./Lean/Exception.c ./Lean/Expr.c ./Lean/HeadIndex.c ./Lean/Hygiene.c ./Lean/InternalExceptionId.c ./Lean/KeyedDeclsAttribute.c ./Lean/Level.c ./Lean/LocalContext.c ./Lean/Message.c ./Lean/Meta.c ./Lean/Meta/AbstractMVars.c ./Lean/Meta/AbstractNestedProofs.c ./Lean/Meta/AppBuilder.c ./Lean/Meta/Basic.c ./Lean/Meta/Check.c ./Lean/Meta/Closure.c ./Lean/Meta/CollectMVars.c ./Lean/Meta/DiscrTree.c ./Lean/Meta/DiscrTreeTypes.c ./Lean/Meta/ExprDefEq.c ./Lean/Meta/ForEachExpr.c ./Lean/Meta/FunInfo.c ./Lean/Meta/GeneralizeTelescope.c ./Lean/Meta/GetConst.c ./Lean/Meta/InferType.c ./Lean/Meta/Instances.c ./Lean/Meta/KAbstract.c ./Lean/Meta/LevelDefEq.c ./Lean/Meta/Match.c ./Lean/Meta/Match/Basic.c ./Lean/Meta/Match/CaseArraySizes.c ./Lean/Meta/Match/CaseValues.c ./Lean/Meta/Match/MVarRenaming.c ./Lean/Meta/Match/Match.c ./Lean/Meta/Match/MatchPatternAttr.c ./Lean/Meta/Match/MatcherInfo.c ./Lean/Meta/MatchUtil.c ./Lean/Meta/Offset.c ./Lean/Meta/PPGoal.c ./Lean/Meta/RecursorInfo.c ./Lean/Meta/Reduce.c ./Lean/Meta/ReduceEval.c ./Lean/Meta/SynthInstance.c ./Lean/Meta/Tactic.c ./Lean/Meta/Tactic/Apply.c ./Lean/Meta/Tactic/Assert.c ./Lean/Meta/Tactic/Assumption.c ./Lean/Meta/Tactic/Cases.c ./Lean/Meta/Tactic/Clear.c ./Lean/Meta/Tactic/Constructor.c ./Lean/Meta/Tactic/Delta.c ./Lean/Meta/Tactic/ElimInfo.c ./Lean/Meta/Tactic/FVarSubst.c ./Lean/Meta/Tactic/Generalize.c ./Lean/Meta/Tactic/Induction.c ./Lean/Meta/Tactic/Injection.c ./Lean/Meta/Tactic/Intro.c ./Lean/Meta/Tactic/Replace.c ./Lean/Meta/Tactic/Revert.c ./Lean/Meta/Tactic/Rewrite.c ./Lean/Meta/Tactic/Subst.c ./Lean/Meta/Tactic/Util.c ./Lean/Meta/Transform.c ./Lean/Meta/TransparencyMode.c ./Lean/Meta/UnificationHint.c ./Lean/Meta/WHNF.c ./Lean/MetavarContext.c ./Lean/Modifiers.c ./Lean/MonadEnv.c ./Lean/Parser.c ./Lean/Parser/Basic.c ./Lean/Parser/Command.c ./Lean/Parser/Do.c ./Lean/Parser/Extension.c ./Lean/Parser/Extra.c ./Lean/Parser/Level.c ./Lean/Parser/Module.c ./Lean/Parser/StrInterpolation.c ./Lean/Parser/Syntax.c ./Lean/Parser/Tactic.c ./Lean/Parser/Term.c ./Lean/Parser/Transform.c ./Lean/ParserCompiler.c ./Lean/ParserCompiler/Attribute.c ./Lean/PrettyPrinter.c ./Lean/PrettyPrinter/Basic.c ./Lean/PrettyPrinter/Delaborator.c ./Lean/PrettyPrinter/Delaborator/Basic.c ./Lean/PrettyPrinter/Delaborator/Builtins.c ./Lean/PrettyPrinter/Formatter.c ./Lean/PrettyPrinter/Parenthesizer.c ./Lean/ProjFns.c ./Lean/ReducibilityAttrs.c ./Lean/ResolveName.c ./Lean/Runtime.c ./Lean/ScopedEnvExtension.c ./Lean/Server.c ./Lean/Server/ServerBin.c ./Lean/Server/Snapshots.c ./Lean/Structure.c ./Lean/Syntax.c ./Lean/ToExpr.c ./Lean/Util.c ./Lean/Util/CollectFVars.c ./Lean/Util/CollectLevelParams.c ./Lean/Util/CollectMVars.c ./Lean/Util/Constructions.c ./Lean/Util/FindExpr.c ./Lean/Util/FindMVar.c ./Lean/Util/FoldConsts.c ./Lean/Util/ForEachExpr.c ./Lean/Util/MonadCache.c ./Lean/Util/PPExt.c ./Lean/Util/Path.c ./Lean/Util/Profile.c ./Lean/Util/RecDepth.c ./Lean/Util/Recognizers.c ./Lean/Util/ReplaceExpr.c ./Lean/Util/ReplaceLevel.c ./Lean/Util/SCC.c ./Lean/Util/Sorry.c ./Lean/Util/Trace.c ./Std.c ./Std/Data.c ./Std/Data/AssocList.c ./Std/Data/BinomialHeap.c ./Std/Data/DList.c ./Std/Data/HashMap.c ./Std/Data/HashSet.c ./Std/Data/PersistentArray.c ./Std/Data/PersistentHashMap.c ./Std/Data/PersistentHashSet.c ./Std/Data/Queue.c ./Std/Data/RBMap.c ./Std/Data/RBTree.c ./Std/Data/Stack.c ./Std/ShareCommon.c ) +add_library (stage0 OBJECT ./Init.c ./Init/Classical.c ./Init/Coe.c ./Init/Control.c ./Init/Control/Basic.c ./Init/Control/EState.c ./Init/Control/Except.c ./Init/Control/Id.c ./Init/Control/Option.c ./Init/Control/Reader.c ./Init/Control/State.c ./Init/Control/StateRef.c ./Init/Core.c ./Init/Data.c ./Init/Data/Array.c ./Init/Data/Array/Basic.c ./Init/Data/Array/BinSearch.c ./Init/Data/Array/QSort.c ./Init/Data/Array/Subarray.c ./Init/Data/Basic.c ./Init/Data/ByteArray.c ./Init/Data/ByteArray/Basic.c ./Init/Data/Char.c ./Init/Data/Char/Basic.c ./Init/Data/Fin.c ./Init/Data/Fin/Basic.c ./Init/Data/Float.c ./Init/Data/FloatArray.c ./Init/Data/FloatArray/Basic.c ./Init/Data/Hashable.c ./Init/Data/Int.c ./Init/Data/Int/Basic.c ./Init/Data/List.c ./Init/Data/List/Basic.c ./Init/Data/List/BasicAux.c ./Init/Data/List/Control.c ./Init/Data/Nat.c ./Init/Data/Nat/Basic.c ./Init/Data/Nat/Bitwise.c ./Init/Data/Nat/Control.c ./Init/Data/Nat/Div.c ./Init/Data/OfScientific.c ./Init/Data/Option.c ./Init/Data/Option/Basic.c ./Init/Data/Option/BasicAux.c ./Init/Data/Option/Instances.c ./Init/Data/Random.c ./Init/Data/Range.c ./Init/Data/Repr.c ./Init/Data/String.c ./Init/Data/String/Basic.c ./Init/Data/String/Extra.c ./Init/Data/ToString.c ./Init/Data/ToString/Basic.c ./Init/Data/ToString/Macro.c ./Init/Data/UInt.c ./Init/Fix.c ./Init/Meta.c ./Init/Notation.c ./Init/NotationExtra.c ./Init/Prelude.c ./Init/SizeOf.c ./Init/System.c ./Init/System/FilePath.c ./Init/System/IO.c ./Init/System/IOError.c ./Init/System/Platform.c ./Init/System/ST.c ./Init/Util.c ./Init/WF.c ./Lean.c ./Lean/Attributes.c ./Lean/AuxRecursor.c ./Lean/Class.c ./Lean/Compiler.c ./Lean/Compiler/BorrowedAnnotation.c ./Lean/Compiler/ClosedTermCache.c ./Lean/Compiler/ConstFolding.c ./Lean/Compiler/ExportAttr.c ./Lean/Compiler/ExternAttr.c ./Lean/Compiler/IR.c ./Lean/Compiler/IR/Basic.c ./Lean/Compiler/IR/Borrow.c ./Lean/Compiler/IR/Boxing.c ./Lean/Compiler/IR/Checker.c ./Lean/Compiler/IR/CompilerM.c ./Lean/Compiler/IR/CtorLayout.c ./Lean/Compiler/IR/ElimDeadBranches.c ./Lean/Compiler/IR/ElimDeadVars.c ./Lean/Compiler/IR/EmitC.c ./Lean/Compiler/IR/EmitUtil.c ./Lean/Compiler/IR/ExpandResetReuse.c ./Lean/Compiler/IR/Format.c ./Lean/Compiler/IR/FreeVars.c ./Lean/Compiler/IR/LiveVars.c ./Lean/Compiler/IR/NormIds.c ./Lean/Compiler/IR/PushProj.c ./Lean/Compiler/IR/RC.c ./Lean/Compiler/IR/ResetReuse.c ./Lean/Compiler/IR/SimpCase.c ./Lean/Compiler/IR/UnboxResult.c ./Lean/Compiler/ImplementedByAttr.c ./Lean/Compiler/InitAttr.c ./Lean/Compiler/InlineAttrs.c ./Lean/Compiler/NameMangling.c ./Lean/Compiler/NeverExtractAttr.c ./Lean/Compiler/Specialize.c ./Lean/Compiler/Util.c ./Lean/CoreM.c ./Lean/Data.c ./Lean/Data/Format.c ./Lean/Data/Json.c ./Lean/Data/Json/Basic.c ./Lean/Data/Json/FromToJson.c ./Lean/Data/Json/Parser.c ./Lean/Data/Json/Printer.c ./Lean/Data/Json/Stream.c ./Lean/Data/JsonRpc.c ./Lean/Data/KVMap.c ./Lean/Data/LBool.c ./Lean/Data/LOption.c ./Lean/Data/Lsp.c ./Lean/Data/Lsp/Basic.c ./Lean/Data/Lsp/Capabilities.c ./Lean/Data/Lsp/Communication.c ./Lean/Data/Lsp/Diagnostics.c ./Lean/Data/Lsp/Hover.c ./Lean/Data/Lsp/InitShutdown.c ./Lean/Data/Lsp/TextSync.c ./Lean/Data/Lsp/Utf16.c ./Lean/Data/Lsp/Workspace.c ./Lean/Data/Name.c ./Lean/Data/NameTrie.c ./Lean/Data/Occurrences.c ./Lean/Data/OpenDecl.c ./Lean/Data/Options.c ./Lean/Data/Position.c ./Lean/Data/PrefixTree.c ./Lean/Data/SMap.c ./Lean/Data/Trie.c ./Lean/Declaration.c ./Lean/Elab.c ./Lean/Elab/App.c ./Lean/Elab/Attributes.c ./Lean/Elab/Binders.c ./Lean/Elab/BuiltinNotation.c ./Lean/Elab/CollectFVars.c ./Lean/Elab/Command.c ./Lean/Elab/DeclModifiers.c ./Lean/Elab/DeclUtil.c ./Lean/Elab/Declaration.c ./Lean/Elab/DefView.c ./Lean/Elab/Deriving.c ./Lean/Elab/Deriving/Basic.c ./Lean/Elab/Do.c ./Lean/Elab/Exception.c ./Lean/Elab/Frontend.c ./Lean/Elab/Import.c ./Lean/Elab/Inductive.c ./Lean/Elab/LetRec.c ./Lean/Elab/Level.c ./Lean/Elab/Log.c ./Lean/Elab/Match.c ./Lean/Elab/MutualDef.c ./Lean/Elab/PreDefinition.c ./Lean/Elab/PreDefinition/Basic.c ./Lean/Elab/PreDefinition/Main.c ./Lean/Elab/PreDefinition/MkInhabitant.c ./Lean/Elab/PreDefinition/Structural.c ./Lean/Elab/PreDefinition/WF.c ./Lean/Elab/Print.c ./Lean/Elab/Quotation.c ./Lean/Elab/Quotation/Util.c ./Lean/Elab/StructInst.c ./Lean/Elab/Structure.c ./Lean/Elab/Syntax.c ./Lean/Elab/SyntheticMVars.c ./Lean/Elab/Tactic.c ./Lean/Elab/Tactic/Basic.c ./Lean/Elab/Tactic/Binders.c ./Lean/Elab/Tactic/ElabTerm.c ./Lean/Elab/Tactic/Generalize.c ./Lean/Elab/Tactic/Induction.c ./Lean/Elab/Tactic/Injection.c ./Lean/Elab/Tactic/Location.c ./Lean/Elab/Tactic/Match.c ./Lean/Elab/Tactic/Rewrite.c ./Lean/Elab/Term.c ./Lean/Elab/Util.c ./Lean/Environment.c ./Lean/Eval.c ./Lean/Exception.c ./Lean/Expr.c ./Lean/HeadIndex.c ./Lean/Hygiene.c ./Lean/InternalExceptionId.c ./Lean/KeyedDeclsAttribute.c ./Lean/Level.c ./Lean/LocalContext.c ./Lean/Message.c ./Lean/Meta.c ./Lean/Meta/AbstractMVars.c ./Lean/Meta/AbstractNestedProofs.c ./Lean/Meta/AppBuilder.c ./Lean/Meta/Basic.c ./Lean/Meta/Check.c ./Lean/Meta/Closure.c ./Lean/Meta/CollectMVars.c ./Lean/Meta/DiscrTree.c ./Lean/Meta/DiscrTreeTypes.c ./Lean/Meta/ExprDefEq.c ./Lean/Meta/ForEachExpr.c ./Lean/Meta/FunInfo.c ./Lean/Meta/GeneralizeTelescope.c ./Lean/Meta/GetConst.c ./Lean/Meta/InferType.c ./Lean/Meta/Instances.c ./Lean/Meta/KAbstract.c ./Lean/Meta/LevelDefEq.c ./Lean/Meta/Match.c ./Lean/Meta/Match/Basic.c ./Lean/Meta/Match/CaseArraySizes.c ./Lean/Meta/Match/CaseValues.c ./Lean/Meta/Match/MVarRenaming.c ./Lean/Meta/Match/Match.c ./Lean/Meta/Match/MatchPatternAttr.c ./Lean/Meta/Match/MatcherInfo.c ./Lean/Meta/MatchUtil.c ./Lean/Meta/Offset.c ./Lean/Meta/PPGoal.c ./Lean/Meta/RecursorInfo.c ./Lean/Meta/Reduce.c ./Lean/Meta/ReduceEval.c ./Lean/Meta/SynthInstance.c ./Lean/Meta/Tactic.c ./Lean/Meta/Tactic/Apply.c ./Lean/Meta/Tactic/Assert.c ./Lean/Meta/Tactic/Assumption.c ./Lean/Meta/Tactic/Cases.c ./Lean/Meta/Tactic/Clear.c ./Lean/Meta/Tactic/Constructor.c ./Lean/Meta/Tactic/Delta.c ./Lean/Meta/Tactic/ElimInfo.c ./Lean/Meta/Tactic/FVarSubst.c ./Lean/Meta/Tactic/Generalize.c ./Lean/Meta/Tactic/Induction.c ./Lean/Meta/Tactic/Injection.c ./Lean/Meta/Tactic/Intro.c ./Lean/Meta/Tactic/Replace.c ./Lean/Meta/Tactic/Revert.c ./Lean/Meta/Tactic/Rewrite.c ./Lean/Meta/Tactic/Subst.c ./Lean/Meta/Tactic/Util.c ./Lean/Meta/Transform.c ./Lean/Meta/TransparencyMode.c ./Lean/Meta/UnificationHint.c ./Lean/Meta/WHNF.c ./Lean/MetavarContext.c ./Lean/Modifiers.c ./Lean/MonadEnv.c ./Lean/Parser.c ./Lean/Parser/Basic.c ./Lean/Parser/Command.c ./Lean/Parser/Do.c ./Lean/Parser/Extension.c ./Lean/Parser/Extra.c ./Lean/Parser/Level.c ./Lean/Parser/Module.c ./Lean/Parser/StrInterpolation.c ./Lean/Parser/Syntax.c ./Lean/Parser/Tactic.c ./Lean/Parser/Term.c ./Lean/Parser/Transform.c ./Lean/ParserCompiler.c ./Lean/ParserCompiler/Attribute.c ./Lean/PrettyPrinter.c ./Lean/PrettyPrinter/Basic.c ./Lean/PrettyPrinter/Delaborator.c ./Lean/PrettyPrinter/Delaborator/Basic.c ./Lean/PrettyPrinter/Delaborator/Builtins.c ./Lean/PrettyPrinter/Formatter.c ./Lean/PrettyPrinter/Parenthesizer.c ./Lean/ProjFns.c ./Lean/ReducibilityAttrs.c ./Lean/ResolveName.c ./Lean/Runtime.c ./Lean/ScopedEnvExtension.c ./Lean/Server.c ./Lean/Server/ServerBin.c ./Lean/Server/Snapshots.c ./Lean/Structure.c ./Lean/Syntax.c ./Lean/ToExpr.c ./Lean/Util.c ./Lean/Util/CollectFVars.c ./Lean/Util/CollectLevelParams.c ./Lean/Util/CollectMVars.c ./Lean/Util/Constructions.c ./Lean/Util/FindExpr.c ./Lean/Util/FindMVar.c ./Lean/Util/FoldConsts.c ./Lean/Util/ForEachExpr.c ./Lean/Util/MonadCache.c ./Lean/Util/PPExt.c ./Lean/Util/Path.c ./Lean/Util/Profile.c ./Lean/Util/RecDepth.c ./Lean/Util/Recognizers.c ./Lean/Util/ReplaceExpr.c ./Lean/Util/ReplaceLevel.c ./Lean/Util/SCC.c ./Lean/Util/Sorry.c ./Lean/Util/Trace.c ./Std.c ./Std/Data.c ./Std/Data/AssocList.c ./Std/Data/BinomialHeap.c ./Std/Data/DList.c ./Std/Data/HashMap.c ./Std/Data/HashSet.c ./Std/Data/PersistentArray.c ./Std/Data/PersistentHashMap.c ./Std/Data/PersistentHashSet.c ./Std/Data/Queue.c ./Std/Data/RBMap.c ./Std/Data/RBTree.c ./Std/Data/Stack.c ./Std/ShareCommon.c ) diff --git a/stage0/stdlib/Lean/Elab.c b/stage0/stdlib/Lean/Elab.c index bb1fb49ed5..87bec06324 100644 --- a/stage0/stdlib/Lean/Elab.c +++ b/stage0/stdlib/Lean/Elab.c @@ -1,6 +1,6 @@ // Lean compiler output // Module: Lean.Elab -// Imports: Init Lean.Elab.Import Lean.Elab.Exception Lean.Elab.Command Lean.Elab.Term Lean.Elab.App Lean.Elab.Binders Lean.Elab.LetRec Lean.Elab.Frontend Lean.Elab.BuiltinNotation Lean.Elab.Declaration Lean.Elab.Tactic Lean.Elab.Match Lean.Elab.Quotation Lean.Elab.Syntax Lean.Elab.Do Lean.Elab.StructInst Lean.Elab.Inductive Lean.Elab.Structure Lean.Elab.Print Lean.Elab.MutualDef Lean.Elab.PreDefinition +// Imports: Init Lean.Elab.Import Lean.Elab.Exception Lean.Elab.Command Lean.Elab.Term Lean.Elab.App Lean.Elab.Binders Lean.Elab.LetRec Lean.Elab.Frontend Lean.Elab.BuiltinNotation Lean.Elab.Declaration Lean.Elab.Tactic Lean.Elab.Match Lean.Elab.Quotation Lean.Elab.Syntax Lean.Elab.Do Lean.Elab.StructInst Lean.Elab.Inductive Lean.Elab.Structure Lean.Elab.Print Lean.Elab.MutualDef Lean.Elab.PreDefinition Lean.Elab.Deriving #include #if defined(__clang__) #pragma clang diagnostic ignored "-Wunused-parameter" @@ -35,6 +35,7 @@ lean_object* initialize_Lean_Elab_Structure(lean_object*); lean_object* initialize_Lean_Elab_Print(lean_object*); lean_object* initialize_Lean_Elab_MutualDef(lean_object*); lean_object* initialize_Lean_Elab_PreDefinition(lean_object*); +lean_object* initialize_Lean_Elab_Deriving(lean_object*); static bool _G_initialized = false; lean_object* initialize_Lean_Elab(lean_object* w) { lean_object * res; @@ -106,6 +107,9 @@ lean_dec_ref(res); res = initialize_Lean_Elab_PreDefinition(lean_io_mk_world()); if (lean_io_result_is_error(res)) return res; lean_dec_ref(res); +res = initialize_Lean_Elab_Deriving(lean_io_mk_world()); +if (lean_io_result_is_error(res)) return res; +lean_dec_ref(res); return lean_io_result_mk_ok(lean_box(0)); } #ifdef __cplusplus diff --git a/stage0/stdlib/Lean/Elab/Deriving.c b/stage0/stdlib/Lean/Elab/Deriving.c new file mode 100644 index 0000000000..c8b36f2f60 --- /dev/null +++ b/stage0/stdlib/Lean/Elab/Deriving.c @@ -0,0 +1,33 @@ +// Lean compiler output +// Module: Lean.Elab.Deriving +// Imports: Init Lean.Elab.Deriving.Basic +#include +#if defined(__clang__) +#pragma clang diagnostic ignored "-Wunused-parameter" +#pragma clang diagnostic ignored "-Wunused-label" +#elif defined(__GNUC__) && !defined(__CLANG__) +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wunused-label" +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#endif +#ifdef __cplusplus +extern "C" { +#endif +lean_object* initialize_Init(lean_object*); +lean_object* initialize_Lean_Elab_Deriving_Basic(lean_object*); +static bool _G_initialized = false; +lean_object* initialize_Lean_Elab_Deriving(lean_object* w) { +lean_object * res; +if (_G_initialized) return lean_io_result_mk_ok(lean_box(0)); +_G_initialized = true; +res = initialize_Init(lean_io_mk_world()); +if (lean_io_result_is_error(res)) return res; +lean_dec_ref(res); +res = initialize_Lean_Elab_Deriving_Basic(lean_io_mk_world()); +if (lean_io_result_is_error(res)) return res; +lean_dec_ref(res); +return lean_io_result_mk_ok(lean_box(0)); +} +#ifdef __cplusplus +} +#endif diff --git a/stage0/stdlib/Lean/Elab/Deriving/Basic.c b/stage0/stdlib/Lean/Elab/Deriving/Basic.c new file mode 100644 index 0000000000..657b0eba2c --- /dev/null +++ b/stage0/stdlib/Lean/Elab/Deriving/Basic.c @@ -0,0 +1,659 @@ +// Lean compiler output +// Module: Lean.Elab.Deriving.Basic +// Imports: Init Lean.Elab.Command +#include +#if defined(__clang__) +#pragma clang diagnostic ignored "-Wunused-parameter" +#pragma clang diagnostic ignored "-Wunused-label" +#elif defined(__GNUC__) && !defined(__CLANG__) +#pragma GCC diagnostic ignored "-Wunused-parameter" +#pragma GCC diagnostic ignored "-Wunused-label" +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#endif +#ifdef __cplusplus +extern "C" { +#endif +extern lean_object* l_Lean_Name_toString___closed__1; +lean_object* l_Lean_Elab_derivingHandlersRef; +lean_object* l_Lean_throwError___at___private_Lean_Elab_Command_0__Lean_Elab_Command_elabCommandUsing___spec__1___rarg(lean_object*, lean_object*, lean_object*, lean_object*); +lean_object* l_Lean_Elab_applyDerivingHandlers_match__1___rarg(lean_object*, lean_object*, lean_object*); +lean_object* l_Lean_stringToMessageData(lean_object*); +uint8_t l_Lean_Name_quickLt(lean_object*, lean_object*); +lean_object* l_Lean_Elab_applyDerivingHandlers___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*); +lean_object* l_Lean_Elab_defaultHandler___rarg___closed__2; +lean_object* lean_st_ref_get(lean_object*, lean_object*); +lean_object* l_List_map___at_Lean_Elab_defaultHandler___spec__1(lean_object*); +lean_object* lean_string_append(lean_object*, lean_object*); +lean_object* l_Lean_MessageData_ofList(lean_object*); +uint8_t l_Lean_NameMap_contains___rarg(lean_object*, lean_object*); +lean_object* l_Lean_Name_toStringWithSep(lean_object*, lean_object*); +lean_object* l_Lean_Elab_applyDerivingHandlers(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*); +lean_object* l_IO_mkRef___at_Lean_Elab_initFn____x40_Lean_Elab_Deriving_Basic___hyg_12____spec__1(lean_object*, lean_object*); +lean_object* lean_st_ref_take(lean_object*, lean_object*); +lean_object* l_Lean_Elab_initFn____x40_Lean_Elab_Deriving_Basic___hyg_12_(lean_object*); +lean_object* l_Lean_Elab_registerBuiltinDerivingHandler___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*); +lean_object* l_Lean_Elab_defaultHandler___boxed(lean_object*); +lean_object* l_Lean_Elab_registerBuiltinDerivingHandler___lambda__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*); +lean_object* l_Std_RBNode_insert___at_Lean_NameMap_insert___spec__1___rarg(lean_object*, lean_object*, lean_object*); +lean_object* lean_st_mk_ref(lean_object*, lean_object*); +lean_object* l_Lean_Elab_registerBuiltinDerivingHandler___lambda__2___closed__1; +lean_object* l_Std_RBNode_find___at_Lean_Elab_applyDerivingHandlers___spec__1(lean_object*, lean_object*); +extern lean_object* l_Lean_KernelException_toMessageData___closed__15; +lean_object* l_Std_RBNode_find___at_Lean_Elab_applyDerivingHandlers___spec__1___boxed(lean_object*, lean_object*); +lean_object* l_Lean_Elab_defaultHandler___rarg(lean_object*, lean_object*, lean_object*, lean_object*); +lean_object* l_Lean_Elab_registerBuiltinDerivingHandler___lambda__2(lean_object*, lean_object*, lean_object*, lean_object*); +lean_object* l_Lean_Elab_defaultHandler(lean_object*); +lean_object* l_Lean_Elab_applyDerivingHandlers_match__1(lean_object*); +lean_object* l_Lean_Elab_registerBuiltinDerivingHandler___closed__1; +lean_object* lean_st_ref_set(lean_object*, lean_object*, lean_object*); +lean_object* l_Lean_Elab_defaultHandler___rarg___closed__1; +lean_object* l_Lean_Elab_registerBuiltinDerivingHandler(lean_object*, lean_object*, lean_object*); +lean_object* l_Lean_Elab_registerBuiltinDerivingHandler___closed__2; +lean_object* lean_io_initializing(lean_object*); +lean_object* l_Lean_Elab_defaultHandler___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*); +lean_object* l_Lean_Elab_registerBuiltinDerivingHandler___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*); +extern lean_object* l_instReprChar___closed__1; +lean_object* l_IO_mkRef___at_Lean_Elab_initFn____x40_Lean_Elab_Deriving_Basic___hyg_12____spec__1(lean_object* x_1, lean_object* x_2) { +_start: +{ +lean_object* x_3; uint8_t x_4; +x_3 = lean_st_mk_ref(x_1, x_2); +x_4 = !lean_is_exclusive(x_3); +if (x_4 == 0) +{ +return x_3; +} +else +{ +lean_object* x_5; lean_object* x_6; lean_object* x_7; +x_5 = lean_ctor_get(x_3, 0); +x_6 = lean_ctor_get(x_3, 1); +lean_inc(x_6); +lean_inc(x_5); +lean_dec(x_3); +x_7 = lean_alloc_ctor(0, 2, 0); +lean_ctor_set(x_7, 0, x_5); +lean_ctor_set(x_7, 1, x_6); +return x_7; +} +} +} +lean_object* l_Lean_Elab_initFn____x40_Lean_Elab_Deriving_Basic___hyg_12_(lean_object* x_1) { +_start: +{ +lean_object* x_2; lean_object* x_3; +x_2 = lean_box(0); +x_3 = l_IO_mkRef___at_Lean_Elab_initFn____x40_Lean_Elab_Deriving_Basic___hyg_12____spec__1(x_2, x_1); +return x_3; +} +} +lean_object* l_Lean_Elab_registerBuiltinDerivingHandler___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) { +_start: +{ +lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; uint8_t x_11; +x_5 = l_Lean_Elab_derivingHandlersRef; +x_6 = lean_st_ref_take(x_5, x_4); +x_7 = lean_ctor_get(x_6, 0); +lean_inc(x_7); +x_8 = lean_ctor_get(x_6, 1); +lean_inc(x_8); +lean_dec(x_6); +x_9 = l_Std_RBNode_insert___at_Lean_NameMap_insert___spec__1___rarg(x_7, x_1, x_2); +x_10 = lean_st_ref_set(x_5, x_9, x_8); +x_11 = !lean_is_exclusive(x_10); +if (x_11 == 0) +{ +return x_10; +} +else +{ +lean_object* x_12; lean_object* x_13; lean_object* x_14; +x_12 = lean_ctor_get(x_10, 0); +x_13 = lean_ctor_get(x_10, 1); +lean_inc(x_13); +lean_inc(x_12); +lean_dec(x_10); +x_14 = lean_alloc_ctor(0, 2, 0); +lean_ctor_set(x_14, 0, x_12); +lean_ctor_set(x_14, 1, x_13); +return x_14; +} +} +} +static lean_object* _init_l_Lean_Elab_registerBuiltinDerivingHandler___lambda__2___closed__1() { +_start: +{ +lean_object* x_1; +x_1 = lean_mk_string("failed to register deriving handler, a handler has already been registered for '"); +return x_1; +} +} +lean_object* l_Lean_Elab_registerBuiltinDerivingHandler___lambda__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) { +_start: +{ +lean_object* x_5; lean_object* x_6; uint8_t x_7; +x_5 = l_Lean_Elab_derivingHandlersRef; +x_6 = lean_st_ref_get(x_5, x_4); +x_7 = !lean_is_exclusive(x_6); +if (x_7 == 0) +{ +lean_object* x_8; lean_object* x_9; uint8_t x_10; +x_8 = lean_ctor_get(x_6, 0); +x_9 = lean_ctor_get(x_6, 1); +x_10 = l_Lean_NameMap_contains___rarg(x_8, x_1); +lean_dec(x_8); +if (x_10 == 0) +{ +lean_object* x_11; lean_object* x_12; +lean_free_object(x_6); +x_11 = lean_box(0); +x_12 = l_Lean_Elab_registerBuiltinDerivingHandler___lambda__1(x_1, x_2, x_11, x_9); +return x_12; +} +else +{ +lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; lean_object* x_19; +lean_dec(x_2); +x_13 = l_Lean_Name_toString___closed__1; +x_14 = l_Lean_Name_toStringWithSep(x_13, x_1); +x_15 = l_Lean_Elab_registerBuiltinDerivingHandler___lambda__2___closed__1; +x_16 = lean_string_append(x_15, x_14); +lean_dec(x_14); +x_17 = l_instReprChar___closed__1; +x_18 = lean_string_append(x_16, x_17); +x_19 = lean_alloc_ctor(18, 1, 0); +lean_ctor_set(x_19, 0, x_18); +lean_ctor_set_tag(x_6, 1); +lean_ctor_set(x_6, 0, x_19); +return x_6; +} +} +else +{ +lean_object* x_20; lean_object* x_21; uint8_t x_22; +x_20 = lean_ctor_get(x_6, 0); +x_21 = lean_ctor_get(x_6, 1); +lean_inc(x_21); +lean_inc(x_20); +lean_dec(x_6); +x_22 = l_Lean_NameMap_contains___rarg(x_20, x_1); +lean_dec(x_20); +if (x_22 == 0) +{ +lean_object* x_23; lean_object* x_24; +x_23 = lean_box(0); +x_24 = l_Lean_Elab_registerBuiltinDerivingHandler___lambda__1(x_1, x_2, x_23, x_21); +return x_24; +} +else +{ +lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; +lean_dec(x_2); +x_25 = l_Lean_Name_toString___closed__1; +x_26 = l_Lean_Name_toStringWithSep(x_25, x_1); +x_27 = l_Lean_Elab_registerBuiltinDerivingHandler___lambda__2___closed__1; +x_28 = lean_string_append(x_27, x_26); +lean_dec(x_26); +x_29 = l_instReprChar___closed__1; +x_30 = lean_string_append(x_28, x_29); +x_31 = lean_alloc_ctor(18, 1, 0); +lean_ctor_set(x_31, 0, x_30); +x_32 = lean_alloc_ctor(1, 2, 0); +lean_ctor_set(x_32, 0, x_31); +lean_ctor_set(x_32, 1, x_21); +return x_32; +} +} +} +} +static lean_object* _init_l_Lean_Elab_registerBuiltinDerivingHandler___closed__1() { +_start: +{ +lean_object* x_1; +x_1 = lean_mk_string("failed to register deriving handler, it can only be registered during initialization"); +return x_1; +} +} +static lean_object* _init_l_Lean_Elab_registerBuiltinDerivingHandler___closed__2() { +_start: +{ +lean_object* x_1; lean_object* x_2; +x_1 = l_Lean_Elab_registerBuiltinDerivingHandler___closed__1; +x_2 = lean_alloc_ctor(18, 1, 0); +lean_ctor_set(x_2, 0, x_1); +return x_2; +} +} +lean_object* l_Lean_Elab_registerBuiltinDerivingHandler(lean_object* x_1, lean_object* x_2, lean_object* x_3) { +_start: +{ +lean_object* x_4; +x_4 = lean_io_initializing(x_3); +if (lean_obj_tag(x_4) == 0) +{ +lean_object* x_5; uint8_t x_6; +x_5 = lean_ctor_get(x_4, 0); +lean_inc(x_5); +x_6 = lean_unbox(x_5); +lean_dec(x_5); +if (x_6 == 0) +{ +uint8_t x_7; +lean_dec(x_2); +lean_dec(x_1); +x_7 = !lean_is_exclusive(x_4); +if (x_7 == 0) +{ +lean_object* x_8; lean_object* x_9; +x_8 = lean_ctor_get(x_4, 0); +lean_dec(x_8); +x_9 = l_Lean_Elab_registerBuiltinDerivingHandler___closed__2; +lean_ctor_set_tag(x_4, 1); +lean_ctor_set(x_4, 0, x_9); +return x_4; +} +else +{ +lean_object* x_10; lean_object* x_11; lean_object* x_12; +x_10 = lean_ctor_get(x_4, 1); +lean_inc(x_10); +lean_dec(x_4); +x_11 = l_Lean_Elab_registerBuiltinDerivingHandler___closed__2; +x_12 = lean_alloc_ctor(1, 2, 0); +lean_ctor_set(x_12, 0, x_11); +lean_ctor_set(x_12, 1, x_10); +return x_12; +} +} +else +{ +lean_object* x_13; lean_object* x_14; lean_object* x_15; +x_13 = lean_ctor_get(x_4, 1); +lean_inc(x_13); +lean_dec(x_4); +x_14 = lean_box(0); +x_15 = l_Lean_Elab_registerBuiltinDerivingHandler___lambda__2(x_1, x_2, x_14, x_13); +return x_15; +} +} +else +{ +uint8_t x_16; +lean_dec(x_2); +lean_dec(x_1); +x_16 = !lean_is_exclusive(x_4); +if (x_16 == 0) +{ +return x_4; +} +else +{ +lean_object* x_17; lean_object* x_18; lean_object* x_19; +x_17 = lean_ctor_get(x_4, 0); +x_18 = lean_ctor_get(x_4, 1); +lean_inc(x_18); +lean_inc(x_17); +lean_dec(x_4); +x_19 = lean_alloc_ctor(1, 2, 0); +lean_ctor_set(x_19, 0, x_17); +lean_ctor_set(x_19, 1, x_18); +return x_19; +} +} +} +} +lean_object* l_Lean_Elab_registerBuiltinDerivingHandler___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) { +_start: +{ +lean_object* x_5; +x_5 = l_Lean_Elab_registerBuiltinDerivingHandler___lambda__1(x_1, x_2, x_3, x_4); +lean_dec(x_3); +return x_5; +} +} +lean_object* l_Lean_Elab_registerBuiltinDerivingHandler___lambda__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) { +_start: +{ +lean_object* x_5; +x_5 = l_Lean_Elab_registerBuiltinDerivingHandler___lambda__2(x_1, x_2, x_3, x_4); +lean_dec(x_3); +return x_5; +} +} +lean_object* l_List_map___at_Lean_Elab_defaultHandler___spec__1(lean_object* x_1) { +_start: +{ +if (lean_obj_tag(x_1) == 0) +{ +lean_object* x_2; +x_2 = lean_box(0); +return x_2; +} +else +{ +uint8_t x_3; +x_3 = !lean_is_exclusive(x_1); +if (x_3 == 0) +{ +lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; +x_4 = lean_ctor_get(x_1, 0); +x_5 = lean_ctor_get(x_1, 1); +x_6 = lean_alloc_ctor(4, 1, 0); +lean_ctor_set(x_6, 0, x_4); +x_7 = l_List_map___at_Lean_Elab_defaultHandler___spec__1(x_5); +lean_ctor_set(x_1, 1, x_7); +lean_ctor_set(x_1, 0, x_6); +return x_1; +} +else +{ +lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; +x_8 = lean_ctor_get(x_1, 0); +x_9 = lean_ctor_get(x_1, 1); +lean_inc(x_9); +lean_inc(x_8); +lean_dec(x_1); +x_10 = lean_alloc_ctor(4, 1, 0); +lean_ctor_set(x_10, 0, x_8); +x_11 = l_List_map___at_Lean_Elab_defaultHandler___spec__1(x_9); +x_12 = lean_alloc_ctor(1, 2, 0); +lean_ctor_set(x_12, 0, x_10); +lean_ctor_set(x_12, 1, x_11); +return x_12; +} +} +} +} +static lean_object* _init_l_Lean_Elab_defaultHandler___rarg___closed__1() { +_start: +{ +lean_object* x_1; +x_1 = lean_mk_string("default handlers have not been implemented yet, "); +return x_1; +} +} +static lean_object* _init_l_Lean_Elab_defaultHandler___rarg___closed__2() { +_start: +{ +lean_object* x_1; lean_object* x_2; +x_1 = l_Lean_Elab_defaultHandler___rarg___closed__1; +x_2 = l_Lean_stringToMessageData(x_1); +return x_2; +} +} +lean_object* l_Lean_Elab_defaultHandler___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) { +_start: +{ +lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; +x_5 = l_List_map___at_Lean_Elab_defaultHandler___spec__1(x_1); +x_6 = l_Lean_MessageData_ofList(x_5); +lean_dec(x_5); +x_7 = l_Lean_Elab_defaultHandler___rarg___closed__2; +x_8 = lean_alloc_ctor(10, 2, 0); +lean_ctor_set(x_8, 0, x_7); +lean_ctor_set(x_8, 1, x_6); +x_9 = l_Lean_KernelException_toMessageData___closed__15; +x_10 = lean_alloc_ctor(10, 2, 0); +lean_ctor_set(x_10, 0, x_8); +lean_ctor_set(x_10, 1, x_9); +x_11 = l_Lean_throwError___at___private_Lean_Elab_Command_0__Lean_Elab_Command_elabCommandUsing___spec__1___rarg(x_10, x_2, x_3, x_4); +return x_11; +} +} +lean_object* l_Lean_Elab_defaultHandler(lean_object* x_1) { +_start: +{ +lean_object* x_2; +x_2 = lean_alloc_closure((void*)(l_Lean_Elab_defaultHandler___rarg___boxed), 4, 0); +return x_2; +} +} +lean_object* l_Lean_Elab_defaultHandler___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) { +_start: +{ +lean_object* x_5; +x_5 = l_Lean_Elab_defaultHandler___rarg(x_1, x_2, x_3, x_4); +lean_dec(x_3); +return x_5; +} +} +lean_object* l_Lean_Elab_defaultHandler___boxed(lean_object* x_1) { +_start: +{ +lean_object* x_2; +x_2 = l_Lean_Elab_defaultHandler(x_1); +lean_dec(x_1); +return x_2; +} +} +lean_object* l_Lean_Elab_applyDerivingHandlers_match__1___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3) { +_start: +{ +if (lean_obj_tag(x_1) == 0) +{ +lean_object* x_4; lean_object* x_5; +lean_dec(x_2); +x_4 = lean_box(0); +x_5 = lean_apply_1(x_3, x_4); +return x_5; +} +else +{ +lean_object* x_6; lean_object* x_7; +lean_dec(x_3); +x_6 = lean_ctor_get(x_1, 0); +lean_inc(x_6); +lean_dec(x_1); +x_7 = lean_apply_1(x_2, x_6); +return x_7; +} +} +} +lean_object* l_Lean_Elab_applyDerivingHandlers_match__1(lean_object* x_1) { +_start: +{ +lean_object* x_2; +x_2 = lean_alloc_closure((void*)(l_Lean_Elab_applyDerivingHandlers_match__1___rarg), 3, 0); +return x_2; +} +} +lean_object* l_Std_RBNode_find___at_Lean_Elab_applyDerivingHandlers___spec__1(lean_object* x_1, lean_object* x_2) { +_start: +{ +if (lean_obj_tag(x_1) == 0) +{ +lean_object* x_3; +x_3 = lean_box(0); +return x_3; +} +else +{ +lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8; +x_4 = lean_ctor_get(x_1, 0); +x_5 = lean_ctor_get(x_1, 1); +x_6 = lean_ctor_get(x_1, 2); +x_7 = lean_ctor_get(x_1, 3); +x_8 = l_Lean_Name_quickLt(x_2, x_5); +if (x_8 == 0) +{ +uint8_t x_9; +x_9 = l_Lean_Name_quickLt(x_5, x_2); +if (x_9 == 0) +{ +lean_object* x_10; +lean_inc(x_6); +x_10 = lean_alloc_ctor(1, 1, 0); +lean_ctor_set(x_10, 0, x_6); +return x_10; +} +else +{ +x_1 = x_7; +goto _start; +} +} +else +{ +x_1 = x_4; +goto _start; +} +} +} +} +lean_object* l_Lean_Elab_applyDerivingHandlers(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) { +_start: +{ +lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; +x_6 = l_Lean_Elab_derivingHandlersRef; +x_7 = lean_st_ref_get(x_6, x_5); +x_8 = lean_ctor_get(x_7, 0); +lean_inc(x_8); +x_9 = lean_ctor_get(x_7, 1); +lean_inc(x_9); +lean_dec(x_7); +x_10 = l_Std_RBNode_find___at_Lean_Elab_applyDerivingHandlers___spec__1(x_8, x_1); +lean_dec(x_8); +if (lean_obj_tag(x_10) == 0) +{ +lean_object* x_11; +x_11 = l_Lean_Elab_defaultHandler___rarg(x_2, x_3, x_4, x_9); +lean_dec(x_4); +return x_11; +} +else +{ +lean_object* x_12; lean_object* x_13; +x_12 = lean_ctor_get(x_10, 0); +lean_inc(x_12); +lean_dec(x_10); +lean_inc(x_4); +lean_inc(x_3); +lean_inc(x_2); +x_13 = lean_apply_4(x_12, x_2, x_3, x_4, x_9); +if (lean_obj_tag(x_13) == 0) +{ +lean_object* x_14; uint8_t x_15; +x_14 = lean_ctor_get(x_13, 0); +lean_inc(x_14); +x_15 = lean_unbox(x_14); +lean_dec(x_14); +if (x_15 == 0) +{ +lean_object* x_16; lean_object* x_17; +x_16 = lean_ctor_get(x_13, 1); +lean_inc(x_16); +lean_dec(x_13); +x_17 = l_Lean_Elab_defaultHandler___rarg(x_2, x_3, x_4, x_16); +lean_dec(x_4); +return x_17; +} +else +{ +uint8_t x_18; +lean_dec(x_4); +lean_dec(x_3); +lean_dec(x_2); +x_18 = !lean_is_exclusive(x_13); +if (x_18 == 0) +{ +lean_object* x_19; lean_object* x_20; +x_19 = lean_ctor_get(x_13, 0); +lean_dec(x_19); +x_20 = lean_box(0); +lean_ctor_set(x_13, 0, x_20); +return x_13; +} +else +{ +lean_object* x_21; lean_object* x_22; lean_object* x_23; +x_21 = lean_ctor_get(x_13, 1); +lean_inc(x_21); +lean_dec(x_13); +x_22 = lean_box(0); +x_23 = lean_alloc_ctor(0, 2, 0); +lean_ctor_set(x_23, 0, x_22); +lean_ctor_set(x_23, 1, x_21); +return x_23; +} +} +} +else +{ +uint8_t x_24; +lean_dec(x_4); +lean_dec(x_3); +lean_dec(x_2); +x_24 = !lean_is_exclusive(x_13); +if (x_24 == 0) +{ +return x_13; +} +else +{ +lean_object* x_25; lean_object* x_26; lean_object* x_27; +x_25 = lean_ctor_get(x_13, 0); +x_26 = lean_ctor_get(x_13, 1); +lean_inc(x_26); +lean_inc(x_25); +lean_dec(x_13); +x_27 = lean_alloc_ctor(1, 2, 0); +lean_ctor_set(x_27, 0, x_25); +lean_ctor_set(x_27, 1, x_26); +return x_27; +} +} +} +} +} +lean_object* l_Std_RBNode_find___at_Lean_Elab_applyDerivingHandlers___spec__1___boxed(lean_object* x_1, lean_object* x_2) { +_start: +{ +lean_object* x_3; +x_3 = l_Std_RBNode_find___at_Lean_Elab_applyDerivingHandlers___spec__1(x_1, x_2); +lean_dec(x_2); +lean_dec(x_1); +return x_3; +} +} +lean_object* l_Lean_Elab_applyDerivingHandlers___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) { +_start: +{ +lean_object* x_6; +x_6 = l_Lean_Elab_applyDerivingHandlers(x_1, x_2, x_3, x_4, x_5); +lean_dec(x_1); +return x_6; +} +} +lean_object* initialize_Init(lean_object*); +lean_object* initialize_Lean_Elab_Command(lean_object*); +static bool _G_initialized = false; +lean_object* initialize_Lean_Elab_Deriving_Basic(lean_object* w) { +lean_object * res; +if (_G_initialized) return lean_io_result_mk_ok(lean_box(0)); +_G_initialized = true; +res = initialize_Init(lean_io_mk_world()); +if (lean_io_result_is_error(res)) return res; +lean_dec_ref(res); +res = initialize_Lean_Elab_Command(lean_io_mk_world()); +if (lean_io_result_is_error(res)) return res; +lean_dec_ref(res); +res = l_Lean_Elab_initFn____x40_Lean_Elab_Deriving_Basic___hyg_12_(lean_io_mk_world()); +if (lean_io_result_is_error(res)) return res; +l_Lean_Elab_derivingHandlersRef = lean_io_result_get_value(res); +lean_mark_persistent(l_Lean_Elab_derivingHandlersRef); +lean_dec_ref(res); +l_Lean_Elab_registerBuiltinDerivingHandler___lambda__2___closed__1 = _init_l_Lean_Elab_registerBuiltinDerivingHandler___lambda__2___closed__1(); +lean_mark_persistent(l_Lean_Elab_registerBuiltinDerivingHandler___lambda__2___closed__1); +l_Lean_Elab_registerBuiltinDerivingHandler___closed__1 = _init_l_Lean_Elab_registerBuiltinDerivingHandler___closed__1(); +lean_mark_persistent(l_Lean_Elab_registerBuiltinDerivingHandler___closed__1); +l_Lean_Elab_registerBuiltinDerivingHandler___closed__2 = _init_l_Lean_Elab_registerBuiltinDerivingHandler___closed__2(); +lean_mark_persistent(l_Lean_Elab_registerBuiltinDerivingHandler___closed__2); +l_Lean_Elab_defaultHandler___rarg___closed__1 = _init_l_Lean_Elab_defaultHandler___rarg___closed__1(); +lean_mark_persistent(l_Lean_Elab_defaultHandler___rarg___closed__1); +l_Lean_Elab_defaultHandler___rarg___closed__2 = _init_l_Lean_Elab_defaultHandler___rarg___closed__2(); +lean_mark_persistent(l_Lean_Elab_defaultHandler___rarg___closed__2); +return lean_io_result_mk_ok(lean_box(0)); +} +#ifdef __cplusplus +} +#endif diff --git a/stage0/stdlib/Lean/Parser/Command.c b/stage0/stdlib/Lean/Parser/Command.c index 50b30eca2e..d68a5987c4 100644 --- a/stage0/stdlib/Lean/Parser/Command.c +++ b/stage0/stdlib/Lean/Parser/Command.c @@ -2020,6 +2020,7 @@ lean_object* l_Lean_Parser_Command_structure___closed__4; lean_object* l_Lean_Parser_Command_printAxioms___closed__2; lean_object* l_Lean_Parser_Command_declModifiers___elambda__1___closed__1; extern lean_object* l_Lean_Parser_Term_forall_formatter___closed__3; +lean_object* l_Lean_Parser_Command_namespace_parenthesizer___closed__3; lean_object* l_Lean_Parser_Command_declModifiers_parenthesizer___closed__21; lean_object* l_Lean_Parser_Command_print___elambda__1(lean_object*, lean_object*); lean_object* l_Lean_Parser_Command_structImplicitBinder_formatter___closed__4; @@ -2149,7 +2150,6 @@ lean_object* l___regBuiltin_Lean_Parser_Command_variable_formatter___closed__1; lean_object* l_Lean_Parser_Command_declModifiers_parenthesizer___closed__24; lean_object* l_Lean_Parser_Command_export_parenthesizer___closed__6; lean_object* l_Lean_Parser_Command_constant___elambda__1___closed__4; -lean_object* l_Lean_Parser_Command_deriving_parenthesizer___closed__6; lean_object* l_Lean_Parser_Command_optDeclSig_parenthesizer___closed__2; lean_object* l_Lean_Parser_Command_declaration_parenthesizer___closed__3; lean_object* l_Lean_Parser_Command_structSimpleBinder___elambda__1(lean_object*, lean_object*); @@ -18349,13 +18349,15 @@ return x_2; static lean_object* _init_l_Lean_Parser_Command_deriving___elambda__1___closed__8() { _start: { -lean_object* x_1; lean_object* x_2; lean_object* x_3; -x_1 = l_Lean_Parser_Command_deriving___elambda__1___closed__7; -x_2 = l_Lean_Parser_ident___closed__2; -x_3 = lean_alloc_closure((void*)(l_Lean_Parser_andthenFn), 4, 2); -lean_closure_set(x_3, 0, x_1); -lean_closure_set(x_3, 1, x_2); -return x_3; +lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; +x_1 = l_Lean_Parser_Command_declId___elambda__1___closed__3; +x_2 = lean_ctor_get(x_1, 1); +lean_inc(x_2); +x_3 = l_Lean_Parser_Command_deriving___elambda__1___closed__7; +x_4 = lean_alloc_closure((void*)(l_Lean_Parser_andthenFn), 4, 2); +lean_closure_set(x_4, 0, x_3); +lean_closure_set(x_4, 1, x_2); +return x_4; } } static lean_object* _init_l_Lean_Parser_Command_deriving___elambda__1___closed__9() { @@ -18446,7 +18448,7 @@ static lean_object* _init_l_Lean_Parser_Command_deriving___closed__2() { _start: { lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; -x_1 = l_Lean_Parser_ident; +x_1 = l_Lean_Parser_Command_declId___elambda__1___closed__3; x_2 = lean_ctor_get(x_1, 0); lean_inc(x_2); x_3 = l_Lean_Parser_Command_deriving___closed__1; @@ -18589,7 +18591,7 @@ _start: { lean_object* x_1; lean_object* x_2; lean_object* x_3; x_1 = l_Lean_Parser_Command_deriving_formatter___closed__2; -x_2 = l_Lean_initFn____x40_Lean_Parser_Extra___hyg_948____closed__11; +x_2 = l_Lean_Parser_Command_declId_formatter___closed__2; x_3 = lean_alloc_closure((void*)(l_Lean_PrettyPrinter_Formatter_andthen_formatter), 7, 2); lean_closure_set(x_3, 0, x_1); lean_closure_set(x_3, 1, x_2); @@ -18692,8 +18694,8 @@ static lean_object* _init_l_Lean_Parser_Command_deriving_parenthesizer___closed_ _start: { lean_object* x_1; lean_object* x_2; lean_object* x_3; -x_1 = l_Lean_Parser_antiquotNestedExpr_parenthesizer___closed__3; -x_2 = l_Lean_initFn____x40_Lean_Parser_Extra___hyg_861____closed__19; +x_1 = l_Lean_Parser_Command_declId_parenthesizer___closed__2; +x_2 = l_Lean_Parser_Command_optDeriving_parenthesizer___closed__2; x_3 = lean_alloc_closure((void*)(l_Lean_PrettyPrinter_Parenthesizer_andthen_parenthesizer), 7, 2); lean_closure_set(x_3, 0, x_1); lean_closure_set(x_3, 1, x_2); @@ -18704,7 +18706,7 @@ static lean_object* _init_l_Lean_Parser_Command_deriving_parenthesizer___closed_ _start: { lean_object* x_1; lean_object* x_2; lean_object* x_3; -x_1 = l_Lean_Parser_Command_declId_parenthesizer___closed__2; +x_1 = l_Lean_Parser_antiquotNestedExpr_parenthesizer___closed__3; x_2 = l_Lean_Parser_Command_deriving_parenthesizer___closed__2; x_3 = lean_alloc_closure((void*)(l_Lean_PrettyPrinter_Parenthesizer_andthen_parenthesizer), 7, 2); lean_closure_set(x_3, 0, x_1); @@ -18727,22 +18729,10 @@ return x_3; static lean_object* _init_l_Lean_Parser_Command_deriving_parenthesizer___closed__5() { _start: { -lean_object* x_1; lean_object* x_2; lean_object* x_3; -x_1 = l_Lean_Parser_antiquotNestedExpr_parenthesizer___closed__3; -x_2 = l_Lean_Parser_Command_deriving_parenthesizer___closed__4; -x_3 = lean_alloc_closure((void*)(l_Lean_PrettyPrinter_Parenthesizer_andthen_parenthesizer), 7, 2); -lean_closure_set(x_3, 0, x_1); -lean_closure_set(x_3, 1, x_2); -return x_3; -} -} -static lean_object* _init_l_Lean_Parser_Command_deriving_parenthesizer___closed__6() { -_start: -{ lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; x_1 = l_Lean_Parser_Command_deriving___elambda__1___closed__2; x_2 = lean_unsigned_to_nat(1024u); -x_3 = l_Lean_Parser_Command_deriving_parenthesizer___closed__5; +x_3 = l_Lean_Parser_Command_deriving_parenthesizer___closed__4; x_4 = lean_alloc_closure((void*)(l_Lean_PrettyPrinter_Parenthesizer_leadingNode_parenthesizer___boxed), 8, 3); lean_closure_set(x_4, 0, x_1); lean_closure_set(x_4, 1, x_2); @@ -18755,7 +18745,7 @@ _start: { lean_object* x_6; lean_object* x_7; lean_object* x_8; x_6 = l_Lean_Parser_Command_deriving_parenthesizer___closed__1; -x_7 = l_Lean_Parser_Command_deriving_parenthesizer___closed__6; +x_7 = l_Lean_Parser_Command_deriving_parenthesizer___closed__5; x_8 = l_Lean_PrettyPrinter_Parenthesizer_orelse_parenthesizer(x_6, x_7, x_1, x_2, x_3, x_4, x_5); return x_8; } @@ -19472,10 +19462,22 @@ return x_4; static lean_object* _init_l_Lean_Parser_Command_namespace_parenthesizer___closed__2() { _start: { +lean_object* x_1; lean_object* x_2; lean_object* x_3; +x_1 = l_Lean_Parser_antiquotNestedExpr_parenthesizer___closed__3; +x_2 = l_Lean_initFn____x40_Lean_Parser_Extra___hyg_861____closed__19; +x_3 = lean_alloc_closure((void*)(l_Lean_PrettyPrinter_Parenthesizer_andthen_parenthesizer), 7, 2); +lean_closure_set(x_3, 0, x_1); +lean_closure_set(x_3, 1, x_2); +return x_3; +} +} +static lean_object* _init_l_Lean_Parser_Command_namespace_parenthesizer___closed__3() { +_start: +{ lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; x_1 = l_Lean_Parser_Command_namespace___elambda__1___closed__2; x_2 = lean_unsigned_to_nat(1024u); -x_3 = l_Lean_Parser_Command_deriving_parenthesizer___closed__2; +x_3 = l_Lean_Parser_Command_namespace_parenthesizer___closed__2; x_4 = lean_alloc_closure((void*)(l_Lean_PrettyPrinter_Parenthesizer_leadingNode_parenthesizer___boxed), 8, 3); lean_closure_set(x_4, 0, x_1); lean_closure_set(x_4, 1, x_2); @@ -19488,7 +19490,7 @@ _start: { lean_object* x_6; lean_object* x_7; lean_object* x_8; x_6 = l_Lean_Parser_Command_namespace_parenthesizer___closed__1; -x_7 = l_Lean_Parser_Command_namespace_parenthesizer___closed__2; +x_7 = l_Lean_Parser_Command_namespace_parenthesizer___closed__3; x_8 = l_Lean_PrettyPrinter_Parenthesizer_orelse_parenthesizer(x_6, x_7, x_1, x_2, x_3, x_4, x_5); return x_8; } @@ -20898,7 +20900,7 @@ _start: lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; x_1 = l_Lean_Parser_Command_universe___elambda__1___closed__2; x_2 = lean_unsigned_to_nat(1024u); -x_3 = l_Lean_Parser_Command_deriving_parenthesizer___closed__2; +x_3 = l_Lean_Parser_Command_namespace_parenthesizer___closed__2; x_4 = lean_alloc_closure((void*)(l_Lean_PrettyPrinter_Parenthesizer_leadingNode_parenthesizer___boxed), 8, 3); lean_closure_set(x_4, 0, x_1); lean_closure_set(x_4, 1, x_2); @@ -24445,7 +24447,7 @@ _start: lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; x_1 = l_Lean_Parser_Command_resolve__name___elambda__1___closed__2; x_2 = lean_unsigned_to_nat(1024u); -x_3 = l_Lean_Parser_Command_deriving_parenthesizer___closed__2; +x_3 = l_Lean_Parser_Command_namespace_parenthesizer___closed__2; x_4 = lean_alloc_closure((void*)(l_Lean_PrettyPrinter_Parenthesizer_leadingNode_parenthesizer___boxed), 8, 3); lean_closure_set(x_4, 0, x_1); lean_closure_set(x_4, 1, x_2); @@ -33147,8 +33149,6 @@ l_Lean_Parser_Command_deriving_parenthesizer___closed__4 = _init_l_Lean_Parser_C lean_mark_persistent(l_Lean_Parser_Command_deriving_parenthesizer___closed__4); l_Lean_Parser_Command_deriving_parenthesizer___closed__5 = _init_l_Lean_Parser_Command_deriving_parenthesizer___closed__5(); lean_mark_persistent(l_Lean_Parser_Command_deriving_parenthesizer___closed__5); -l_Lean_Parser_Command_deriving_parenthesizer___closed__6 = _init_l_Lean_Parser_Command_deriving_parenthesizer___closed__6(); -lean_mark_persistent(l_Lean_Parser_Command_deriving_parenthesizer___closed__6); l___regBuiltin_Lean_Parser_Command_deriving_parenthesizer___closed__1 = _init_l___regBuiltin_Lean_Parser_Command_deriving_parenthesizer___closed__1(); lean_mark_persistent(l___regBuiltin_Lean_Parser_Command_deriving_parenthesizer___closed__1); res = l___regBuiltin_Lean_Parser_Command_deriving_parenthesizer(lean_io_mk_world()); @@ -33279,6 +33279,8 @@ l_Lean_Parser_Command_namespace_parenthesizer___closed__1 = _init_l_Lean_Parser_ lean_mark_persistent(l_Lean_Parser_Command_namespace_parenthesizer___closed__1); l_Lean_Parser_Command_namespace_parenthesizer___closed__2 = _init_l_Lean_Parser_Command_namespace_parenthesizer___closed__2(); lean_mark_persistent(l_Lean_Parser_Command_namespace_parenthesizer___closed__2); +l_Lean_Parser_Command_namespace_parenthesizer___closed__3 = _init_l_Lean_Parser_Command_namespace_parenthesizer___closed__3(); +lean_mark_persistent(l_Lean_Parser_Command_namespace_parenthesizer___closed__3); l___regBuiltin_Lean_Parser_Command_namespace_parenthesizer___closed__1 = _init_l___regBuiltin_Lean_Parser_Command_namespace_parenthesizer___closed__1(); lean_mark_persistent(l___regBuiltin_Lean_Parser_Command_namespace_parenthesizer___closed__1); res = l___regBuiltin_Lean_Parser_Command_namespace_parenthesizer(lean_io_mk_world()); diff --git a/stage0/stdlib/Lean/Parser/Syntax.c b/stage0/stdlib/Lean/Parser/Syntax.c index f917c03303..6cbd0da156 100644 --- a/stage0/stdlib/Lean/Parser/Syntax.c +++ b/stage0/stdlib/Lean/Parser/Syntax.c @@ -1007,6 +1007,7 @@ extern lean_object* l_myMacro____x40_Init_Notation___hyg_49____closed__6; lean_object* l_Lean_Parser_Command_elabTail___elambda__1___closed__8; lean_object* l_Lean_Parser_Syntax_atom_parenthesizer___closed__2; lean_object* l_Lean_Parser_Command_postfix___closed__4; +extern lean_object* l_Lean_Parser_Command_namespace_parenthesizer___closed__2; lean_object* l_Lean_Parser_Syntax_sepBy_formatter___closed__12; lean_object* l_Lean_Parser_Command_syntax_formatter___closed__10; lean_object* l_Lean_Parser_Command_elab_parenthesizer___closed__12; @@ -1112,7 +1113,6 @@ lean_object* l_Lean_Parser_maxSymbol___elambda__1___closed__4; lean_object* l_Lean_Parser_Command_macro___elambda__1___closed__7; extern lean_object* l_myMacro____x40_Init_Notation___hyg_49____closed__8; extern lean_object* l_Lean_Parser_Term_typeAscription___closed__1; -extern lean_object* l_Lean_Parser_Command_deriving_parenthesizer___closed__2; lean_object* l_Lean_Parser_Command_parserKind___elambda__1(lean_object*, lean_object*); lean_object* l_Lean_Parser_Syntax_paren_formatter___closed__5; lean_object* l_Lean_Parser_Command_notation___elambda__1___closed__8; @@ -11418,7 +11418,7 @@ _start: { lean_object* x_1; lean_object* x_2; lean_object* x_3; x_1 = l_Lean_Parser_Syntax_paren_parenthesizer___closed__3; -x_2 = l_Lean_Parser_Command_deriving_parenthesizer___closed__2; +x_2 = l_Lean_Parser_Command_namespace_parenthesizer___closed__2; x_3 = lean_alloc_closure((void*)(l_Lean_PrettyPrinter_Parenthesizer_andthen_parenthesizer), 7, 2); lean_closure_set(x_3, 0, x_1); lean_closure_set(x_3, 1, x_2); @@ -12227,7 +12227,7 @@ _start: lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; x_1 = l_Lean_Parser_Command_syntaxCat___elambda__1___closed__2; x_2 = lean_unsigned_to_nat(1024u); -x_3 = l_Lean_Parser_Command_deriving_parenthesizer___closed__2; +x_3 = l_Lean_Parser_Command_namespace_parenthesizer___closed__2; x_4 = lean_alloc_closure((void*)(l_Lean_PrettyPrinter_Parenthesizer_leadingNode_parenthesizer___boxed), 8, 3); lean_closure_set(x_4, 0, x_1); lean_closure_set(x_4, 1, x_2); @@ -14302,7 +14302,7 @@ static lean_object* _init_l_Lean_Parser_Command_macroTailDefault_parenthesizer__ _start: { lean_object* x_1; lean_object* x_2; -x_1 = l_Lean_Parser_Command_deriving_parenthesizer___closed__2; +x_1 = l_Lean_Parser_Command_namespace_parenthesizer___closed__2; x_2 = lean_alloc_closure((void*)(l_Lean_PrettyPrinter_Parenthesizer_atomic_parenthesizer), 6, 1); lean_closure_set(x_2, 0, x_1); return x_2; @@ -15021,7 +15021,7 @@ static lean_object* _init_l_Lean_Parser_Command_elab__rules_parenthesizer___clos _start: { lean_object* x_1; lean_object* x_2; -x_1 = l_Lean_Parser_Command_deriving_parenthesizer___closed__2; +x_1 = l_Lean_Parser_Command_namespace_parenthesizer___closed__2; x_2 = lean_alloc_closure((void*)(l_Lean_Parser_optional_parenthesizer), 6, 1); lean_closure_set(x_2, 0, x_1); return x_2;