{"id":29251711,"url":"https://github.com/macrat/parcon","last_synced_at":"2025-08-22T19:03:42.861Z","repository":{"id":57695002,"uuid":"487542451","full_name":"macrat/parcon","owner":"macrat","description":"Parcon is a yet another parser combinator written in Go.","archived":false,"fork":false,"pushed_at":"2022-05-04T12:59:59.000Z","size":41,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-06-20T06:34:24.673Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/macrat.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}},"created_at":"2022-05-01T13:17:32.000Z","updated_at":"2022-05-01T13:18:21.000Z","dependencies_parsed_at":"2022-09-14T22:21:13.936Z","dependency_job_id":null,"html_url":"https://github.com/macrat/parcon","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/macrat/parcon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macrat%2Fparcon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macrat%2Fparcon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macrat%2Fparcon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macrat%2Fparcon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/macrat","download_url":"https://codeload.github.com/macrat/parcon/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/macrat%2Fparcon/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263427316,"owners_count":23464845,"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":[],"created_at":"2025-07-04T01:08:13.350Z","updated_at":"2025-07-04T01:08:13.935Z","avatar_url":"https://github.com/macrat.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Parcon\n======\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/macrat/parcon.svg)](https://pkg.go.dev/github.com/macrat/parcon)\n\nParcon is a yet another parser combinator written in Go. (This is a experimental implementation and it is not effective at all)\n\n``` golang\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strconv\"\n\n\tpc \"github.com/macrat/parcon\"\n)\n\ntype Color struct {\n\tRed   uint8\n\tGreen uint8\n\tBlue  uint8\n}\n\nvar HexNumber = pc.Convert(\n\tpc.Repeat(2, pc.SingleHexDigit),\n\tfunc(input []rune) (uint8, error) {\n\t\ti, err := strconv.ParseUint(string(input), 16, 8)\n\t\treturn uint8(i), err\n\t},\n)\n\nvar ColorParser = pc.Convert(\n\tpc.WithPrefix(\n\t\tpc.TagStr(\"HASH\", \"#\"),\n\t\tpc.Repeat(3, HexNumber),\n\t),\n\tfunc(input []uint8) (Color, error) {\n\t\treturn Color{\n\t\t\tRed:   input[0],\n\t\t\tGreen: input[1],\n\t\t\tBlue:  input[2],\n\t\t}, nil\n\t},\n)\n\nfunc ParseColor(input string) (Color, error) {\n\toutput, remain, err := ColorParser.Parse([]rune(input), true)\n\tif err != nil {\n\t\treturn Color{}, err\n\t}\n\tif len(remain) != 0 {\n\t\treturn Color{}, fmt.Errorf(\"found extra string: %#v\", string(remain))\n\t}\n\treturn output, nil\n}\n\nfunc main() {\n\tcolor, err := ParseColor(\"#2F14DF\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Printf(\"red:%d green:%d blue:%d\\n\", color.Red, color.Green, color.Blue)\n\n\t// OUTPUT:\n\t// red:47 green:20 blue:223\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacrat%2Fparcon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmacrat%2Fparcon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacrat%2Fparcon/lists"}