{"id":20171140,"url":"https://github.com/deathbeam/parsihax","last_synced_at":"2026-02-06T13:46:15.680Z","repository":{"id":77929432,"uuid":"65295131","full_name":"deathbeam/parsihax","owner":"deathbeam","description":"A monadic LL(infinity) parser combinator library for Haxe :wine_glass:","archived":false,"fork":false,"pushed_at":"2019-11-23T00:57:31.000Z","size":286,"stargazers_count":21,"open_issues_count":3,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-15T06:37:55.401Z","etag":null,"topics":["cross-platform","haxe","parse","parsec"],"latest_commit_sha":null,"homepage":"http://deathbeam.github.io/parsihax/parsihax/Parser.html","language":"Haxe","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/deathbeam.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":"2016-08-09T12:58:51.000Z","updated_at":"2024-02-25T15:22:17.000Z","dependencies_parsed_at":"2023-02-25T10:00:26.402Z","dependency_job_id":null,"html_url":"https://github.com/deathbeam/parsihax","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/deathbeam/parsihax","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deathbeam%2Fparsihax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deathbeam%2Fparsihax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deathbeam%2Fparsihax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deathbeam%2Fparsihax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deathbeam","download_url":"https://codeload.github.com/deathbeam/parsihax/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deathbeam%2Fparsihax/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266775359,"owners_count":23982273,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cross-platform","haxe","parse","parsec"],"created_at":"2024-11-14T01:23:31.284Z","updated_at":"2026-02-06T13:46:10.635Z","avatar_url":"https://github.com/deathbeam.png","language":"Haxe","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Parsihax\n[![TravisCI Build Status][travis-img]][travis]\n\nParsihax is a small library for writing big parsers made up of lots of little parsers. The API is inspired by\n[parsec][] and [Parsimmon][parsimmon] (originally, Parsihax was just supposed to be Parsimmon rewrite in Haxe).\n\n### Installation\n\nInstall the library via [haxelib][] (library manager that comes with any Haxe distribution).\n\n```\nhaxelib install parsihax\n```\n\n## API Documentation\n\nHaxe-generated API documentation is available at [documentation website][docs], or see the\n[annotated source of `parsihax.Parser.hx`.][parsihax]\n\n## Examples\n\nSee the [test][] directory for annotated examples of parsing JSON, simple Lisp-like structure and monad parser.\n\n## Basics\nTo use nice sugar syntax, simply add this to your Haxe file\n\n```haxe\nimport parsihax.*;\nimport parsihax.Parser.*;\nusing parsihax.Parser;\n```\n\nA `ParseObject` parser is an abstract that represents an action on a stream of text, and the promise of either an\nobject yielded by that action on success or a message in case of failure. For example, `Parser.string('foo')` yields\nthe string `'foo'` if the beginning of the stream is `'foo'`, and otherwise fails.\n\nThe method `.map` is used to transform the yielded value. For example,\n\n```haxe\n'foo'.string()\n  .map(function(x) return x + 'bar');\n```\n\nwill yield `'foobar'` if the stream starts with `'foo'`. The parser\n\n```haxe\n~/[0-9]+/.regexp()\n  .map(function(x) return Std.parseInt(x) * 2);\n```\n\nwill yield the number `24` when it encounters the string `'12'`.\n\nAlso, Parsihax supports nice sugar syntax thanks to Haxe operator overloading. For example,\n\n```haxe\nvar a = \"a\".string() / \"important letter a\"\nvar b = \"b\".string() / \"important letter b\"\nvar c = \"c\".string() / \"important letter c\"\n\nvar result = a | b + c;\n\n// Will succeed on \"ac\" and \"bc\"\n// In case of failure, it will throw \"expected important letter a|b|c\"\n// So, plus operator is alias to then, or operator to or and div\n// operator to as\n```\n\nGetting `apply` from a `ParseObject` (or explicitly casting it to `ParseFunction` returns parsing function\n`String -\u003e ?Int -\u003e Result\u003cA\u003e` (or just `ParseFunction`), that parses the string and returns a `Hax.Result`\nwith a boolean `status` flag, indicating whether the parse succeeded. If it succeeded, the `value` attribute will\ncontain the yielded value. Otherwise, the `index` and `expected` attributes will contain the offset of the parse error,\nand a sorted, unique array of messages indicating what was expected.\n\nThe error object can be passed along with the original source to `ParseUtil.formatError` to obtain\na human-readable error string.\n\nChanging `ParseObject.apply` value changes `ParseObject` behaviour, but still keeps it's reference, what is\nreally usefull in recursive parsers.\n\n[travis]: https://travis-ci.org/deathbeam/parsihax\n[travis-img]: https://api.travis-ci.org/deathbeam/parsihax.svg?branch=master\n[haxelib]: http://lib.haxe.org/p/parsihax\n[docs]: https://deathbeam.github.io/parsihax/parsihax/Parser.html\n[parsihax]: https://github.com/deathbeam/parsihax/blob/master/src/parsihax/Parser.hx\n[test]: https://github.com/deathbeam/parsihax/tree/master/test/parsihax\n[parsec]: https://hackage.haskell.org/package/parsec\n[parsimmon]: https://github.com/jneen/parsimmon\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeathbeam%2Fparsihax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeathbeam%2Fparsihax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeathbeam%2Fparsihax/lists"}