@@ -550,7 +550,7 @@ def __init__(self, ctx, node):
550550}
551551
552552def to_ast_node ( ctx , node = None ):
553- # print 'to-ast-node', ctx
553+ print 'to-ast-node' , ctx
554554
555555 if ctx .type == 'node' :
556556 print 'NODE::' , ctx .node
@@ -598,6 +598,7 @@ def to_ast_node( ctx, node=None ):
598598
599599 elif ctx .type == 'single_kw' :
600600 if ctx .token == 'else' or ctx .token == 'elif' :
601+ #if ctx.token == 'else': ## TODO fix: "if/elif: if"
601602 orelse = IfExp ._previous .orelse
602603 for child in node .children :
603604 walk_nodes ( child , orelse )
@@ -610,21 +611,21 @@ def to_ast_node( ctx, node=None ):
610611 elif ctx .type == 'node_js' :
611612 print (ctx .tree [0 ])
612613 ## special brython inline javascript ##
613- if len (ctx .tree ) == 1 and '__iadd__' in ctx .tree [0 ]:
614- AugAssign ._previous .op = '+'
615- elif len (ctx .tree ) == 1 and '__isub__' in ctx .tree [0 ]:
616- AugAssign ._previous .op = '-'
617- elif len (ctx .tree ) == 1 and ctx .tree [0 ].startswith ("if($temp.$fast_augm" ):
618- print (ctx .tree [0 ])
619- c = ctx .tree [0 ].split ('"' )
620- if len (c ) == 3 :
621- AugAssign ._previous .target = Name ( name = c [1 ] )
622- else :
623- print (c )
624- raise TypeError
625-
626- elif len (ctx .tree ) == 1 and ctx .tree [0 ] == 'else' :
627- pass
614+ # if len(ctx.tree) == 1 and '__iadd__' in ctx.tree[0]:
615+ # AugAssign._previous.op = '+'
616+ # elif len(ctx.tree) == 1 and '__isub__' in ctx.tree[0]:
617+ # AugAssign._previous.op = '-'
618+ # elif len(ctx.tree) == 1 and ctx.tree[0].startswith("if($temp.$fast_augm"):
619+ # print(ctx.tree[0])
620+ # c = ctx.tree[0].split('"')
621+ # if len(c) == 3:
622+ # AugAssign._previous.target = Name( name=c[1] )
623+ # else:
624+ # print(c)
625+ # raise TypeError
626+
627+ if len (ctx .tree ) == 1 and ctx .tree [0 ] == 'else' : ## DEPRECATED
628+ raise TypeError
628629 else :
629630 print '--------special node_js error-------'
630631 print (ctx )
0 commit comments