Skip to content

Commit

Permalink
Merge pull request #22648 from JuliaLang/jb/deparsespaces
Browse files Browse the repository at this point in the history
two small improvements to `deparse`
  • Loading branch information
JeffBezanson authored Jul 2, 2017
2 parents b4396ff + 2493817 commit db5ddfa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/ast.scm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
;; successfully printed as a julia value
(string.sub s 9 (string.dec s (length s)))
s)))
((char? e) (string "'" e "'"))
((atom? e) (string e))
((eq? (car e) '|.|)
(string (deparse (cadr e)) '|.|
Expand All @@ -37,7 +38,7 @@
((memq (car e) '(... |'| |.'|))
(string (deparse (cadr e)) (car e)))
((or (syntactic-op? (car e)) (eq? (car e) '|<:|) (eq? (car e) '|>:|))
(string (deparse (cadr e)) (car e) (deparse (caddr e))))
(string (deparse (cadr e)) " " (car e) " " (deparse (caddr e))))
((memq (car e) '($ &))
(string (car e) (deparse (cadr e))))
((eq? (car e) '|::|)
Expand Down
2 changes: 1 addition & 1 deletion test/parse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ for op in ["+", "-", "\$", "|", ".+", ".-", "*", ".*"]
end

# issue #17701
@test expand(Main, :(i==3 && i+=1)) == Expr(:error, "invalid assignment location \"==(i,3)&&i\"")
@test expand(Main, :(i==3 && i+=1)) == Expr(:error, "invalid assignment location \"==(i,3) && i\"")

# issue #18667
@test expand(Main, :(true = 1)) == Expr(:error, "invalid assignment location \"true\"")
Expand Down

0 comments on commit db5ddfa

Please sign in to comment.