Merge branch 'master' into pr/222
This commit is contained in:
commit
8d96f68bd6
2
AUTHORS
2
AUTHORS
@ -14,4 +14,4 @@
|
||||
* Thomas Ballinger <thomasballinger@gmail.com>
|
||||
* Morten Linderud <mcfoxax@gmail.com>
|
||||
* Guillermo Vayá <guivaya@gmail.com>
|
||||
|
||||
* Ralph Möritz <ralph.moeritz@outlook.com>
|
||||
|
26
NEWS
26
NEWS
@ -1,3 +1,29 @@
|
||||
Changes from Hy 0.9.8
|
||||
|
||||
[ Syntax Fixes ]
|
||||
|
||||
* Macros are now module-specific, and must be required when used. (KH)
|
||||
* Added a few more string escapes to the compiler (Thomas Ballinger)
|
||||
* Keywords are pseudo-callable again, to get the value out of a dict. (PT)
|
||||
* Empty expression is now the same as an empty vector. (Guillermo Vaya)
|
||||
|
||||
[ Language Changes ]
|
||||
|
||||
* HyDicts (quoted dicts or internal HST repr) are now lists
|
||||
that compiled down to dicts by the Compiler later on. (ND)
|
||||
* Macros can be constants as well. (KH)
|
||||
* Add eval-when-compile and eval-and-compile (KH)
|
||||
* Add break and continue to Hy (Morten Linderud)
|
||||
* Core language libraries added. As example, I've included `take` and
|
||||
`drop` in this release. More to come (PT)
|
||||
|
||||
[ Misc. Fixes ]
|
||||
|
||||
* Ensure compiler errors are always "user friendly" (JD)
|
||||
* Hy REPL quitter repr adjusted to match Hy syntax (Morten Linderud)
|
||||
* Windows will no longer break due to missing readline (Ralph Moritz)
|
||||
|
||||
|
||||
Changes from Hy 0.9.7
|
||||
|
||||
[ Syntax Fixes ]
|
||||
|
@ -24,28 +24,24 @@
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
|
||||
import ast
|
||||
import code
|
||||
import optparse
|
||||
import os
|
||||
import readline
|
||||
import code
|
||||
import ast
|
||||
import sys
|
||||
|
||||
import hy
|
||||
|
||||
from hy.importer import ast_compile, import_buffer_to_module
|
||||
from hy.lex.states import Idle, LexException
|
||||
from hy.lex.machine import Machine
|
||||
from hy.compiler import hy_compile
|
||||
from hy.core import process
|
||||
from hy.importer import ast_compile, import_buffer_to_module
|
||||
from hy.completer import completion
|
||||
|
||||
import hy.completer
|
||||
|
||||
from hy.macros import macro, require
|
||||
from hy.models.expression import HyExpression
|
||||
from hy.models.string import HyString
|
||||
from hy.models.symbol import HySymbol
|
||||
|
||||
from hy.macros import macro, require
|
||||
|
||||
_machine = Machine(Idle, 1, 0)
|
||||
|
||||
@ -185,23 +181,15 @@ def run_repl(hr=None):
|
||||
sys.ps1 = "=> "
|
||||
sys.ps2 = "... "
|
||||
|
||||
history = os.path.expanduser("~/.hy-history")
|
||||
readline.parse_and_bind("set blink-matching-paren on")
|
||||
with completion():
|
||||
if not hr:
|
||||
hr = HyREPL()
|
||||
|
||||
try:
|
||||
readline.read_history_file(history)
|
||||
except IOError:
|
||||
open(history, 'a').close()
|
||||
hr.interact("{appname} {version}".format(
|
||||
appname=hy.__appname__,
|
||||
version=hy.__version__
|
||||
))
|
||||
|
||||
readline.parse_and_bind("tab: complete")
|
||||
|
||||
if not hr:
|
||||
hr = HyREPL()
|
||||
hr.interact("{appname} {version}".format(
|
||||
appname=hy.__appname__,
|
||||
version=hy.__version__
|
||||
))
|
||||
readline.write_history_file(history)
|
||||
return 0
|
||||
|
||||
|
||||
|
@ -1,4 +1,11 @@
|
||||
# Copyright (c) 2013 Paul Tagliamonte <paultag@debian.org>
|
||||
# Copyright (c) 2013 Gergely Nagy <algernon@madhouse-project.org>
|
||||
# Copyright (c) 2013 James King <james@agentultra.com>
|
||||
# Copyright (c) 2013 Julien Danjou <julien@danjou.info>
|
||||
# Copyright (c) 2013 Konrad Hinsen <konrad.hinsen@fastmail.net>
|
||||
# Copyright (c) 2013 Thom Neale <twneale@gmail.com>
|
||||
# Copyright (c) 2013 Will Kahn-Greene <willg@bluesock.org>
|
||||
# Copyright (c) 2013 Ralph Moritz <ralph.moeritz@outlook.com>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
@ -18,6 +25,21 @@
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
|
||||
import os
|
||||
from contextlib import contextmanager
|
||||
|
||||
docomplete = True
|
||||
|
||||
try:
|
||||
import readline
|
||||
except ImportError:
|
||||
try:
|
||||
import pyreadline.rlmain
|
||||
import pyreadline.unicode_helper # NOQA
|
||||
import readline
|
||||
except ImportError:
|
||||
docomplete = False
|
||||
|
||||
import hy.macros
|
||||
import hy.compiler
|
||||
|
||||
@ -58,10 +80,27 @@ class Completer(object):
|
||||
return None
|
||||
|
||||
|
||||
try:
|
||||
import readline
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
readline.set_completer(Completer().complete)
|
||||
readline.set_completer_delims("()[]{} ")
|
||||
@contextmanager
|
||||
def completion(completer=None):
|
||||
delims = "()[]{} "
|
||||
if not completer:
|
||||
completer = Completer()
|
||||
|
||||
if docomplete:
|
||||
readline.set_completer(completer.complete)
|
||||
readline.set_completer_delims(delims)
|
||||
|
||||
history = os.path.expanduser("~/.hy-history")
|
||||
readline.parse_and_bind("set blink-matching-paren on")
|
||||
|
||||
try:
|
||||
readline.read_history_file(history)
|
||||
except IOError:
|
||||
open(history, 'a').close()
|
||||
|
||||
readline.parse_and_bind("tab: complete")
|
||||
|
||||
yield
|
||||
|
||||
if docomplete:
|
||||
readline.write_history_file(history)
|
||||
|
6
setup.py
6
setup.py
@ -22,16 +22,20 @@
|
||||
|
||||
from hy import __appname__, __version__
|
||||
from setuptools import setup
|
||||
|
||||
import os
|
||||
|
||||
long_description = """Hy is a Python <--> Lisp layer. It helps
|
||||
make things work nicer, and lets Python and the Hy lisp variant play
|
||||
nice together. """
|
||||
|
||||
install_requires = []
|
||||
if os.name == 'nt':
|
||||
install_requires.append('pyreadline==2.0')
|
||||
|
||||
setup(
|
||||
name=__appname__,
|
||||
version=__version__,
|
||||
install_requires=install_requires,
|
||||
scripts=[
|
||||
"bin/hy",
|
||||
"bin/hyc",
|
||||
|
Loading…
x
Reference in New Issue
Block a user