UNPKG

solidity-antlr4

Version:

Solidity Lang Lexer and Parser by official ANTLR4 grammar

30 lines (29 loc) 952 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.solidityErrorListener = exports.SolidityErrorListener = exports.ParseError = void 0; var _base = require("../ast/base.cjs"); var _antlr = require("../antlr4/index.cjs"); class ParseError extends Error { constructor(message, position) { super(message, { cause: null }); this.message = message; this.position = position; } } exports.ParseError = ParseError; class SolidityErrorListener extends _antlr.BaseErrorListener { errors = []; syntaxError(_recognizer, _offendingSymbol, line, column, message, _exception) { this.errors.push(new ParseError(message, _base.Position.create(line, column))); } throws = () => { if (!this.errors.length) return; throw this.errors[0]; }; } exports.SolidityErrorListener = SolidityErrorListener; const solidityErrorListener = exports.solidityErrorListener = new SolidityErrorListener();