-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiler subsystem #26
Conversation
This commit adds the compiler subpackage to implement issue #25. The compiler subpackage currently contains abstract base classes and will receive implementations later.
The RegexParser is a Parser implementation identifying the start and end of a code section with regular expressions. This is the standart implementation modified to implement issue #25.
- add CompileError for exceptions during compiling - replace Mapping in Code.execute with Dict because exec needs a dict - move line offset handling from CodeBuilder to Parser - replace name and loader with ModuleSpec
This commit changes RegexParser to comply to the new abc. Furthermore, CompileError is changed to show the section which failed.
This commit adds the current implementation of code objects to the compiler subpackage. This requires to raise the minimal python version to 3.8 as stated in issue #25.
This is necessary because the generic code implementation requires the CodeType.replace method, which is available in python 3.8+.
This commit adds a facade to the compiler subsystem as mentioned in issue #25.
This commits adds the dedenting feature as a decorator as mentioned in issue #25.
To allow for better testing, the code for detecting code lines is moved into a seperate method.
Before this commit, every builder kept track the section number themself, resulting in redundancy and susceptibility to errors. This commit modifies compiler.CodeBuilder.add_* to accept the current section number.
This commit adds a implementation of compiler.Code in python bytecode as mentioned in issue #25. It is implemented using a generator and currently slower than the generic implementation to allow for variables to be passed to .execute. If MAKE_FUNCTION gets faster or the compiler subsystem gets changed it may be faster.
This commit replaces a few type hints in the compiler subpackage with generics. This allows detaching a CodeBuilderDecorator which was detached from another CodeBuilderDecorator and fixes the result of CodeBuilder.copy() not having the same type as his 'parent'.
To allow for better error discovery, this commit replaces CompileError with a normal SyntaxError with the correct line number set.
To allow for Python version 3.7 to be used, GenericCodeBuilder now uses the ast module instead of CodeType.replace.
This commit updates the workflow to not run MyPy on pypy-3.7 because it is not supported.
Hello @Deric-W! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:
|
Codecov Report
@@ Coverage Diff @@
## master #26 +/- ##
===========================================
+ Coverage 30.59% 67.45% +36.85%
===========================================
Files 5 9 +4
Lines 317 507 +190
===========================================
+ Hits 97 342 +245
+ Misses 220 165 -55
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Implement Issue #25