Permalink
Browse files

[fix] opaPrint: quick fix on js-like dom #id printer

  • Loading branch information...
1 parent 7851fe2 commit 70ad91428e94993c041a6261abb82f1fbfa2447d @cedricss cedricss committed Jan 16, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 opalang/opaPrint.ml
View
@@ -76,6 +76,7 @@ let unary_minus_float = "unary_minus_float"
let operator_image s =
if s = unary_minus then "-"
else if s = unary_minus_float then "-."
+ else if s = "$" then "#"
else s
let is_operator s =
@@ -1267,6 +1268,8 @@ module Js = struct
| Apply ((Ident oper,_LABEL1),([(_,e1);(_,e2)],_LABEL2)) as e when self#is_operator oper ->
if op || colon then pp f "(%a)" self#reset#expr_node e else
pp f "@[<2>%a %s@ %a@]" self#under_op#expr e1 (operator_image (self#to_unprotected_ident oper)) self#under_op#expr e2
+ | Apply ((Ident oper,_LABEL1),([(_,(Const (CString s), _))],_LABEL2)) when (Obj.magic oper="$") ->
+ pp f "#%a" Format.pp_print_string (self#to_protected_ident (Obj.magic s))
| Apply ((Ident oper,_LABEL1),([(_,e1)],_LABEL2)) as e when self#is_operator oper ->
if op || colon then pp f "(%a)" self#reset#expr_node e else
pp f "@[<2>%s%a@]" (operator_image (self#to_unprotected_ident oper)) self#under_op#expr e1

0 comments on commit 70ad914

Please sign in to comment.