Metadata-Version: 2.1
Name: asts
Version: 0.1.6.dev1
Summary: A library for programmatic software modification
Home-page: https://github.com/grammatech/sel
Author: Eric Schulte and GrammaTech
Author-email: sel@grammatech.com
License: GPLv3+
Project-URL: Bug Reports, https://github.com/grammatech/sel/issues
Project-URL: Source, https://github.com/grammatech/sel/
Keywords: software-engineering,source,program-synthesis
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Python: >=3.6
Description-Content-Type: text/markdown

Generic Tree-Sitter AST API
===========================

The ASTs package provides a Python API into GrammaTech's Software
Evolution Library ([SEL][]) for source code manipulation.  SEL
generalizes over GitHub's [tree-sitter][] parsing libraries providing
a uniform interface over multiple programming languages (primarily
Python, JavaScript/TypeScript, C, C++, and Java; with lesser support
for Bash, CSS, Go HTML, and Rust), and providing additional
functionality for software inspection and modification.

[tree-sitter]: https://tree-sitter.github.io/tree-sitter/
[SEL]: https://grammatech.github.io/sel/index.html#Software-Evolution-Library

<!-- TODO: Setup automatic documentation building. -->
See the methods provided by asts.py for more information.

Example usage:

```
$ python3
Python 3.8.5
Type "help", "copyright", "credits" or "license" for more information.
>>> import asts
>>> it = asts.AST("python", "x + 88")
>>> it.children()
[<asts.asts.AST object at 0x7f8e91fb52b0>]
>>> it.children()[0].children()
[<asts.asts.AST object at 0x7f8e918b7100>]
>>> it.children()[0].children()[0].children()
[<asts.asts.AST object at 0x7f8e918b7490>, <asts.asts.AST object at 0x7f8e918b73a0>, <asts.asts.AST object at 0x7f8e918b73d0>]
>>> it.children()[0].children()[0].children()[0].source_text()
'x'
>>> it.children()[0].children()[0].children()[1].source_text()
'+'
>>> it.children()[0].children()[0].children()[2].source_text()
'88'
>>> it.children()[0].children()[0].source_text()
'x + 88'
>>> it.children()[0].children()[0].child_slots()
[['PYTHON-LEFT', 1], ['PYTHON-OPERATOR', 1], ['PYTHON-RIGHT', 1], ['CHILDREN', 0]]
>>> list(map(lambda x:x.source_text(), it.children()[0].children()[0].children()))
['x', '+', '88']
>>> list(map(lambda x:x.ast_type(), it.children()[0].children()[0].children()))
['PYTHON-IDENTIFIER', 'PYTHON-+', 'PYTHON-INTEGER']
```


