Record Class ScriptComments
java.lang.Object
java.lang.Record
com.darkcollective.relix.lang.ast.ScriptComments
- Record Components:
namespace- the comments placed by thenamespacedeclaration, as a statement's are;ScriptComments.StatementComments.NONEwhen it declares nonestatements- one entry per statement, in the order ofScript.statements(); empty when nothing is known about any- the comments after the last statement, on lines of their own- whether a blank line separated the footer from the statements
public record ScriptComments(ScriptComments.StatementComments namespace, List<ScriptComments.StatementComments> statements, List<Comment> footer, boolean footerSpaced)
extends Record
The comments a parsed script carried, each placed by the code it was written next to,
so that
ScriptPrinter can put it back there.
A comment is not part of what a script means, and no phase above the parser reads
one. These are kept only for printing: a formatter that dropped them could not be run
over someone's files. A script built rather than parsed has NONE.
- Since:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe comments placed by one statement, and whether a blank line came before it. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ScriptCommentsNo comments at all: what a script built from statements carries. -
Constructor Summary
ConstructorsConstructorDescriptionScriptComments(ScriptComments.StatementComments namespace, List<ScriptComments.StatementComments> statements, List<Comment> footer, boolean footerSpaced) Checks and copies every component. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.footer()Returns the value of thefooterrecord component.booleanReturns the value of thefooterSpacedrecord component.final inthashCode()Returns a hash code value for this object.Returns the value of thenamespacerecord component.statement(int index) The comments placed by one statement.Returns the value of thestatementsrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
NONE
No comments at all: what a script built from statements carries.
-
-
Constructor Details
-
ScriptComments
public ScriptComments(ScriptComments.StatementComments namespace, List<ScriptComments.StatementComments> statements, List<Comment> footer, boolean footerSpaced) Checks and copies every component.- Since:
- 1.0
-
-
Method Details
-
statement
The comments placed by one statement.- Parameters:
index- the statement's position inScript.statements()- Returns:
- its comments, or
ScriptComments.StatementComments.NONEwhen none are recorded - Since:
- 1.0
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
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 '=='. -
namespace
Returns the value of thenamespacerecord component.- Returns:
- the value of the
namespacerecord component
-
statements
Returns the value of thestatementsrecord component.- Returns:
- the value of the
statementsrecord component
-