Commit Graph

424 Commits

Author SHA1 Message Date
Konrad Hinsen
269da19d76 Make macros module-specific.
A macro is available in the module where it was defined and
in any module that does a require of the defining module.
Only macros defined in hy.core are globally available.
Fixes #181
2013-05-16 15:34:14 +02:00
Paul Tagliamonte
de85940114 Meh, 0.9.8 time. 2013-05-12 13:40:53 -04:00
Paul Tagliamonte
8717d40e19 Rushed fix for the contrib.meth macros 2013-05-12 13:40:30 -04:00
Nicolas Dandrimont
5a74fff7e6 Fix up the native-macros to use compiler imports 2013-05-11 21:25:21 +02:00
Paul Tagliamonte
636eec8f51 style fixes 2013-05-11 13:59:19 -04:00
Nicolas Dandrimont
b380b330cd Add a defmacro builtin 2013-05-11 09:13:15 +02:00
Nicolas Dandrimont
0986f9001e Change macros to be called with separate arguments
This provides free argument-length checking for macros.
2013-05-11 09:09:34 +02:00
Nicolas Dandrimont
74d4937078 Don't return a useless pass in require 2013-05-11 08:04:59 +02:00
Paul Tagliamonte
2426237916 Add the (require) form. 2013-05-10 23:43:34 -04:00
Nicolas Dandrimont
2860ef6ff7 Don't macro-expand inside quotes 2013-05-11 00:29:42 +02:00
Nicolas Dandrimont
68399b9fc3 Make sure splicing works at all times 2013-05-11 00:26:37 +02:00
Nicolas Dandrimont
58bb3239ee Distinguish between quote and quasiquote 2013-05-10 23:42:38 +02:00
Nicolas Dandrimont
322a9992e5 Implement unquote and unquote-splicing 2013-05-10 23:42:38 +02:00
Paul Tagliamonte
9811b7514e Merge branch 'master' into pr/171 2013-05-09 20:39:49 -04:00
Paul Tagliamonte
1fa53f9255 Try/Except: Ensure that we return properly
From both inside a try and in an exception handler.
2013-05-08 20:41:16 -04:00
Nicolas Dandrimont
0055f00a76 Allow kwapply for any expression.
This fixes #103.
2013-05-09 02:28:42 +02:00
Paul Tagliamonte
98134e7396 Merge branch 'master' into bugfix/paultag/fix-try-except 2013-05-08 20:22:51 -04:00
Paul Tagliamonte
066c9781c7 Merge branch 'master' into pr/170 2013-05-08 20:11:57 -04:00
Paul Tagliamonte
058197a24f Allow returning inside a try / except. Closes #163 2013-05-08 20:00:09 -04:00
Nicolas Dandrimont
4e3f842972 Add &optional arguments.
Python doesn't really have that concept, so make them clash with &key arguments.
2013-05-08 21:11:33 +02:00
Nicolas Dandrimont
772927c53d Drop the bare names that were sprinkled everywhere in the generated AST.
This closes #162

We make sure not to drop *explicitly written* bare names.
2013-05-08 18:49:07 +02:00
Nicolas Dandrimont
c7176c05c0 Merge branch 'jd/defclass' of https://github.com/jd/hy into jd-jd/defclass 2013-05-08 15:30:20 +02:00
Julien Danjou
a823aca0c8 Run unit tests against hy2py
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-05-08 14:39:38 +02:00
Julien Danjou
ad7e110af4 Implements defclass
This fixes issue #156

Signed-off-by: Julien Danjou <julien@danjou.info>
2013-05-08 12:38:57 +02:00
Nicolas Dandrimont
1e24dde153 Merge fn and lambda
We actually only generate an ast.Lambda if (lambda) was called, as a lot of code
expect ast.FunctionDefs (most notably with_decorator).

This allows empty lambdas too.

This fixes #165.
2013-05-07 20:07:15 +02:00
Julien Danjou
5a6e3ca31b Small code simplification
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-05-06 15:46:06 +02:00
Paul Tagliamonte
57430a7a86 awesome. 0.9.7 2013-05-05 23:04:51 -04:00
Julien Danjou
a0285903e6 Cleanup
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-05-05 20:42:48 +02:00
Julien Danjou
9d8accb93a compiler: do not optimize Name
The optimization is wrong; they can't have side effects, but they can
raise errors.

Signed-off-by: Julien Danjou <julien@danjou.info>
2013-05-05 20:42:48 +02:00
Nicolas Dandrimont
126e7ac531 Remove some unused code 2013-05-05 20:42:48 +02:00
Nicolas Dandrimont
387bc0d9f2 Split eval in two steps to allow eval'ing statements
We compile the evaluated operand, separating the body (statements)
from the expression. We then eval() those separately, and return
the evaluated expression.
2013-05-05 20:42:48 +02:00
Nicolas Dandrimont
510ad53c71 mangles kthxbye 2013-05-05 20:42:48 +02:00
Nicolas Dandrimont
e9f7c47663 Do the macro processing in the compiler 2013-05-05 20:42:48 +02:00
Nicolas Dandrimont
3d8a3d589c Refactor compiler using a result carrying object
This object allows to coerce statements to an expression, if we need to use
them that way, which, with a lisp, is often.

This was collaborative work that has been rebased to make it bisectable.

Helped-by: Paul Tagliamonte <paultag@debian.org>
Helped-by: Julien Danjou <julien@danjou.info>
2013-05-05 20:42:48 +02:00
Nicolas Dandrimont
b7f92bd915 Don't lex "j" as a complex number.
This fixes #143
2013-05-04 10:27:30 +02:00
Julien Danjou
2ef9a0fdaf Rename decorate-with' to with-decorator'
Fixes #158

Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-28 17:14:22 +02:00
Julien Danjou
f25177e9a6 Add a `unless' macro
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-28 17:04:35 +02:00
Julien Danjou
f68e3b972b Add a `when' macro
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-28 17:04:35 +02:00
Julien Danjou
9b261a5004 Make HyList add returns HyList
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-28 17:04:33 +02:00
Will Kahn-Greene
07dec18dc3 Fix "hy -c CMD" to show lex errors; add tests
* tells you there's a lex error, but doesn't tell you much else
* adds tests for all new bin/hy functionality
2013-04-24 22:23:12 -04:00
John Jacobsen
760774afde Implement import_buffer_to_module 2013-04-24 21:58:42 -04:00
Julien Danjou
50daf1b4c8 Make temp attribute more solid and add unit test on regression
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-24 22:36:49 +02:00
Julien Danjou
4447ac5f1a Revert wrong changes on temporary_attribute_value
We don't want to ignore any error.

Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-24 22:18:45 +02:00
Will Kahn-Greene
08b30e8195 Back-figuring the license/copyright info
I did a git log thing to figure out who touched bin/hy and copied
those people over here since the bulk of the code came from bin/hy.
2013-04-24 09:03:56 -04:00
Will Kahn-Greene
3f7f241097 Fix license header 2013-04-24 08:57:51 -04:00
Will Kahn-Greene
fb8140b6bc Add license to new file 2013-04-24 08:32:03 -04:00
Will Kahn-Greene
4e59af0033 Redid command line code
This supports:

* -h, --help
* --version
* -c cmd
* -i cmd
* file
* -

Plus it's easy to add new options.

Also, now we can do ridiculous things like have projects where
the installation is:

$ curl -s http://example.com/install-hypster-program | hy
2013-04-23 22:02:41 -04:00
Paul Tagliamonte
ada946fca8 style cleanup 2013-04-23 19:25:02 -04:00
Paul Tagliamonte
a1cf9e50eb Merge branch 'master' into pr/141 2013-04-23 19:23:37 -04:00
Paul Tagliamonte
52ebcfae8c removing the dunder. that was a bad move. 2013-04-22 21:49:19 -04:00