summaryrefslogtreecommitdiff
path: root/src/sexpr/parser.py
blob: 201f4574faca5840e634c95aad36b02b59a5217d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class SExpr(object):
    ''' print a SExpr
    '''
    __slots__ = ('_value')
    name = 'tmwa::sexpr::SExpr'
    enabled = True

    def __init__(self, value):
        self._value = value

    def to_string(self):
        return None

    def children(self):
        v = self._value
        t = v['_type']
        if t == 0:
            yield '(list)', v['_list']
        if t == 1:
            yield '(int)', v['_int']
        if t == 2:
            yield '(str)', v['_str']
        if t == 3:
            yield '(token)', v['_str']
        yield '_span', v['_span']