Interface SourceFile

All Superinterfaces:
Tree
All Known Subinterfaces:
Remote
All Known Implementing Classes:
Binary, ParseError, PlainText, Quark, RemoteArchive, RemoteFile

public interface SourceFile extends Tree
  • Method Details

    • printEqualsInput

      default boolean printEqualsInput(Parser.Input input, ExecutionContext ctx)
      Does this source file represented as an LST, when printed, produce a byte-for-byte identical result to the original input source file?
      Parameters:
      input - The input source.
      Returns:
      true if the parse-to-print loop is idempotent, false otherwise.
    • getSourcePath

      Path getSourcePath()
      Returns:
      An absolute or relative file path.
    • withSourcePath

      <T extends SourceFile> T withSourcePath(Path path)
    • getCharset

    • withCharset

      <T extends SourceFile> T withCharset(Charset charset)
    • isCharsetBomMarked

      boolean isCharsetBomMarked()
    • withCharsetBomMarked

      <T extends SourceFile> T withCharsetBomMarked(boolean marked)
    • getChecksum

    • withChecksum

      <T extends SourceFile> T withChecksum(@Nullable @Nullable Checksum checksum)
    • getFileAttributes

      @Nullable @Nullable FileAttributes getFileAttributes()
    • withFileAttributes

      <T extends SourceFile> T withFileAttributes(@Nullable @Nullable FileAttributes fileAttributes)
    • getStyle

      @Nullable default <S extends Style> S getStyle(Class<S> style)
    • getStyle

      default <S extends Style> S getStyle(Class<S> style, S defaultStyle)
    • printAllAsBytes

      default <P> byte[] printAllAsBytes(P p)
    • printAllAsBytes

      default byte[] printAllAsBytes()
    • printAll

      default <P> String printAll(P p)
    • printAll

      default <P> String printAll(PrintOutputCapture<P> out)
    • printAll

      default String printAll()
    • printAllTrimmed

      default <P> String printAllTrimmed(P p)
    • printAllTrimmed

      default String printAllTrimmed()
    • printer

      default <P> TreeVisitor<?,PrintOutputCapture<P>> printer(Cursor cursor)
      Specified by:
      printer in interface Tree
    • service

      @Incubating(since="8.2.0") default <S, T extends S> T service(Class<S> service)
    • getWeight

      default long getWeight(Predicate<Object> uniqueIdentity)
      A measure of the size of the AST by count of number of AST nodes or some other similar measure. Because perfect referential uniqueness is space inefficient, this weight will always be approximate and is best used for comparative size between two ASTs rather than an absolute measure.
      Parameters:
      uniqueIdentity - A means of only counting referentially equal AST nodes once. In performance sensitive situations this should use a probabilistic set membership data structure.
      Returns:
      The weight of the AST.