Package org.eclipse.m2m.atl.common
Class AtlNbCharFile
- java.lang.Object
-
- org.eclipse.m2m.atl.common.AtlNbCharFile
-
public class AtlNbCharFile extends java.lang.Object
This class is used by a stackframe to compute char position in a file With the file name and project name, this structure build a list for each line the position of its first char and the position of the tabs.
-
-
Constructor Summary
Constructors Constructor Description AtlNbCharFile(java.io.InputStream in)
The AtlNbCharFile constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getIndex(java.lang.String cursorPosition)
Returns computes the char start position from the string "cursorLine:cursorColumn" given by Eclipse (tabs are 4 chars long by default, but it is user-configurable).int[]
getIndexChar(java.lang.String sourceLocation)
Returns the index char in the source location.int[]
getIndexChar(java.lang.String sourceLocation, int tabWidth)
Returns an array of int: first element is startChar, second element is endChar.
-
-
-
Method Detail
-
getIndexChar
public int[] getIndexChar(java.lang.String sourceLocation)
Returns the index char in the source location.- Parameters:
sourceLocation
- the source- Returns:
- the index char in the source location
-
getIndexChar
public int[] getIndexChar(java.lang.String sourceLocation, int tabWidth)
Returns an array of int: first element is startChar, second element is endChar. *- Parameters:
sourceLocation
- the string representing "startLine:startColumn-endLine:endColumn" the location given by antlr (tabs are 8 chars long)tabWidth
- the width of the tab- Returns:
- An array of int: first element is startChar, second element is endChar
-
getIndex
public int getIndex(java.lang.String cursorPosition)
Returns computes the char start position from the string "cursorLine:cursorColumn" given by Eclipse (tabs are 4 chars long by default, but it is user-configurable).- Parameters:
cursorPosition
- the string representing the cursor position- Returns:
- computes the char start position from the string "cursorLine:cursorColumn" given by Eclipse (tabs are 4 chars long by default, but it is user-configurable)
- Throws:
java.lang.NumberFormatException
java.lang.IndexOutOfBoundsException
-
-