Commit Graph

24 Commits

Author SHA1 Message Date
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
Kodi Arfer
a8fe95c5b6 Update test_preprocessor_exceptions
This test has been passing since b023ebd0b5, so I removed the xfail. I also rewrote the test to use pytest.raises.
2018-04-29 19:29:17 -07:00
Kodi Arfer
c1a487cdf7 Move logic from macroexpand_1 to macroexpand
By ending macro-expansion immediately when appropriate, this change fixes a bug arising from the fact that NaN != NaN.
2018-04-21 12:25:29 -07:00
Kodi Arfer
6de7ddfee5 Update copyright years 2018-01-01 10:38:33 -05: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
6cd3201421 rename sharp macros to tag macros 2017-06-22 22:48:46 -06:00
Kodi Arfer
2eb81864df Make all files comply with license-header policy 2017-04-27 14:16:57 -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
ace125ee9b Consolidate hy.models.* and tests/models/* into one file apiece
They were a lot of similar, tiny files.
2017-02-16 19:43:00 -08:00
Paul Tagliamonte
8d2143177e Overhaul macros to allow macros to ref the Compiler
This allows macros to take a keyword dict containing useful things by
defining a keyword argument. This allows us to pass in new objects
which might be handy to have in macros.

This changeset refactors module_name to become `compiler`, so that we
can pass the compiler itself into the macros as `opts['compiler']`.

This allows the macro to both get the macro name
(`compiler.module_name`), as well as use the compiler to build AST.

In the future, this will enable us to create "super-macros" which return
AST, not HyAST, in order to manually create insane things from userland.

For userland macros (not `defmacro`) the core.language `macroexpand`
will go ahead and make a new compiler for you.
2015-12-23 15:52:47 -05:00
Jakub Wilk
1d16addd2e Fix typos 2015-12-08 14:43:47 +01:00
Adam Schwalm
f18007955d Better error messages on invalid macro arguments 2015-08-30 17:14:22 -05:00
Zhao Shenyang
38cf570ca4 move 'wrap_value' test from macros/ to models/ 2015-01-24 08:32:20 +08:00
Ian Denhardt
3503ed9027 Add tests for _wrap_value 2014-09-21 12:08:14 -04:00
Foxboron
c9fdd40c9f Hy reader macros #377
Added first iteration of reader macros
Refactored defmacro and defreader
Added test inn hy/tests/lex/test_lex.py
Added new test in hy/tests/native/tests
Added new test in hy/tests/macros.

changed the error given in the dispatch macro and added some handling for missing symbol and invalid characters
2013-12-23 14:33:51 +01:00
Nicolas Dandrimont
d5bf328aa7 Cleanup the hy.macros module
Add comments to the functions, reorder, make the file clearer
2013-09-29 18:13:28 +02:00
Paul Tagliamonte
b78be9a594 Jank @olasd's hack, clean up core.
The core shall from now on be only for the core language bits. Macro
 bits shall live in hy.macros and in hy.compiler. This cleans up
 garbage.
2013-07-06 14:00:11 -04:00
Konrad Hinsen
269da19d76 Make macros module-specific.
A macro is available in the module where it was defined and
in any module that does a require of the defining module.
Only macros defined in hy.core are globally available.
Fixes #181
2013-05-16 15:34:14 +02:00
Nicolas Dandrimont
0986f9001e Change macros to be called with separate arguments
This provides free argument-length checking for macros.
2013-05-11 09:09:34 +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
Paul Tagliamonte
abf63fca12 fixing up the tests 2013-03-08 18:46:51 -05:00
Paul R. Tagliamonte
dbd9f0bbf8 Q'plah! 2013-03-07 23:04:20 -05:00
Paul R. Tagliamonte
3166fec53e Thinking some ideas out. 2013-03-07 22:52:47 -05:00