https://github.com/aerogo/codetree
:evergreen_tree: Parses indented code and returns a tree structure.
https://github.com/aerogo/codetree
go parser
Last synced: 7 months 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 9 years ago)
- Default Branch: master
- Last Pushed: 2019-10-26T04:19:45.000Z (about 6 years ago)
- Last Synced: 2024-10-29T21:05:48.925Z (about 1 year 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-extra - codetree - 11-26T02:50:38Z|2019-10-26T04:19:45Z| (Bot Building / Parsers/Encoders/Decoders)
- awesome-go-cn - codetree
- awesome-go-with-stars - codetree - Parses indented code (python, pixy, scarlet, etc.) and returns a tree structure. (Text Processing / Parsers/Encoders/Decoders)
- awesome-go - codetree - Parses indented code (python, pixy, scarlet, etc.) and returns a tree structure. (Text Processing / Parsers/Encoders/Decoders)
- awesome-go - codetree - Parses indented code (python, pixy, scarlet, etc.) and returns a tree structure. (Text Processing / Parsers/Encoders/Decoders)
- awesome-Char - codetree - Parses indented code (python, pixy, scarlet, etc.) and returns a tree structure. (Text Processing / HTTP Clients)
- zero-alloc-awesome-go - codetree - Parses indented code (python, pixy, scarlet, etc.) and returns a tree structure. (Text Processing / Parsers/Encoders/Decoders)
- awesome-go-cn - codetree
- awesome-go - codetree - Parses indented code (python, pixy, scarlet, etc.) and returns a tree structure. (Text Processing / HTTP Clients)
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
child4
parent2
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
| [](https://github.com/cedricfung) | [](https://github.com/soulcramer) | [](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