public interface SyntaxErrorReportable
A SyntaxErrorReportable is a recognizer that can report syntax error
| Type Params | Return Type | Name and description |
|---|---|---|
|
public PositionInfo |
genPositionInfo(int offset)Builds a position from the current error line and the current error column plus offset. |
|
public PositionInfo |
genPositionInfo(Tuple2<Integer, Integer> offset)Builds a position by adding offset to the current error line and column. |
|
public int |
getErrorColumn()Returns the 1-based column of the current syntax error. |
|
public int |
getErrorLine()Returns the 1-based line of the current syntax error. |
|
public int |
getSyntaxErrorSource()Returns whether this reporter is the lexer or the parser. |
|
public void |
require(boolean condition, String msg, int offset, boolean toAttachPositionInfo)Throws a syntax error when condition is false. |
|
public void |
require(boolean condition, String msg, Tuple2<Integer, Integer> offset, boolean toAttachPositionInfo)Throws a syntax error when condition is false. |
|
public void |
require(boolean condition, String msg, boolean toAttachPositionInfo)Throws a syntax error when condition is false, without a position
adjustment. |
|
public void |
require(boolean condition, String msg, int offset)Throws a syntax error when condition is false, adding offset
to the current error column. |
|
public void |
require(boolean condition, String msg, Tuple2<Integer, Integer> offset)Throws a syntax error when condition is false. |
|
public void |
require(boolean condition, String msg)Throws a syntax error when condition is false, at the current
error position, without repeating that position in the message. |
|
public void |
throwSyntaxError(String msg, int offset, boolean toAttachPositionInfo)Throws a syntax error whose column is the current error column plus offset. |
|
public void |
throwSyntaxError(String msg, Tuple2<Integer, Integer> offset, boolean toAttachPositionInfo)
|
Builds a position from the current error line and the current error column
plus offset.
offset - columns added to the current error column Builds a position by adding offset to the current error line and column.
offset - line adjustment, then column adjustmentReturns the 1-based column of the current syntax error.
Returns the 1-based line of the current syntax error.
Returns whether this reporter is the lexer or the parser.
Throws a syntax error when condition is false. offset
is added to the current error column; the line is not adjusted.
condition - requirement that must holdmsg - the error textoffset - columns added to the current error columntoAttachPositionInfo - whether the message includes the caret position Throws a syntax error when condition is false. offset's
first value is added to the error line and its second value to the error column.
condition - requirement that must holdmsg - the error textoffset - line adjustment, then column adjustmenttoAttachPositionInfo - whether the message includes the caret position Throws a syntax error when condition is false, without a position
adjustment. toAttachPositionInfo selects whether the message
includes the caret position.
condition - requirement that must holdmsg - the error texttoAttachPositionInfo - whether the message includes the caret position Throws a syntax error when condition is false, adding offset
to the current error column. The message does not repeat the caret position.
condition - requirement that must holdmsg - the error textoffset - columns added to the current error column Throws a syntax error when condition is false. offset's
first value is added to the error line and its second value to the error column.
The message does not repeat the caret position.
condition - requirement that must holdmsg - the error textoffset - line adjustment, then column adjustment Throws a syntax error when condition is false, at the current
error position, without repeating that position in the message.
condition - requirement that must holdmsg - the error text Throws a syntax error whose column is the current error column plus offset.
msg - the error textoffset - columns added to the current error columntoAttachPositionInfo - whether the message includes the caret position
toAttachPositionInfo - if true, append " @ line N, column M"
to the exception message. Leave false when the
error will be wrapped in SyntaxException,
which already appends the same location (otherwise the
displayed message repeats the position).