Commit Graph

194 Commits

Author SHA1 Message Date
Kodi Arfer
271f2846dc Minor cleanup in test_ast 2018-07-24 09:37:19 -07:00
Kodi Arfer
03aafad657 Make empty expressions illegal at the top level 2018-07-24 08:59:52 -07:00
Kodi Arfer
7abd8ffc2a Make importing a dotted name a syntax error, per Python 2018-06-27 10:24:22 -07:00
Kodi Arfer
14979edcab Remove tests of the old comprehension forms 2018-06-13 17:31:08 -07:00
Kodi Arfer
3256932b13 Add a version of for parallel to lfor etc. 2018-06-13 17:31:08 -07:00
Kodi Arfer
3204a9e8a3 Streamline auto-promotion and position spoofing
Auto-promotion now occurs in only two cases: when we start the compiler and when we expand a macro. It's fully recursive so even a non-model nested in a model will be promoted.

This change fixes some regressions induced by the stricter type checks of the pattern-matching compiler.
2018-06-05 09:23:21 -07:00
Kodi Arfer
a38c948ed2 Fix a regression with mangling module names 2018-06-03 15:38:49 -07:00
Kodi Arfer
210086c7ca Clean up the decorators used in the compiler 2018-05-20 14:11:35 -07:00
Kodi Arfer
57b5fa49b1 Unify illegal special forms 2018-05-20 14:11:31 -07:00
Kodi Arfer
45e8783997 Use model patterns for fn 2018-05-20 14:07:44 -07:00
Kodi Arfer
79c02514b9 Introduce the use of model patterns 2018-05-20 14:07:44 -07:00
Kodi Arfer
a2aeca2338 Remove tuple unpacking in lambda lists 2018-05-04 10:40:22 -07:00
Simon Gomizelj
7c3477e738 Fix a bug where the compiler doesn't properly handle unquote-splice
Added test coverage as well
2018-04-30 09:38:57 -07:00
Kodi Arfer
ec1c92bf4e Allow for with an empty body 2018-04-29 19:51:00 -07:00
Kodi Arfer
b7e5c5f17a Allow while with an empty body 2018-04-29 19:51:00 -07:00
Kodi Arfer
87aced2370 Don't let HyExpression etc. inherit from HyList
This means the compiler no longer allows e.g. `(fn (x) ...)` in place of `(fn [x] ...)`.
2018-04-29 19:17:47 -07:00
Simon Gomizelj
032247e380
Merge pull request #1588 from Kodiologist/no-amp-key
Remove &key
2018-04-27 00:21:11 -04:00
Kodi Arfer
a605936651 Remove &key
It's redundant with &optional.
2018-04-19 09:26:02 -07:00
Kodi Arfer
7bf2901364 Ban (except)
It's rarely useful, because it catches all exceptions, but it doesn't let you do anything other than return `None`. You can still get the same effect with `(except [])`.
2018-04-16 19:34:50 -07:00
Kodi Arfer
097647bf6f Remove tests of cons cells 2018-04-12 16:45:17 -07:00
Simon Gomizelj
84e1c65bcd Improve checks inside defclass
We need to make sure we're looking at HyExpression when trying to
determine if we're rewriting an __init__ expression.

Fixes #1533
2018-03-31 02:43:53 -04:00
Kodi Arfer
e3058b5cf5 Handle module docstrings on Python 3.7 2018-03-24 12:34:43 -07:00
Simon Gomizelj
c663d38e33 Add metaclass support, support PEP 3115 and PEP 487 2018-03-22 13:28:22 -07:00
Tuukka Turto
cb72a8c155
Merge pull request #1530 from vodik/pytest-cleanups
Use pytest.raises for asserting compiler exceptions
2018-03-15 08:14:09 +02:00
Kodi Arfer
d252bb0e94 Mangle names that coincide with Python keywords 2018-03-13 14:55:55 -04:00
Simon Gomizelj
e3f4fc8481 Use pytest.raises for asserting compiler exceptions 2018-03-12 01:44:57 -04:00
Simon Gomizelj
316220b742 Fix AST generation of a naked return 2018-02-14 16:05:31 -05:00
Kodi Arfer
6de7ddfee5 Update copyright years 2018-01-01 10:38:33 -05:00
Simon Gomizelj
2ffaa8e5be Fix yield-from to prevent it from accepting no arguments
Closes #1472
2017-12-30 19:02:15 -05:00
gilch
e43d6f5e2f Merge pull request #1419 from rkday/else_multiple_statements
Allow multiple statements in the else branch of for
2017-09-16 14:10:28 -06:00
Rob Day
be35b09e5d Allow multiple statements in the else branch of a for loop 2017-09-16 20:41:22 +01:00
Ryan Gonzalez
3f69ed8e8e Merge pull request #1399 from Kodiologist/compiler-refactor 2017-09-15 14:44:32 -05:00
Ryan Gonzalez
44e5ded522 Merge pull request #1379 from Kodiologist/lua-str-literal
Add #[DELIM[ … ]DELIM] syntax for string literals
2017-09-15 14:36:08 -05:00
Rob Day
567fa14f1d Allow else after a while loop 2017-09-14 20:55:29 +01:00
Kodi Arfer
cf7ff802c9 Make hy.compiler.builds more flexible
I removed the "Hypster" error message and the test for it because it can only catch compiler bugs that should themselves be caught by Hy's tests.
2017-09-13 13:30:59 -07:00
Kodi Arfer
eb23ddc1e2 Add #[DELIM[ … ]DELIM] syntax for string literals 2017-09-08 11:27:34 -07:00
Kodi Arfer
7ed31a18f3 Forbid arguments to break and continue 2017-08-26 11:37:15 -07:00
David Schaefer
969fa8d533 Fixes #1350: try form in defmacro 2017-08-11 01:21:01 +02:00
Kodi Arfer
ecc974de1e Implement Python 2 exec
The implementation of `hy.core.language.exec` draws code from the `exec_` function in commit f574c7be6ebc80041ef58ca29588f310248ebed4 of the library Six, which is copyright 2010–2017 Benjamin Peterson and licensed under the Expat license.
2017-08-02 13:33:59 -04:00
Kodi Arfer
33052f4180 Test compiling a lot of comment lines 2017-07-12 14:07:42 -07:00
Kodi Arfer
55986b2033 Auto-promote values to HyObjects in the compiler 2017-07-03 17:01:12 -07:00
Kodi Arfer
4be37b358b Make lists no longer magical for the compiler 2017-07-03 17:01:12 -07:00
Kodi Arfer
5bf9ecfc5a Forbid (try) and (try BODY) 2017-05-25 20:48:09 -05:00
Kodi Arfer
81d89c9d12 Enforce the standard order of try elements 2017-05-25 20:48:09 -05:00
Kodi Arfer
2eb81864df Make all files comply with license-header policy 2017-04-27 14:16:57 -07:00
Kodi Arfer
d085fba5fe Move a quoting test to get rid of a directory 2017-04-26 13:58:09 -07:00
Kodi Arfer
8afd13cb16 Use test functions instead of unittest.TestCase 2017-04-26 13:58:09 -07:00
Kodi Arfer
a27d737e1c Drop support for Pythons 3 older than 3.3 2017-04-24 14:22:13 -07:00
Kodi Arfer
5eb928356a Overhaul semantics of binary operators (#1261)
I've added shadow versions of many operators that didn't have one. And, I've changed the behavior of various binary operators with more or fewer than 2 arguments to make the shadow and real versions more consistent and to make the behavior more logical in either case. For details, see the additions to NEWS and the new file tests/native_tests/operators.hy, which simultaneously tests shadow and real operators.

Although there are a lot of changes, I've put them all in one commit because they're interdependent.
2017-04-13 19:42:01 -05:00
Kodi Arfer
8ecb17d1fd Fix bug: quoting a bytestring raises ImportError (#1245) 2017-03-04 19:04:28 -06:00