public class ParseException extends IOException implements FMParserConstants
TemplateException
). This usually
signals syntactical/lexical errors.
Note that on JavaCC-level lexical errors throw TokenMgrError
instead of this, however with the API-s that
most users use those will be wrapped into ParseException
-s.
This is a modified version of file generated by JavaCC from FTL.jj.
You can modify this class to customize the error reporting mechanisms so long as the public interface
remains compatible with the original.TokenMgrError
,
Serialized FormModifier and Type | Field and Description |
---|---|
int |
columnNumber |
Token |
currentToken
This is the last token that has been consumed successfully.
|
int |
endColumnNumber |
int |
endLineNumber |
protected String |
eol
The end of line string for this machine.
|
int[][] |
expectedTokenSequences
Each entry in this array is an array of integers.
|
int |
lineNumber |
protected boolean |
specialConstructor
Deprecated.
Will be remove without replacement in 2.4.
|
String[] |
tokenImage
This is a reference to the "tokenImage" array of the generated
parser within which the parse error occurred.
|
_INCLUDE, AND, AS, ASCII_DIGIT, ASSIGN, ATTEMPT, BLANK, BREAK, BUILT_IN, CALL, CASE, CLOSE_BRACKET, CLOSE_PAREN, CLOSE_TAG1, CLOSE_TAG2, CLOSING_CURLY_BRACKET, COLON, COMMA, COMMENT, COMPRESS, DECIMAL, DEFAUL, DEFAULT, DIRECTIVE_END, DIV_EQUALS, DIVIDE, DOLLAR_INTERPOLATION_OPENING, DOT, DOT_DOT, DOT_DOT_ASTERISK, DOT_DOT_LESS, DOUBLE_EQUALS, DOUBLE_STAR, ELLIPSIS, ELSE, ELSE_IF, EMPTY_DIRECTIVE_END, END_ASSIGN, END_ATTEMPT, END_COMPRESS, END_ESCAPE, END_FOREACH, END_FUNCTION, END_GLOBAL, END_IF, END_ITEMS, END_LIST, END_LOCAL, END_MACRO, END_NOESCAPE, END_RECOVER, END_SEP, END_SWITCH, END_TAG, END_TRANSFORM, EOF, EQUALS, ESCAPE, ESCAPED_CHAR, ESCAPED_GT, ESCAPED_GTE, ESCAPED_ID_CHAR, EXCLAM, EXISTS, EXPRESSION_COMMENT, FALLBACK, FALSE, FLUSH, FM_EXPRESSION, FOREACH, FTL_HEADER, FUNCTION, GLOBALASSIGN, HALT, HASH_INTERPOLATION_OPENING, ID, ID_START_CHAR, IF, IMPORT, IN, IN_PAREN, INTEGER, ITEMS, KEEP_GOING, LESS_THAN, LESS_THAN_EQUALS, LIST, LOCALASSIGN, LONE_LESS_THAN_OR_DASH, LTRIM, MACRO, MAYBE_END, MINUS, MINUS_EQUALS, MINUS_MINUS, MOD_EQUALS, NAMED_PARAMETER_EXPRESSION, NATURAL_GT, NATURAL_GTE, NESTED, NO_PARSE, NO_SPACE_EXPRESSION, NODIRECTIVE, NOESCAPE, NON_ESCAPED_ID_START_CHAR, NOPARSE, NOT_EQUALS, NOTRIM, OPEN_BRACKET, OPEN_MISPLACED_INTERPOLATION, OPEN_PAREN, OPENING_CURLY_BRACKET, OR, PERCENT, PLUS, PLUS_EQUALS, PLUS_PLUS, RAW_STRING, RECOVER, RECURSE, RETURN, RTRIM, SEMICOLON, SEP, SETTING, SIMPLE_NESTED, SIMPLE_RECURSE, SIMPLE_RETURN, START_TAG, STATIC_TEXT_FALSE_ALARM, STATIC_TEXT_NON_WS, STATIC_TEXT_WS, STOP, STRING_LITERAL, SWITCH, TERMINATING_EXCLAM, TERMINATING_WHITESPACE, TERSE_COMMENT, TERSE_COMMENT_END, TIMES, TIMES_EQUALS, TRANSFORM, TRIM, TRIVIAL_FTL_HEADER, TRUE, UNIFIED_CALL, UNIFIED_CALL_END, UNKNOWN_DIRECTIVE, USING, VISIT
Modifier | Constructor and Description |
---|---|
protected |
ParseException()
Deprecated.
Use a constructor to which you pass description, template, and positions.
|
|
ParseException(String description,
int lineNumber,
int columnNumber)
Deprecated.
Use a constructor to which you can also pass the template, and the end positions.
|
|
ParseException(String description,
Template template,
int lineNumber,
int columnNumber)
Deprecated.
Use
ParseException(String, Template, int, int, int, int) instead, as IDE-s need the end
position of the error too. |
|
ParseException(String description,
Template template,
int lineNumber,
int columnNumber,
int endLineNumber,
int endColumnNumber) |
|
ParseException(String description,
Template template,
int lineNumber,
int columnNumber,
int endLineNumber,
int endColumnNumber,
Throwable cause) |
|
ParseException(String description,
Template template,
int lineNumber,
int columnNumber,
Throwable cause)
Deprecated.
Use
ParseException(String, Template, int, int, int, int, Throwable) instead, as IDE-s need
the end position of the error too. |
|
ParseException(String description,
TemplateObject tobj) |
|
ParseException(String description,
TemplateObject tobj,
Throwable cause) |
|
ParseException(String description,
Template template,
Token tk) |
|
ParseException(String description,
Template template,
Token tk,
Throwable cause) |
|
ParseException(Token currentTokenVal,
int[][] expectedTokenSequencesVal,
String[] tokenImageVal)
This constructor is used by the method "generateParseException"
in the generated parser.
|
Modifier and Type | Method and Description |
---|---|
protected String |
add_escapes(String str)
Used to convert raw characters to their escaped version
when these raw version cannot be used as part of an ASCII
string literal.
|
int |
getColumnNumber()
1-based column number of the failing section, or 0 is the information is not available.
|
String |
getEditorMessage()
Returns the description of the error without error location or source quotations, or
null if there's no
description available. |
int |
getEndColumnNumber()
1-based column number of the last character of the failing section, or 0 if the information is not available.
|
int |
getEndLineNumber()
1-based line number of the last line that contains the failing section, or 0 if the information is not available.
|
int |
getLineNumber()
1-based line number of the failing section, or 0 is the information is not available.
|
String |
getMessage()
Returns the error location plus the error description.
|
String |
getTemplateName()
Returns the name (template-root relative path) of the template whose parsing was failed.
|
void |
setTemplateName(String templateName)
Should be used internally only; sets the name of the template that contains the error.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public Token currentToken
public int columnNumber
public int lineNumber
public int endColumnNumber
public int endLineNumber
public int[][] expectedTokenSequences
public String[] tokenImage
protected String eol
protected boolean specialConstructor
public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal)
protected ParseException()
public ParseException(String description, int lineNumber, int columnNumber)
public ParseException(String description, Template template, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber)
public ParseException(String description, Template template, int lineNumber, int columnNumber, int endLineNumber, int endColumnNumber, Throwable cause)
public ParseException(String description, Template template, int lineNumber, int columnNumber)
ParseException(String, Template, int, int, int, int)
instead, as IDE-s need the end
position of the error too.public ParseException(String description, Template template, int lineNumber, int columnNumber, Throwable cause)
ParseException(String, Template, int, int, int, int, Throwable)
instead, as IDE-s need
the end position of the error too.public ParseException(String description, Template template, Token tk, Throwable cause)
public ParseException(String description, TemplateObject tobj)
public ParseException(String description, TemplateObject tobj, Throwable cause)
public void setTemplateName(String templateName)
public String getMessage()
getMessage
in class Throwable
getDescription()
,
getTemplateName()
,
getLineNumber()
,
getColumnNumber()
public String getEditorMessage()
null
if there's no
description available. This is useful in editors (IDE-s) where the error markers and the editor window itself
already carry this information, so it's redundant the repeat in the error dialog.public String getTemplateName()
null
if this is a non-stored template.public int getLineNumber()
public int getColumnNumber()
public int getEndLineNumber()
public int getEndColumnNumber()
Copyright © 2016. All Rights Reserved.