56 lines
2.3 KiB
Text
56 lines
2.3 KiB
Text
[Elab.definition.body] «term_+++_» : Lean.TrailingParserDescr :=
|
|
Lean.ParserDescr.trailingNode `«term_+++_» 45 46
|
|
(Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "+++") (Lean.ParserDescr.cat `term 46))
|
|
[Elab.definition.body] «_aux_ppNotationCode___macroRules_term_+++__1» : Lean.Macro :=
|
|
fun x =>
|
|
let discr := x;
|
|
if Lean.Syntax.isOfKind discr `«term_+++_» = true then
|
|
let discr_1 := Lean.Syntax.getArg discr 0;
|
|
let discr_2 := Lean.Syntax.getArg discr 1;
|
|
let discr := Lean.Syntax.getArg discr 2;
|
|
let rhs := { raw := discr };
|
|
let lhs := { raw := discr_1 };
|
|
do
|
|
let info ← Lean.MonadRef.mkInfoFromRefPos
|
|
let scp ← Lean.getCurrMacroScope
|
|
let mainModule ← Lean.getMainModule
|
|
pure
|
|
{ raw :=
|
|
Lean.Syntax.node Lean.SourceInfo.none `Lean.Parser.Term.app
|
|
#[Lean.Syntax.ident info (String.toSubstring "Nat.add") (Lean.addMacroScope mainModule `Nat.add scp)
|
|
[(`Nat.add, [])],
|
|
Lean.Syntax.node Lean.SourceInfo.none `null #[lhs.raw, rhs.raw]] }.raw
|
|
else
|
|
let discr := x;
|
|
throw Lean.Macro.Exception.unsupportedSyntax
|
|
[Elab.definition.body] _aux_ppNotationCode___unexpand_Nat_add_1 : Lean.PrettyPrinter.Unexpander :=
|
|
fun x =>
|
|
let discr := x;
|
|
if Lean.Syntax.isOfKind discr `Lean.Parser.Term.app = true then
|
|
let discr_1 := Lean.Syntax.getArg discr 0;
|
|
bif false || Lean.Syntax.isOfKind discr_1 `ident then
|
|
let discr_2 := Lean.Syntax.getArg discr 1;
|
|
if Lean.Syntax.matchesNull discr_2 2 = true then
|
|
let discr := Lean.Syntax.getArg discr_2 0;
|
|
let discr_3 := Lean.Syntax.getArg discr_2 1;
|
|
let rhs := { raw := discr_3 };
|
|
let lhs := { raw := discr };
|
|
let f := { raw := discr_1 };
|
|
Lean.withRef f.raw do
|
|
let info ← Lean.MonadRef.mkInfoFromRefPos
|
|
let _ ← Lean.getCurrMacroScope
|
|
let _ ← Lean.getMainModule
|
|
pure
|
|
{ raw :=
|
|
Lean.Syntax.node Lean.SourceInfo.none `«term_+++_»
|
|
#[lhs.raw, Lean.Syntax.atom info "+++", rhs.raw] }.raw
|
|
else
|
|
let discr := Lean.Syntax.getArg discr 1;
|
|
throw ()
|
|
else
|
|
let discr_2 := Lean.Syntax.getArg discr 0;
|
|
let discr := Lean.Syntax.getArg discr 1;
|
|
throw ()
|
|
else
|
|
let discr := x;
|
|
throw ()
|