Class AptParser

java.lang.Object
org.apache.maven.doxia.parser.AbstractParser
org.apache.maven.doxia.parser.AbstractTextParser
org.apache.maven.doxia.module.apt.AptParser
All Implemented Interfaces:
org.apache.maven.doxia.logging.LogEnabled, org.apache.maven.doxia.markup.Markup, org.apache.maven.doxia.markup.TextMarkup, AptMarkup, org.apache.maven.doxia.parser.Parser

@Component(role=org.apache.maven.doxia.parser.Parser.class, hint="apt") public class AptParser extends org.apache.maven.doxia.parser.AbstractTextParser implements AptMarkup
The APT parser.
Based on the APTconvert project.
Since:
1.0
  • Field Details

    • SPACES

      protected static final char[] SPACES
      An array of 85 spaces.
    • TAB_WIDTH

      public static final int TAB_WIDTH
      Default tab width.
      See Also:
    • sourceContent

      protected String sourceContent
      sourceContent.
    • sink

      protected org.apache.maven.doxia.sink.Sink sink
      the sink to receive the events.
    • line

      protected String line
      a line of AptSource.
    • warnMessages

      protected Map<String,Set<String>> warnMessages
      Map of warn messages with a String as key to describe the error type and a Set as value. Using to reduce warn messages.
  • Constructor Details

    • AptParser

      public AptParser()
  • Method Details

    • parse

      public void parse(Reader source, org.apache.maven.doxia.sink.Sink sink) throws org.apache.maven.doxia.parser.ParseException
      Specified by:
      parse in interface org.apache.maven.doxia.parser.Parser
      Throws:
      org.apache.maven.doxia.parser.ParseException
    • parse

      public void parse(Reader source, org.apache.maven.doxia.sink.Sink sink, String reference) throws org.apache.maven.doxia.parser.ParseException
      Specified by:
      parse in interface org.apache.maven.doxia.parser.Parser
      Overrides:
      parse in class org.apache.maven.doxia.parser.AbstractParser
      Throws:
      org.apache.maven.doxia.parser.ParseException
    • getSourceName

      public String getSourceName()
      Returns the name of the Apt source document.
      Returns:
      the source name.
    • getSourceLineNumber

      public int getSourceLineNumber()
      Returns the current line number of the Apt source document.
      Returns:
      the line number.
    • nextLine

      protected void nextLine() throws AptParseException
      Parse the next line of the Apt source document.
      Throws:
      AptParseException - if something goes wrong.
    • doTraverseText

      protected void doTraverseText(String text, int begin, int end, org.apache.maven.doxia.sink.Sink sink) throws AptParseException
      Parse the given text.
      Parameters:
      text - the text to parse.
      begin - offset.
      end - offset.
      sink - the sink to receive the events.
      Throws:
      AptParseException - if something goes wrong.
    • charAt

      protected static char charAt(String string, int length, int i)
      Returns the character at position i of the given string.
      Parameters:
      string - the string.
      length - length.
      i - offset.
      Returns:
      the character, or '\0' if i > length.
    • skipSpace

      protected static int skipSpace(String string, int length, int i)
      Skip spaces.
      Parameters:
      string - string.
      length - length.
      i - offset.
      Returns:
      int.
    • replaceAll

      protected static String replaceAll(String string, String oldSub, String newSub)
      Replace part of a string.
      Parameters:
      string - the string
      oldSub - the substring to replace
      newSub - the replacement string
      Returns:
      String
    • init

      protected void init()
      Overrides:
      init in class org.apache.maven.doxia.parser.AbstractParser