{"id":34935839,"url":"https://github.com/consulo/consulo-antlr4","last_synced_at":"2026-01-07T03:12:50.653Z","repository":{"id":148691095,"uuid":"115265756","full_name":"consulo/consulo-antlr4","owner":"consulo","description":null,"archived":false,"fork":true,"pushed_at":"2025-12-21T17:36:14.000Z","size":27968,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-12-22T16:56:29.959Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"antlr/intellij-plugin-v4","license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/consulo.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}},"created_at":"2017-12-24T13:48:41.000Z","updated_at":"2025-12-07T13:24:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"7c517136-8711-4ca6-b10b-73b7ffba20fe","html_url":"https://github.com/consulo/consulo-antlr4","commit_stats":null,"previous_names":[],"tags_count":744,"template":false,"template_full_name":null,"purl":"pkg:github/consulo/consulo-antlr4","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consulo%2Fconsulo-antlr4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consulo%2Fconsulo-antlr4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consulo%2Fconsulo-antlr4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consulo%2Fconsulo-antlr4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/consulo","download_url":"https://codeload.github.com/consulo/consulo-antlr4/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/consulo%2Fconsulo-antlr4/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28057678,"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-12-26T02:00:06.189Z","response_time":55,"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":[],"created_at":"2025-12-26T18:04:21.133Z","updated_at":"2025-12-26T18:05:59.683Z","avatar_url":"https://github.com/consulo.png","language":"Java","readme":"# IntelliJ Idea Plugin for ANTLR v4\n\nAn [IntelliJ](https://www.jetbrains.com/idea/) 13.x, 14.x, ... plugin for ANTLR v4 ([plugin source at github](https://github.com/antlr/antlr4)).\n\n[Plugin page at intellij](http://plugins.jetbrains.com/plugin/7358?pr=idea)\n\nThis plugin is for ANTLR v4 grammars and includes ANTLR 4.6. Works with Intellij and other Jetbrains IDEs.\n\nFeatures:\n\n- syntax highlighting\n- syntax error checking\n- semantic error checking\n- navigation window\n- goto-declaration\n- find usages\n- rename tokens\n- rename rules\n- comment grammar rule lines with meta-/ (1.7)\n- generates Java code; shortcut (ctrl-shift-G / meta-shift-G) but it's in Tools menu and popups.\n- code completion for tokens, rule names;\n- finds tokenVocab option for code gen if there is a tokenVocab option, don't warn about implicit tokens.\n- handles separate parsers and lectures like TParser.g4 and TLexer.g4 (1.7)\n- Parse tree nodes show the alternative number the parser chose to match that node. (1.7)\n- has live grammar interpreter for grammar preview. Right click on rule and say \"Test ANTLR Rule\".\n- can view parse trees for input matched in more than one way (ambiguities) (1.7)\n- can view lookahead trees to show how input directed ANTLR to match a particular alternative (1.7)\n- changes to grammar seen in parse tree upon save of grammar.\n- refactoring: extra rule, inline rule\n\nYou can configure the ANTLR tool options per grammar file; right-click\nin a grammar or on a grammar element within the structured view.\nWhen you change and save a grammar, it automatically builds with ANTLR\nin the background according to the preferences you have set.  ANTLR\ntool errors appear in a console you can opened by clicking on a button\nin the bottom tab.\n\nYou can use the ctrl-key while moving the mouse and it will show you\ntoken information in the preview editor box via tooltips. Meta-key shows parser call stack.\n\nErrors within the preview editor are now highlighted with tooltips\nand underlining just like a regular editor window. The difference\nis that this window's grammar is specified in your grammar file.\n\nmeta-j pops up a list of live templates, just like it does for Java programming.\nCurrently, there are a number of lexical rules for common tokens such as comments\nand identifiers that you can automatically inject.\nThere are shortcuts like rid that lets you jump directly to the\nlexical rule you would like to generate. If you type the shortcut and wait a\nsecond, intellij should pop up an action you can select for that shortcut.\n\nctrl-return, or whatever you have configured for the generate pop-up,\nwill bring up a list of things you can generate. The only one so far is\na generator to create lexical rules for any literals, referenced in the parser\n grammar, that have not been defined.\n\n## History\n\nSee [Releases](PerGramma://github.com/antlr/intellij-plugin-v4/releases)\n\n## Screenshots\n\n### Java grammar view\n![Java grammar view](images/java-grammar.png)\n\n### Find usages\n![Find usages](images/findusages.png)\n\n### Code completion\n![Code completion](images/completion.png)\n\n### Live templates\n\nYou can inject predefined lexer rules. Use meta-j or type the abbreviation like rid and wait a second. It should pop up that choice.\n\n![predefined lexer rules](images/lexer-templates.png)\n\n### Refactoring: generate rules for literals\n\nIt guesses rule names or just uses T__\u0026lt;n\u003e. Respects literals already defined. Use Code::Generate menu item or key equivalent.\n\n![def-literals.png](images/def-literals.png)\n\n### Live parse tree preview\n\nYou can test any rule in the (parser) grammar.  Right click on rule in grammar\nor navigator to \"Test ANTLR Rule\".  Changing grammar and saving, updates\nparse tree. It works with combined grammars and separated but separated\nmust be in same directory and named XParser.g4 and XLexer.g4.\nNo raw Java actions are executed obviously during interpretation in\nlive preview.\n\n[![Live parse preview](http://img.youtube.com/vi/h60VapD1rOo/0.jpg)](//www.youtube.com/embed/h60VapD1rOo)\n\n![Live preview](images/live-preview.png)\n![Live preview](images/live-preview-error.png)\n\nYou can also use the ctrl key while moving the mouse in preview window to get token info.\n\n![Live preview](images/token-tooltips.png)\n\nThe meta key while moving the mouse shows the parser call stack (path to the root of parse tree).\n\nWhen there are errors, you will see the output in the small console under the input editor in case you need to cut and paste. But, for general viewing you can however the cursor over an underlined error and it will show you the message in a pop-up. Basically the input window behaves like a regular editor window except that it is subject to the grammar in your other editor.\n\n![error-popup.png](images/error-popup.png)\n\nWith alt-mouse movement, you'll see parse region for rule matching token under cursor. Click and it jumps to grammar definition.\n\n![parse-region.png](images/parse-region.png)\n\n### Grammar Profiler\n\nThe profiler helps you understand which decisions in your grammar are complicated or expensive.  Profiling data is always available just like the parse tree during grammar interpretation.  The profiler cannot track code execution because it is running the grammar interpreter not executing compiled code.  It provides both a simplified set of columns and an expert set the provides a great deal more information. Clicking on a row in the profiler highlights the decision in the grammar and also highlights relevant pieces of the input, such as ambiguities or the deepest lookahead. You can sort the columns by clicking on the header row. Hover over the header row to get tooltips describing the column.\n\nIf you see ambiguities highlighted, those you should definitely take a look\n at in your grammar. If you see decisions requiring full context sensitivity,\n when viewing the expert columns, those are very expensive and could be causing\n speed problems. Note that the profiler always tries to keep up-to-date with\n the input. The profiler uses the parser interpreter but is fairly\n consistent with the speed of a generated and compiled parser but it does use\n single-stage full LL parsing which can be slower.  It needs to do that so\n that it gets full and complete profiling information. For those in the know,\n it uses PredictionMode.LL_EXACT_AMBIG_DETECTION. For really big files and\n slow grammars, there is an appreciable delay when displaying the parse tree or profiling information.\n\n![parse-region.png](images/profiler.png)\n\n### Grammar ambiguities and lookahead\n\nA grammar that matches an input phrase more than one way is considered ambiguous and it's generally an error because we want to interpret input phrases in just one way. ANTLR resolves ambiguities on-the-fly to create a single interpretation (parse tree) but sometimes, for debugging purposes, you'd like to know how else to grammar can match some input. When you have selected an ambiguity using the profiler described in the previous section, you can right click in the preview input window like so:\n\n![ambig-right-click.png](images/ambig-right-click.png)\n\nIt will pop up a dialog box that looks like this:\n\n![ambig1.png](images/ambig1.png)\n\nThe darkened background node is the node for the rule containing the decision that is ambiguous.  The yellow boxes outlining nodes indicates that it differs from the chosen interpretation of the parse tree. Here's another example that shows two interpretations (of `User f() {`):\n\n![ambig2.png](images/ambig2.png)\n\nEven when a grammar is getting a single interpretation of the input, we often wonder why it's not choosing the path we expected.  When you right click on a lookahead sequence in the input window, it will pop up a dialog to show you how ANTLR tried to use the input to match the alternative. The trees with gray backgrounds indicate the parse trees that were attempted but that failed at some input depth. The tree with a white background chose the chosen parse tree:\n\n![lookahead1.png](images/lookahead1.png)\n\n### Unicode chars are no problem\n\n![unicode.png](images/unicode.png)\n\n### Per file ANTLR configuration\n\n![Configuration](images/per-file-config.png)\n\n### ANTLR output console\n\n![Output console](images/tool-console.png)\n\n\n### Color preferences\n\n![Live preview](images/color-prefs.png)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsulo%2Fconsulo-antlr4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconsulo%2Fconsulo-antlr4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsulo%2Fconsulo-antlr4/lists"}