# Path: lang/femtocode/thirdparty/meta/asttools/visitors/symbol_visitor.py
# def get_symbols(node, ctx_types=(ast.Load, ast.Store)):
#     '''
#     Returns all symbols defined in an ast node. 
#     
#     if ctx_types is given, then restrict the symbols to ones with that context.
#     
#     :param node: ast node
#     :param ctx_types: type or tuple of types that may be found assigned to the `ctx` attribute of 
#                       an ast Name node.
#         
#     '''
#     gen = SymbolVisitor(ctx_types)
#     return gen.visit(node)


from . import Visitor, visit_children
from ..visitors.symbol_visitor import get_symbols
from ...utils import py2op
import ast
    gen = ConditionalSymbolVisitor()
    gen.visit(node)
    return gen.cond_lhs, gen.stable_lhs


def conditional_symbols(node):
    '''
    Group lhs and rhs into contitional, stable and undefined
    :param node: ast node 
    
    :returns: tuple of (contitional_lhs, stable_lhs),(contitional_rhs, stable_rhs), undefined
    
    '''

    gen = ConditionalSymbolVisitor()
    gen.visit(node)
    lhs = gen.cond_lhs, gen.stable_lhs
    rhs = gen.cond_rhs, gen.stable_rhs
    undefined = gen.undefined
    return lhs, rhs, undefined

if __name__ == '__main__':

    source = '''
while k:
    a = 1
    b = 1
    break
    d = 1
else:

# Path: lang/femtocode/thirdparty/meta/asttools/visitors/symbol_visitor.py
# def get_symbols(node, ctx_types=(ast.Load, ast.Store)):
#     '''
#     Returns all symbols defined in an ast node. 
#     
#     if ctx_types is given, then restrict the symbols to ones with that context.
#     
#     :param node: ast node
#     :param ctx_types: type or tuple of types that may be found assigned to the `ctx` attribute of 
#                       an ast Name node.
#         
#     '''
#     gen = SymbolVisitor(ctx_types)
#     return gen.visit(node)


# Path: lang/femtocode/thirdparty/meta/asttools/visitors/cond_symbol_visitor.py
from . import Visitor, visit_children
from ..visitors.symbol_visitor import get_symbols
from ...utils import py2op
import ast

    gen = ConditionalSymbolVisitor()
    gen.visit(node)
    return gen.cond_lhs, gen.stable_lhs


def conditional_symbols(node):
    '''
    Group lhs and rhs into contitional, stable and undefined
    :param node: ast node 
    
    :returns: tuple of (contitional_lhs, stable_lhs),(contitional_rhs, stable_rhs), undefined
    
    '''

    gen = ConditionalSymbolVisitor()
    gen.visit(node)
    lhs = gen.cond_lhs, gen.stable_lhs
    rhs = gen.cond_rhs, gen.stable_rhs
    undefined = gen.undefined
    return lhs, rhs, undefined

if __name__ == '__main__':

    source = '''
while k:
    a = 1
    b = 1
    break
    d = 1
else:

    a =2