Kodi Arfer
734cdcd2fd
Delay importing the lexer and parser
...
This speeds up runs of Hy that never need to parse or compile Hy code (e.g., running a Hy program that's already byte-compiled).
2018-08-18 18:05:40 -04:00
Kodi Arfer
7ba2105a2b
Fix date and time hy-reprs on Windows
2018-08-08 09:26:20 -04:00
gilch
109c0b0f5b
Merge pull request #1664 from brandonwillard/require-in-macroexpand-all
...
Expand `require`d macros in `macroexpand-all`
2018-08-02 23:57:32 -06:00
Brandon T. Willard
33f2b4a91a
Compile require
s 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
Kodi Arfer
081a710b0f
Fix handling of unpacking in method calls and attribute lookups
2018-07-24 09:45:00 -07:00
Kodi Arfer
0f85331c81
Rename variables in @builds_model(HyExpression)
2018-07-24 09:41:57 -07:00
Kodi Arfer
1d2c73165d
Make HyKeyword callable
...
Co-authored-by: Simon Gomizelj <simon@vodik.xyz>
2018-07-24 09:19:37 -07:00
Kodi Arfer
03aafad657
Make empty expressions illegal at the top level
2018-07-24 08:59:52 -07:00
gilch
0de8557fb5
Merge pull request #1647 from gilch/let-rebind
...
Fix let rebind bug.
2018-07-08 21:52:32 -06:00
Kodi Arfer
af8907b151
Minor cleanup in compile_unary_operator
2018-06-30 11:04:57 -07:00
Kodi Arfer
88f33453dc
Minor cleanup for raise
and try
2018-06-30 11:04:11 -07:00
Kodi Arfer
bd675a5db6
Unmangle in compile_expression before build_method
...
This ensures that e.g. the symbols "~" and "hyx_XtildeX" in the root position will both appear as "~" to the build method.
2018-06-30 11:04:11 -07:00
Kodi Arfer
fca2eb93b0
Remove dead code from HyASTCompiler.compile
2018-06-30 11:04:11 -07:00
Kodi Arfer
00150c088c
Remove an unused helper method in the compiler
2018-06-30 11:04:11 -07:00
Kodi Arfer
e2b98effda
Replace an unused variable with _
2018-06-30 11:04:11 -07:00
Kodi Arfer
217fc2a487
Clean up _render_quoted_form
2018-06-30 11:04:11 -07:00
Kodi Arfer
8a70d5c90f
Fold _branch into the compiler
2018-06-30 11:04:11 -07:00
Kodi Arfer
45ec57ab56
Simplify Result.force_expr
2018-06-30 11:04:11 -07:00
Kodi Arfer
21f7ef0713
Fold load_stdlib into the compiler
2018-06-30 11:04:11 -07:00
Kodi Arfer
d501b073d8
Fold compile_time_ns into the compiler
2018-06-30 11:04:11 -07:00
Kodi Arfer
3d3d1fe6ae
Remove unused compiler subroutines
2018-06-30 11:04:11 -07:00
Kodi Arfer
9c6714c176
Remove unused imports
2018-06-30 11:04:11 -07: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
7abd8ffc2a
Make importing a dotted name a syntax error, per Python
2018-06-27 10:24:22 -07:00
Oskar Kvist
edbe8e3b7f
Make defmacro! work with optional args
2018-06-25 11:45:23 -07:00
Kodi Arfer
76b80bad81
Remove support for the old comprehension forms
2018-06-13 17:31:08 -07:00
Kodi Arfer
cf0dafef9b
Update uses of the old comprehension forms
2018-06-13 17:31:08 -07:00
Kodi Arfer
4754b152a9
Allow comprehensions with no looping parts
2018-06-13 17:31:08 -07:00
Kodi Arfer
e1972c535f
Remove for/a
, for*
, and for/a*
2018-06-13 17:31:08 -07:00
Kodi Arfer
3256932b13
Add a version of for
parallel to lfor
etc.
2018-06-13 17:31:08 -07:00
Kodi Arfer
ba1dc55e96
Implement lfor
, sfor
, gfor
, dfor
2018-06-13 17:31:08 -07:00
Kodi Arfer
7a40561db8
Add tagged model patterns
2018-06-13 17:31:08 -07:00
Kodi Arfer
5ffbb4b0eb
Add Result.lineno and Result.col_offset
2018-06-13 17:31:08 -07:00
Kodi Arfer
844256b99b
Make Asty use static rather than instance methods
...
This ensures `asty.Pass is asty.Pass`.
2018-06-13 17:31:08 -07:00
Kodi Arfer
c3d4c7aa82
Clean up else
compilation in while
2018-06-11 21:05:29 -07:00
Kodi Arfer
ea899471af
Remove an unused compiler function
2018-06-11 21:05:29 -07:00
Kodi Arfer
16ec46a473
Update docstring handling for Python 3.7
...
See https://github.com/python/cpython/pull/7121 .
2018-06-05 17:35:48 -07:00
Kodi Arfer
3204a9e8a3
Streamline auto-promotion and position spoofing
...
Auto-promotion now occurs in only two cases: when we start the compiler and when we expand a macro. It's fully recursive so even a non-model nested in a model will be promoted.
This change fixes some regressions induced by the stricter type checks of the pattern-matching compiler.
2018-06-05 09:23:21 -07:00
Kodi Arfer
a38c948ed2
Fix a regression with mangling module names
2018-06-03 15:38:49 -07:00
Ryan Gonzalez
e66743c976
Merge pull request #1615 from Kodiologist/no-parser-cache
...
Disable the parser cache
2018-05-27 16:28:00 -05:00
Kodi Arfer
e344ac1fd6
Fix the management of _stdlib
...
_stdlib is a global variable, so core modules could use it, contrary to our intention, so long as they happened to be compiled after a non-core module. I've added a compiler attribute to track whether we can use _stdlib.
This fix exposed some cases where hy.core.shadow tried to use a core function, so I fixed those.
I've also added an `if not _stdlib` to `load_stdlib` so that we only bother to actually load _stdlib once.
2018-05-24 17:51:21 -07:00
Kodi Arfer
1732ddec4d
Disable the parser cache
...
I wasn't able to observe a meaningful performance improvement from it, and it requires some file I/O. Here are the times, in seconds, I observed on my ThinkPad T450s with Python 3.6 and Ubuntu 18.04:
test 1 test 2
master 8.96 2.59
this change 8.88 2.62
Test 1 is the total time from:
$ time dash -c 'git clean -dfx && pip install -e . && pytest --ignore tests/test_bin.py'
Test 2 is pytest's reported total time from a subsequent:
$ pytest --ignore tests/test_bin.py
2018-05-21 09:22:49 -07:00
Kodi Arfer
0a5bc21fcf
Simplify compile_numeric_literal for new astor
2018-05-20 14:11:35 -07:00
Kodi Arfer
38fdcc2114
Don't let HySymbol inherit from HyString
2018-05-20 14:11:35 -07:00
Kodi Arfer
210086c7ca
Clean up the decorators used in the compiler
2018-05-20 14:11:35 -07:00
Kodi Arfer
98fbdcfc50
Move @builds(HyExpression) next to other @builds
2018-05-20 14:11:35 -07:00
Kodi Arfer
a933646bdd
Use model patterns for the remaining special forms
2018-05-20 14:11:35 -07:00
Kodi Arfer
8b2733e921
Use model patterns for comprehensions
...
I haven't bothered to refine the patterns for these since I intend to completely overhaul the comprehension forms in the near future.
2018-05-20 14:11:35 -07:00
Kodi Arfer
41d3f26001
Use model patterns for comparison and math ops
2018-05-20 14:11:35 -07:00