Module aya.cli.impl

Class SyntaxHighlight

java.lang.Object
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 class SyntaxHighlight extends Object 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
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @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)
     
    static @NotNull kala.collection.immutable.ImmutableSeq<HighlightInfo>
    highlight(@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)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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()
  • Method Details

    • highlight

      @NotNull public static @NotNull kala.collection.immutable.ImmutableSeq<HighlightInfo> highlight(@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)