Merge branch 'master' into pr/187
This commit is contained in:
commit
b00f181e1e
1
AUTHORS
1
AUTHORS
@ -11,3 +11,4 @@
|
||||
* Vladimir Gorbunov <vsg@suburban.me>
|
||||
* John Jacobsen <john@mail.npxdesigns.com>
|
||||
* rogererens <roger.erens@e-s-c.biz>
|
||||
* Thomas Ballinger <thomasballinger@gmail.com>
|
||||
|
@ -12,7 +12,7 @@ Theory of Hy
|
||||
============
|
||||
|
||||
Hy maintains, over everything else, 100% compatibility in both directions
|
||||
with Python it's self. All Hy code follows a few simple rules. Memorize
|
||||
with Python itself. All Hy code follows a few simple rules. Memorize
|
||||
this, it's going to come in handy.
|
||||
|
||||
These rules help make sure code is idiomatic and interface-able in both
|
||||
|
6
eg/clint/clint-progress.hy
Normal file
6
eg/clint/clint-progress.hy
Normal file
@ -0,0 +1,6 @@
|
||||
(import [clint.textui [progress]]
|
||||
[time [sleep]]
|
||||
[random [random]])
|
||||
|
||||
(for [x (.bar progress (range 100))]
|
||||
(sleep (* (random) 0.1)))
|
@ -255,8 +255,9 @@ class String(State):
|
||||
"""
|
||||
if self.escaped:
|
||||
self.escaped = False
|
||||
if char == "n":
|
||||
self.nodes.append("\n")
|
||||
simple_escapables = tuple('abfnrtv')
|
||||
if char in simple_escapables:
|
||||
self.nodes.append(eval('"\\'+char+'"'))
|
||||
return
|
||||
if char == "\\":
|
||||
self.nodes.append("\\")
|
||||
|
21
hy/macros.py
21
hy/macros.py
@ -57,20 +57,25 @@ def _wrap_value(x):
|
||||
else:
|
||||
return wrapper(x)
|
||||
|
||||
_wrappers = {int: HyInteger,
|
||||
bool: lambda x: HySymbol("True") if x else HySymbol("False"),
|
||||
float: HyFloat,
|
||||
complex: HyComplex,
|
||||
str_type: HyString,
|
||||
dict: lambda d: HyDict(_wrap_value(x) for x in sum(d.items(), ())),
|
||||
list: lambda l: HyList(_wrap_value(x) for x in l)}
|
||||
_wrappers = {
|
||||
int: HyInteger,
|
||||
bool: lambda x: HySymbol("True") if x else HySymbol("False"),
|
||||
float: HyFloat,
|
||||
complex: HyComplex,
|
||||
str_type: HyString,
|
||||
dict: lambda d: HyDict(_wrap_value(x) for x in sum(d.items(), ())),
|
||||
list: lambda l: HyList(_wrap_value(x) for x in l)
|
||||
}
|
||||
|
||||
|
||||
def process(tree, module_name):
|
||||
if isinstance(tree, HyExpression):
|
||||
fn = tree[0]
|
||||
if fn in ("quote", "quasiquote"):
|
||||
return tree
|
||||
ntree = HyExpression([fn] + [process(x, module_name) for x in tree[1:]])
|
||||
ntree = HyExpression(
|
||||
[fn] + [process(x, module_name) for x in tree[1:]]
|
||||
)
|
||||
ntree.replace(tree)
|
||||
|
||||
if isinstance(fn, HyString):
|
||||
|
@ -728,3 +728,7 @@
|
||||
(assert (= x [3 2 1]))
|
||||
"success")
|
||||
(except [NameError] "failure")))))
|
||||
|
||||
(defn test-encoding-nightmares []
|
||||
"NATIVE: test unicode encoding escaping crazybits"
|
||||
(assert (= (len "ℵℵℵ♥♥♥\t♥♥\r\n") 11)))
|
||||
|
Loading…
Reference in New Issue
Block a user