Interface StaticSourceFile
-
- All Known Implementing Classes:
JSSourceFile
,SimpleSourceFile
,SourceFile
public interface StaticSourceFile
TheStaticSourceFile
contains information about a compiler input.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
getColumnOfOffset(int offset)
Gets the 0-based column number of the given source offset.int
getLineOffset(int lineNumber)
Returns the offset of the given line number relative to the file start.int
getLineOfOffset(int offset)
Gets the 1-based line number of the given source offset.java.lang.String
getName()
The name of the file.boolean
isExtern()
Returns whether this is an externs file.
-
-
-
Method Detail
-
getName
java.lang.String getName()
The name of the file. Must be unique across all files in the compilation.
-
isExtern
boolean isExtern()
Returns whether this is an externs file.
-
getLineOffset
int getLineOffset(int lineNumber)
Returns the offset of the given line number relative to the file start. Line number should be 1-based. If the source file doesn't have line information, it should return Integer.MIN_VALUE. The negative offsets will make it more obvious what happened.- Parameters:
lineNumber
- the line of the input to get the absolute offset of.- Returns:
- the absolute offset of the start of the provided line.
- Throws:
java.lang.IllegalArgumentException
- if lineno is less than 1 or greater than the number of lines in the source.
-
getLineOfOffset
int getLineOfOffset(int offset)
Gets the 1-based line number of the given source offset.- Parameters:
offset
- An absolute file offset.- Returns:
- The 1-based line number of that offset. The behavior is undefined if this offset does not exist in the source file.
-
getColumnOfOffset
int getColumnOfOffset(int offset)
Gets the 0-based column number of the given source offset.- Parameters:
offset
- An absolute file offset.- Returns:
- The 0-based column number of that offset. The behavior is undefined if this offset does not exist in the source file.
-
-