712 Commits

Author SHA1 Message Date
Foxboron
a35ecc41bd Fix reader macros to actually be macros 2014-01-17 01:07:47 +01:00
Gergely Nagy
8ef02a54b5 hy/lex/parser.py: Add support for sub-object mangling
With this patch, every identifier is split up along dots, each part gets
separately mangled, and then it is all joined back together. This allows
for fun stuff like (.foo? (Foo)), and even more contrived examples.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2014-01-16 16:23:35 +01:00
Gergely Nagy
ceb615d010 hy/lex/parser.py: Move most of the identifier mangling into a def
As a refactoring step, move the identifier mangling done in t_identifier
into a separate def.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2014-01-16 16:20:51 +01:00
Nicolas Dandrimont
8bfa4f33fc Add set comprehensions, dict comprehensions and generator expressions
Closes: #14 (woo, two-digit tickets)
2014-01-16 00:49:48 +01:00
Berker Peksag
25459177eb Move "hy on meth" example to eg/. 2014-01-14 06:03:57 +02:00
Paul Tagliamonte
5a64f18726 Refactor (loop) in terms of fnr; change to use decorator. 2014-01-13 20:37:25 -05:00
Gergely Nagy
5b78735011 hy/cmdline.py: Add support for running with --spy -i
There's no reason why one would need to choose between --spy and -i, so
pass down options.spy to run_icommand, and then to HyREPL, so we can
have both.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
2014-01-13 22:12:32 +01:00
Paul Tagliamonte
0afbbeb68c Add (recur) for functions and stuff. 2014-01-12 18:53:08 -05:00
Clinton N. Dreisbach
47d67b0062 Added loop/recur macro for tail-call optimization 2014-01-12 14:02:27 -05:00
Paul Tagliamonte
5fc047e77c Merge branch 'master' into pr/425
Conflicts:
	hy/core/language.hy
2014-01-12 12:48:26 -05:00
Nicolas Dandrimont
1e793e696a Fix indentation of *exports* 2014-01-12 17:34:05 +01:00
Nicolas Dandrimont
14a791f37b Merge branch 'f/is-coll' of https://github.com/theanalyst/hy into theanalyst-f/is-coll 2014-01-12 17:33:17 +01:00
Abhishek L
ec8220c2b7 Merge master onto pr/428 2014-01-12 20:33:25 +05:30
Abhishek L
f159f1499b Adding a simple coll? function to the core
* hy/core/language.hy:
  -Added a simple coll? function that checks whether the given argument
  is an iterable and not a string,
  - Also replaced the check in `flatten` by coll?

* tests/native_tests/core.hy: Tests updated for checking coll?
2014-01-12 15:49:09 +05:30
Paul Tagliamonte
cc2f45be69 slice is amazing, @olasd is amazing, I love everything. 2014-01-10 22:50:20 -05:00
Paul Tagliamonte
0f74b1ddf3 Add handling for (for []). Nice catch, @olasd. 2014-01-10 22:29:20 -05:00
Paul Tagliamonte
2167c21120 Adjust (for) to just use itertools.product
This is to avoid nesting in for loops, helping make clear
 what (break) and (else) do.

 This commit is hereby dedicated to @nedbat
2014-01-10 22:00:30 -05:00
Paul Tagliamonte
c0a654e6cb Add callgraph stuff. Slick look. 2014-01-10 21:03:19 -05:00
Clinton N. Dreisbach
849244f3b4 Make first and rest fns instead of macros
car and cdr are still macros, but I'd recommend either making them
fns or removing them.
2014-01-10 13:46:31 -05:00
Nicolas Dandrimont
d18e752d33 Implement the . attribute access DSL
This fixes #399
2014-01-09 03:34:53 +01:00
Paul Tagliamonte
85bdd3fe19 Merge branch 'master' into paultag/bugfix/python3.4 2014-01-04 12:51:55 -05:00
Nicolas Dandrimont
d3fa1fd1a8 Add disassemble function to hy.core.language
This function dumps the AST or the python code generated by evaluating a quoted expression to stdout.

Fixes #58
2014-01-04 03:47:04 +01:00
Paul Tagliamonte
de31aea5d2 Cleanup use of PY3* in the compiler. 2014-01-03 20:02:36 -05:00
Paul Tagliamonte
c5c36e1022 Merge branch 'master' into paultag/bugfix/python3.4
Conflicts:
	bin/hy2py
2014-01-03 19:57:05 -05:00
Nicolas Dandrimont
2f7d40b409 Factor the calling-module-name function 2014-01-03 21:41:14 +01:00
Paul Tagliamonte
590d3bf1df Clean up compare to use the tuple. Thanks @olasd 2014-01-01 22:33:44 -05:00
Nicolas Dandrimont
a44e53f4de Comments end when the input ends or a newline occurs
This fixes #382, which occured because the REPL doesn't use trailing newlines.
2014-01-02 03:09:18 +01:00
Paul Tagliamonte
1d58e52584 Flake8 style fix. 2014-01-01 19:12:17 -05:00
Paul Tagliamonte
f28bf41f8d Merge branch 'master' of github.com:hylang/hy into paultag/bugfix/python3.4 2014-01-01 18:59:23 -05:00
Paul Tagliamonte
d22a152134 Merge branch 'master' of github.com:hylang/hy into paultag/bugfix/python3.4 2014-01-01 18:58:39 -05:00
Paul Tagliamonte
26e2fb3606 Give a whack at Python 3.4 support
This adds ast.arg for Python 3.4+, for FunctionDef args and other
 args (starargs, kwargs)
2014-01-01 18:56:09 -05:00
Nicolas Dandrimont
77baf3b9f3 Merge branch 'meth-fix' of https://github.com/Willyfrog/hy into Willyfrog-meth-fix
Conflicts:
	tests/__init__.py
2014-01-02 00:53:40 +01:00
Nicolas Dandrimont
88451bbeaa Merge branch 'better-macroexpand' of https://github.com/sbp/hy into sbp-better-macroexpand
Conflicts:
	hy/core/language.hy
	tests/native_tests/language.hy
2014-01-02 00:49:40 +01:00
Paul Tagliamonte
575388fc13 Merge branch 'master' into pr/397
Conflicts:
	hy/importer.py
2014-01-01 16:40:16 -05:00
Bob Tolbert
032200bcb4 Some small doc fixes
This cleans up a number of doc warnings, including a bad
underline for zero?

While there, added a nil? function to match up with the
new nil is None.

Also un-hid myself from coreteam.
2013-12-31 16:14:05 -07:00
Paul Tagliamonte
dfbdbdfb73 We're 0.9.12 2013-12-31 14:24:50 -05:00
Paul Tagliamonte
eeef65b505 Change the signature of (for) and (with).
(for) is restored to clojure-like flatness.
 (with) can be used without the nested list if you don't care about the
        name.

   Tests and examples updated.
2013-12-31 13:35:31 -05:00
Bob Tolbert
05899423df Changing --show_tracebacks to --show-tracebacks 2013-12-31 09:56:03 -07:00
Bob Tolbert
5040c29946 Cleaning up some comments from berker 2013-12-31 09:56:03 -07:00
Bob Tolbert
765dba3e56 More updates, including from Foxboron, for errors like (for) 2013-12-31 09:56:03 -07:00
Foxboron
f064d3f121 Errors into errors.py, added HyMacroExpansionError, fixed macro arg fail 2013-12-31 09:56:03 -07:00
Bob Tolbert
f6160c755a Much better version of new error messages.
This version is much simpler.

At the point that the exception is raised, we don't have access to
the actual source, just the current expression. but as the
exception percolates up, we can intercept it, add the source and
the re-raise it.

Then at the final point, in the cmdline handler, we can choose to
let the entire traceback print, or just the simpler, direct error
message.

And even with the full traceback, the last bit is nicely formatted
just like the shorter, simpler message.

The error message is colored if clint is installed, but to avoid
yet another dependency, you get monochrome without clint.

I'm sure there is a better way to do the markup, the current method
is kludgy but works.

I wish there was more shared code between HyTypeError and LexException
but they are kind of different in some fundamental ways.

This doesn't work (yet) with runtime errors generated from Python,
like NameError, but I have a method that can catch NameError and turn it
into a more pleasing output.

Finally, there is no obvious way to raise HyTypeError from pure Hy code,
so methods in core/language.hy throw ugly TypeError/ValueError.
2013-12-31 09:56:03 -07:00
Paul Tagliamonte
e754a58237 Merge branch 'master' into pr/363 2013-12-31 11:41:30 -05:00
Foxboron
426d34288f Added docs and one small bug fix in defreader 2013-12-31 15:46:21 +02:00
Abhishek L
0a80b87b7f Merge branch 'master' onto pr/395 2013-12-31 03:37:26 +05:30
Gergely Nagy
62522a5f86 Allow get with multiple arguments
When calling get with more than two arguments, treat the rest as indexes
into the expression from the former. That is, (get foo "bar" "baz")
would translate to foo["bar"]["baz"], and so on.

This fixes #362.

Requested-by: Sean B. Palmer <sean@miscoranda.com>
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2013-12-30 12:04:40 +01:00
Foxboron
d82636958b added for and with macros
Fixed up anaphoric.hy and added the tests too native_tests/__init__.py

added __init__.hy
2013-12-29 16:50:21 +01:00
Berker Peksag
8120a25c08 Add py_compile.{MAGIC, wr_long} to hy._compat.
Closes #344.
2013-12-29 13:10:36 +02:00
Kenan Bölükbaşı
3f590f8916 Reflect parameters of code.InteractiveConsele in HyREPL in order to make hy run inside Blender. 2013-12-29 01:22:16 +02:00
Paul Tagliamonte
9656c7f53c Add profiling macros 2013-12-28 11:25:27 -05:00