Package com.google.javascript.rhino
Interface StaticSourceFile
-
- All Known Implementing Classes:
SimpleSourceFile
,SourceFile
public interface StaticSourceFile
TheStaticSourceFile
contains information about a compiler input.- Author:
- [email protected] (Nick Santos)
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
StaticSourceFile.SourceKind
Source kinds.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description int
getColumnOfOffset(int offset)
Gets the 0-based column number of the given source offset.StaticSourceFile.SourceKind
getKind()
The source kind.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.default boolean
isExtern()
Whether the source kind is EXTERN.default boolean
isStrong()
Whether the source kind is STRONG.default boolean
isWeak()
Whether the source kind is WEAK.
-
-
-
Method Detail
-
getName
java.lang.String getName()
The name of the file. Must be unique across all files in the compilation.
-
getKind
StaticSourceFile.SourceKind getKind()
The source kind.
-
isStrong
default boolean isStrong()
Whether the source kind is STRONG.
-
isWeak
default boolean isWeak()
Whether the source kind is WEAK.
-
isExtern
default boolean isExtern()
Whether the source kind is EXTERN.
-
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.
-
-