001/* 002 * Copyright (C) 2009-2011 Mathias Doenitz 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.parboiled.errors; 018 019import org.parboiled.buffers.InputBuffer; 020 021/** 022 * Common interface of all parboiled parse error implementations. 023 */ 024public interface ParseError { 025 026 /** 027 * Gets the inputbuffer this error occurred in. 028 * 029 * @return the inputbuffer 030 */ 031 InputBuffer getInputBuffer(); 032 033 /** 034 * Gets the start index of the parse error in the underlying input buffer. 035 * 036 * @return the input index of the first character covered by this error 037 */ 038 int getStartIndex(); 039 040 /** 041 * Gets the end index of the parse error in the underlying input buffer. 042 * 043 * @return the end index of this error, i.e. the index of the character immediately following the last character 044 * covered by this error 045 */ 046 int getEndIndex(); 047 048 /** 049 * An optional error message. 050 * 051 * @return an optional error message. 052 */ 053 String getErrorMessage(); 054 055}