Kodi Arfer
cf60dc7a13
Fix a hy-repr test for Python 3.7
2018-03-24 12:34:43 -07:00
Kodi Arfer
cfb042304c
Test module docstrings
2018-03-24 12:34:43 -07:00
Kodi Arfer
ad59fd7ff6
In -> and ->>, don't modify the arguments
2018-03-23 13:57:19 -07:00
Simon Gomizelj
c663d38e33
Add metaclass support, support PEP 3115 and PEP 487
2018-03-22 13:28:22 -07:00
Kodi Arfer
85968e70dd
Add mangle
and unmangle
as core functions
2018-03-13 14:55:55 -04:00
Kodi Arfer
ebc9bda7ee
Remove an obsolete test
2018-03-13 14:55:55 -04:00
Kodi Arfer
0c8c5dc830
Mangle special forms
2018-03-13 14:55:55 -04:00
Kodi Arfer
ccb3ba6092
Mangle macro names
2018-03-13 14:55:55 -04:00
Kodi Arfer
0c816f2e83
Mangle keyword arguments
2018-03-13 14:55:55 -04:00
Kodi Arfer
d252bb0e94
Mangle names that coincide with Python keywords
2018-03-13 14:55:55 -04:00
Kodi Arfer
52edad28e2
Overhaul mangling rules
2018-03-13 14:55:53 -04:00
Kodi Arfer
d501d4d806
Mangle symbols at compile-time instead of parse-time
...
This means that a HySymbol remembers its original name. That is, `a-b` and `a_b` are different symbols although `(setv a-b 1)` and `(setv a_b 1)` set the same variable (namely, `a_b`).
Most of the edits in this commit are to switch underscores to hyphens in places where mangling hasn't happened yet.
I removed some lexer tests since the lexer no longer does any mangling.
2018-03-13 14:55:15 -04:00
Kodi Arfer
7fcc7ac4b6
Make unary comparison ops evaluate their argument
2018-03-13 14:38:36 -04:00
Kodi Arfer
9f0911161d
Fix tests with =
-and-parentheses errors
2018-03-13 14:38:36 -04:00
Kodi Arfer
0574e275b5
Make hy-repr support some collections
classes
2018-03-10 18:11:07 -08:00
Kodi Arfer
38f461890d
Make hy-repr support DateTime objects
2018-03-10 18:11:07 -08:00
Kodi Arfer
3dbe05302e
Make hy-repr support regex match objects
2018-03-10 18:11:07 -08:00
Kodi Arfer
f7ab9a6e7c
Make hy-repr support dictionary views
2018-03-10 18:11:07 -08:00
Kodi Arfer
90a09b5b44
Make hy-repr use double spaces for dictionaries
2018-03-10 18:11:07 -08:00
Kodi Arfer
199bb70150
Add a hy-repr test for keyword-like bytes objects
2018-03-10 18:11:07 -08:00
Kodi Arfer
4f2706e18e
Test a case where hy-repr shouldn't round-trip
2018-03-10 18:11:07 -08:00
Kodi Arfer
83c4f63bc2
Reimplement hy-repr with registered functions
...
This removes a lot of hy-reprs that were hard-coded into the hy-repr function itself. It also allows you to add a hy-repr for an existing class without monkey-patching the class.
2018-03-10 18:11:07 -08:00
Simon Gomizelj
5c40f793a1
Support PEP 328
...
Add support for proper relative imports
2018-02-06 23:41:12 -05:00
Tuukka Turto
5c720c0110
Merge pull request #1473 from Kodiologist/new-year-2018
...
Update copyright years
2018-02-05 15:11:59 +02:00
Tuukka Turto
cf87de5cc2
Merge pull request #1483 from vodik/remove-def
...
Just remove `def`
2018-01-31 08:54:59 +02:00
Simon Gomizelj
0cd4df3898
Remove def and standardize on setv
2018-01-21 00:25:33 -05:00
Tuukka Turto
a9621817f9
Merge pull request #1433 from Kodiologist/while-multistatement
...
Handle statements in the condition of `while`
2018-01-11 07:45:27 +02:00
Kodi Arfer
6de7ddfee5
Update copyright years
2018-01-01 10:38:33 -05:00
Simon Gomizelj
f69ccd2421
Allow coroutines to be decorated
2017-12-31 09:03:39 -05:00
Simon Gomizelj
1e4ad3167b
Introduce for/a* and for/a expressions
2017-12-30 19:02:15 -05:00
Simon Gomizelj
783d53ecb7
Introduce with/a* and with/a expressions
2017-12-30 19:02:15 -05:00
Simon Gomizelj
e3e01d4405
Introduce fn/a and defn/a
...
Closes #1054
2017-12-30 19:02:15 -05:00
Rob Day
eda78eb81c
Allow multiple expressions in a try
2017-12-03 09:47:41 +00:00
Kodi Arfer
fd64575799
Handle statements in the condition of while
2017-11-02 07:31:58 -07:00
Ryan Gonzalez
e0e664c030
Merge branch 'master' into letmacro
2017-11-01 09:39:18 -05:00
gilch
8f2e80d12e
add newlines in disassemble tests for astor 0.6
2017-10-31 21:46:44 -06:00
gilch
6bb997dbea
update astor to 0.6
2017-10-31 14:13:41 -06:00
gilch
e90f082baf
back let
with dict for better defclass behavior
2017-10-30 20:23:57 -06:00
Tuukka Turto
fac87c99d0
Merge pull request #1444 from gilch/xi-tag
...
change xi macro to #% tag macro
2017-10-29 21:34:56 +02:00
gilch
497e929913
generalize #% to arbitrary expressions
2017-10-26 14:23:25 -06:00
gilch
b5f1136ba5
%* %** parameters for #% tag macro
2017-10-26 13:03:01 -06:00
gilch
f81fb771eb
change xi macro to #% tag macro
2017-10-26 12:55:48 -06:00
gilch
2319adcc7f
fix whitespace in anaphoric
2017-10-26 12:53:08 -06:00
gilch
c4b3d7bcda
fix gensym format to start with _ for import *
2017-09-23 23:41:37 -06:00
gilch
a54f6aa38b
add hidden &name parameter to macros
...
The module name allows macros to preexpand their body in the proper
context.
2017-09-23 14:59:43 -06:00
gilch
5bbf4d9894
fix premature binding in let
2017-09-22 20:07:48 -06:00
Kodi Arfer
1e456c6ced
Don't treat [else…] or ("else"…) as else clauses
2017-09-20 16:34:56 -07:00
Kodi Arfer
f8fbcf3f06
Spacing fix in test
2017-09-20 16:31:55 -07:00
gilch
20b4342d40
support (global) in let
2017-09-18 14:54:08 -06:00
gilch
ba898aa8d8
support (nonlocal) in let
2017-09-18 13:51:32 -06:00
gilch
34038ff433
implement let
2017-09-18 12:21:42 -06:00
Rob Day
907e72681f
Let argument destructuring work with docstrings
2017-09-17 21:06:45 +01:00
Rob Day
5a6488e353
Treat _42 etc. as a variable name, not an integer
2017-09-16 16:12:29 -07: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
277469dfe1
Add xfail test of #1390 (statements in assert
)
2017-09-13 13:30:54 -07:00
Kodi Arfer
deb801edab
Preserve .brackets in quoted HyStrings
2017-09-08 11:27:34 -07:00
Kodi Arfer
0fc96306bc
Drop support for Python 3.3
2017-08-26 13:36:51 -07:00
Kodi Arfer
8b677bb20c
Un-xfail a passing test of macroexpand
...
It seems that #1374 (1faee7ac39
) fixed this bug.
2017-08-25 15:25:06 -07:00
Kodi Arfer
2bbf886ceb
Make assoc
a macro instead of a special form
...
The new macro evaluates its lvalue only once.
2017-08-25 11:41:28 -07:00
Ryan Gonzalez
dea99c8b76
Merge pull request #1354 from gilch/comment-discard
...
add #_ discard syntax
2017-08-19 11:29:57 -05:00
Kodi Arfer
8d40a68232
Initialize the return variable of with
2017-08-19 07:35:41 -07:00
Kodi Arfer
f5ee5f4ee5
Whitespace fix
2017-08-19 07:25:00 -07:00
Kodi Arfer
21ea36f277
Add return
as a special form
2017-08-11 13:56:44 -07:00
gilch
0f81369deb
tests for #_ and (comment ...)
2017-08-04 14:35:11 -06:00
David Schaefer
432d560310
No TypeError from multi-arity defn returning None
2017-08-04 17:08:41 +02:00
Kodi Arfer
e8ffd41202
Merge pull request #1349 from woodrush/fix-unquote-splice-none
...
Allow `unquote-splice` to accept any false value as empty
2017-08-02 19:50:47 -04: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
Hikaru Ikuta
a0224ef8bd
Allow unquote-splice
to accept any false value as empty
2017-08-02 00:50:37 +09:00
Kodi Arfer
67a4815024
Shadow get
( #1344 )
2017-07-26 21:10:54 -05:00
Kodi Arfer
28ce83524b
Don't try to lex tag-macro calls as shebangs
2017-07-23 11:43:19 -07:00
Kodi Arfer
0bbb5f8e34
hy-repr: Support #* and #**
2017-07-19 10:25:24 -07:00
Kodi Arfer
97ecb0b553
Remove apply
from tests
2017-07-17 13:34:42 -07:00
Kodi Arfer
2d863abc85
Implement #* and #** unpacking
2017-07-17 13:34:39 -07:00
Kodi Arfer
801836f6c2
Remove the Python 2 yield-from macro
...
I moved the yield-from tests from native_macros to py3_only_tests.
2017-07-13 08:46:41 -07:00
Kodi Arfer
b7657e8fa3
Require HySymbols instead of HyStrings more often
2017-07-12 10:57:35 -07:00
Kodi Arfer
5a1e6a7c6a
hy-repr: Support NaN and Inf
2017-07-10 08:50:49 -07:00
Kodi Arfer
55986b2033
Auto-promote values to HyObjects in the compiler
2017-07-03 17:01:12 -07:00
Kodi Arfer
ca95194240
Change eval
from a special form to a function
2017-06-27 08:14:29 -06:00
Kodi Arfer
26d1b3f72e
Don't parse 5.attr or :foo.attr as symbols
2017-06-23 08:30:37 -07:00
gilch
b7a0c2abf0
add tag macro tests
2017-06-22 22:49:00 -06:00
gilch
6cd3201421
rename sharp macros to tag macros
2017-06-22 22:48:46 -06:00
neil-lindquist
d3df17d9d8
Modify cond to support single argument branches
2017-06-10 08:30:53 -07:00
Kodi Arfer
5bf9ecfc5a
Forbid (try) and (try BODY)
2017-05-25 20:48:09 -05:00
Kodi Arfer
dffa2811e6
Return from the else
clause of a try
form
...
I overhauled the documentation of `try` while I was editing it.
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
eeb0be8fb0
Add some xfail tests for known bugs
2017-04-26 14:00:39 -07:00
Kodi Arfer
d3fa375052
Migrate from Nose to pytest
2017-04-26 14:00:11 -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
55c205f87e
Test take
and drop
only in native_tests.core
2017-04-26 13:58:09 -07:00
Kodi Arfer
07e9284100
Correct import syntax in a test
2017-04-25 09:30:13 -07:00
Kodi Arfer
a27d737e1c
Drop support for Pythons 3 older than 3.3
2017-04-24 14:22:13 -07:00
Kodi Arfer
4c38e2c9dd
Rename reader macros to "sharp macros" ( #1282 )
...
They're not actually reader macros, since their arguments are parsed s-expressions, like a regular macro, not pre-parsed source text.
2017-04-21 10:07:48 -05:00
Kodi Arfer
ad94343e4a
Merge pull request #1269 from Kodiologist/bytecode
...
Automatically read and write bytecode
2017-04-14 13:52:07 -07:00
Kodi Arfer
2b11b9be20
Automatically read and write bytecode
...
Importing or executing a Hy file now loads the byte-compiled version if it exists and is up to date, and if not, the source is byte-compiled after it's parsed.
This change can speed up Hy a lot. Here are some examples comparing run times of the current master (491b474e
) to this commit, on my laptop with Python 3.6:
- `nosetests --exclude='test_bin'` goes from 3.8 s to 0.7 s (a 5-fold speedup)
- `hy -c '(print "hello world")` goes from 0.47 s to 0.20 s (a 2-fold speedup)
- Rogue TV's startup goes from 3.6 s to 0.4 s (a 9-fold speedup)
Accompanying changes include:
- `setup.py` now creates and installs bytecode for `hy.core`, `hy.contrib`, and `hy.extra`.
- The `hyc` command under Python 3 now creates bytecode in `__pycache__`, as usual for Python 3, instead of putting the `.pyc` right next to the source file like Python 2 does.
I've removed a test of `hy.extra.anaphoric.a-if` that triggers #1268 when the test file is byte-compiled and then hits some weird `macroexpand` bug or something when I try to work around that—Nose crashes when trying to produce an error message, and I can't seem to replicate the bug without Nose.
2017-04-14 13:38:33 -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
18acfe6495
Revert the extension of with-decorator
to setv
...
This is no longer necessary now that `defn` always produces a `FunctionDef`.
To compensate, I've made small edits to two contrib modules and reverted a small test change.
2017-04-13 06:36:00 +03:00