{"id":15293312,"url":"https://github.com/opal/c_lexer","last_synced_at":"2025-10-25T01:03:56.453Z","repository":{"id":62555746,"uuid":"129287081","full_name":"opal/c_lexer","owner":"opal","description":"Port of whitequark/parser's lexer in C","archived":false,"fork":false,"pushed_at":"2022-11-23T16:30:24.000Z","size":177,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-30T13:13:40.957Z","etag":null,"topics":["lexer","opal","parser","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ragel","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/opal.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}},"created_at":"2018-04-12T17:19:46.000Z","updated_at":"2022-11-23T15:49:01.000Z","dependencies_parsed_at":"2023-01-23T05:15:48.918Z","dependency_job_id":null,"html_url":"https://github.com/opal/c_lexer","commit_stats":null,"previous_names":["iliabylich/c_lexer"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opal%2Fc_lexer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opal%2Fc_lexer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opal%2Fc_lexer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opal%2Fc_lexer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opal","download_url":"https://codeload.github.com/opal/c_lexer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252811639,"owners_count":21807984,"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":["lexer","opal","parser","ruby"],"created_at":"2024-09-30T16:46:10.781Z","updated_at":"2025-10-25T01:03:56.446Z","avatar_url":"https://github.com/opal.png","language":"Ragel","readme":"# CLexer\n\n[![Build Status](https://travis-ci.org/opal/c_lexer.svg?branch=master)](https://travis-ci.org/opal/c_lexer)\n[![Build status](https://ci.appveyor.com/api/projects/status/lqw4pid44jvfbnl3/branch/master?svg=true)](https://ci.appveyor.com/project/iliabylich/c-lexer/branch/master)\n\nA C port of the whitequark/parser's lexer.\n\nInitially based on [whitequark/parser#248](https://github.com/whitequark/parser/pull/248) (thanks [@alexdowad](https://github.com/alexdowad)).\n\nCan be use on Linux/Mac/Windows, requires MRI.\n\n## Installation\n\n```\n$ gem install c_lexer\n```\n\n## Usage\n\n`c_lexer` doesn't change any parser classes.\n\nIt provides 3 classes:\n+ `Parser::CLexer` (C version of the lexer)\n+ `Parser::Ruby25WithCLexer` (a subclass of `parser/ruby25` that uses `Parser::CLexer` for lexing)\n+ `Parser::Ruby26WithCLexer` (a subclass of `parser/ruby26` that uses `Parser::CLexer` for lexing)\n\nIf you want `CLexer` to be a default lexer you can use the following patch:\n\n``` ruby\nrequire 'parser'\nrequire 'c_lexer'\n\nmodule Parser\n  dedenter = Lexer::Dedenter\n\n  remove_const(:Lexer)\n  Lexer = CLexer\n  Lexer::Dedenter = dedenter\n\n  remove_const(:Ruby26)\n  Ruby26 = Ruby26WithCLexer\nend\n```\n\n## Versioning\n\n`c_lexer` follows versioning of the `parser` gem to avoid confusions like\n\"which version of `c_lexer` should be used with the `parser vX.Y.Z`\". For `parser 2.5.1.0` you should use `c_lexer 2.5.1.0.X`.\n\n`c_lexer` supports all versions of `parser` starting from `2.5.1.0`\n\n## Development\n\n1. Make sure that you have `ragel` installed.\n2. Clone the repo and fetch submodules with `git submodule update --init`.\n3. The parser gem is located under `vendor/parser`.\n4. `rake ruby_parser:generate` generates `lexer.rb` and parsers for the `parser` gem.\n5. `rake c_lexer:generate` generates `lexer.c`.\n6. `rake compile` compiles `lexer.c` to `lexer.so` (or `lexer.bundle` depending on your platform).\n7. `rake test` runs `parser` tests using `c_lexer` as a default lexer.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/opal/c_lexer.\n\nBefore submitting a bug report, please, make sure that `parser` is not affected by the same issue.\nIf it's a parser bug please report it to the parser repo and we will backport it afterwards.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopal%2Fc_lexer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopal%2Fc_lexer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopal%2Fc_lexer/lists"}