java.lang.Object
java.lang.Record
org.aya.cli.parse.AyaProducer
public record AyaProducer(@NotNull kala.control.Either<org.aya.util.error.SourceFile,org.aya.util.error.SourcePos> source, @NotNull org.aya.util.reporter.Reporter reporter)
extends Record
Working with GK parser:
- Use
GenericNode.peekChild(IElementType)if you want to check if the node has a child with desired type. - Use
GenericNode.child(IElementType)if you are sure the node has a child with desired type. -
For psi nodes with
extendsattribute in `AyaPsiParser.bnf` (like expr, decl, stmt, etc.):- Use
GenericNode.peekChild(TokenSet),GenericNode.child(TokenSet)if you want to obtain the node itself from its parent. AvailableTokenSets areEXPR,STMT,ARGUMENTand something alike. - Use
GenericNode.is(IElementType)to pattern-matching on the node. - Note that extends nodes are flattened so producing concrete tree from parse tree is different from
other nodes, compare
expr(GenericNode)and its bnf rule for more details. - You may inspect the produced node tree by the
toDebugStringmethod. - If you edited extends attribute in the bnf file, do not forgot to update them here. We don't have any compile-time error thanks to the parse node being dynamically typed (we may improve it in the future) -- so be careful and patient!
- Use
- See Also:
-
AyaPsiElementTypes
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final @NotNull com.intellij.psi.tree.TokenSetstatic final @NotNull com.intellij.psi.tree.TokenSetstatic final @NotNull com.intellij.psi.tree.TokenSetstatic final @NotNull com.intellij.psi.tree.TokenSetstatic final @NotNull com.intellij.psi.tree.TokenSet -
Constructor Summary
ConstructorsConstructorDescriptionAyaProducer(@NotNull kala.control.Either<org.aya.util.error.SourceFile, org.aya.util.error.SourcePos> source, @NotNull org.aya.util.reporter.Reporter reporter) Creates an instance of aAyaProducerrecord class. -
Method Summary
Modifier and TypeMethodDescriptionorg.aya.concrete.Expr.NamedArgargument(@NotNull org.aya.parser.GenericNode<?> node) @NotNull org.aya.util.binop.Assocassoc(@NotNull org.aya.parser.GenericNode<?> node) org.aya.concrete.Pattern.ClausebareOrBarredClause(@NotNull org.aya.parser.GenericNode<?> node) @NotNull kala.tuple.Tuple2<org.aya.concrete.Expr,org.aya.concrete.Expr> bareOrBarredSubSystem(@NotNull org.aya.parser.GenericNode<?> node) @NotNull org.aya.concrete.stmt.BindBlockbindBlock(@NotNull org.aya.parser.GenericNode<?> node) org.aya.concrete.Pattern.Clauseclause(@NotNull org.aya.parser.GenericNode<?> node) org.aya.concrete.stmt.decl.TeleDecl.DataCtordataBody(@NotNull org.aya.parser.GenericNode<?> node) org.aya.concrete.stmt.decl.TeleDecl.DataCtordataCtor(@NotNull kala.collection.immutable.ImmutableSeq<org.aya.util.Arg<org.aya.concrete.Pattern>> patterns, @NotNull org.aya.parser.GenericNode<?> node) org.aya.concrete.stmt.decl.TeleDecl.DataDecldataDecl(org.aya.parser.GenericNode<?> node, @NotNull kala.collection.mutable.MutableList<org.aya.concrete.stmt.Stmt> additional) @Nullable org.aya.concrete.stmt.decl.Decldecl(@NotNull org.aya.parser.GenericNode<?> node, @NotNull kala.collection.mutable.MutableList<org.aya.concrete.stmt.Stmt> additional) declModifiersOf(@NotNull org.aya.parser.GenericNode<?> node, ModifierParser.Filter filter) @Nullable kala.tuple.Tuple2<@NotNull org.aya.util.error.WithPos<String>,@Nullable org.aya.util.binop.OpDecl.OpInfo> declNameOrInfix(@Nullable org.aya.parser.GenericNode<?> node) org.aya.concrete.Expr.DoBinddoBinding(@NotNull org.aya.parser.GenericNode<?> node) This function assumed that the node is DO_BINDINGfinal booleanIndicates whether some other object is "equal to" this one.@NotNull org.aya.concrete.Exprexpr(@NotNull org.aya.parser.GenericNode<?> node) @Nullable kala.control.Either<org.aya.concrete.Expr,kala.collection.immutable.ImmutableSeq<org.aya.concrete.Pattern.Clause>> fnBody(@NotNull org.aya.parser.GenericNode<?> node) org.aya.concrete.stmt.decl.TeleDecl.FnDeclfnDecl(@NotNull org.aya.parser.GenericNode<?> node) @NotNull org.aya.concrete.stmt.Generalizegeneralize(@NotNull org.aya.parser.GenericNode<?> node) @NotNull org.aya.util.error.WithPos<String>generalizeParamName(@NotNull org.aya.parser.GenericNode<?> node) final inthashCode()Returns a hash code value for this object.org.aya.concrete.stmt.UseHidehideList(kala.collection.SeqView<? extends org.aya.parser.GenericNode<?>> hideLists, org.aya.concrete.stmt.UseHide.Strategy strategy) org.aya.concrete.stmt.Command.ImportimportCmd(@NotNull org.aya.parser.GenericNode<?> node) @NotNull kala.collection.immutable.ImmutableSeq<org.aya.concrete.Expr.Param>lambdaTele(@NotNull org.aya.parser.GenericNode<?> node) @NotNull kala.collection.immutable.ImmutableSeq<org.aya.concrete.Expr.Param>lambdaTeleBinder(boolean explicit, @NotNull org.aya.parser.GenericNode<?> node) @NotNull kala.collection.immutable.ImmutableSeq<org.aya.concrete.Expr.Param>lambdaTelescope(kala.collection.SeqView<? extends org.aya.parser.GenericNode<?>> telescope) org.aya.concrete.Expr.LetBindletBind(@NotNull org.aya.parser.GenericNode<?> node) org.aya.concrete.stmt.Command.Modulemodule(@NotNull org.aya.parser.GenericNode<?> node) @NotNull org.aya.resolve.context.ModulePathmodulePath(@NotNull org.aya.parser.GenericNode<?> node) @NotNull org.aya.util.error.WithPos<String>newArgField(@NotNull org.aya.parser.GenericNode<?> node) @NotNull org.aya.concrete.ExprnewBinOPScope(@NotNull org.aya.concrete.Expr expr) [kiva]: make `(expr)` into a new BinOP parser scope so the `f (+)` becomes passing `+` as an argument to function `f`.@NotNull org.aya.concrete.PatternnewBinOPScope(@NotNull org.aya.concrete.Pattern expr, boolean explicit) @NotNull kala.collection.immutable.ImmutableSeq<org.aya.concrete.stmt.Stmt>openCmd(@NotNull org.aya.parser.GenericNode<?> node) org.aya.concrete.Expr.PartElpartial(@Nullable org.aya.parser.GenericNode<?> partial, @NotNull org.aya.util.error.SourcePos fallbackPos) @NotNull org.aya.util.Arg<org.aya.concrete.Pattern>pattern(@NotNull org.aya.parser.GenericNode<?> node) @NotNull kala.collection.immutable.ImmutableSeq<org.aya.util.Arg<org.aya.concrete.Pattern>>patterns(@NotNull org.aya.parser.GenericNode<?> node) org.aya.concrete.stmt.decl.TeleDecl.PrimDeclprimDecl(@NotNull org.aya.parser.GenericNode<?> node) @NotNull kala.control.Either<kala.collection.immutable.ImmutableSeq<org.aya.concrete.stmt.Stmt>,org.aya.concrete.Expr> program(@NotNull org.aya.parser.GenericNode<?> node) @NotNull org.aya.concrete.stmt.QualifiedIDqualifiedId(@NotNull org.aya.parser.GenericNode<?> node) @NotNull org.aya.util.reporter.Reporterreporter()Returns the value of thereporterrecord component.@NotNull kala.control.Either<org.aya.util.error.SourceFile,org.aya.util.error.SourcePos> source()Returns the value of thesourcerecord component.static @NotNull org.aya.util.error.SourcePossourcePosOf(com.intellij.lexer.FlexLexer.Token token, @NotNull org.aya.util.error.SourceFile file) static @NotNull org.aya.util.error.SourcePossourcePosOf(@NotNull com.intellij.openapi.util.TextRange range, @NotNull org.aya.util.error.SourceFile file, boolean isTerminal) static @NotNull org.aya.util.error.SourcePossourcePosOf(@NotNull org.aya.parser.GenericNode<?> node, @NotNull org.aya.util.error.SourceFile file) @NotNull kala.collection.immutable.ImmutableSeq<org.aya.concrete.stmt.Stmt>stmt(@NotNull org.aya.parser.GenericNode<?> node) org.aya.concrete.stmt.decl.TeleDecl.StructDeclstructDecl(@NotNull org.aya.parser.GenericNode<?> node, @NotNull kala.collection.mutable.MutableList<org.aya.concrete.stmt.Stmt> additional) org.aya.concrete.stmt.decl.TeleDecl.StructFieldstructField(org.aya.parser.GenericNode<?> node) @NotNull kala.tuple.Tuple2<org.aya.concrete.Expr,org.aya.concrete.Expr> subSystem(@NotNull org.aya.parser.GenericNode<?> node) @NotNull kala.collection.immutable.ImmutableSeq<org.aya.concrete.Expr.Param>tele(@NotNull org.aya.parser.GenericNode<?> node) @NotNull kala.collection.immutable.ImmutableSeq<org.aya.concrete.Expr.Param>teleBinder(boolean explicit, @NotNull org.aya.parser.GenericNode<?> node) @NotNull org.aya.util.error.WithPos<String>teleParamName(@NotNull org.aya.parser.GenericNode<?> node) @NotNull kala.collection.immutable.ImmutableSeq<org.aya.concrete.Expr.Param>telescope(kala.collection.SeqView<? extends org.aya.parser.GenericNode<?>> telescope) final StringtoString()Returns a string representation of this record class.@NotNull org.aya.concrete.Exprtype(@NotNull org.aya.parser.GenericNode<?> node) @NotNull org.aya.concrete.ExprtypeOrHole(@Nullable org.aya.parser.GenericNode<?> node, org.aya.util.error.SourcePos sourcePos) @Nullable org.aya.concrete.ExprtypeOrNull(@Nullable org.aya.parser.GenericNode<?> node) @NotNull org.aya.concrete.stmt.UseHideuseHide(@NotNull org.aya.parser.GenericNode<?> node) kala.collection.SeqView<org.aya.concrete.stmt.UseHide.Name>useIdsComma(@NotNull org.aya.parser.GenericNode<?> node) org.aya.concrete.stmt.UseHideuseList(kala.collection.SeqView<? extends org.aya.parser.GenericNode<?>> useLists, org.aya.concrete.stmt.UseHide.Strategy strategy) @NotNull org.aya.util.error.WithPos<String>weakId(@NotNull org.aya.parser.GenericNode<?> node)
-
Field Details
-
ARRAY_BLOCK
@NotNull public static final @NotNull com.intellij.psi.tree.TokenSet ARRAY_BLOCK -
ARGUMENT
@NotNull public static final @NotNull com.intellij.psi.tree.TokenSet ARGUMENT -
STMT
@NotNull public static final @NotNull com.intellij.psi.tree.TokenSet STMT -
EXPR
@NotNull public static final @NotNull com.intellij.psi.tree.TokenSet EXPR -
DECL
@NotNull public static final @NotNull com.intellij.psi.tree.TokenSet DECL
-
-
Constructor Details
-
AyaProducer
public AyaProducer(@NotNull @NotNull kala.control.Either<org.aya.util.error.SourceFile, org.aya.util.error.SourcePos> source, @NotNull @NotNull org.aya.util.reporter.Reporter reporter) Creates an instance of aAyaProducerrecord class.- Parameters:
source- the value for thesourcerecord componentreporter- the value for thereporterrecord component
-
-
Method Details
-
program
@NotNull public @NotNull kala.control.Either<kala.collection.immutable.ImmutableSeq<org.aya.concrete.stmt.Stmt>,org.aya.concrete.Expr> program(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
stmt
@NotNull public @NotNull kala.collection.immutable.ImmutableSeq<org.aya.concrete.stmt.Stmt> stmt(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
generalize
@NotNull public @NotNull org.aya.concrete.stmt.Generalize generalize(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
importCmd
@NotNull public org.aya.concrete.stmt.Command.Import importCmd(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
openCmd
@NotNull public @NotNull kala.collection.immutable.ImmutableSeq<org.aya.concrete.stmt.Stmt> openCmd(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
hideList
public org.aya.concrete.stmt.UseHide hideList(kala.collection.SeqView<? extends org.aya.parser.GenericNode<?>> hideLists, org.aya.concrete.stmt.UseHide.Strategy strategy) -
useList
public org.aya.concrete.stmt.UseHide useList(kala.collection.SeqView<? extends org.aya.parser.GenericNode<?>> useLists, org.aya.concrete.stmt.UseHide.Strategy strategy) -
useIdsComma
public kala.collection.SeqView<org.aya.concrete.stmt.UseHide.Name> useIdsComma(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
assoc
@NotNull public @NotNull org.aya.util.binop.Assoc assoc(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
bindBlock
@NotNull public @NotNull org.aya.concrete.stmt.BindBlock bindBlock(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
useHide
@NotNull public @NotNull org.aya.concrete.stmt.UseHide useHide(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
module
@NotNull public org.aya.concrete.stmt.Command.Module module(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
decl
@Nullable public @Nullable org.aya.concrete.stmt.decl.Decl decl(@NotNull @NotNull org.aya.parser.GenericNode<?> node, @NotNull @NotNull kala.collection.mutable.MutableList<org.aya.concrete.stmt.Stmt> additional) -
declModifiersOf
@NotNull public ModifierParser.Modifiers declModifiersOf(@NotNull @NotNull org.aya.parser.GenericNode<?> node, @NotNull ModifierParser.Filter filter) - Returns:
- public if accessiblity is unspecified
- See Also:
-
fnDecl
@Nullable public org.aya.concrete.stmt.decl.TeleDecl.FnDecl fnDecl(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
fnBody
@Nullable public @Nullable kala.control.Either<org.aya.concrete.Expr,kala.collection.immutable.ImmutableSeq<org.aya.concrete.Pattern.Clause>> fnBody(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
dataDecl
@Nullable public org.aya.concrete.stmt.decl.TeleDecl.DataDecl dataDecl(org.aya.parser.GenericNode<?> node, @NotNull @NotNull kala.collection.mutable.MutableList<org.aya.concrete.stmt.Stmt> additional) -
dataBody
@Nullable public org.aya.concrete.stmt.decl.TeleDecl.DataCtor dataBody(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
structDecl
@Nullable public org.aya.concrete.stmt.decl.TeleDecl.StructDecl structDecl(@NotNull @NotNull org.aya.parser.GenericNode<?> node, @NotNull @NotNull kala.collection.mutable.MutableList<org.aya.concrete.stmt.Stmt> additional) -
structField
@NotNull public org.aya.concrete.stmt.decl.TeleDecl.StructField structField(org.aya.parser.GenericNode<?> node) -
primDecl
@Nullable public org.aya.concrete.stmt.decl.TeleDecl.PrimDecl primDecl(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
dataCtor
@Nullable public org.aya.concrete.stmt.decl.TeleDecl.DataCtor dataCtor(@NotNull @NotNull kala.collection.immutable.ImmutableSeq<org.aya.util.Arg<org.aya.concrete.Pattern>> patterns, @NotNull @NotNull org.aya.parser.GenericNode<?> node) -
telescope
@NotNull public @NotNull kala.collection.immutable.ImmutableSeq<org.aya.concrete.Expr.Param> telescope(kala.collection.SeqView<? extends org.aya.parser.GenericNode<?>> telescope) -
tele
@NotNull public @NotNull kala.collection.immutable.ImmutableSeq<org.aya.concrete.Expr.Param> tele(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
teleBinder
@NotNull public @NotNull kala.collection.immutable.ImmutableSeq<org.aya.concrete.Expr.Param> teleBinder(boolean explicit, @NotNull @NotNull org.aya.parser.GenericNode<?> node) -
lambdaTelescope
@NotNull public @NotNull kala.collection.immutable.ImmutableSeq<org.aya.concrete.Expr.Param> lambdaTelescope(kala.collection.SeqView<? extends org.aya.parser.GenericNode<?>> telescope) -
lambdaTele
@NotNull public @NotNull kala.collection.immutable.ImmutableSeq<org.aya.concrete.Expr.Param> lambdaTele(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
lambdaTeleBinder
@NotNull public @NotNull kala.collection.immutable.ImmutableSeq<org.aya.concrete.Expr.Param> lambdaTeleBinder(boolean explicit, @NotNull @NotNull org.aya.parser.GenericNode<?> node) -
declNameOrInfix
@Nullable public @Nullable kala.tuple.Tuple2<@NotNull org.aya.util.error.WithPos<String>,@Nullable org.aya.util.binop.OpDecl.OpInfo> declNameOrInfix(@Nullable @Nullable org.aya.parser.GenericNode<?> node) -
expr
@NotNull public @NotNull org.aya.concrete.Expr expr(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
argument
@NotNull public org.aya.concrete.Expr.NamedArg argument(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
partial
@NotNull public org.aya.concrete.Expr.PartEl partial(@Nullable @Nullable org.aya.parser.GenericNode<?> partial, @NotNull @NotNull org.aya.util.error.SourcePos fallbackPos) -
bareOrBarredSubSystem
@NotNull public @NotNull kala.tuple.Tuple2<org.aya.concrete.Expr,org.aya.concrete.Expr> bareOrBarredSubSystem(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
subSystem
@NotNull public @NotNull kala.tuple.Tuple2<org.aya.concrete.Expr,org.aya.concrete.Expr> subSystem(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
pattern
@NotNull public @NotNull org.aya.util.Arg<org.aya.concrete.Pattern> pattern(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
letBind
@NotNull public org.aya.concrete.Expr.LetBind letBind(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
patterns
@NotNull public @NotNull kala.collection.immutable.ImmutableSeq<org.aya.util.Arg<org.aya.concrete.Pattern>> patterns(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
clause
@NotNull public org.aya.concrete.Pattern.Clause clause(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
bareOrBarredClause
@NotNull public org.aya.concrete.Pattern.Clause bareOrBarredClause(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
type
@NotNull public @NotNull org.aya.concrete.Expr type(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
typeOrNull
@Nullable public @Nullable org.aya.concrete.Expr typeOrNull(@Nullable @Nullable org.aya.parser.GenericNode<?> node) -
typeOrHole
@NotNull public @NotNull org.aya.concrete.Expr typeOrHole(@Nullable @Nullable org.aya.parser.GenericNode<?> node, org.aya.util.error.SourcePos sourcePos) -
weakId
@NotNull public @NotNull org.aya.util.error.WithPos<String> weakId(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
generalizeParamName
@NotNull public @NotNull org.aya.util.error.WithPos<String> generalizeParamName(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
teleParamName
@NotNull public @NotNull org.aya.util.error.WithPos<String> teleParamName(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
newArgField
@NotNull public @NotNull org.aya.util.error.WithPos<String> newArgField(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
qualifiedId
@NotNull public @NotNull org.aya.concrete.stmt.QualifiedID qualifiedId(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
modulePath
@NotNull public @NotNull org.aya.resolve.context.ModulePath modulePath(@NotNull @NotNull org.aya.parser.GenericNode<?> node) -
doBinding
@NotNull public org.aya.concrete.Expr.DoBind doBinding(@NotNull @NotNull org.aya.parser.GenericNode<?> node) This function assumed that the node is DO_BINDING -
newBinOPScope
@NotNull public @NotNull org.aya.concrete.Expr newBinOPScope(@NotNull @NotNull org.aya.concrete.Expr expr) [kiva]: make `(expr)` into a new BinOP parser scope so the `f (+)` becomes passing `+` as an argument to function `f`. -
newBinOPScope
@NotNull public @NotNull org.aya.concrete.Pattern newBinOPScope(@NotNull @NotNull org.aya.concrete.Pattern expr, boolean explicit) -
sourcePosOf
@NotNull public static @NotNull org.aya.util.error.SourcePos sourcePosOf(@NotNull @NotNull org.aya.parser.GenericNode<?> node, @NotNull @NotNull org.aya.util.error.SourceFile file) -
sourcePosOf
@NotNull public static @NotNull org.aya.util.error.SourcePos sourcePosOf(@NotNull com.intellij.lexer.FlexLexer.Token token, @NotNull @NotNull org.aya.util.error.SourceFile file) -
sourcePosOf
@NotNull public static @NotNull org.aya.util.error.SourcePos sourcePosOf(@NotNull @NotNull com.intellij.openapi.util.TextRange range, @NotNull @NotNull org.aya.util.error.SourceFile file, boolean isTerminal) -
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. All components in this record class are compared withObjects::equals(Object,Object). -
source
@NotNull public @NotNull kala.control.Either<org.aya.util.error.SourceFile,org.aya.util.error.SourcePos> source()Returns the value of thesourcerecord component.- Returns:
- the value of the
sourcerecord component
-
reporter
@NotNull public @NotNull org.aya.util.reporter.Reporter reporter()Returns the value of thereporterrecord component.- Returns:
- the value of the
reporterrecord component
-