gov.llnl.babel.msg
Class ErrorFormatter

java.lang.Object
  extended by gov.llnl.babel.msg.ErrorFormatter

public class ErrorFormatter
extends java.lang.Object


Constructor Summary
ErrorFormatter()
           
 
Method Summary
static java.lang.String formatOffendingToken(java.lang.String filename, Token t)
          Generate two lines of text the first with line of specified by the token the second some carets (^) pointing out the actual token
static java.lang.String formatOffendingTokens(java.lang.String filename, Token begin, Token end)
          Generate two lines of text; the first with line specified by the token range, the second some carets (^) point out the offending tokens.
static void formatParseError(ParseException e, java.lang.String url)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorFormatter

public ErrorFormatter()
Method Detail

formatOffendingToken

public static java.lang.String formatOffendingToken(java.lang.String filename,
                                                    Token t)
Generate two lines of text the first with line of specified by the token the second some carets (^) pointing out the actual token

Parameters:
filename - where the token was found (if null, then empty string returned)
t - token to highlight
Returns:
a two line string suitable for error messages or a message explaining that the original contents of the file cannot be found.

formatOffendingTokens

public static java.lang.String formatOffendingTokens(java.lang.String filename,
                                                     Token begin,
                                                     Token end)
Generate two lines of text; the first with line specified by the token range, the second some carets (^) point out the offending tokens. Note if the token range spans more than one line, then only the first line is displayed.

Parameters:
filename - where the token was found (if null, then empty string returned)
begin - first token to highlight
end - last token to highlight
Returns:
See Also:
formatOffendingToken(java.lang.String, gov.llnl.babel.parsers.sidl2.Token)

formatParseError

public static void formatParseError(ParseException e,
                                    java.lang.String url)