public class ShellLocation extends Object
| Constructor and Description |
|---|
ShellLocation(String content,
int line,
int column,
int characterOffset)
Constructor
|
ShellLocation(String content,
Token token)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
int |
column()
Returns the column pointer remembered by this class
|
boolean |
isSameAs(ShellLocation other)
Tells if the passed
ShellLocation has the same offset or not (this is a kind of shallow version of the
equals method) |
int |
line()
Returns the line pointer remembered by this class
|
char |
readChar()
Returns the character of the Shell script pointed to by the offset
|
ShellLocation |
shift(int nbChar)
Returns a
ShellLocation that corresponds to this instance + line, column and offset parameters moved
forward of the passed number of characters |
String |
toString()
Returns a string representation of this class
|
public ShellLocation(String content, Token token)
content - the Shell script to highlighttoken - a token to be pointed to (and certainly highlighted) in the Shell scriptpublic ShellLocation(String content, int line, int column, int characterOffset)
content - the Shell script to highlightline - a line to point to (by convention, lines start at 1)column - a column to point to (by convention, columns start at 1)characterOffset - a character offset in the content equals to the number of characters read so far between
the content's start and the given column of the given linepublic int line()
public int column()
public String toString()
public ShellLocation shift(int nbChar)
ShellLocation that corresponds to this instance + line, column and offset parameters moved
forward of the passed number of charactersnbChar - a number of character to move forwardShellLocation updated with the passed additional offsetIllegalStateException - if the passed number of character added to the offset will point to a character
beyond the content's end (i.e. if offset + nbChar > content.length())shift(char)public char readChar()
public boolean isSameAs(ShellLocation other)
ShellLocation has the same offset or not (this is a kind of shallow version of the
equals method)other - another ShellLocationtrue if the offset of the passed ShellLocation equals to the offset of this class,
false if notCopyright © 2018–2019. All rights reserved.