Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aerogo/codetree
:evergreen_tree: Parses indented code and returns a tree structure.
https://github.com/aerogo/codetree
go parser
Last synced: 14 days ago
JSON representation
:evergreen_tree: Parses indented code and returns a tree structure.
- Host: GitHub
- URL: https://github.com/aerogo/codetree
- Owner: aerogo
- License: other
- Created: 2016-11-26T02:50:38.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-10-26T04:19:45.000Z (about 5 years ago)
- Last Synced: 2024-05-29T00:18:16.979Z (5 months ago)
- Topics: go, parser
- Language: Go
- Homepage:
- Size: 46.9 KB
- Stars: 24
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - codetree - Parses indented code (python, pixy, scarlet, etc.) and returns a tree structure. (Text Processing / Parsers/Encoders/Decoders)
- awesome-go-extra - codetree - 11-26T02:50:38Z|2019-10-26T04:19:45Z| (Bot Building / Parsers/Encoders/Decoders)
README
# codetree
[![Godoc][godoc-image]][godoc-url]
[![Report][report-image]][report-url]
[![Tests][tests-image]][tests-url]
[![Coverage][coverage-image]][coverage-url]
[![Sponsor][sponsor-image]][sponsor-url]Parses indented code (Python, Pug, Stylus, Pixy, codetree, etc.) and returns a tree structure.
## Installation
```bash
go get github.com/aerogo/codetree
```## Usage
```go
tree, err := codetree.New(reader)
defer tree.Close()
```## Input
```
parent1
child1
child2
child3
child3.1
child3.2
child4parent2
child1
```## Output
See [CodeTree](https://github.com/aerogo/codetree/blob/master/CodeTree.go#L23-L32) structure.
The root node always starts with `Indent` being `-1`.
## Style
Please take a look at the [style guidelines](https://github.com/akyoto/quality/blob/master/STYLE.md) if you'd like to make a pull request.
## Sponsors
| [![Cedric Fung](https://avatars3.githubusercontent.com/u/2269238?s=70&v=4)](https://github.com/cedricfung) | [![Scott Rayapoullé](https://avatars3.githubusercontent.com/u/11772084?s=70&v=4)](https://github.com/soulcramer) | [![Eduard Urbach](https://avatars3.githubusercontent.com/u/438936?s=70&v=4)](https://twitter.com/eduardurbach) |
| --- | --- | --- |
| [Cedric Fung](https://github.com/cedricfung) | [Scott Rayapoullé](https://github.com/soulcramer) | [Eduard Urbach](https://eduardurbach.com) |Want to see [your own name here?](https://github.com/users/akyoto/sponsorship)
[godoc-image]: https://godoc.org/github.com/aerogo/codetree?status.svg
[godoc-url]: https://godoc.org/github.com/aerogo/codetree
[report-image]: https://goreportcard.com/badge/github.com/aerogo/codetree
[report-url]: https://goreportcard.com/report/github.com/aerogo/codetree
[tests-image]: https://cloud.drone.io/api/badges/aerogo/codetree/status.svg
[tests-url]: https://cloud.drone.io/aerogo/codetree
[coverage-image]: https://codecov.io/gh/aerogo/codetree/graph/badge.svg
[coverage-url]: https://codecov.io/gh/aerogo/codetree
[sponsor-image]: https://img.shields.io/badge/github-donate-green.svg
[sponsor-url]: https://github.com/users/akyoto/sponsorship