Commit graph

11 commits

Author SHA1 Message Date
Benjamin Woodruff
eae98942fd Implement Dict node
This implements the required nodes, but not the parsing logic (that'll
be a later diff).

To support `Dict`, this diff also introduces `BaseDictElement`,
`DictElement`, `StarredDictElement`, and `BaseDict`.

It also refactors some of the logic in `BaseSet` into `_BaseSetOrDict`
so that it can be shared between `BaseSet` and `BaseDict`.

`DictComp` will come later.
2019-07-26 12:48:22 -07:00
Ray Zeng
3be6c0df3d Export CodePosition/CodeRange; fix pickle with add_slots
This commit supports some use-cases internal to Instagram.
2019-07-22 20:05:07 -07:00
Benjamin Woodruff
46799cefcf Fix flake8 errors
This is a combination of:
- Fixing some issues upstream.
- Modifying our cleanup script to carry over noqa comments, and
  copying over the new versions of some files.
- A small addition to our flake8 config.
2019-07-22 20:05:07 -07:00
Benjamin Woodruff
656f61b810 Implement nodes and parser logic for Set and SetComp
This supports the syntax:

```
myset = {1, 2, 3}
```

and

```
myset = {i + 1 for i in range(3)}
```
2019-07-22 20:04:37 -07:00
Jennifer Taylor
f9f7a202f7 Remove Number
Remove Number wrapper node and go back to just having UnaryOperation.
2019-07-22 20:04:37 -07:00
Benjamin Woodruff
2295d062fc Add node classes for ListComp
This adds support for

```
[a for b in c if d]
```

I added support for GeneratorExp in a previous commit, so this is a
simple extension of that.
2019-07-22 20:04:37 -07:00
Benjamin Woodruff
6557122db6 Add node classes for GeneratorExp
This adds support for

```
(a for b in c if d)
```

As well as various nested versions of the expression.

This does not include nodes for other comprehension types, they'll come
in later diffs.
2019-07-22 20:04:37 -07:00
Benjamin Woodruff
a293787f8c Add node class and parser implementation for List
This is based heavily on the implementation of Tuple, and was pretty
straightforward as a result.
2019-07-22 19:53:49 -07:00
Benjamin Woodruff
1dab051ddb Remove Starred element type
We decided to merge this functionality into StarredElement.
2019-07-22 19:53:49 -07:00
Benjamin Woodruff
ca15eb2685 Add nodedefs (no parsing yet) needed for Tuple
This ended up being pretty complicated, so the parser stuff will come in
another diff.

Hopefully this should set up up nicely for dicts, sets, and lists too.
2019-06-05 15:23:22 -07:00
Jennifer Taylor
0719faa198 Initial export of LibCST to github. 2019-05-31 14:16:53 -07:00