File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -506,7 +506,7 @@ function toexpr(sys::AbstractSystem)
506
506
striplines (expr) # keeping the line numbers is never helpful
507
507
end
508
508
509
- Base. write (io:: IO , sys:: AbstractSystem ) = write (io, JuliaFormatter . format_text ( string ( toexpr (sys) )))
509
+ Base. write (io:: IO , sys:: AbstractSystem ) = write (io, readable_code ( toexpr (sys)))
510
510
511
511
function Base. show (io:: IO , :: MIME"text/plain" , sys:: AbstractSystem )
512
512
eqs = equations (sys)
Original file line number Diff line number Diff line change @@ -84,3 +84,17 @@ function indepvar2depvar(s::Sym, args...)
84
84
ns = Sym {T} (nameof (s))(args... )
85
85
@set! ns. metadata = s. metadata
86
86
end
87
+
88
+ function _readable_code (ex)
89
+ ex isa Expr || return ex
90
+ if ex. head === :call
91
+ f, args = ex. args[1 ], ex. args[2 : end ]
92
+ if f isa Function && (nf = nameof (f); Base. isoperator (nf))
93
+ return Expr (:call , nf, args... )
94
+ end
95
+ end
96
+ expr = Expr (ex. head)
97
+ expr. args = map (_readable_code, ex. args)
98
+ Base. remove_linenums! (expr)
99
+ end
100
+ readable_code (expr) = JuliaFormatter. format_text (string (_readable_code (expr)))
You can’t perform that action at this time.
0 commit comments