Skip to content

Instantly share code, notes, and snippets.

@julie-mills
Created October 16, 2019 17:52
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save julie-mills/c2048141545691cc504ce4dec70c9689 to your computer and use it in GitHub Desktop.
var QuerySeparationGrammarListener = require('./QuerySeparationGrammarListener').QuerySeparationGrammarListener;
var CustomListener = function(result) {
this.result = result;
QuerySeparationGrammarListener.call(this); // inherit default listener
return this;
};
// continue inheriting default listener
CustomListener.prototype = Object.create(QuerySeparationGrammarListener.prototype);
CustomListener.prototype.constructor = CustomListener;
// override default listener behavior
CustomListener.prototype.exitStatement = function(ctx) {
this.result.push([ctx.start.start, ctx.stop.stop]); // storing the start and stop indices of every statement
};
exports.CustomListener = CustomListener;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment