Konrad Hinsen
0c56885d42
Use __future__.division for all Hy code
...
Fixes #106
Note: This is implemented by replacing all calls to Python's
builtin "compile" function by calls to hy.importer.compile_,
which adds the "future division" flag. Anyone using "compile"
in future work will have to remember this.
2013-04-12 05:23:25 +02:00
Paul R. Tagliamonte
db3e2bd346
updating the nested mangles
2013-04-11 22:25:23 -04:00
Konrad Hinsen
e3a9909a7e
Implement integer division operator
...
Fixes #107
2013-04-11 10:09:15 +02:00
Paul R. Tagliamonte
d25d354281
Adding in on-the-fly-importing.
2013-04-10 22:51:58 -04:00
Paul R. Tagliamonte
c98a367495
Merging the two tests.
2013-04-09 21:55:34 -04:00
Paul R. Tagliamonte
6f0e739b31
test hoisted functions too
2013-04-09 21:45:37 -04:00
Paul R. Tagliamonte
8cc26ba1bf
moving to locals; fixing _ast vs ast, adding tests
2013-04-09 21:40:54 -04:00
Julien Danjou
92eaed21e4
Merge pull request #87 from jd/jd/try
...
compiler: add `else' support in `try'
2013-04-09 08:23:41 -07:00
Julien Danjou
b13cc60075
Implements (raise)
...
As in Python, this allows to re-raise the last raised exception.
This fixes #86
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-09 17:00:45 +02:00
Julien Danjou
f8131d3c36
compiler: add else' support in
try'
...
This is a bit tricky, since we'll also have to support `finally' in the end,
I've introduced an Else statement on my own to be able to recognize it.
This fixes #74
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-09 17:00:30 +02:00
Julien Danjou
d7e8dd2a91
compiler: optimize empty tree mangling to ast.Pass
...
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-08 13:27:50 -04:00
Paul R. Tagliamonte
38a714b5c5
Adding more tests; new entries
2013-04-07 19:44:52 -04:00
Paul R. Tagliamonte
5336b2f71a
Fix early returns. Close #83
2013-04-07 19:29:45 -04:00
Paul R. Tagliamonte
6912f4c4d9
Merge branch 'master' into pr-82
2013-04-07 18:51:18 -04:00
Julien Danjou
2ff3da032c
Merge pull request #81 from paultag/paultag/bugfix/with-syntax-fix
...
Fixing (with)'s syntax to be more hyish.
2013-04-07 15:41:53 -07:00
Paul R. Tagliamonte
e22a0ff73c
Mangle a macro until it stops moving
...
this helps if we use a macro in something that got tree-mangled
back out.
2013-04-07 18:41:41 -04:00
Paul R. Tagliamonte
83d91c3f81
Asserting `fd' exists inside the with
2013-04-07 18:39:30 -04:00
Julien Danjou
0d3500f6e5
try: accept a simpler form
...
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-08 00:36:08 +02:00
Paul R. Tagliamonte
4db9446197
Fixing (with)'s syntax to be more hyish.
2013-04-07 18:35:36 -04:00
Julien Danjou
a73d460beb
try: allow empty body
...
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-08 00:14:42 +02:00
Gergely Nagy
1b7d145c65
Implement the (or) function too
...
The (or) function is to be constructed similarly to (and), so refactor
the compile_and_operator function to handle or aswell.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2013-04-08 00:02:08 +02:00
Gergely Nagy
f03b538787
Implement the (and) function
...
The function takes at least two arguments, and turns it into a pythonic
and statement, which returns the last True-ish value, or False.
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2013-04-07 23:54:56 +02:00
Paul R. Tagliamonte
bfc71e4a60
Add tail threading (->>)
2013-04-07 15:05:30 -04:00
Julien Danjou
bdd07e1251
Alias except' to
catch' and raise' to
throw'
...
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-07 18:24:01 +02:00
Julien Danjou
6dec894a0c
Better catch syntax
...
The syntax is now changed to:
(catch [] BODY)
(catch [Exception] BODY)
(catch [e Exception] BODY)
(catch [e [Exception1 Exception2]] BODY)
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-07 18:03:43 +02:00
Paul R. Tagliamonte
9d36dab693
Test importing things with dashes
2013-04-07 09:54:53 -04:00
Paul R. Tagliamonte
03dfbde1b8
style voodoo
2013-04-06 23:11:43 -04:00
Paul R. Tagliamonte
5a96089266
Using backslashes for now; punycode soon.
2013-04-06 21:33:52 -04:00
Paul R. Tagliamonte
bac3f6991c
Revert "adding this as testable"
...
This reverts commit 104b9d1636
.
2013-04-06 20:03:14 -04:00
Paul R. Tagliamonte
e0ed7cac40
Revert "Make HySymbol bytes free!"
...
This reverts commit 8b144a4f3d
.
2013-04-06 20:02:08 -04:00
Paul R. Tagliamonte
104b9d1636
adding this as testable
2013-04-06 19:57:59 -04:00
Julien Danjou
8b144a4f3d
Make HySymbol bytes free!
...
We can know use any amount and type of bytes to build a HyString, meaning we
can use Unicode and UTF-8 for our function and variables.
Eat that, snake!
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-06 23:37:34 +02:00
Julien Danjou
0eb795b4a5
Check the number of arguments for each function
...
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-06 19:00:32 +02:00
Paul R. Tagliamonte
4b57fd0a51
Adding in an If mangle
2013-04-06 11:10:33 -04:00
Paul R. Tagliamonte
3ab7153398
Merge branch 'master' of git://github.com/jd/hy
2013-04-06 08:19:23 -04:00
Julien Danjou
3e9a2178c5
Add support for unary operators (not, ~)
...
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-06 10:38:41 +02:00
Julien Danjou
9768345a7c
let: add a scope test
...
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-06 10:12:03 +02:00
Paul R. Tagliamonte
7abc472336
Implementing `let'
2013-04-05 21:54:04 -04:00
Julien Danjou
fa5ab3b3ad
Tests for a future native-eval. Close #64 .
2013-04-05 20:18:46 -04:00
Paul R. Tagliamonte
3b185250e0
trailing newlines suck
2013-04-05 20:01:37 -04:00
Paul R. Tagliamonte
27e4772aa7
Test the function return-o-matic
2013-04-05 19:59:33 -04:00
Paul R. Tagliamonte
936d1bcec7
testing nested things
2013-04-04 21:58:26 -04:00
Paul R. Tagliamonte
b2406a9d72
list flattener
2013-04-04 19:32:56 -04:00
Nicolas Dandrimont
ba021ed7bf
Count the number of expressions executed in do
2013-04-04 11:20:10 +02:00
Nicolas Dandrimont
06511fe303
Add do-in-defn tests
2013-04-04 11:08:18 +02:00
Nicolas Dandrimont
99f62fb8b3
Add some tests for defn
2013-04-04 09:29:21 +02:00
Paul R. Tagliamonte
d421d869af
Fixing the "olasd" bug
2013-04-03 20:18:56 -04:00
Nicolas Dandrimont
d070d3d484
Add while loops to the compiler
2013-04-03 19:55:09 +02:00
Paul R. Tagliamonte
d316a8fde8
covering the new bits
2013-04-02 20:49:42 -04:00
Paul R. Tagliamonte
b1c605cc6a
Updating the tests to not break Python 3.x
2013-04-01 23:06:59 -04:00