Confusingly fun.
This commit is contained in:
parent
74d4937078
commit
b884eca7bf
@ -93,6 +93,14 @@ def ast_str(foobar):
|
|||||||
|
|
||||||
|
|
||||||
def builds(_type):
|
def builds(_type):
|
||||||
|
|
||||||
|
unpythonic_chars = ["-"]
|
||||||
|
really_ok = ["-"]
|
||||||
|
if True in (x in str_type(_type) for x in unpythonic_chars):
|
||||||
|
if _type not in really_ok:
|
||||||
|
raise TypeError("`build' needs to be *post* translated strings, "
|
||||||
|
"Mr. / Mrs. Hypser. -- `%s' sucks." % (_type))
|
||||||
|
|
||||||
def _dec(fn):
|
def _dec(fn):
|
||||||
_compile_table[_type] = fn
|
_compile_table[_type] = fn
|
||||||
return fn
|
return fn
|
||||||
@ -569,7 +577,7 @@ class HyASTCompiler(object):
|
|||||||
return ret
|
return ret
|
||||||
|
|
||||||
@builds("unquote")
|
@builds("unquote")
|
||||||
@builds("unquote-splicing")
|
@builds("unquote_splicing")
|
||||||
def compile_unquote(self, expr):
|
def compile_unquote(self, expr):
|
||||||
raise HyTypeError(expr,
|
raise HyTypeError(expr,
|
||||||
"`%s' can't be used at the top-level" % expr[0])
|
"`%s' can't be used at the top-level" % expr[0])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user