How to use the parsimmon.formatError function in parsimmon

To help you get started, we’ve selected a few parsimmon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dsferruzza / simpleSqlParser / src / sql2ast.js View on Github external
module.exports = function(sql) {
	var result = p.parse(sql);
	if (result.status === false) result.error = Parsimmon.formatError(sql, result);
	return result;
};
github afader / thompson-regex-js / lib / CharRegex.js View on Github external
var CharRegex = function(pattern) {
  this.pattern = pattern;
  this.parseResults = parser.parse(pattern);
  if (!this.parseResults.status) {
    var error = Parsimmon.formatError(pattern, this.parseResults)
    throw new SyntaxError("Could not parse: " + error);
  }
  this.expression = this.parseResults.value;
};
github zubairq / pilot / public / simpleSqlParser.js View on Github external
module.exports = function(sql) {
	var result = p.parse(sql);
	if (result.status === false) result.error = Parsimmon.formatError(sql, result);
	return result;
};
github brotchie / protobuf-textformat / src / parser.js View on Github external
module.exports = function(input) {
  var result = whitespace.then(expr).parse(input);
  if (!result.status) {
    result.error = Parsimmon.formatError(input, result);
  }
  return result;
};
github mollerse / ait-lang / lib / parser / parse.js View on Github external
export default function parse(src: string): Array | AitFault {
  const result = final.parse(src);
  if (result.status) {
    return (result.value: Array).reverse();
  }
  return aitFault(formatError(src, result));
}
github dsferruzza / simpleSqlParser / dist / simpleSqlParser.js View on Github external
module.exports = function(sql) {
	var result = p.parse(sql);
	if (result.status === false) result.error = Parsimmon.formatError(sql, result);
	return result;
};