{"id":15813861,"url":"https://github.com/mattgreen/lexer","last_synced_at":"2025-04-01T01:48:50.567Z","repository":{"id":143246123,"uuid":"226712536","full_name":"mattgreen/lexer","owner":"mattgreen","description":"A batteries-included lexing library based on finite automata","archived":false,"fork":false,"pushed_at":"2020-01-10T14:37:26.000Z","size":6539,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-06T04:07:00.711Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mattgreen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-12-08T18:29:37.000Z","updated_at":"2020-01-10T14:37:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"a07e4be4-c4d4-4d7c-893e-059538bfedbd","html_url":"https://github.com/mattgreen/lexer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattgreen%2Flexer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattgreen%2Flexer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattgreen%2Flexer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattgreen%2Flexer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattgreen","download_url":"https://codeload.github.com/mattgreen/lexer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246569006,"owners_count":20798341,"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":"2024-10-05T04:07:09.800Z","updated_at":"2025-04-01T01:48:50.545Z","avatar_url":"https://github.com/mattgreen.png","language":"C","readme":"# TODO: choose name for Rust lexing library\n\nA batteries-included lexing library for Rust based on finite automata.\n\nThis is a small library intended to automate much of the tedium associated with lexing so you can move onto more interesting problems.\n\n## Sample Usage\n\n```\nlet lexicon = LexiconBuilder::new()\n    .ignore_chars(\" \\t\\r\\n\")\n    .pattern(1, \"[a-zA-Z]+\")\n    .pattern(2, \"[0-9]+\")\n    .pattern(3, \"[.,'\\\":\\\\[\\\\];{}()!?-]\")\n    .build()\n    .unwrap();\n\nlet content = \"hello there, Gil\";\nlet mut lexer = Lexer::new(\u0026lexicon, \u0026contents);\nloop {\n    match lexer.next() {\n        Next::Token(id, text, pos) =\u003e println!(\"Token: #{}: \\\"{}\\\"\", text, pos),\n        Next::Error(c, pos) =\u003e println!(\"ERROR: {}\n        Next::End =\u003e break,\n    }\n}\n```\n\n## Features\n\n* Compiles regular expressions to finite automata\n* Efficient dispatch of input to applicable rules via lookup tables for first character\n* Leftmost-longest match semantics (`iffy` matched instead of `if` `fy` even when `if` is a pattern of interest)\n* Optionally specify characters to be ignored (such as whitespace)\n* Line and column number tracking\n\n## Roadmap\n\n* Flesh out Unicode support\n* Optional support for indent/dedent tokens\n* High-level `derive`-based API\n* Expand test and benchmark suite\n* Convert NFAs to DFAs\n* Consider submitting crate to crates.io\n\n## Performance\nTimes are from a i9 processor running at 2.4ghz.\n\n### Programming Language workload\n```\nsqlite3.c (7.6 MB of C)    time: 4.6849 ms   849,549 tokens\n```\n\n### NLP-type workload\n```\nkjv.txt (4.1MB of text)    time: 727.46 ns   1,010,863 tokens\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattgreen%2Flexer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattgreen%2Flexer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattgreen%2Flexer/lists"}