Exemple #1
0
def make_parser():
    return ox.make_parser([
        ("expr : NUMBER", lambda x: as_expr(float(x))),
        ("expr : STRING", lambda x: as_expr(clean_string(x))),
        ("expr : NAME", var),
        ("expr : SYMBOL", var.read),
        ("expr : 'if'", handle_if),
        ("expr : 'let'", handle_let),
        ("expr : '(' 'items' ')'", handle_eval),
    ])
Exemple #2
0
 def Tuple(values):
     return as_expr(tuple(to_python(x) for x in values))
Exemple #3
0
 def List(values):
     return as_expr([to_python(x) for x in values])
Exemple #4
0
 def Atom(value):  # noqa: N802, N805
     return as_expr(value)
Exemple #5
0
 def Record(values):
     d = {}
     for i, j in values.items():
         d[str(i)] = to_python(j)
     return as_expr(d)