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:
MacroExecutor,Markup,TextMarkup,AptMarkup,Parser
The APT parser.
Based on the APTconvert project.
Based on the APTconvert project.
- Since:
- 1.0
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringa line of AptSource.protected Sinkthe sink to receive the events.protected StringsourceContent.protected static final char[]An array of 85 spaces.static final intDefault tab width.Fields inherited from interface org.apache.maven.doxia.module.apt.AptMarkup
ANCHOR_END_MARKUP, ANCHOR_START_MARKUP, BACKSLASH, BOLD_END_MARKUP, BOLD_START_MARKUP, COMMENT, HEADER_START_MARKUP, HORIZONTAL_RULE_MARKUP, ITALIC_END_MARKUP, ITALIC_START_MARKUP, LINK_END_MARKUP, LINK_START_1_MARKUP, LINK_START_2_MARKUP, LIST_END_MARKUP, LIST_START_MARKUP, MONOSPACED_END_MARKUP, MONOSPACED_START_MARKUP, NON_BREAKING_SPACE_MARKUP, NUMBERING, NUMBERING_LOWER_ALPHA_CHAR, NUMBERING_LOWER_ROMAN_CHAR, NUMBERING_UPPER_ALPHA_CHAR, NUMBERING_UPPER_ROMAN_CHAR, PAGE_BREAK, PAGE_BREAK_MARKUP, PERCENT, SECTION_TITLE_START_MARKUP, TAB, TABLE_CELL_SEPARATOR_MARKUP, TABLE_COL_CENTERED_ALIGNED_MARKUP, TABLE_COL_LEFT_ALIGNED_MARKUP, TABLE_COL_RIGHT_ALIGNED_MARKUP, TABLE_ROW_SEPARATOR_MARKUP, TABLE_ROW_START_MARKUP, VERBATIM_END_MARKUP, VERBATIM_SOURCE_END_MARKUP, VERBATIM_SOURCE_START_MARKUP, VERBATIM_START_MARKUPFields inherited from interface org.apache.maven.doxia.markup.Markup
COLON, EOL, EQUAL, GREATER_THAN, LEFT_CURLY_BRACKET, LEFT_SQUARE_BRACKET, LESS_THAN, MINUS, PLUS, QUOTE, RIGHT_CURLY_BRACKET, RIGHT_SQUARE_BRACKET, SEMICOLON, SLASH, SPACE, STARFields inherited from interface org.apache.maven.doxia.parser.Parser
TXT_TYPE, UNKNOWN_TYPE, XML_TYPEFields inherited from interface org.apache.maven.doxia.markup.TextMarkup
PIPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static charReturns the character at position i of the given string.protected voiddoTraverseText(String text, int begin, int end, Sink sink) Parse the given text.intReturns the current line number of the Apt source document.Returns the name of the Apt source document.protected voidinit()Initialize the parser.protected voidnextLine()Parse the next line of the Apt source document.voidParses the given source model and emits Doxia events into the given sink.voidParses the given source model and emits Doxia events into the given sink.protected static StringreplaceAll(String string, String oldSub, String newSub) Replace part of a string.protected static intSkip spaces.Methods inherited from class org.apache.maven.doxia.parser.AbstractTextParser
getTypeMethods inherited from class org.apache.maven.doxia.parser.AbstractParser
addSinkWrapperFactory, doxiaVersion, executeMacro, getBasedir, getMacroManager, getSinkWrapperFactories, getWrappedSink, isEmitAnchorsForIndexableEntries, isEmitComments, isSecondParsing, parse, parse, setEmitAnchorsForIndexableEntries, setEmitComments, setMacroExecutor, setSecondParsing
-
Field Details
-
SPACES
An array of 85 spaces. -
TAB_WIDTH
Default tab width.- See Also:
-
sourceContent
sourceContent. -
sink
the sink to receive the events. -
line
a line of AptSource.
-
-
Constructor Details
-
AptParser
public AptParser()
-
-
Method Details
-
parse
Description copied from interface:ParserParses the given source model and emits Doxia events into the given sink. Shortcut forParser.parse(Reader, Sink, String)with last argument beingnull.- Specified by:
parsein interfaceParser- Overrides:
parsein classAbstractParser- Parameters:
source- not null reader that provides the source document.sink- A sink that consumes the Doxia events.- Throws:
ParseException- if the model could not be parsed.
-
parse
Description copied from interface:ParserParses the given source model and emits Doxia events into the given sink.- Specified by:
parsein interfaceParser- Parameters:
source- not null reader that provides the source document.sink- A sink that consumes the Doxia events.reference- a string identifying the source (for file based documents the source file path)- Throws:
ParseException- if the model could not be parsed.
-
getSourceName
Returns the name of the Apt source document.- Returns:
- the source name.
-
getSourceLineNumber
Returns the current line number of the Apt source document.- Returns:
- the line number.
-
nextLine
Parse the next line of the Apt source document.- Throws:
AptParseException- if something goes wrong.
-
doTraverseText
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
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
Skip spaces.- Parameters:
string- string.length- length.i- offset.- Returns:
- int.
-
replaceAll
Replace part of a string.- Parameters:
string- the stringoldSub- the substring to replacenewSub- the replacement string- Returns:
- String
-
init
Initialize the parser. This is called first byAbstractParser.parse(java.io.Reader, org.apache.maven.doxia.sink.Sink)and can be used to set the parser into a clear state so it can be re-used.- Overrides:
initin classAbstractParser
-