gov.llnl.babel.msg

Class ErrorFormatter


public class ErrorFormatter
extends java.lang.Object

Method Summary

static String
formatOffendingToken(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 String
formatOffendingTokens(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, String url)

Method Details

formatOffendingToken

public static String formatOffendingToken(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 String formatOffendingTokens(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:

formatParseError

public static void formatParseError(ParseException e,
                                    String url)