antlr4-autosuggest

Autosuggest engine for ANTLR4 grammars

Stats

StarsIssuesVersionUpdatedCreatedSize
antlr4-autosuggest
2850.0.283 years ago4 years agoMinified + gzip package size for antlr4-autosuggest in KB

Readme

JavaScript autosuggest engine for ANTLR4 grammars

Oran Epelbaum

npm version Codacy Badge

Getting the antlr-autosuggest JavaScript Module

npm install --save antlr4-autosuggest

Example

// Load the lexer and parser modules generated by antlr4
const lexerModule = require('./myGrammarLexer');
const parserModule = require('./myGrammarParser');

// Create an autosuggester, providing it with the lexer and parser classes
const autosuggest = require('antlr4-autosuggest');
const autosuggester = autosuggest.autosuggester(lexerModule.myGrammarLexer, parserModule.myGrammarParser);

// Suggest completions for the string "ABC"
let suggestions = autosuggester.autosuggest("ABC");

How It Works

See explanation in the Java project.

Building

  • Clone the antlr-autosuggest-js repository.
  • Install Node and NPM (tested with 8)
  • Run the command npm test.

Credits

Written by Oran Epelbaum at Intigua. When starting to write this, studied the following blog posts (though much has changed since):

  • RAPID7: How to Implement ANTLR4 Autocomplete
  • TOMASETTI: Building autocompletion for an editor based on ANTLR by Federico Tomassetti

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.