{"id":17802373,"url":"https://github.com/azrdev/coco-idea-plugin","last_synced_at":"2026-05-01T14:33:36.959Z","repository":{"id":72699675,"uuid":"77085910","full_name":"azrdev/coco-idea-plugin","owner":"azrdev","description":"Jetbrains IDE (Intellij IDEA, PyStorm, CLion, ...) support for Coco/R compiler generator grammar files","archived":false,"fork":false,"pushed_at":"2018-03-17T21:41:23.000Z","size":237,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T04:48:05.412Z","etag":null,"topics":["intellij","intellij-plugin","jetbrains-ides"],"latest_commit_sha":null,"homepage":"https://plugins.jetbrains.com/idea/plugin/9457-coco-r-grammar-support","language":"Java","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/azrdev.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":"2016-12-21T21:03:46.000Z","updated_at":"2018-07-17T14:35:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"964a3493-2057-4f1c-b1ed-127196c0e34c","html_url":"https://github.com/azrdev/coco-idea-plugin","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/azrdev/coco-idea-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azrdev%2Fcoco-idea-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azrdev%2Fcoco-idea-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azrdev%2Fcoco-idea-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azrdev%2Fcoco-idea-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azrdev","download_url":"https://codeload.github.com/azrdev/coco-idea-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azrdev%2Fcoco-idea-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32501402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["intellij","intellij-plugin","jetbrains-ides"],"created_at":"2024-10-27T12:41:57.244Z","updated_at":"2026-05-01T14:33:36.918Z","avatar_url":"https://github.com/azrdev.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Coco/R grammar support for Jetbrains IDEs\n\nPlugin for [Jetbrains](https://www.jetbrains.com/) IDEs\nto support grammar files (\\*.atg) of the [Coco/R](http://ssw.jku.at/Coco/) compiler generator.\nCheck it out from [Jetbrains' plugin repository](https://plugins.jetbrains.com/idea/plugin/9457-coco-r-grammar-support).\n\n![Screenshot of v3](doc/2017-02-06.v3.Screenshot.Cocoatg.png)\n\n## Implementation\n\nFollowing the [Custom Language Support Tutorial](http://www.jetbrains.org/intellij/sdk/docs/tutorials/custom_language_support_tutorial.html), the lexer is generated from Coco.flex using JFlex, and the parser from Coco.bnf using [Grammar-Kit](https://github.com/JetBrains/Grammar-Kit).\n\n# TODOs\n* language injection\n    - configurable language and/or good guess\n    - prefix \u0026 suffix as needed\n    - file header\n\n- folding: comments, injected blocks (esp. at file start)\n- references: not resolved in IGNORE, COMMENTS, PRAGMAS\n- customizable syntax highlighting: [Color Settings Page](http://www.jetbrains.org/intellij/sdk/docs/tutorials/custom_language_support/syntax_highlighter_and_color_settings_page.html)\n    - syntax highlighting: different colors for keywords, charsets, tokens, productions\n- PRAGMAs in structure view\n- `$CNF` file header\n\n- code completion, templates, \"new file\" (template), build system integration, quick fix, code style, ...\n\n# Tutorial deficits\n- \"register\" occurs in plugin.xml\n- for references: methods from .bnf are delegated to psiImplUtilClass, *if signature fits*\n- bnf: methods(nonterminals)=[] are not resolved correctly in \"attributes\" header\n- bug in `SimpleStructureViewModel.isAlwaysLeaf`: `element instanceof SimpleFile` is always false, it should be `treeElement.psiElement instanceof ...`\n- `PsiReference.resolve()` is only called when you return a valid value from `.rangeInsideHost()` (which `PsiReferenceBase` does *not* do)\n\nWhat may help understanding the tutorial:\n- Rust [JFlex Lexer](https://github.com/intellij-rust/intellij-rust/blob/master/src/main/grammars/RustLexer.flex) and [Grammar-Kit Parser](https://github.com/intellij-rust/intellij-rust/blob/master/src/main/grammars/RustParser.bnf)\n- Monkey C [Grammar-Kit Parser](https://github.com/liias/monkey/blob/master/src/main/java/io/github/liias/monkey/lang/grammar/Monkey.bnf)\n- meta-plugin for using ANTLR-grammar in jetbrains IDEs: [Code](https://github.com/antlr/jetbrains) and [forum announcement](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206103369-Using-ANTLR-v4-to-lex-parse-custom-file-formats)\n\n## howto language embedding, other plugins \u0026 forum posts\n\n- \u003chttps://intellij-support.jetbrains.com/hc/en-us/community/posts/206122689-Embedding-custom-languages-in-HTML-script-tags-\u003e\n\ngitter.im Alexander Zolotov @zolotov 2017-08-15 09:17\n\u003e You can properly lex/parse A language inside B language to get rid of injection A into B. We do so for CSS and JS in HTML, or for Python in SQL, so you can write JS in HTML and inject something into that JS.\nTake a look at com.intellij.psi.impl.source.tree.LazyParseablePsiElement and com.intellij.lexer.EmbeddedTokenTypesProvider (this one is for embedding into HTML)\n\n\u003chttps://github.com/bjansen/pebble-intellij/commit/72640eeddbb650204f45e9578581b2b1550319bb#diff-b576c185db1751b8f65142d839a73714\u003e\n\n[This thread about the *Play!* plugin](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206780275-Example-of-a-custom-language-plugin-for-a-templating-language)[^1] explains the differences between the three possible embedding \"types\":\n\n- LanguageSubstitutor: replace Language of an already handled file (e.g. HTML) with your own lang\n    * \u003chttps://intellij-support.jetbrains.com/hc/en-us/community/posts/207106595-Python-like-selectable-templating-laguages\u003e (Perl?)\n- Language injection: embed your language (fragments) in already handled file, e.g. properties in Java string[^2]\n    *  Documentation for [Language Injections](https://www.jetbrains.com/help/idea/2016.3/using-language-injections.html). References from embedded fragments are explained [in the tutorial](http://www.jetbrains.org/intellij/sdk/docs/tutorials/custom_language_support/reference_contributor.html#define-a-reference-contributor)\n    * \u003chttps://intellij-support.jetbrains.com/hc/en-us/community/posts/206483119-Java-code-Injection-in-custom-language-\u003e (CUP)\n    * \u003chttps://intellij-support.jetbrains.com/hc/en-us/community/posts/206020584-Language-Plugin-for-a-Thymeleaf-like-templating-language\u003e (HTL, but there are other plugins for HTL, too)\n- MultiplePsiFilesPerDocumentFileViewProvider: create several different Psi trees for one file. Have to use a layered Lexer (like [Scala](https://github.com/JetBrains/intellij-scala/blob/32dd1c4/src/org/jetbrains/plugins/scala/lang/lexer/LayeredLexer.java) or *Latte*)?\n    * \u003chttps://intellij-support.jetbrains.com/hc/en-us/community/posts/206765105-Tutorial-Custom-templating-language-plugin\u003e (Latte)\n    * \u003chttps://intellij-support.jetbrains.com/hc/en-us/community/posts/207316255-FindUsages-in-MultiPsiTree-files\u003e (Perl/Pod), [Perl plugin dev thread](https://intellij-support.jetbrains.com/hc/en-us/community/posts/206102159-Perl5-plugin-for-Intellij-IDEA)\n    * \u003chttps://intellij-support.jetbrains.com/hc/en-us/community/posts/207231009-ERB-like-template-language\u003e (Elixir/ERB)\n    * \u003chttps://github.com/JetBrains/intellij-plugins/blob/master/handlebars/src/com/dmarcotte/handlebars/file/HbFileViewProvider.java\u003e (Handlebars)\n    * thoughts on multiple languages' parser interaction \u003chttps://intellij-support.jetbrains.com/hc/en-us/community/posts/207645985-language-composition-with-Grammar-Kit-\u003e\n    * how to implement references between different language Psis \u003chttps://intellij-support.jetbrains.com/hc/en-us/community/posts/205990364-References-between-HTML-fragments-and-custom-template-language\u003e (another HTL plugin)\n\n\nThe last paragraph in [Custom Language Tutorial/Lexer](http://www.jetbrains.org/intellij/sdk/docs/reference_guide/custom_language_support/implementing_lexer.html) tells about mixing languages using chameleon tokens implementing `ILazyParseableElementType`, probably that's the method with multiple Psi files.\n- \u003chttps://intellij-support.jetbrains.com/hc/en-us/community/posts/206124409-Confucion-of-ILazyParseableElementType\u003e, \u003chttps://intellij-support.jetbrains.com/hc/en-us/community/posts/204145984-Index-stub-and-IReparseableElementType\u003e\n\n[^1]: For *Play!* see also \u003chttps://groups.google.com/forum/#!topic/play-framework/fB-2SXtlYfc\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazrdev%2Fcoco-idea-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazrdev%2Fcoco-idea-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazrdev%2Fcoco-idea-plugin/lists"}