Commit Graph

53 Commits

Author SHA1 Message Date
Gergely Nagy
494bf0e8ad Remove the import-as and import-from builtins
The new and improved (import) can handle all cases import-as and
import-from did, so drop the latter two from the language. To do this,
the import builtin had to be changed a little: if there's a single
import statement to return, return it as-is, otherwise return a list of
imports.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2013-04-20 16:06:32 +02:00
Paul R. Tagliamonte
7b4d4fb371 Merge branch 'jd/finally' of git://github.com/jd/hy into pr-94 2013-04-14 21:57:11 -04:00
Paul R. Tagliamonte
3b3768853a Merge branch 'jd/remove-pass' of git://github.com/jd/hy into pr-122 2013-04-14 21:09:47 -04:00
Julien Danjou
bbaab58a4c Implements else' for foreach' statements
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-15 02:50:26 +02:00
Julien Danjou
fdb6bf944c try: add support for `finally'
This fixes #75

Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-15 02:48:58 +02:00
Julien Danjou
cb20910d93 Remove `pass' from the language.
This also fixes a bug in the pass optimize missing branch where the code is
something like: [stmt, [], stmt]; in such case we want to filter out [], so
if we end up with [] we can optimize it. This fix is needed otherwise (do)
inside (do) are not properly optimized.

Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-14 13:56:44 +02:00
Paul R. Tagliamonte
f295b10f52 Updating yield. 2013-04-12 23:48:58 -04:00
Nicolas Dandrimont
30c0b25512 Add a unicode string handling test 2013-04-12 20:58:56 +02:00
Paul R. Tagliamonte
a948cf2870 Merge branch 'master' into feature/quoting 2013-04-09 19:50:25 -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
4ba6ada77b Merge pull request #92 from jd/jd/raise-0-arg
Implements (raise)
2013-04-09 08:23:09 -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
dd90272129 except/catch: check exceptions list type
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-09 16:56:45 +02:00
Paul R. Tagliamonte
997b32e18c Testing the behavior of (quote "foo") 2013-04-08 22:31:26 -04:00
Paul R. Tagliamonte
eeab56c2b7 Adding a symbol checker. 2013-04-08 20:24:47 -04:00
Paul R. Tagliamonte
93e4bc17eb Adding some basic testing in; more to come. 2013-04-08 20:23:51 -04:00
Julien Danjou
cd36a1d7eb Allow empty `do'
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-08 15:17:11 +02: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
Julien Danjou
a81a716420 Be sure errors are raised at by compile, not tokenize
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-08 00:38:55 +02: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
Nicolas Dandrimont
1853b7d33c Correctly balance the brackets in the wrong syntax tests
We want to test the compiler, not the lexer.
2013-04-07 19:53:50 +02: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
2fd56e8fa1 catch: uncomment some tests
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-07 18:20:32 +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
Julien Danjou
123339bfcf tests: simplify not compiling tests
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-06 21:28:12 +02:00
Julien Danjou
78133500cb Fix flake8 errors in tests
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-06 21:22:35 +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
6aebc5820f Merge branch 'jd/if' of git://github.com/jd/hy 2013-04-06 08:18:13 -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
b36018981a if: emit error on too many args
Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-06 10:13:14 +02:00
Nicolas Dandrimont
d070d3d484 Add while loops to the compiler 2013-04-03 19:55:09 +02:00
Julien Danjou
1c8d21e3de Raises TypeError on bad if statements
This relates to issue #6.

Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-03 11:25:17 +02:00
Paul R. Tagliamonte
c4b270a727 test coverage bits 2013-04-01 22:07:05 -04:00
Paul Tagliamonte
025e501b13 cleaning up the tests a bit 2013-04-01 20:00:37 -04:00
Paul Tagliamonte
678ef441e5 Adding in tuple checkingish. 2013-04-01 19:53:04 -04:00
Paul Tagliamonte
6831841699 Adding in some tests for print 2013-04-01 19:51:21 -04:00
Paul Tagliamonte
426c7cd829 Test bad decoration 2013-04-01 19:38:58 -04:00
Paul R. Tagliamonte
4cb4e7384e holy shit it's 2013 2013-03-18 10:27:14 -04:00
Paul R. Tagliamonte
81d6a6515b adding better native testing 2013-03-05 22:15:45 -05:00
Paul Tagliamonte
fecf17960d unstaged changes 2013-03-05 09:08:13 -05:00
Paul R. Tagliamonte
4d32dac9ad Moving the compiler stuff around. 2013-03-04 20:40:23 -05:00
Paul Tagliamonte
20805fc7b2 tweaking the ast. 2013-03-04 19:12:57 -05:00
Paul R. Tagliamonte
9e16fb4ca0 Very broken. 2013-03-03 19:40:46 -05:00
Paul R. Tagliamonte
ef9007c229 Futzing about. 2013-03-03 16:26:17 -05:00
Paul R. Tagliamonte
9b58f893cb adding more testing 2013-03-03 13:12:23 -05:00
Paul R. Tagliamonte
a9b5d851b2 Fiddling with more AST testing 2013-03-03 13:10:50 -05:00