Module aya.cli.impl

Record Class SyntaxHighlight

java.lang.Object
java.lang.Record
org.aya.cli.literate.SyntaxHighlight
All Implemented Interfaces:
Function<org.aya.concrete.stmt.Stmt,kala.collection.mutable.MutableList<HighlightInfo>>, org.aya.concrete.visitor.ExprFolder<kala.collection.mutable.MutableList<HighlightInfo>>, org.aya.concrete.visitor.PatternFolder<kala.collection.mutable.MutableList<HighlightInfo>>, org.aya.concrete.visitor.StmtFolder<kala.collection.mutable.MutableList<HighlightInfo>>

public record SyntaxHighlight(@Nullable kala.collection.immutable.ImmutableSeq<String> currentFileModule) extends Record implements org.aya.concrete.visitor.StmtFolder<kala.collection.mutable.MutableList<HighlightInfo>>
Implementation Note:
Use MutableList instead of SeqView for performance consideration.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final @NotNull com.intellij.psi.tree.TokenSet
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    SyntaxHighlight(@Nullable kala.collection.immutable.ImmutableSeq<String> currentFileModule)
    Creates an instance of a SyntaxHighlight record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable kala.collection.immutable.ImmutableSeq<String>
    Returns the value of the currentFileModule record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    @NotNull kala.collection.mutable.MutableList<HighlightInfo>
    fold(@NotNull kala.collection.mutable.MutableList<HighlightInfo> acc, @NotNull org.aya.concrete.Expr expr)
     
    @NotNull kala.collection.mutable.MutableList<HighlightInfo>
    fold(@NotNull kala.collection.mutable.MutableList<HighlightInfo> acc, @NotNull org.aya.concrete.Pattern pat)
     
    @NotNull kala.collection.mutable.MutableList<HighlightInfo>
    foldModuleDecl(@NotNull kala.collection.mutable.MutableList<HighlightInfo> acc, @NotNull org.aya.util.error.SourcePos pos, @NotNull org.aya.resolve.context.ModuleName path)
     
    @NotNull kala.collection.mutable.MutableList<HighlightInfo>
    foldModuleRef(@NotNull kala.collection.mutable.MutableList<HighlightInfo> acc, @NotNull org.aya.util.error.SourcePos pos, @NotNull org.aya.resolve.context.ModuleName path)
     
    @NotNull kala.collection.mutable.MutableList<HighlightInfo>
    foldVarDecl(@NotNull kala.collection.mutable.MutableList<HighlightInfo> acc, @NotNull org.aya.ref.AnyVar var, @NotNull org.aya.util.error.SourcePos pos, @NotNull kala.value.LazyValue<@Nullable org.aya.core.term.Term> type)
     
    @NotNull kala.collection.mutable.MutableList<HighlightInfo>
    foldVarRef(@NotNull kala.collection.mutable.MutableList<HighlightInfo> acc, @NotNull org.aya.ref.AnyVar var, @NotNull org.aya.util.error.SourcePos pos, @NotNull kala.value.LazyValue<@Nullable org.aya.core.term.Term> type)
     
    final int
    Returns a hash code value for this object.
    static @NotNull kala.collection.immutable.ImmutableSeq<HighlightInfo>
    highlight(@Nullable kala.collection.immutable.ImmutableSeq<String> currentFileModule, @NotNull kala.control.Option<org.aya.util.error.SourceFile> sourceFile, @NotNull kala.collection.immutable.ImmutableSeq<org.aya.concrete.stmt.Stmt> program)
     
    @NotNull kala.collection.mutable.MutableList<HighlightInfo>
     
    static @NotNull HighlightInfo.DefKind
    kindOf(@NotNull org.aya.ref.AnyVar var)
     
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.aya.concrete.visitor.ExprFolder

    foldParamDecl, withTermType

    Methods inherited from interface java.util.function.Function

    andThen, compose

    Methods inherited from interface org.aya.concrete.visitor.PatternFolder

    apply, foldVar, lazyType, noType, varType

    Methods inherited from interface org.aya.concrete.visitor.StmtFolder

    apply, fold, fold
  • Field Details

    • SPECIAL_SYMBOL

      @NotNull public static final @NotNull com.intellij.psi.tree.TokenSet SPECIAL_SYMBOL
  • Constructor Details

    • SyntaxHighlight

      public SyntaxHighlight(@Nullable @Nullable kala.collection.immutable.ImmutableSeq<String> currentFileModule)
      Creates an instance of a SyntaxHighlight record class.
      Parameters:
      currentFileModule - the value for the currentFileModule record component
  • Method Details

    • highlight

      @NotNull public static @NotNull kala.collection.immutable.ImmutableSeq<HighlightInfo> highlight(@Nullable @Nullable kala.collection.immutable.ImmutableSeq<String> currentFileModule, @NotNull @NotNull kala.control.Option<org.aya.util.error.SourceFile> sourceFile, @NotNull @NotNull kala.collection.immutable.ImmutableSeq<org.aya.concrete.stmt.Stmt> program)
      Parameters:
      sourceFile - If not null, provide keyword highlights too
      Returns:
      a list of HighlightInfo, no order was expected, the elements may be duplicated
    • init

      @NotNull public @NotNull kala.collection.mutable.MutableList<HighlightInfo> init()
      Specified by:
      init in interface org.aya.concrete.visitor.ExprFolder<kala.collection.mutable.MutableList<HighlightInfo>>
      Specified by:
      init in interface org.aya.concrete.visitor.PatternFolder<kala.collection.mutable.MutableList<HighlightInfo>>
    • foldVarRef

      @NotNull public @NotNull kala.collection.mutable.MutableList<HighlightInfo> foldVarRef(@NotNull @NotNull kala.collection.mutable.MutableList<HighlightInfo> acc, @NotNull @NotNull org.aya.ref.AnyVar var, @NotNull @NotNull org.aya.util.error.SourcePos pos, @NotNull @NotNull kala.value.LazyValue<@Nullable org.aya.core.term.Term> type)
      Specified by:
      foldVarRef in interface org.aya.concrete.visitor.PatternFolder<kala.collection.mutable.MutableList<HighlightInfo>>
    • foldVarDecl

      @NotNull public @NotNull kala.collection.mutable.MutableList<HighlightInfo> foldVarDecl(@NotNull @NotNull kala.collection.mutable.MutableList<HighlightInfo> acc, @NotNull @NotNull org.aya.ref.AnyVar var, @NotNull @NotNull org.aya.util.error.SourcePos pos, @NotNull @NotNull kala.value.LazyValue<@Nullable org.aya.core.term.Term> type)
      Specified by:
      foldVarDecl in interface org.aya.concrete.visitor.PatternFolder<kala.collection.mutable.MutableList<HighlightInfo>>
    • fold

      @NotNull public @NotNull kala.collection.mutable.MutableList<HighlightInfo> fold(@NotNull @NotNull kala.collection.mutable.MutableList<HighlightInfo> acc, @NotNull @NotNull org.aya.concrete.Expr expr)
      Specified by:
      fold in interface org.aya.concrete.visitor.ExprFolder<kala.collection.mutable.MutableList<HighlightInfo>>
    • fold

      @NotNull public @NotNull kala.collection.mutable.MutableList<HighlightInfo> fold(@NotNull @NotNull kala.collection.mutable.MutableList<HighlightInfo> acc, @NotNull @NotNull org.aya.concrete.Pattern pat)
      Specified by:
      fold in interface org.aya.concrete.visitor.PatternFolder<kala.collection.mutable.MutableList<HighlightInfo>>
    • foldModuleRef

      @NotNull public @NotNull kala.collection.mutable.MutableList<HighlightInfo> foldModuleRef(@NotNull @NotNull kala.collection.mutable.MutableList<HighlightInfo> acc, @NotNull @NotNull org.aya.util.error.SourcePos pos, @NotNull @NotNull org.aya.resolve.context.ModuleName path)
      Specified by:
      foldModuleRef in interface org.aya.concrete.visitor.StmtFolder<kala.collection.mutable.MutableList<HighlightInfo>>
    • foldModuleDecl

      @NotNull public @NotNull kala.collection.mutable.MutableList<HighlightInfo> foldModuleDecl(@NotNull @NotNull kala.collection.mutable.MutableList<HighlightInfo> acc, @NotNull @NotNull org.aya.util.error.SourcePos pos, @NotNull @NotNull org.aya.resolve.context.ModuleName path)
      Specified by:
      foldModuleDecl in interface org.aya.concrete.visitor.StmtFolder<kala.collection.mutable.MutableList<HighlightInfo>>
    • kindOf

      @NotNull public static @NotNull HighlightInfo.DefKind kindOf(@NotNull @NotNull org.aya.ref.AnyVar var)
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • currentFileModule

      @Nullable public @Nullable kala.collection.immutable.ImmutableSeq<String> currentFileModule()
      Returns the value of the currentFileModule record component.
      Returns:
      the value of the currentFileModule record component