Class AptParser

All Implemented Interfaces:
MacroExecutor, Markup, TextMarkup, AptMarkup, Parser

@Singleton @Named("apt") public class AptParser extends AbstractTextParser implements AptMarkup
The APT parser.
Based on the APTconvert project.
Since:
1.0
  • Field Details

  • Constructor Details

  • Method Details

    • parse

      public void parse(Reader source, Sink sink) throws ParseException
      Specified by:
      parse in interface Parser
      Overrides:
      parse in class AbstractParser
      Throws:
      ParseException
    • parse

      public void parse(Reader source, Sink sink, String reference) throws ParseException
      Specified by:
      parse in interface Parser
      Throws:
      ParseException
    • 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, 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 AbstractParser