Commit Graph

83 Commits

Author SHA1 Message Date
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
Abhishek L 948e6d34c7 Merge branch master onto pr/284
Conflicts:
	hy/core/language.hy
2013-12-06 20:07:39 +05:30
Abhishek L f1c68bd51a Allow macros to return None, fixes #357
Allows Hy macros to return None, to test this

  (defmacro foo [])
  (foo)

Should work now
2013-12-06 00:27:45 +05:30
Guillermo Vaya f61d702788 Int conversion to long in py2.x
Updated to current master
    Droped HyInt/HyLong commit
2013-10-11 01:49:42 +02: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
Berker Peksag f21ddeeded Add hy._compat module.
There was a couple of duplicate imports and type checkings in the
codebase. So I added a new module to unify all Python 2 and 3
compatibility codes.

Also, this is a somewhat common pattern in Python. See Jinja2 for
example:

https://github.com/mitsuhiko/jinja2/blob/master/jinja2/_compat.py
2013-09-29 12:10:08 +03:00
Paul Tagliamonte 1c12b2870e Add yield from via macro magic.
This will let us use (basic) yield from behavior from Python 2. This
 isn't complete, and is low-hanging fruit for others willing to hack
 on hy.

 I've also changed the macrosystem to allow for proper bootstrapping.
 This is similar to how it's done elsewhere in the codebase (stdlib
 stuff).
2013-08-17 11:37:48 -04: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
Nicolas Dandrimont b65c2a4596 whitespace fix 2013-06-26 08:50:37 +02:00
Guillermo Vaya 482282178c changed macro to ignore empty trees and made compiler do the substitution work 2013-06-26 08:50:37 +02:00
Guillermo Vaya 4c7b4f70e3 changed try to testing for an empty list for legibility (as suggested by paultag), also added to authors 2013-06-26 08:50:37 +02:00
Guillermo Vaya 7b7b953410 set the value of empty hy expression to [] 2013-06-26 08:50:37 +02:00
Paul Tagliamonte d15aa31a32 style fixes 2013-06-08 20:10:27 -04:00
Konrad Hinsen 12abef5ed5 Forgot boolean constants.. 2013-06-07 16:35:28 +02:00
Konrad Hinsen e47bac1f96 Permit macros to return constants 2013-06-05 12:19:06 +02:00
Paul Tagliamonte 9c28e0292d Merge branch 'master' into pr/185
Conflicts:
	hy/macros.py
	tests/compilers/test_compiler.py

Hoodoggy!
2013-05-17 11:17:51 -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 9e03e0e6ec Modify HyDict semantics to allow nesting expressions
HyDicts are now HyLists, that get compiled down to dicts
only by the compiler.
2013-05-14 11:43:17 +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
Nicolas Dandrimont 2860ef6ff7 Don't macro-expand inside quotes 2013-05-11 00:29:42 +02:00
Paul R. Tagliamonte e0ed7cac40 Revert "Make HySymbol bytes free!"
This reverts commit 8b144a4f3d.
2013-04-06 20:02:08 -04:00
Julien Danjou 8b144a4f3d Make HySymbol bytes free!
We can know use any amount and type of bytes to build a HyString, meaning we
can use Unicode and UTF-8 for our function and variables.

Eat that, snake!

Signed-off-by: Julien Danjou <julien@danjou.info>
2013-04-06 23:37:34 +02:00
Paul R. Tagliamonte 4cb4e7384e holy shit it's 2013 2013-03-18 10:27:14 -04:00
Paul R. Tagliamonte 0bc2dd8d00 Moving `for' to a "macro" 2013-03-13 20:41:53 -04:00
Thomas Mashek 8a88b2a0f0 Making dict comprehension work with py2.6 2013-03-12 12:39:23 -07:00
Paul R. Tagliamonte 57bf7b5cba syntax fixes 2013-03-10 10:35:08 -04:00
Paul R. Tagliamonte 0a86226da0 fixing up dicts + macros 2013-03-10 10:30:03 -04:00
Paul R. Tagliamonte ccfcefe207 adjust calling bits to allow ((foo)) 2013-03-09 16:42:07 -05:00
Paul Tagliamonte abf63fca12 fixing up the tests 2013-03-08 18:46:51 -05:00
Paul Tagliamonte 67b803b99a Breaking things to start again. 2013-03-08 18:18:43 -05:00
Paul R. Tagliamonte dbd9f0bbf8 Q'plah! 2013-03-07 23:04:20 -05:00
Paul R. Tagliamonte 4945d0aa14 fixing python 3 2013-03-07 22:56:35 -05:00
Paul R. Tagliamonte 3166fec53e Thinking some ideas out. 2013-03-07 22:52:47 -05:00