Module com.darkcollective.relix.ast
Package com.darkcollective.relix.ast
Record Class SourceLocation
java.lang.Object
java.lang.Record
com.darkcollective.relix.ast.SourceLocation
- Record Components:
filePath- the path of the source file; never nullline- 1-based source line (0 = no position available)column- 1-based source column (0 = no position available)
The source location of an AST node — file path, 1-based line, and 1-based
column of the first character of the construct.
All three components are carried together so that nodes remain fully
self-describing after semantic analysis assembles a SemanticModel
from multiple files.
UNKNOWN is the sentinel used when a node was constructed
programmatically (e.g. in tests) without access to a source position.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SourceLocationSentinel used when no real source location is available. -
Constructor Summary
ConstructorsConstructorDescriptionSourceLocation(String filePath, int line, int column) Creates an instance of aSourceLocationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcolumn()Returns the value of thecolumnrecord component.final booleanIndicates whether some other object is "equal to" this one.filePath()Returns the value of thefilePathrecord component.final inthashCode()Returns a hash code value for this object.intline()Returns the value of thelinerecord component.toString()Returns a human-readablefilePath:line:columnstring.
-
Field Details
-
UNKNOWN
Sentinel used when no real source location is available.
-
-
Constructor Details
-
Method Details
-
toString
Returns a human-readablefilePath:line:columnstring. When line is 0 the positional part is omitted. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
filePath
Returns the value of thefilePathrecord component.- Returns:
- the value of the
filePathrecord component
-
line
public int line()Returns the value of thelinerecord component.- Returns:
- the value of the
linerecord component
-
column
public int column()Returns the value of thecolumnrecord component.- Returns:
- the value of the
columnrecord component
-