{"id":16027781,"url":"https://github.com/followtheprocess/parser","last_synced_at":"2025-04-10T05:26:09.070Z","repository":{"id":218790967,"uuid":"747359842","full_name":"FollowTheProcess/parser","owner":"FollowTheProcess","description":"Simple, combinatorial parsing in Go!","archived":false,"fork":false,"pushed_at":"2025-02-14T17:45:04.000Z","size":112,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T06:51:30.248Z","etag":null,"topics":["go","parser","parser-combinators","text-parsing","utf-8"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FollowTheProcess.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-23T19:18:55.000Z","updated_at":"2025-02-14T17:45:07.000Z","dependencies_parsed_at":"2024-04-29T20:31:13.307Z","dependency_job_id":"569c11d8-c034-42c6-aaa3-51a9ddcd88c9","html_url":"https://github.com/FollowTheProcess/parser","commit_stats":{"total_commits":48,"total_committers":2,"mean_commits":24.0,"dds":"0.10416666666666663","last_synced_commit":"431b903db657e7fffff4d00afe2ba0eca8a8a9c3"},"previous_names":["followtheprocess/parser"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FollowTheProcess%2Fparser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FollowTheProcess%2Fparser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FollowTheProcess%2Fparser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FollowTheProcess%2Fparser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FollowTheProcess","download_url":"https://codeload.github.com/FollowTheProcess/parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248162145,"owners_count":21057702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","parser","parser-combinators","text-parsing","utf-8"],"created_at":"2024-10-08T20:23:26.909Z","updated_at":"2025-04-10T05:26:09.051Z","avatar_url":"https://github.com/FollowTheProcess.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Parser\n\n[![License](https://img.shields.io/github/license/FollowTheProcess/parser)](https://github.com/FollowTheProcess/parser)\n[![Go Reference](https://pkg.go.dev/badge/github.com/FollowTheProcess/parser.svg)](https://pkg.go.dev/github.com/FollowTheProcess/parser)\n[![Go Report Card](https://goreportcard.com/badge/github.com/FollowTheProcess/parser)](https://goreportcard.com/report/github.com/FollowTheProcess/parser)\n[![GitHub](https://img.shields.io/github/v/release/FollowTheProcess/parser?logo=github\u0026sort=semver)](https://github.com/FollowTheProcess/parser)\n[![CI](https://github.com/FollowTheProcess/parser/workflows/CI/badge.svg)](https://github.com/FollowTheProcess/parser/actions?query=workflow%3ACI)\n[![codecov](https://codecov.io/gh/FollowTheProcess/parser/branch/main/graph/badge.svg)](https://codecov.io/gh/FollowTheProcess/parser)\n\nSimple, fast, zero-allocation [combinatorial parsing] with Go\n\n## Project Description\n\n`parser` is intended to be a simple, expressive and easy to use API for all your text parsing needs. It aims to be:\n\n- **Fast:** Performant text parsing can be tricky, `parser` aims to be as fast as possible without compromising safety or error handling. Every parser function has a benchmark and has been written with performance in mind, almost none of them allocate on the heap ⚡️\n- **Correct:** You get the correct behaviour at all times, on any valid UTF-8 text. Errors are well handled and reported for easy debugging. 100% test coverage and every base level parsing function is Fuzzed.\n- **Intuitive:** Some parser combinator libraries are tricky to wrap your head around, I want `parser` to be super simple to use so that anyone can pick it up and be productive quickly\n- **Well Documented:** Every combinator in `parser` has a comprehensive doc comment describing it's entire behaviour, as well as an executable example of its use\n\n## Installation\n\n```shell\ngo get github.com/FollowTheProcess/parser@latest\n```\n\n## Quickstart\n\nLet's borrow the [nom] example and parse a hex colour!\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"strconv\"\n\n\t\"github.com/FollowTheProcess/parser\"\n)\n\n// RGB represents a colour.\ntype RGB struct {\n\tRed   int\n\tGreen int\n\tBlue  int\n}\n\n// fromHex parses a string into a hex digit.\nfunc fromHex(s string) (int, error) {\n\thx, err := strconv.ParseUint(s, 16, 64)\n\treturn int(hx), err\n}\n\n// hexPair is a parser that converts a hex string into it's integer value.\nfunc hexPair(colour string) (int, string, error) {\n\treturn parser.Map(\n\t\tparser.Take(2),\n\t\tfromHex,\n\t)(colour)\n}\n\nfunc main() {\n\t// Let's parse this into an RGB\n\tcolour := \"#2F14DF\"\n\n\t// We don't actually care about the #\n\t_, colour, err := parser.Char('#')(colour)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\t// We want 3 hex pairs\n\tpairs, _, err := parser.Count(hexPair, 3)(colour)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tif len(pairs) != 3 {\n\t\tlog.Fatalln(\"Not enough pairs\")\n\t}\n\n\trgb := RGB{\n\t\tRed:   pairs[0],\n\t\tGreen: pairs[1],\n\t\tBlue:  pairs[2],\n\t}\n\n\tfmt.Printf(\"%#v\\n\", rgb) // main.RGB{Red:47, Green:20, Blue:223}\n}\n\n```\n\n### Credits\n\nThis package was created with [copier] and the [FollowTheProcess/go_copier] project template.\n\nIt is also heavily inspired by [nom], an excellent combinatorial parsing library written in [Rust].\n\n[copier]: https://copier.readthedocs.io/en/stable/\n[FollowTheProcess/go_copier]: https://github.com/FollowTheProcess/go_copier\n[combinatorial parsing]: https://en.wikipedia.org/wiki/Parser_combinator\n[nom]: https://github.com/rust-bakery/nom\n[Rust]: https://www.rust-lang.org\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffollowtheprocess%2Fparser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffollowtheprocess%2Fparser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffollowtheprocess%2Fparser/lists"}