{"id":26657041,"url":"https://github.com/mcchatman8009/antlr4-helper","last_synced_at":"2025-06-22T15:35:53.759Z","repository":{"id":57180783,"uuid":"143197400","full_name":"mcchatman8009/antlr4-helper","owner":"mcchatman8009","description":"A NPM library that assists in various Antlr4 parse, language analysis, and language manipulation tasks","archived":false,"fork":false,"pushed_at":"2018-09-08T10:59:31.000Z","size":269,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-22T13:28:27.923Z","etag":null,"topics":["antlr","antlr-helper","antlr4","antlr4-helper","dsl","es5","es6","helper","language","language-manipulation","manipulation","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcchatman8009.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}},"created_at":"2018-08-01T19:08:27.000Z","updated_at":"2022-05-24T11:37:28.000Z","dependencies_parsed_at":"2022-09-14T03:40:48.413Z","dependency_job_id":null,"html_url":"https://github.com/mcchatman8009/antlr4-helper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mcchatman8009/antlr4-helper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcchatman8009%2Fantlr4-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcchatman8009%2Fantlr4-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcchatman8009%2Fantlr4-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcchatman8009%2Fantlr4-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcchatman8009","download_url":"https://codeload.github.com/mcchatman8009/antlr4-helper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcchatman8009%2Fantlr4-helper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261315368,"owners_count":23140262,"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":["antlr","antlr-helper","antlr4","antlr4-helper","dsl","es5","es6","helper","language","language-manipulation","manipulation","typescript"],"created_at":"2025-03-25T08:16:42.616Z","updated_at":"2025-06-22T15:35:48.739Z","avatar_url":"https://github.com/mcchatman8009.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Antlr4 Helper\n\n## Overview\nThe goal of this project is to provided classes and interfaces that \nassist with the interaction of Antlr parsers. Making things like\nlanguage manipulation and analysis much easier.\n\n## Getting Started\n```bash\nnpm install -S antlr4-helper\n```\n\n## Antlr4 Helper Documentation\n\n [Documentation (Click Here)](./docs/README.md)\n\n\n## JavaScript Examples\n### Parsing Text\n```javascript\nconst antlrHelper = require('antlr4-helper');\nconst TinycLexer = require('./parser/TinycLexer').TinycLexer;\nconst TinycParser = require('./parser/TinycParser').TinycParser;\n\n\nconst factory = antlrHelper.createFactoryBuilder()\n    .lexer((input) =\u003e new TinycLexer(input))\n    .parser(tokenStream =\u003e new TinycParser(tokenStream))\n    .rootRule((parser) =\u003e parser.program())\n    .build();\n\nconst parser = antlrHelper.createParser(factory);\nparser.parse('variable = 100;');\nparser.checkForErrors();\n\n//\n// Find only variables\n//\nparser.filter((rule) =\u003e rule.getName() === 'id')\n    .forEach((rule) =\u003e {\n        const ruleName = rule.getName();\n        console.log(ruleName); // id\n        console.log(rule.getText()); // variable\n    });\n```\n\n### Changing Parsed Text\n```javascript\nconst antlrHelper = require('antlr4-helper');\nconst TinycLexer = require('./parser/TinycLexer').TinycLexer;\nconst TinycParser = require('./parser/TinycParser').TinycParser;\n\nconst factory = antlrHelper.createFactoryBuilder()\n    .lexer((input) =\u003e new TinycLexer(input))\n    .parser(tokenStream =\u003e new TinycParser(tokenStream))\n    .rootRule((parser) =\u003e parser.program())\n    .build();\n\nconst parser = antlrHelper.createParser(factory);\nparser.parse('a = 10;');\nparser.checkForErrors(); // No parse errors\n\n//\n// Find the first rule\n//\nconst rule = parser.findRuleByName('id');\n\nrule.setText('var');\nconsole.log(\"The changed text:\");\nconsole.log(parser.getText()); //var = 10;\n\nconsole.log(\"The replaced variable:\");\nconst varName = rule.getText();\nconsole.log(varName); //var;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcchatman8009%2Fantlr4-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcchatman8009%2Fantlr4-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcchatman8009%2Fantlr4-helper/lists"}