-
Notifications
You must be signed in to change notification settings - Fork 7
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
Conversion to python3 and some other fixes #1
Open
KOLANICH
wants to merge
28
commits into
aixp:master
Choose a base branch
from
UniGrammar:python3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…parate file. Removed unneeded version string on every launch
…_name% -> __class__ ).
KOLANICH
force-pushed
the
python3
branch
2 times, most recently
from
November 23, 2017 20:15
7bf41c8
to
69f2c24
Compare
1. Tests fix for non-Windows OSes 2. removed obsolete stuff from setup.py 3. metadata retrieval fixes. 4. Replaced os.path with pathlib 5. Dropped python2
Moved constants into a separate enum. Reformatted with black and autopep8. Now it uses LF line endings and tabs.
Python 3 support has been implemented, Python 2 support has been dropped. Migrated from dumb strings to `ast`, which has greatly improved the structure of the code and allowed further improvements. The cost is that the comments and whitespaces are not preserved, since there are no nodes for them. Transforming asts into strings is done using `astor` library. Optionally (if installed) the result is postprocessed by `antiflash`. Added types, reformatted source. Now we use tabs (a tab is now considered to be completion to 4 spaces). Enable `editorconfig` in your favorite editor if you want to see the sources right. Implemented python code detection. Instead of custom and incomplete parsing as was done earlier we now use python parser. The first syntax error in python code is considered to be an end of python code and continuation of CoCo/R grammar. Implemented optional typing for parameters. Typing uses Java/C++/C# syntax (type name), not python one (name: type) for compatibility Moved the components used by every parser into `CoCoRuntime` module. It provides abstract base classes with some props that must be populated in generated code Started eliminating global state. Stuff earlier saved into classes now is saved into instances. Dropped frame files support. Use object oriented programming instead. `Copyright.frame` is not used anymore (in fact it has been never used in CoCoPy, but CoCo/R manual mentions it). Instead put copyright header into `__copyright__` variable, and it will be inserted in both `Scanner` and `Parser` Dropped generation of drivers. They were not really generated, just copied. (Non)terminals enum values are now stored in a single shared `IntEnum` rather than in parser and lexer classes themselves. Added a mode to use lookups from the enum instead of raw numbers in generated code. Should improve readability and simplify debugging and diffing the generated code Now we use `setup.cfg` and `pyproject.toml` for fetching versions from git. Installation from the sources other than git is deprecated. Refactored keywords lookup. Now they are not matched using elif ladders, instead they are stored in a map Optimized error messages storage. Since their numbers are sequential, now they are stored in a `list` rather than a `dict`. Dropped numeric values (that initially were not in a enum, just untidy mess) mixing node types, symbol types and state types. Now we have a dedicated class for each. Optionally optimized keywords lookup using prefix trees using `datrie` library. Automatically enabled, if `datrie` is installed.
Moved the metadata into `pyproject.toml`. Removed `setup.py`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi.
I have:
setup.cfg
ToDos:
Coco.atg
because of imports with dot.invoke
instead of subprocess