Class EntryReader.CommentFormat

java.lang.Object
org.plumelib.util.EntryReader.CommentFormat
Enclosing class:
EntryReader

public static class EntryReader.CommentFormat extends Object
This class informs EntryReader where a comment begins and ends.

No quoting is supported. That is, EntryReader does not attempt to infer whether a comment regex matches within (say) a string in the input text. To prevent a comment marker from being matched, embed it in a fenced code block.

  • Field Details

    • NONE

      public static final EntryReader.CommentFormat NONE
      A CommentFormat that supports no comments.
    • C

      public static final EntryReader.CommentFormat C
      A CommentFormat for C-style comments.
    • C_AT_START_OF_LINE

      public static final EntryReader.CommentFormat C_AT_START_OF_LINE
      A CommentFormat for C-style comments, only at the beginning of a line.
    • HTML

      public static final EntryReader.CommentFormat HTML
      A CommentFormat for HTML-style comments.
    • HTML_AT_START_OF_LINE

      public static final EntryReader.CommentFormat HTML_AT_START_OF_LINE
      A CommentFormat for HTML-style comments, only at the beginning of a line.
    • SHELL

      public static final EntryReader.CommentFormat SHELL
      A CommentFormat for Shell/Python-style comments.
    • SHELL_AT_START_OF_LINE

      public static final EntryReader.CommentFormat SHELL_AT_START_OF_LINE
      A CommentFormat for Shell/Python-style comments, only at the beginning of a line.
    • TEX

      public static final EntryReader.CommentFormat TEX
      A CommentFormat for TeX/LaTeX-style comments.
    • TEX_AT_START_OF_LINE

      public static final EntryReader.CommentFormat TEX_AT_START_OF_LINE
      A CommentFormat for TeX/LaTeX-style comments, only at the beginning of a line.
  • Constructor Details

    • CommentFormat

      public CommentFormat(@Nullable @Regex String lineCommentStart, @Nullable @Regex String multilineCommentStart, @Nullable @Regex String multilineCommentEnd)
      Creates a CommentFormat.
      Parameters:
      lineCommentStart - regular expression that matches a single-line comment
      multilineCommentStart - regular expression that matches the start of a multi-line comment
      multilineCommentEnd - regular expression that matches the end of a multi-line comment
    • CommentFormat

      public CommentFormat(@Nullable @Regex String lineCommentStart)
      Creates a CommentFormat that does not match multi-line comments.
      Parameters:
      lineCommentStart - regular expression that matches a single-line comment
    • CommentFormat

      public CommentFormat(@Nullable Pattern lineCommentStart, @Nullable Pattern multilineCommentStart, @Nullable Pattern multilineCommentEnd)
      Creates a CommentFormat.
      Parameters:
      lineCommentStart - regular expression that matches a single-line comment
      multilineCommentStart - regular expression that matches the start of a multi-line comment
      multilineCommentEnd - regular expression that matches the end of a multi-line comment