Commit Graph

127 Commits

Author SHA1 Message Date
Tristan Cacqueray
1c7ca7ac1f update contrib and macro to use the new list? function 2019-04-09 00:07:10 +00:00
Kodi Arfer
62638b44a3 Update copyright years 2019-02-07 08:57:35 -05:00
Brandon T. Willard
144a7fa240 Produce Python AST for require statements and skip self requires
Closes hylang/hy#1211.
2018-11-08 22:57:17 -06:00
Brandon T. Willard
87a5b117a1 Implement new importer using PEP-302 semantics
Python 3.x is patched in a way that integrates `.hy` source files into
Pythons default `importlib` machinery.  In Python 2.7, a PEP-302 "importer"
and "loader" is implemented according to the standard `import` logic (via
`pkgutil` and later pure-Python `imp` package code).

In both cases, the entry-point for the loaders is through `sys.path_hooks` only.
As well, the import semantics have been updated all throughout to utilize
`importlib` and follow aspects of PEP-420.  This, along with some light
patches, should allow for basic use of `runpy`, `py_compile` and `reload`.

In all cases, if a `.hy` file is shadowed by a `.py`, Hy will silently use
`.hy`.
2018-08-25 22:50:38 -05:00
Kodi Arfer
7ba2105a2b Fix date and time hy-reprs on Windows 2018-08-08 09:26:20 -04:00
Brandon T. Willard
33f2b4a91a Compile requires in the body of a macro
This change enables further macro expansion for cases in which a macro
`require`s other macros within its body.
2018-07-25 17:20:19 -05:00
gilch
8c79015b40 Fix let rebind bug. 2018-06-27 23:41:49 -06:00
gilch
4b0e318997 Remove outdated comment in walk. 2018-06-27 23:39:44 -06:00
Kodi Arfer
cf0dafef9b Update uses of the old comprehension forms 2018-06-13 17:31:08 -07:00
Kodi Arfer
210086c7ca Clean up the decorators used in the compiler 2018-05-20 14:11:35 -07:00
gilch
049c78f5d5 Fix bug in let's handle-dot. 2018-05-18 10:40:59 -07:00
gilch
e7ac4ec859
fix botsbuildbots for #1582
This is preventing Hy from installing.

Closes #1599

#1601 would make this moot, but fixing it is the more conservative change. Pick one or the other. This `botsbuildsbots` doesn't do anything important. It's just one of our Easter eggs.
2018-05-06 19:55:16 -06:00
gilch
9d1304aacd Remove lambda list unpacking handling in let. 2018-05-04 10:40:22 -07:00
Kodi Arfer
a605936651 Remove &key
It's redundant with &optional.
2018-04-19 09:26:02 -07:00
Kodi Arfer
c93a60ede0 Remove support for cons cells 2018-04-12 16:45:17 -07:00
Simon Gomizelj
1b7dfd2839 Make HyKeyword a first class objects
HyKeywords are no longer an instances of string with a particular
prefix, but a completely separate object.

This means keywords no longer trip isinstance str checks, adding a
little bit of type safety to the compiler.

It also means that HyKeywords evaluate to themselves.

Closes #1352
2018-04-07 22:29:20 -07:00
Kodi Arfer
85968e70dd Add mangle and unmangle as core functions 2018-03-13 14:55:55 -04:00
Kodi Arfer
0c8c5dc830 Mangle special forms 2018-03-13 14:55:55 -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
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
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
be6ddd4bb2 Fix deprecation warning triggered by PEP 479 2018-02-14 16:05:31 -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
Simon Gomizelj
0cd4df3898 Remove def and standardize on setv 2018-01-21 00:25:33 -05:00
Kodi Arfer
6de7ddfee5 Update copyright years 2018-01-01 10:38:33 -05:00
Jakub Wilk
e2e1b04ea3 Fix typos 2017-11-26 00:44:03 +01:00
gilch
a4dd344ebd protect eval-and-compile/eval-when-compile in let 2017-10-30 20:24:09 -06:00
gilch
e90f082baf back let with dict for better defclass behavior 2017-10-30 20:23:57 -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
gilch
081a6e2575 factor out smacrolet from let 2017-09-18 23:01:13 -06:00
gilch
bcc93fb1fe refactor let symbol expansion to a class 2017-09-18 21:01:42 -06: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
gilch
7674bf3267 proper reprs for Hy models 2017-09-07 11:50:16 -07:00
David Schaefer
432d560310 No TypeError from multi-arity defn returning None 2017-08-04 17:08:41 +02:00
Kodi Arfer
eea8cf1061 hy-repr: Fix a crash when given a NumPy array 2017-07-20 08:46:42 -07:00
Kodi Arfer
7b94c45e16 Remove an extra parenthesis in hy.contrib.profile 2017-07-20 08:46:37 -07:00
Kodi Arfer
0bbb5f8e34 hy-repr: Support #* and #** 2017-07-19 10:25:24 -07:00
Kodi Arfer
75e4ad8304 Remove uses of apply from /hy 2017-07-17 13:34:42 -07:00
Kodi Arfer
5a1e6a7c6a hy-repr: Support NaN and Inf 2017-07-10 08:50:49 -07:00
Kodi Arfer
2eb81864df Make all files comply with license-header policy 2017-04-27 14:16:57 -07: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
Kodi Arfer
5aadeba3fe Fix bug: loop replaced strings equal to "recur" 2017-03-30 15:49:10 -07:00
Kodi Arfer
bf2f90a0d9 Add hy.contrib.hy-repr 2017-03-24 08:43:53 -07:00