summaryrefslogtreecommitdiff
path: root/src/sexpr/parser.py
blob: d638259d09ee4afc303c7d6d32a2700422b1357c (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 = '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']