[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-5691":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":30,"readmeContent":31,"aiSummary":32,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":33,"discoverSource":34},5691,"pest","pest-parser\u002Fpest","pest-parser","The Elegant Parser","https:\u002F\u002Fpest.rs",null,"Rust",5353,291,40,65,0,2,5,20,6,71.9,"Apache License 2.0",false,"master",true,[27,28,29],"parsing","peg","rust","2026-06-12 04:00:26","\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Fraw.github.com\u002Fpest-parser\u002Fpest\u002Fmaster\u002Fpest-logo.svg?sanitize=true\" width=\"80%\"\u002F>\n\u003C\u002Fp>\n\n# pest. The Elegant Parser\n\n[![Join the chat at https:\u002F\u002Fgitter.im\u002Fpest-parser\u002Fpest](https:\u002F\u002Fbadges.gitter.im\u002Fdragostis\u002Fpest.svg)](https:\u002F\u002Fgitter.im\u002Fpest-parser\u002Fpest?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)\n[![Book](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fbook-WIP-4d76ae.svg)](https:\u002F\u002Fpest.rs\u002Fbook)\n[![Docs](https:\u002F\u002Fdocs.rs\u002Fpest\u002Fbadge.svg)](https:\u002F\u002Fdocs.rs\u002Fpest)\n\n[![pest Continuous Integration](https:\u002F\u002Fgithub.com\u002Fpest-parser\u002Fpest\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fpest-parser\u002Fpest\u002Factions\u002Fworkflows\u002Fci.yml)\n[![codecov](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fpest-parser\u002Fpest\u002Fbranch\u002Fmaster\u002Fgraph\u002Fbadge.svg)](https:\u002F\u002Fcodecov.io\u002Fgh\u002Fpest-parser\u002Fpest)\n\u003Ca href=\"https:\u002F\u002Fblog.rust-lang.org\u002F2024\u002F11\u002F28\u002FRust-1.83.0\u002F\">\u003Cimg alt=\"Rustc Version 1.83.0+\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Frustc-1.83.0%2B-lightgrey.svg\"\u002F>\u003C\u002Fa>\n\n[![Crates.io](https:\u002F\u002Fimg.shields.io\u002Fcrates\u002Fd\u002Fpest.svg)](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fpest)\n[![Crates.io](https:\u002F\u002Fimg.shields.io\u002Fcrates\u002Fv\u002Fpest.svg)](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fpest)\n\npest is a general purpose parser written in Rust with a focus on accessibility,\ncorrectness, and performance. It uses parsing expression grammars\n(or [PEG]) as input, which are similar in spirit to regular expressions, but\nwhich offer the enhanced expressivity needed to parse complex languages.\n\n[PEG]: https:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FParsing_expression_grammar\n\n## Getting started\n\nThe recommended way to start parsing with pest is to read the official [book].\n\nOther helpful resources:\n\n* API reference on [docs.rs]\n* play with grammars and share them on our [fiddle]\n* find previous common questions answered or ask questions on [GitHub Discussions]\n* leave feedback, ask questions, or greet us on [Gitter] or [Discord]\n\n[book]: https:\u002F\u002Fpest.rs\u002Fbook\n[docs.rs]: https:\u002F\u002Fdocs.rs\u002Fpest\n[fiddle]: https:\u002F\u002Fpest.rs\u002F#editor\n[Gitter]: https:\u002F\u002Fgitter.im\u002Fpest-parser\u002Fpest\n[Discord]: https:\u002F\u002Fdiscord.gg\u002FXEGACtWpT2\n[GitHub Discussions]: https:\u002F\u002Fgithub.com\u002Fpest-parser\u002Fpest\u002Fdiscussions\n\n## Example\n\nThe following is an example of a grammar for a list of alphanumeric identifiers\nwhere all identifiers don't start with a digit:\n\n```rust\nalpha = { 'a'..'z' | 'A'..'Z' }\ndigit = { '0'..'9' }\n\nident = { !digit ~ (alpha | digit)+ }\n\nident_list = _{ ident ~ (\" \" ~ ident)* }\n          \u002F\u002F ^\n          \u002F\u002F ident_list rule is silent which means it produces no tokens\n```\n\nGrammars are saved in separate .pest files which are never mixed with procedural\ncode. This results in an always up-to-date formalization of a language that is\neasy to read and maintain.\n\n## Meaningful error reporting\n\nBased on the grammar definition, the parser also includes automatic error\nreporting. For the example above, the input `\"123\"` will result in:\n\n```\nthread 'main' panicked at ' --> 1:1\n  |\n1 | 123\n  | ^---\n  |\n  = unexpected digit', src\u002Fmain.rs:12\n```\nwhile `\"ab *\"` will result in:\n```\nthread 'main' panicked at ' --> 1:1\n  |\n1 | ab *\n  |    ^---\n  |\n  = expected ident', src\u002Fmain.rs:12\n```\n\nThese error messages can be obtained from their default `Display` implementation,\ne.g. `panic!(\"{}\", parser_result.unwrap_err())` or `println!(\"{}\", e)`.\n\n## Pairs API\n\nThe grammar can be used to derive a `Parser` implementation automatically.\nParsing returns an iterator of nested token pairs:\n\n```rust\nuse pest_derive::Parser;\nuse pest::Parser;\n\n#[derive(Parser)]\n#[grammar = \"ident.pest\"]\nstruct IdentParser;\n\nfn main() {\n    let pairs = IdentParser::parse(Rule::ident_list, \"a1 b2\").unwrap_or_else(|e| panic!(\"{}\", e));\n\n    \u002F\u002F Because ident_list is silent, the iterator will contain idents\n    for pair in pairs {\n        \u002F\u002F A pair is a combination of the rule which matched and a span of input\n        println!(\"Rule:    {:?}\", pair.as_rule());\n        println!(\"Span:    {:?}\", pair.as_span());\n        println!(\"Text:    {}\", pair.as_str());\n\n        \u002F\u002F A pair can be converted to an iterator of the tokens which make it up:\n        for inner_pair in pair.into_inner() {\n            match inner_pair.as_rule() {\n                Rule::alpha => println!(\"Letter:  {}\", inner_pair.as_str()),\n                Rule::digit => println!(\"Digit:   {}\", inner_pair.as_str()),\n                _ => unreachable!()\n            };\n        }\n    }\n}\n```\n\nThis produces the following output:\n```\nRule:    ident\nSpan:    Span { start: 0, end: 2 }\nText:    a1\nLetter:  a\nDigit:   1\nRule:    ident\nSpan:    Span { start: 3, end: 5 }\nText:    b2\nLetter:  b\nDigit:   2\n```\n\n### Defining multiple parsers in a single file\nThe current automatic `Parser` derivation will produce the `Rule` enum\nwhich would have name conflicts if one tried to define multiple such structs\nthat automatically derive `Parser`. One possible way around it is to put each\nparser struct in a separate namespace:\n\n```rust\nmod a {\n    #[derive(Parser)]\n    #[grammar = \"a.pest\"]\n    pub struct ParserA;\n}\nmod b {\n    #[derive(Parser)]\n    #[grammar = \"b.pest\"]\n    pub struct ParserB;\n}\n```\n\n## Other features\n\n* Precedence climbing\n* Input handling\n* Custom errors\n* Runs on stable Rust\n\n## Projects using pest\n\nYou can find more projects and ecosystem tools in the [awesome-pest](https:\u002F\u002Fgithub.com\u002Fpest-parser\u002Fawesome-pest) repo.\n\n* [pest_meta](https:\u002F\u002Fgithub.com\u002Fpest-parser\u002Fpest\u002Fblob\u002Fmaster\u002Fmeta\u002Fsrc\u002Fgrammar.pest) (bootstrapped)\n* [AshPaper](https:\u002F\u002Fgithub.com\u002Fshnewto\u002Fashpaper)\n* [brain](https:\u002F\u002Fgithub.com\u002Fbrain-lang\u002Fbrain)\n* [cicada](https:\u002F\u002Fgithub.com\u002Fmitnk\u002Fcicada)\n* [comrak](https:\u002F\u002Fgithub.com\u002Fkivikakk\u002Fcomrak)\n* [elastic-rs](https:\u002F\u002Fgithub.com\u002Fcch123\u002Felastic-rs)\n* [graphql-parser](https:\u002F\u002Fgithub.com\u002FKeats\u002Fgraphql-parser)\n* [handlebars-rust](https:\u002F\u002Fgithub.com\u002Fsunng87\u002Fhandlebars-rust)\n* [hexdino](https:\u002F\u002Fgithub.com\u002FLuz\u002Fhexdino)\n* [Huia](https:\u002F\u002Fgitlab.com\u002Fjimsy\u002Fhuia\u002F)\n* [insta](https:\u002F\u002Fgithub.com\u002Fmitsuhiko\u002Finsta)\n* [jql](https:\u002F\u002Fgithub.com\u002Fyamafaktory\u002Fjql)\n* [json5-rs](https:\u002F\u002Fgithub.com\u002Fcallum-oakley\u002Fjson5-rs)\n* [mt940](https:\u002F\u002Fgithub.com\u002Fsvenstaro\u002Fmt940-rs)\n* [Myoxine](https:\u002F\u002Fgithub.com\u002Fd3bate\u002Fmyoxine)\n* [py_literal](https:\u002F\u002Fgithub.com\u002Fjturner314\u002Fpy_literal)\n* [rouler](https:\u002F\u002Fgithub.com\u002Fjarcane\u002Frouler)\n* [RuSh](https:\u002F\u002Fgithub.com\u002Flwandrebeck\u002FRuSh)\n* [rs_pbrt](https:\u002F\u002Fgithub.com\u002Fwahn\u002Frs_pbrt)\n* [stache](https:\u002F\u002Fgithub.com\u002Fdgraham\u002Fstache)\n* [tera](https:\u002F\u002Fgithub.com\u002FKeats\u002Ftera)\n* [ui_gen](https:\u002F\u002Fgithub.com\u002Femoon\u002Fui_gen)\n* [ukhasnet-parser](https:\u002F\u002Fgithub.com\u002Fadamgreig\u002Fukhasnet-parser)\n* [ZoKrates](https:\u002F\u002Fgithub.com\u002FZoKrates\u002FZoKrates)\n* [Vector](https:\u002F\u002Fgithub.com\u002Ftimberio\u002Fvector)\n* [AutoCorrect](https:\u002F\u002Fgithub.com\u002Fhuacnlee\u002Fautocorrect)\n* [yaml-peg](https:\u002F\u002Fgithub.com\u002Faofdev\u002Fyaml-peg)\n* [qubit](https:\u002F\u002Fgithub.com\u002Fabhimanyu003\u002Fqubit)\n* [caith](https:\u002F\u002Fgithub.com\u002FGeobert\u002Fcaith) (a dice roller crate)\n* [Melody](https:\u002F\u002Fgithub.com\u002Fyoav-lavi\u002Fmelody)\n* [json5-nodes](https:\u002F\u002Fgithub.com\u002Fjlyonsmith\u002Fjson5-nodes)\n* [prisma](https:\u002F\u002Fgithub.com\u002Fprisma\u002Fprisma)\n* [ws2markdown](https:\u002F\u002Fcode.rosaelefanten.org\u002Fws2markdown) (a WordStar to Markdown converter)\n\n## Minimum Supported Rust Version (MSRV)\n\nThis library should always compile with default features on **Rust 1.83.0**.\n\n## no_std support\n\nThe `pest` and `pest_derive` crates can be built without the Rust standard\nlibrary and target embedded environments. To do so, you need to disable\ntheir default features. In your `Cargo.toml`, you can specify it as follows:\n\n```toml\n[dependencies]\n# ...\npest = { version = \"2\", default-features = false }\npest_derive = { version = \"2\", default-features = false }\n```\n\nIf you want to build these crates in the pest repository's workspace, you can\npass the `--no-default-features` flag to `cargo` and specify these crates using\nthe `--package` (`-p`) flag. For example:\n\n```bash\n$ cargo build --target thumbv7em-none-eabihf --no-default-features -p pest\n$ cargo bootstrap\n$ cargo build --target thumbv7em-none-eabihf --no-default-features -p pest_derive\n```\n\n## Special thanks\n\nA special round of applause goes to prof. Marius Minea for his guidance and all\npest contributors, some of which being none other than my friends.\n","pest 是一个用 Rust 编写的通用解析器，专注于易用性、正确性和性能。它使用解析表达式文法（PEG）作为输入，这种文法类似于正则表达式，但提供了更强大的表达能力，能够处理复杂的语言结构。pest 的核心功能包括清晰的语法定义、自动错误报告和与 Rust 代码分离的.pest 文件，使得语言规范易于阅读和维护。适合用于需要高效且准确地解析复杂文本格式的场景，如编程语言、配置文件或自定义数据格式。","2026-06-11 03:04:45","top_language"]