How to use the hy.models.symbol.HySymbol function in hy

To help you get started, we’ve selected a few hy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hylang / hy / hy / lex / states.py View on Github external
"null": "None",
    }

    if obj in table:
        return HySymbol(table[obj])

    if obj.startswith(":"):
        return HyKeyword(obj)

    if obj.startswith("*") and obj.endswith("*") and obj not in ("*", "**"):
        obj = obj[1:-1].upper()

    if "-" in obj and obj != "-":
        obj = obj.replace("-", "_")

    return HySymbol(obj)
github hylang / hy / hy / contrib / meth.py View on Github external
def router(tree, rkwargs=None):
    tree = HyExpression(tree)
    name = tree.pop(0)
    path = tree.pop(0)
    tree.insert(0, HySymbol("fn"))
    tree = HyExpression([HySymbol("def"), name, tree])

    route = HyExpression([HySymbol(".route"), HySymbol("app"), path])

    if rkwargs:
        route = HyExpression([HySymbol("kwapply"), route,
                              HyDict({HyString("methods"): rkwargs})])

    return HyExpression([HySymbol("with_decorator"), route, tree])
github hylang / hy / hy / core / bootstrap.py View on Github external
def defn_macro(name, *body):
    return HyExpression([HySymbol("def"),
                         name, HyExpression([HySymbol("fn")] + list(body))])