java.lang.Object
java.lang.Record
org.aya.cli.literate.LiterateFaithfulPrettier
- Record Components:
problems- All problems of a single filehighlights- All highlights of a single file
- All Implemented Interfaces:
Consumer<org.aya.literate.Literate>,FaithfulPrettier,org.aya.literate.LiterateConsumer
public record LiterateFaithfulPrettier(@NotNull kala.collection.immutable.ImmutableSeq<org.aya.util.reporter.Problem> problems, @NotNull kala.collection.immutable.ImmutableSeq<HighlightInfo> highlights, @NotNull org.aya.util.prettier.PrettierOptions options)
extends Record
implements org.aya.literate.LiterateConsumer, FaithfulPrettier
This prettier maintains all highlights created from
SyntaxHighlight and all
problems reported by Aya compiler.
Implementation-wise, this prettier can be seen as a highlight server for a single file.
When the highlight of a code block is requested, it filters out
all highlights and problems that belong to the code block, and then
build a Doc containing the highlighted source code mixed with compiler
outputs, as done in highlight(String, SourcePos).
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.aya.cli.literate.FaithfulPrettier
FaithfulPrettier.KnifeCutNested classes/interfaces inherited from interface org.aya.literate.LiterateConsumer
org.aya.literate.LiterateConsumer.InstanceExtractinator<T extends org.aya.literate.Literate>, org.aya.literate.LiterateConsumer.LiterateExtractinator<T> -
Constructor Summary
ConstructorsConstructorDescriptionLiterateFaithfulPrettier(@NotNull kala.collection.immutable.ImmutableSeq<org.aya.util.reporter.Problem> problems, @NotNull kala.collection.immutable.ImmutableSeq<HighlightInfo> highlights, @NotNull org.aya.util.prettier.PrettierOptions options) Creates an instance of aLiterateFaithfulPrettierrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(@NotNull org.aya.literate.Literate literate) Highlight all visible aya code blocksfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@NotNull org.aya.pretty.doc.DocApply highlights to source code string.@NotNull kala.collection.immutable.ImmutableSeq<HighlightInfo> Returns the value of thehighlightsrecord component.@NotNull org.aya.util.prettier.PrettierOptionsoptions()Returns the value of theoptionsrecord component.@NotNull kala.collection.immutable.ImmutableSeq<org.aya.util.reporter.Problem> problems()Returns the value of theproblemsrecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.aya.cli.literate.FaithfulPrettier
doHighlight
-
Constructor Details
-
LiterateFaithfulPrettier
public LiterateFaithfulPrettier(@NotNull @NotNull kala.collection.immutable.ImmutableSeq<org.aya.util.reporter.Problem> problems, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<HighlightInfo> highlights, @NotNull @NotNull org.aya.util.prettier.PrettierOptions options) Creates an instance of aLiterateFaithfulPrettierrecord class.- Parameters:
problems- the value for theproblemsrecord componenthighlights- the value for thehighlightsrecord componentoptions- the value for theoptionsrecord component
-
-
Method Details
-
accept
-
highlight
@NotNull public @NotNull org.aya.pretty.doc.Doc highlight(@NotNull @NotNull String raw, @NotNull @NotNull org.aya.util.error.SourcePos codeRange) Apply highlights to source code string.- Parameters:
raw- the source codecodeRange- where the raw start from (the 'raw' might be a piece of the source code, so it probably not starts from 0).
-
toString
-
hashCode
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
problems
-
highlights
Returns the value of thehighlightsrecord component.- Returns:
- the value of the
highlightsrecord component
-
options
@NotNull public @NotNull org.aya.util.prettier.PrettierOptions options()Returns the value of theoptionsrecord component.- Specified by:
optionsin interfaceFaithfulPrettier- Returns:
- the value of the
optionsrecord component
-