Commit Graph

43 Commits

Author SHA1 Message Date
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
Kodi Arfer
f3edeb99ae Allow commas and underscores in numeric literals
You can use them as thousands separators.

This change differs from PEP 515 in that not only does it allow commas in addition to underscores, but it's much more liberal about placement. Any number of underscores or commas can be placed anywhere, even at the start.
2017-02-15 09:03:24 +02:00
Jakub Wilk
7aaf5f5330 Fix invalid escape sequences
Fixes:

    hy/cmdline.py:175: DeprecationWarning: invalid escape sequence \_
    tests/lex/test_lex.py:267: DeprecationWarning: invalid escape sequence \s
    tests/compilers/test_compiler.py:45: DeprecationWarning: invalid escape sequence \*

when run against Python 3.6 with warnings enabled.
2017-01-01 00:20:04 +03:00
Kodi Arfer
5b85990d87 Add a module for getting reserved words (#1171)
This is helpful for writing syntax highlighters (e.g., https://github.com/hylang/hy/pull/1170).
2016-12-12 10:11:42 +02:00
Kodi Arfer
0880610401 Don't sort or deduplicate the items in a HySet
Fixes #1120.

I also added hy.models._wrapper[set] so a macro can return an ordinary set in place of a HySet.
2016-09-26 09:47:04 -07:00
Ryan Gonzalez
f88f6e597b Reformat string literals in test_lex_strings 2015-08-25 11:04:39 -05:00
Ryan Gonzalez
a2f95366fe Add tests for #831 2015-08-25 11:04:11 -05:00
Gergely Nagy
73f8a47f65
Mangle trailing bangs on symbols
Postfixing functions with a bang, like set!, get!, etc are relatively
common. However, those names are not valid in python, so in the name of
python interoperability, lets mangle them to set_bang and get_bang,
respectively.

Closes #536.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2015-08-10 14:37:17 +02:00
Ryan Gonzalez
016d25d104 Add one-argument division and rationals (closes #825 and #826) 2015-07-29 13:30:24 -05:00
Ryan Gonzalez
c94c0e8b50 Add set literals (closes #827) 2015-07-14 23:59:29 +03:00
Adam Schwalm
f1df108b31 Add support for multi-line strings in interpreter 2014-12-28 23:38:38 -06:00
James King
277028cdd5 Remove HyLambdaListKeyword from the parser
It's not a syntactic element and doesn't belong in the parser. Parsing
lambda lists is now handled by the compiler alone.
2014-06-03 21:36:49 -04:00
Nicolas Dandrimont
52144820ca Add a cons object and related mechanisms
Closes: #183
2014-01-23 23:08:52 +01:00
Nicolas Dandrimont
eedebd12b3 Merge branch 'master' into pr/443 2014-01-17 20:25:09 +01:00
Foxboron
a35ecc41bd Fix reader macros to actually be macros 2014-01-17 01:07:47 +01:00
Gergely Nagy
8ef02a54b5 hy/lex/parser.py: Add support for sub-object mangling
With this patch, every identifier is split up along dots, each part gets
separately mangled, and then it is all joined back together. This allows
for fun stuff like (.foo? (Foo)), and even more contrived examples.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2014-01-16 16:23:35 +01:00
Gergely Nagy
e49ad3b3d5 tests/lex/test_lex.py: Add a few tests to cover identifier mangling
Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
2014-01-16 16:23:35 +01:00
Nicolas Dandrimont
c1d5948d73 Add regression test for #382 2014-01-02 03:13:49 +01: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
81af09d002 Wire the rply parser
Amend the tests to account for the changes
2013-07-28 17:36:36 +02:00
Nicolas Dandrimont
3252af3129 Add tests for expr-in-dict 2013-05-14 12:01:23 +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
b7f92bd915 Don't lex "j" as a complex number.
This fixes #143
2013-05-04 10:27:30 +02:00
Paul Tagliamonte
6f7f402c19 Merge branch 'master' into pr/140
Conflicts:
	hy/compiler.py
	tests/native_tests/language.hy
2013-04-21 12:29:09 -04:00
James King
18ed72136f Merge branch 'master' into feature/lambda-list-keyword
Conflicts:
	hy/compiler.py
	hy/lex/states.py
	hy/util.py
	tests/compilers/test_ast.py
	tests/lex/test_lex.py
2013-04-18 15:17:30 -04:00
Nicolas Dandrimont
8bc8a4a170 Merge remote-tracking branch 'khinsen/float_and_complex_2' into paultag/master
Conflicts:
	hy/lex/states.py
	tests/lex/test_lex.py
2013-04-12 18:16:43 +02:00
Konrad Hinsen
ac0a597742 Tests for float and complex constants 2013-04-11 09:54:59 +02:00
Konrad Hinsen
fd99f497a4 Fixed typo in test_lex.py 2013-04-11 09:40:57 +02:00
Konrad Hinsen
4f98ea22e8 Allow atoms (integers, booleans, symbols) as top-level expressions 2013-04-10 13:08:32 +02:00
James King
4d90123506 Merge branch 'develop' into feature/lambda-list-keyword 2013-04-09 15:13:25 -04:00
Nicolas Dandrimont
806f0d900c Throw an error on unbalanced expressions 2013-04-08 00:25:47 +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
James King
c200b4e3d1 Added HyLambdaListKeyword tokens to the lexer
The name "lambda list keyword" is a historical artifact from the CLHS
and not optimal (http://clhs.lisp.se/Body/26_glo_l.htm).

The name may change at some point.
2013-04-03 10:19:18 -04:00
Paul R. Tagliamonte
c4b270a727 test coverage bits 2013-04-01 22:07:05 -04:00
Paul Tagliamonte
025e501b13 cleaning up the tests a bit 2013-04-01 20:00:37 -04:00
Paul R. Tagliamonte
4cb4e7384e holy shit it's 2013 2013-03-18 10:27:14 -04:00
Paul R. Tagliamonte
0b3628bcc3 Adding more compiler coverage. 2013-03-07 23:01:17 -05:00
Paul R. Tagliamonte
b520d3148b Revert "Adding in Quoting bits."
This reverts commit db122f2ec9.

I'm an idjiot.
2013-03-07 21:37:43 -05:00
Paul R. Tagliamonte
db122f2ec9 Adding in Quoting bits. 2013-03-07 21:29:18 -05:00
Paul Tagliamonte
173598d055 add spaceless things 2013-03-07 19:23:11 -05:00
Paul R. Tagliamonte
935ef5424e Add in dicts. 2013-03-06 20:59:45 -05:00
Paul R. Tagliamonte
b37d92fe28 better line bits. 2013-03-03 14:03:59 -05:00
Paul R. Tagliamonte
b42fdc0bb7 Adding more testing. 2013-03-02 23:47:16 -05:00