Module aya.cli.impl

Class AyaMdParser

java.lang.Object
org.aya.cli.literate.AyaMdParser

public class AyaMdParser extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    AyaMdParser(@NotNull org.aya.util.error.SourceFile file, @NotNull org.aya.util.reporter.Reporter reporter)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull String
    extractAya(@NotNull org.aya.concrete.remark.Literate literate)
    Extract all aya code blocks, keep source poses.
    @Nullable org.aya.util.error.SourcePos
    fromSourceSpans(@NotNull kala.collection.Seq<org.commonmark.node.SourceSpan> sourceSpans)
     
    static @Nullable org.aya.util.error.SourcePos
    fromSourceSpans(@NotNull org.aya.util.error.SourceFile file, int startFrom, @NotNull kala.collection.Seq<org.commonmark.node.SourceSpan> sourceSpans)
    Build a SourcePos from a list of SourceSpan
    @NotNull org.aya.concrete.remark.Literate
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AyaMdParser

      public AyaMdParser(@NotNull @NotNull org.aya.util.error.SourceFile file, @NotNull @NotNull org.aya.util.reporter.Reporter reporter)
  • Method Details

    • parseLiterate

      @NotNull public @NotNull org.aya.concrete.remark.Literate parseLiterate()
    • extractAya

      @NotNull public @NotNull String extractAya(@NotNull @NotNull org.aya.concrete.remark.Literate literate)
      Extract all aya code blocks, keep source poses. Fill the space between two code blocks with comment.

      Another strategy: create a lexer that can tokenize some pieces of source code

    • fromSourceSpans

      @Nullable public @Nullable org.aya.util.error.SourcePos fromSourceSpans(@NotNull @NotNull kala.collection.Seq<org.commonmark.node.SourceSpan> sourceSpans)
    • fromSourceSpans

      @Contract(pure=true) @Nullable public static @Nullable org.aya.util.error.SourcePos fromSourceSpans(@NotNull @NotNull org.aya.util.error.SourceFile file, int startFrom, @NotNull @NotNull kala.collection.Seq<org.commonmark.node.SourceSpan> sourceSpans)
      Build a SourcePos from a list of SourceSpan
      Parameters:
      startFrom - the SourcePos should start from. (inclusive)
      sourceSpans - a not null sequence
      Returns:
      null if an empty sourceSpans