com.holub.text
Class ParseFailure

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by com.holub.text.ParseFailure
All Implemented Interfaces:
Serializable

public class ParseFailure
extends Exception

Thrown in the event of a Scanner (or parser) failure

See Also:
Serialized Form
©2004 Allen I. Holub. All rights reserved.

This code may be used freely by yourself with the following restrictions:

  1. Your splash screen, about box, or equivalent, must include Allen Holub's name, copyright, and URL. For example:

    This program contains Allen Holub's SQL package.
    (c) 2005 Allen I. Holub. All Rights Reserved.
    http://www.holub.com


    If your program does not run interactively, then the foregoing notice must appear in your documentation.
  2. You may not redistribute (or mirror) the source code.
  3. You must report any bugs that you find to me. Use the form at http://www.holub.com/company/contact.html or send email.
  4. The software is supplied as is. Neither Allen Holub nor Holub Associates are responsible for any bugs (or any problems caused by bugs, including lost productivity or data) in any of this code.

Constructor Summary
ParseFailure(String message, String inputLine, int inputPosition, int inputLineNumber)
           
 
Method Summary
 String getErrorReport()
          Returns a String that shows the current input line and a pointer indicating the current input position.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ParseFailure

public ParseFailure(String message,
                    String inputLine,
                    int inputPosition,
                    int inputLineNumber)
Method Detail

getErrorReport

public String getErrorReport()
Returns a String that shows the current input line and a pointer indicating the current input position. In the following sample, the input is positioned at the @ sign on input line 17:
  Line 17:
  a = b + @ c;
  ________^
  
Note that the official "message" [returned from Throwable.getMessage()] is not included in the error report.