Commit Graph

8 Commits

Author SHA1 Message Date
Dan Gohman
c842b9aaa1 Code cleanup: import OrderedDict rather than collections.OrderedDict 2018-03-15 10:13:26 -07:00
Dan Gohman
272d03d8fc Add a utility for generating Rust 'match' expressions.
This makes it a little simpler to generate 'match' statements, and
it performs deduplication of identical arms. And it means I don't
have to think about as many strings like '{} {{ {}.. }} => {}'
when I'm trying to think about how instructions work :-).
2018-03-14 10:51:09 -07:00
Dan Gohman
b60b2ce135 Change parse_multiline to follow PEP 257.
The main change is that it avoids creating blank lines when processing
docstrings.

This also adds blank lines in various places to make the generated code
prettier.
2017-10-31 12:21:23 -07:00
Jakob Stoklund Olesen
27d272ade0 Add a fmt.multi_line() method to srcgen.Formatter.
Write out multiple code lines from a single string after stripping a
common indentation.

Also use this for doc_comment().
2017-07-07 15:10:17 -07:00
Jakob Stoklund Olesen
cfe2c7f46f Add more mypy annotations. 2017-03-30 15:16:44 -07:00
Jakob Stoklund Olesen
c01ff670ed Fixed for mypy 0.501.
The List and Dict types are no longer implicitly available. They must be
imported from typing.

Type annotations must appear before the doc comment in a function. Also
fix type errors in these functions that weren't detected before.
2017-03-03 09:08:28 -08:00
Jakob Stoklund Olesen
ed917c394f Add PEP 484 type annotations to a bunch of Python code.
Along with the mypy tool, this helps find bugs in the Python code
handling the instruction definition data structures.
2016-10-26 15:15:51 -07:00
Jakob Stoklund Olesen
af6355e2ef Move the 'meta' dir to 'lib/cretonne/meta'.
The 'lib/cretonne' directory will be the new root of a stand-alone
cretonne crate containg both Python and Rust sources.

This is in preparation for publishing crates on crates.io.
2016-10-17 14:19:23 -07:00