Author: ltheussl
Date: Tue Sep 4 13:46:47 2007
New Revision: 572813
URL: http://svn.apache.org/viewvc?rev=572813&view=rev
Log:
Javadocs, Checkstyle fixes. No code changes.
Modified:
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptMarkup.java
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParseException.java
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptReaderSource.java
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSource.java
Modified:
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptMarkup.java
URL:
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptMarkup.java?rev=572813&r1=572812&r2=572813&view=diff
==============================================================================
---
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptMarkup.java
(original)
+++
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptMarkup.java
Tue Sep 4 13:46:47 2007
@@ -1,18 +1,22 @@
package org.apache.maven.doxia.module.apt;
/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license
- * agreements. See the NOTICE file distributed with this work for additional
information regarding
- * copyright ownership. The ASF licenses this file to you under the Apache
License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
License. You may obtain a
- * copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express
- * or implied. See the License for the specific language governing permissions
and limitations under
- * the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.maven.doxia.markup.TextMarkup;
Modified:
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParseException.java
URL:
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParseException.java?rev=572813&r1=572812&r2=572813&view=diff
==============================================================================
---
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParseException.java
(original)
+++
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParseException.java
Tue Sep 4 13:46:47 2007
@@ -21,13 +21,14 @@
import org.apache.maven.doxia.parser.ParseException;
+/** Wraps an exception when parsing apt source documents. */
public class AptParseException
extends ParseException
{
/**
- * @deprecated source isn't a safe place to get linenumbers from
- * @param message
- * @param source
+ * @deprecated source isn't a safe place to get linenumbers from.
+ * @param message the error message.
+ * @param source the AptSource.
*/
public AptParseException( String message, AptSource source )
{
@@ -36,32 +37,64 @@
/**
* @deprecated source isn't a safe place to get linenumbers from
- * @param message
- * @param source
- * @param e
+ * @param message the error message.
+ * @param source the AptSource.
+ * @param e the Exception.
*/
public AptParseException( String message, AptSource source, Exception e )
{
super( e, message, source.getName(), source.getLineNumber() );
}
-
- public AptParseException( String message, String name, int lineNumber,
Exception e)
+ /**
+ * Construct a new AptParseException with the specified cause, detail
message,
+ * filename and linenumber.
+ *
+ * @param message The detailed message.
+ * This can later be retrieved by the Throwable.getMessage() method.
+ * @param name Name of a file that couldn't be parsed.
+ * This can later be retrieved by the getFileName() method.
+ * @param lineNumber The line number where the parsing failed.
+ * This can later be retrieved by the getLineNumber() method.
+ * @param e the cause. This can be retrieved later by the
Throwable.getCause() method.
+ * (A null value is permitted, and indicates that the cause is nonexistent
or unknown.)
+ */
+ public AptParseException( String message, String name, int lineNumber,
Exception e )
{
- super( e, message, name, lineNumber);
+ super( e, message, name, lineNumber );
}
+ /**
+ * Construct a new AptParseException with the specified detail message and
cause.
+ *
+ * @param message The detailed message.
+ * This can later be retrieved by the Throwable.getMessage() method.
+ * @param e the cause. This can be retrieved later by the
Throwable.getCause() method.
+ * (A null value is permitted, and indicates that the cause is nonexistent
or unknown.)
+ */
public AptParseException( String message, Exception e )
{
super( message, e );
}
-
+ /**
+ * Construct a new AptParseException with the specified detail message.
+ *
+ * @param message The detailed message.
+ * This can later be retrieved by the Throwable.getMessage() method.
+ */
public AptParseException( String message )
{
super( message );
}
+ /**
+ * Constructs a new AptParseException with the specified cause. The error
message is
+ * (cause == null ? null : cause.toString() ).
+ *
+ * @param e the cause. This can be retrieved later by the
Throwable.getCause() method.
+ * (A null value is permitted, and indicates that the cause is nonexistent
or unknown.)
+ */
public AptParseException( Exception e )
{
super( e );
Modified:
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java
URL:
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java?rev=572813&r1=572812&r2=572813&view=diff
==============================================================================
---
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java
(original)
+++
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptParser.java
Tue Sep 4 13:46:47 2007
@@ -100,40 +100,51 @@
/** Macro event id */
private static final int MACRO = 16;
- private static final String typeNames[] = {"TITLE", "SECTION1",
"SECTION2", "SECTION3", "SECTION4", "SECTION5",
+ /** String representations of event ids */
+ private static final String TYPE_NAMES[] = {"TITLE", "SECTION1",
"SECTION2", "SECTION3", "SECTION4", "SECTION5",
"PARAGRAPH", "VERBATIM", "FIGURE", "TABLE", "LIST_ITEM",
"NUMBERED_LIST_ITEM", "DEFINITION_LIST_ITEM",
"HORIZONTAL_RULE", "PAGE_BREAK", "LIST_BREAK", "MACRO"};
- private static final char spaces[] = {' ', ' ', ' ', ' ', ' ', ' ', ' ', '
', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
+ /** An array of spaces. */
+ private static final char SPACES[] = {' ', ' ', ' ', ' ', ' ', ' ', ' ', '
', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
' ', ' ', ' ', ' '};
+ /** Default tab width. */
public static final int TAB_WIDTH = 8;
// ----------------------------------------------------------------------
// Instance fields
// ----------------------------------------------------------------------
+ /** sourceContent. */
private String sourceContent;
+ /** the AptSource. */
private AptSource source;
+ /** the sink to receive the events. */
private Sink sink;
+ /** a line of AptSource. */
private String line;
+ /** a block of AptSource. */
private Block block;
+ /** blockFileName. */
private String blockFileName;
+ /** blockLineNumber. */
private int blockLineNumber;
// ----------------------------------------------------------------------
// Public methods
// ----------------------------------------------------------------------
+ /** [EMAIL PROTECTED] */
public void parse( Reader source,
Sink sink )
throws AptParseException
@@ -179,12 +190,22 @@
}
}
+ /**
+ * Returns the name of the Apt source document.
+ *
+ * @return the source name.
+ */
public String getSourceName()
{
// Use this rather than source.getName() to report errors.
return blockFileName;
}
+ /**
+ * Returns the current line number of the Apt source document.
+ *
+ * @return the line number.
+ */
public int getSourceLineNumber()
{
// Use this rather than source.getLineNumber() to report errors.
@@ -195,6 +216,11 @@
// Private methods
// ----------------------------------------------------------------------
+ /**
+ * Parse the head of the Apt source document.
+ *
+ * @throws AptParseException if something goes wrong.
+ */
private void traverseHead()
throws AptParseException
{
@@ -209,6 +235,11 @@
sink.head_();
}
+ /**
+ * Parse the body of the Apt source document.
+ *
+ * @throws AptParseException if something goes wrong.
+ */
private void traverseBody()
throws AptParseException
{
@@ -227,6 +258,12 @@
sink.body_();
}
+ /**
+ * Parse a section of the Apt source document.
+ *
+ * @param level The section level.
+ * @throws AptParseException if something goes wrong.
+ */
private void traverseSection( int level )
throws AptParseException
{
@@ -256,6 +293,8 @@
case 4:
sink.section5();
break;
+ default:
+ break;
}
block.traverse();
@@ -291,9 +330,16 @@
case 4:
sink.section5_();
break;
+ default:
+ break;
}
}
+ /**
+ * Parse the section blocks of the Apt source document.
+ *
+ * @throws AptParseException if something goes wrong.
+ */
private void traverseSectionBlocks()
throws AptParseException
{
@@ -338,6 +384,11 @@
}
}
+ /**
+ * Parse a list of the Apt source document.
+ *
+ * @throws AptParseException if something goes wrong.
+ */
private void traverseList()
throws AptParseException
{
@@ -433,6 +484,11 @@
sink.list_();
}
+ /**
+ * Parse a numbered list of the Apt source document.
+ *
+ * @throws AptParseException if something goes wrong.
+ */
private void traverseNumberedList()
throws AptParseException
{
@@ -523,6 +579,11 @@
sink.numberedList_();
}
+ /**
+ * Parse a definition list of the Apt source document.
+ *
+ * @throws AptParseException if something goes wrong.
+ */
private void traverseDefinitionList()
throws AptParseException
{
@@ -615,18 +676,34 @@
sink.definitionList_();
}
+ /**
+ * Parse the next line of the Apt source document.
+ *
+ * @throws AptParseException if something goes wrong.
+ */
private void nextLine()
throws AptParseException
{
line = source.getNextLine();
}
+ /**
+ * Parse the next block of the Apt source document.
+ *
+ * @throws AptParseException if something goes wrong.
+ */
private void nextBlock()
throws AptParseException
{
nextBlock( /*first*/ false );
}
+ /**
+ * Parse the next block of the Apt source document.
+ *
+ * @param firstBlock True if this is the first block of the Apt source
document.
+ * @throws AptParseException if something goes wrong.
+ */
private void nextBlock( boolean firstBlock )
throws AptParseException
{
@@ -804,6 +881,8 @@
block = new MacroBlock( indent, line );
}
break;
+ default:
+ break;
}
if ( block == null )
@@ -819,6 +898,12 @@
}
}
+ /**
+ * Checks that the current block is of the expected type.
+ *
+ * @param type the expected type.
+ * @throws AptParseException if something goes wrong.
+ */
private void expectedBlock( int type )
throws AptParseException
{
@@ -826,22 +911,42 @@
if ( blockType != type )
{
- throw new AptParseException( "expected " + typeNames[type] + ",
found " + typeNames[blockType] );
+ throw new AptParseException( "expected " + TYPE_NAMES[type] + ",
found " + TYPE_NAMES[blockType] );
}
}
// -----------------------------------------------------------------------
+ /**
+ * Determin if c is an octal character.
+ *
+ * @param c the character.
+ * @return boolean
+ */
private static boolean isOctalChar( char c )
{
return ( c >= '0' && c <= '7' );
}
+ /**
+ * Determin if c is an hex character.
+ *
+ * @param c the character.
+ * @return boolean
+ */
private static boolean isHexChar( char c )
{
return ( ( c >= '0' && c <= '9' ) || ( c >= 'a' && c <= 'f' ) || ( c
>= 'A' && c <= 'F' ) );
}
+ /**
+ * Returns the character at position i of the given string.
+ *
+ * @param string the string.
+ * @param length length.
+ * @param i offset.
+ * @return the character, or '\0' if i > length.
+ */
private static char charAt( String string,
int length,
int i )
@@ -849,6 +954,14 @@
return ( i < length ) ? string.charAt( i ) : '\0';
}
+ /**
+ * Skip spaces.
+ *
+ * @param string string.
+ * @param length length.
+ * @param i offset.
+ * @return int.
+ */
private static int skipSpace( String string,
int length,
int i )
@@ -868,6 +981,15 @@
return i;
}
+ /**
+ * Parse the given text.
+ *
+ * @param text the text to parse.
+ * @param begin offset.
+ * @param end offset.
+ * @param sink the sink to receive the events.
+ * @throws AptParseException if something goes wrong.
+ */
private static void doTraverseText( String text,
int begin,
int end,
@@ -925,8 +1047,8 @@
buffer.append( escaped );
break;
case 'x':
- if ( i + 3 < end && isHexChar( text.charAt( i
+ 2 ) ) &&
- isHexChar( text.charAt( i + 3 ) ) )
+ if ( i + 3 < end && isHexChar( text.charAt( i
+ 2 ) )
+ && isHexChar( text.charAt( i + 3 ) ) )
{
int value = '?';
try
@@ -947,9 +1069,10 @@
}
break;
case 'u':
- if ( i + 5 < end && isHexChar( text.charAt( i
+ 2 ) ) &&
- isHexChar( text.charAt( i + 3 ) ) &&
isHexChar( text.charAt( i + 4 ) ) &&
- isHexChar( text.charAt( i + 5 ) ) )
+ if ( i + 5 < end && isHexChar( text.charAt( i
+ 2 ) )
+ && isHexChar( text.charAt( i + 3 )
)
+ && isHexChar( text.charAt( i + 4 )
)
+ && isHexChar( text.charAt( i + 5 )
) )
{
int value = '?';
try
@@ -1099,7 +1222,8 @@
break;
case GREATER_THAN:
- if ( monospaced && i + 2 < end && text.charAt( i + 1 ) ==
GREATER_THAN && text.charAt( i + 2 ) == GREATER_THAN )
+ if ( monospaced && i + 2 < end && text.charAt( i + 1 ) ==
GREATER_THAN
+ && text.charAt( i + 2 ) == GREATER_THAN )
{
i += 2;
monospaced = false;
@@ -1167,6 +1291,12 @@
flushTraversed( buffer, sink );
}
+ /**
+ * Emits the text so far parsed into the given sink.
+ *
+ * @param buffer A StringBuffer that contains the text to be flushed.
+ * @param sink The sink to receive the text.
+ */
private static void flushTraversed( StringBuffer buffer,
Sink sink )
{
@@ -1177,6 +1307,16 @@
}
}
+ /**
+ * Parse the given text.
+ *
+ * @param text the text to parse.
+ * @param begin offset.
+ * @param end offset.
+ * @param linkAnchor a StringBuffer.
+ * @return int
+ * @throws AptParseException if something goes wrong.
+ */
private static int skipTraversedLinkAnchor( String text,
int begin,
int end,
@@ -1215,6 +1355,15 @@
return i;
}
+ /**
+ * Parse the given text.
+ *
+ * @param text the text to parse.
+ * @param begin offset.
+ * @param end offset.
+ * @return String
+ * @throws AptParseException if something goes wrong.
+ */
private static String getTraversedLink( String text,
int begin,
int end )
@@ -1243,6 +1392,15 @@
return doGetTraversedLink( text, begin, i - 1 );
}
+ /**
+ * Parse the given text.
+ *
+ * @param text the text to parse.
+ * @param begin offset.
+ * @param end offset.
+ * @return String
+ * @throws AptParseException if something goes wrong.
+ */
private static String getTraversedAnchor( String text,
int begin,
int end )
@@ -1269,6 +1427,15 @@
return doGetTraversedLink( text, begin, i );
}
+ /**
+ * Parse the given text.
+ *
+ * @param text the text to parse.
+ * @param begin offset.
+ * @param end offset.
+ * @return String
+ * @throws AptParseException if something goes wrong.
+ */
private static String doGetTraversedLink( String text,
int begin,
int end )
@@ -1300,16 +1467,28 @@
// -----------------------------------------------------------------------
+ /** A block of an apt source document. */
private abstract class Block
{
+ /** type. */
protected int type;
+ /** indent. */
protected int indent;
+ /** text. */
protected String text;
+ /** textLength. */
protected int textLength;
+ /**
+ * Constructor.
+ *
+ * @param type the block type.
+ * @param indent indent.
+ * @throws AptParseException AptParseException
+ */
public Block( int type,
int indent )
throws AptParseException
@@ -1317,6 +1496,14 @@
this( type, indent, null );
}
+ /**
+ * Constructor.
+ *
+ * @param type type.
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @throws AptParseException AptParseException
+ */
public Block( int type,
int indent,
String firstLine )
@@ -1345,8 +1532,9 @@
int i = 0;
i = skipSpace( l, length, i );
- if ( i == length ||
- ( AptParser.charAt( l, length, i ) == COMMENT &&
AptParser.charAt( l, length, i + 1 ) == COMMENT ) )
+ if ( i == length
+ || ( AptParser.charAt( l, length, i ) == COMMENT
+ && AptParser.charAt( l, length, i + 1 ) == COMMENT
) )
{
// Stop after open or comment line and skip it.
// (A comment line is considered to be an open line.)
@@ -1365,25 +1553,53 @@
}
}
+ /**
+ * Return the block type.
+ *
+ * @return int
+ */
public final int getType()
{
return type;
}
+ /**
+ * Return the block indent.
+ *
+ * @return int
+ */
public final int getIndent()
{
return indent;
}
+ /**
+ * Parse the block.
+ *
+ * @throws AptParseException if something goes wrong.
+ */
public abstract void traverse()
throws AptParseException;
+ /**
+ * Traverse the text.
+ *
+ * @param begin offset.
+ * @throws AptParseException if something goes wrong.
+ */
protected void traverseText( int begin )
throws AptParseException
{
traverseText( begin, text.length() );
}
+ /**
+ * Traverse the text.
+ *
+ * @param begin offset.
+ * @param end offset.
+ * @throws AptParseException if something goes wrong.
+ */
protected void traverseText( int begin,
int end )
throws AptParseException
@@ -1391,6 +1607,11 @@
AptParser.doTraverseText( text, begin, end, AptParser.this.sink );
}
+ /**
+ * Skip spaces.
+ *
+ * @return int.
+ */
protected int skipLeadingBullets()
{
int i = skipSpaceFrom( 0 );
@@ -1404,6 +1625,13 @@
return skipSpaceFrom( i );
}
+ /**
+ * Skip brackets.
+ *
+ * @param i offset.
+ * @return int.
+ * @throws AptParseException if something goes wrong.
+ */
protected int skipFromLeftToRightBracket( int i )
throws AptParseException
{
@@ -1425,15 +1653,29 @@
return i;
}
+ /**
+ * Skip spaces.
+ *
+ * @param i offset.
+ * @return int.
+ */
protected final int skipSpaceFrom( int i )
{
return AptParser.skipSpace( text, textLength, i );
}
}
+ /** A ListBreak Block. */
private class ListBreak
extends AptParser.Block
{
+ /**
+ * Constructor.
+ *
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @throws AptParseException AptParseException
+ */
public ListBreak( int indent,
String firstLine )
throws AptParseException
@@ -1441,6 +1683,7 @@
super( AptParser.LIST_BREAK, indent );
}
+ /** [EMAIL PROTECTED] */
public void traverse()
throws AptParseException
{
@@ -1448,9 +1691,17 @@
}
}
+ /** A Title Block. */
private class Title
extends Block
{
+ /**
+ * Constructor.
+ *
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @throws AptParseException AptParseException
+ */
public Title( int indent,
String firstLine )
throws AptParseException
@@ -1458,6 +1709,7 @@
super( TITLE, indent, firstLine );
}
+ /** [EMAIL PROTECTED] */
public void traverse()
throws AptParseException
{
@@ -1474,8 +1726,9 @@
String line = lines.nextToken().trim();
int lineLength = line.length();
- if ( AptParser.charAt( line, lineLength, 0 ) == MINUS &&
AptParser.charAt( line, lineLength, 1 ) == MINUS &&
- AptParser.charAt( line, lineLength, 2 ) == MINUS )
+ if ( AptParser.charAt( line, lineLength, 0 ) == MINUS
+ && AptParser.charAt( line, lineLength, 1 ) == MINUS
+ && AptParser.charAt( line, lineLength, 2 ) == MINUS )
{
switch ( separator )
{
@@ -1499,6 +1752,8 @@
// Note that an extra decorative line is allowed
// at the end of the author.
break loop;
+ default:
+ break;
}
++separator;
@@ -1523,6 +1778,8 @@
date = true;
AptParser.this.sink.date();
break;
+ default:
+ break;
}
}
else
@@ -1559,13 +1816,24 @@
AptParser.this.sink.date_();
}
break;
+ default:
+ break;
}
}
}
+ /** A Section Block. */
private class Section
extends Block
{
+ /**
+ * Constructor.
+ *
+ * @param type type.
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @throws AptParseException AptParseException
+ */
public Section( int type,
int indent,
String firstLine )
@@ -1574,6 +1842,7 @@
super( type, indent, firstLine );
}
+ /** [EMAIL PROTECTED] */
public void traverse()
throws AptParseException
{
@@ -1582,20 +1851,30 @@
Title_();
}
+ /** Start a title. */
public void Title()
{
AptParser.this.sink.sectionTitle();
}
+ /** End a title. */
public void Title_()
{
AptParser.this.sink.sectionTitle_();
}
}
+ /** A Section1 Block. */
private class Section1
extends Section
{
+ /**
+ * Constructor.
+ *
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @throws AptParseException AptParseException
+ */
public Section1( int indent,
String firstLine )
throws AptParseException
@@ -1603,20 +1882,30 @@
super( SECTION1, indent, firstLine );
}
+ /** [EMAIL PROTECTED] */
public void Title()
{
AptParser.this.sink.sectionTitle1();
}
+ /** [EMAIL PROTECTED] */
public void Title_()
{
AptParser.this.sink.sectionTitle1_();
}
}
+ /** A Section2 Block. */
private class Section2
extends Section
{
+ /**
+ * Constructor.
+ *
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @throws AptParseException AptParseException
+ */
public Section2( int indent,
String firstLine )
throws AptParseException
@@ -1624,20 +1913,30 @@
super( SECTION2, indent, firstLine );
}
+ /** [EMAIL PROTECTED] */
public void Title()
{
AptParser.this.sink.sectionTitle2();
}
+ /** [EMAIL PROTECTED] */
public void Title_()
{
AptParser.this.sink.sectionTitle2_();
}
}
+ /** A Section3 Block. */
private class Section3
extends Section
{
+ /**
+ * Constructor.
+ *
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @throws AptParseException AptParseException
+ */
public Section3( int indent,
String firstLine )
throws AptParseException
@@ -1645,20 +1944,30 @@
super( SECTION3, indent, firstLine );
}
+ /** [EMAIL PROTECTED] */
public void Title()
{
AptParser.this.sink.sectionTitle3();
}
+ /** [EMAIL PROTECTED] */
public void Title_()
{
AptParser.this.sink.sectionTitle3_();
}
}
+ /** A Section4 Block. */
private class Section4
extends Section
{
+ /**
+ * Constructor.
+ *
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @throws AptParseException AptParseException
+ */
public Section4( int indent,
String firstLine )
throws AptParseException
@@ -1666,20 +1975,30 @@
super( SECTION4, indent, firstLine );
}
+ /** [EMAIL PROTECTED] */
public void Title()
{
AptParser.this.sink.sectionTitle4();
}
+ /** [EMAIL PROTECTED] */
public void Title_()
{
AptParser.this.sink.sectionTitle4_();
}
}
+ /** A Section5 Block. */
private class Section5
extends Section
{
+ /**
+ * Constructor.
+ *
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @throws AptParseException AptParseException
+ */
public Section5( int indent,
String firstLine )
throws AptParseException
@@ -1687,20 +2006,30 @@
super( SECTION5, indent, firstLine );
}
+ /** [EMAIL PROTECTED] */
public void Title()
{
AptParser.this.sink.sectionTitle5();
}
+ /** [EMAIL PROTECTED] */
public void Title_()
{
AptParser.this.sink.sectionTitle5_();
}
}
+ /** A Paragraph Block. */
private class Paragraph
extends Block
{
+ /**
+ * Constructor.
+ *
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @throws AptParseException AptParseException
+ */
public Paragraph( int indent,
String firstLine )
throws AptParseException
@@ -1708,6 +2037,7 @@
super( PARAGRAPH, indent, firstLine );
}
+ /** [EMAIL PROTECTED] */
public void traverse()
throws AptParseException
{
@@ -1717,11 +2047,20 @@
}
}
+ /** A Verbatim Block. */
private class Verbatim
extends Block
{
+ /** boxed. */
private boolean boxed;
+ /**
+ * Constructor.
+ *
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @throws AptParseException AptParseException
+ */
public Verbatim( int indent,
String firstLine )
throws AptParseException
@@ -1739,8 +2078,9 @@
String l = AptParser.this.line;
int length = l.length();
- if ( AptParser.charAt( l, length, 0 ) == firstChar &&
AptParser.charAt( l, length, 1 ) == MINUS &&
- AptParser.charAt( l, length, 2 ) == MINUS )
+ if ( AptParser.charAt( l, length, 0 ) == firstChar
+ && AptParser.charAt( l, length, 1 ) == MINUS
+ && AptParser.charAt( l, length, 2 ) == MINUS )
{
AptParser.this.nextLine();
@@ -1763,7 +2103,7 @@
column = ( ( column + 1 + TAB_WIDTH - 1 ) / TAB_WIDTH
) * TAB_WIDTH;
- buffer.append( spaces, 0, column - prevColumn );
+ buffer.append( SPACES, 0, column - prevColumn );
}
else
{
@@ -1790,6 +2130,7 @@
text = buffer.toString();
}
+ /** [EMAIL PROTECTED] */
public void traverse()
throws AptParseException
{
@@ -1799,9 +2140,17 @@
}
}
+ /** A Figure Block. */
private class Figure
extends Block
{
+ /**
+ * Constructor.
+ *
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @throws AptParseException AptParseException
+ */
public Figure( int indent,
String firstLine )
throws AptParseException
@@ -1809,6 +2158,7 @@
super( FIGURE, indent, firstLine );
}
+ /** [EMAIL PROTECTED] */
public void traverse()
throws AptParseException
{
@@ -1829,9 +2179,17 @@
}
}
+ /** A Table Block. */
private class Table
extends Block
{
+ /**
+ * Constructor.
+ *
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @throws AptParseException AptParseException
+ */
public Table( int indent,
String firstLine )
throws AptParseException
@@ -1839,6 +2197,7 @@
super( TABLE, indent, firstLine );
}
+ /** [EMAIL PROTECTED] */
public void traverse()
throws AptParseException
{
@@ -1971,7 +2330,15 @@
AptParser.this.sink.table_();
}
- private int[] parseJustification( String line,
+ /**
+ * Parse a table justification line.
+ *
+ * @param jline the justification line.
+ * @param lineLength the length of the line. Must be > 2.
+ * @return int[]
+ * @throws AptParseException if something goes wrong.
+ */
+ private int[] parseJustification( String jline,
int lineLength )
throws AptParseException
{
@@ -1979,13 +2346,15 @@
for ( int i = 2 /*Skip '*--'*/; i < lineLength; ++i )
{
- switch ( line.charAt( i ) )
+ switch ( jline.charAt( i ) )
{
case STAR:
case PLUS:
case COLON:
++columns;
break;
+ default:
+ break;
}
}
@@ -1998,7 +2367,7 @@
columns = 0;
for ( int i = 2; i < lineLength; ++i )
{
- switch ( line.charAt( i ) )
+ switch ( jline.charAt( i ) )
{
case STAR:
justification[columns++] = JUSTIFY_CENTER;
@@ -2009,12 +2378,22 @@
case COLON:
justification[columns++] = JUSTIFY_RIGHT;
break;
+ default:
+ break;
}
}
return justification;
}
+ /**
+ * Traverse a table row.
+ *
+ * @param cells The table cells.
+ * @param headers true for header cells.
+ * @return boolean
+ * @throws AptParseException if something goes wrong.
+ */
private boolean traverseRow( StringBuffer[] cells,
boolean[] headers )
throws AptParseException
@@ -2065,9 +2444,17 @@
}
}
+ /** A ListItem Block. */
private class ListItem
extends Block
{
+ /**
+ * Constructor.
+ *
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @throws AptParseException AptParseException
+ */
public ListItem( int indent,
String firstLine )
throws AptParseException
@@ -2075,6 +2462,7 @@
super( LIST_ITEM, indent, firstLine );
}
+ /** [EMAIL PROTECTED] */
public void traverse()
throws AptParseException
{
@@ -2084,25 +2472,41 @@
}
}
+ /** A NumberedListItem Block. */
private class NumberedListItem
extends Block
{
+ /** numbering. */
private int numbering;
+ /**
+ * Constructor.
+ *
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @param number numbering.
+ * @throws AptParseException AptParseException
+ */
public NumberedListItem( int indent,
String firstLine,
- int numbering )
+ int number )
throws AptParseException
{
super( NUMBERED_LIST_ITEM, indent, firstLine );
- this.numbering = numbering;
+ this.numbering = number;
}
+ /**
+ * getNumbering.
+ *
+ * @return int
+ */
public int getNumbering()
{
return numbering;
}
+ /** [EMAIL PROTECTED] */
public void traverse()
throws AptParseException
{
@@ -2111,6 +2515,12 @@
AptParser.this.sink.paragraph_();
}
+ /**
+ * skipItemNumber.
+ *
+ * @return int
+ * @throws AptParseException AptParseException
+ */
private int skipItemNumber()
throws AptParseException
{
@@ -2136,9 +2546,17 @@
}
}
+ /** A DefinitionListItem Block. */
private class DefinitionListItem
extends Block
{
+ /**
+ * Constructor.
+ *
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @throws AptParseException AptParseException
+ */
public DefinitionListItem( int indent,
String firstLine )
throws AptParseException
@@ -2146,6 +2564,7 @@
super( DEFINITION_LIST_ITEM, indent, firstLine );
}
+ /** [EMAIL PROTECTED] */
public void traverse()
throws AptParseException
{
@@ -2169,9 +2588,17 @@
}
}
+ /** A HorizontalRule Block. */
private class HorizontalRule
extends Block
{
+ /**
+ * Constructor.
+ *
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @throws AptParseException AptParseException
+ */
public HorizontalRule( int indent,
String firstLine )
throws AptParseException
@@ -2179,6 +2606,7 @@
super( HORIZONTAL_RULE, indent );
}
+ /** [EMAIL PROTECTED] */
public void traverse()
throws AptParseException
{
@@ -2186,9 +2614,17 @@
}
}
+ /** A PageBreak Block. */
private class PageBreak
extends Block
{
+ /**
+ * Constructor.
+ *
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @throws AptParseException AptParseException
+ */
public PageBreak( int indent,
String firstLine )
throws AptParseException
@@ -2196,6 +2632,7 @@
super( PAGE_BREAK, indent );
}
+ /** [EMAIL PROTECTED] */
public void traverse()
throws AptParseException
{
@@ -2203,9 +2640,17 @@
}
}
+ /** A MacroBlock Block. */
private class MacroBlock
extends Block
{
+ /**
+ * Constructor.
+ *
+ * @param indent indent.
+ * @param firstLine the first line.
+ * @throws AptParseException AptParseException
+ */
public MacroBlock( int indent,
String firstLine )
throws AptParseException
@@ -2215,6 +2660,7 @@
text = firstLine;
}
+ /** [EMAIL PROTECTED] */
public void traverse()
throws AptParseException
{
@@ -2266,6 +2712,12 @@
}
}
+ /**
+ * escapeForMacro
+ *
+ * @param s String
+ * @return String
+ */
private String escapeForMacro( String s )
{
if ( s == null || s.length() < 1 )
@@ -2283,6 +2735,12 @@
return result;
}
+ /**
+ * unescapeForMacro
+ *
+ * @param s String
+ * @return String
+ */
private String unescapeForMacro( String s )
{
if ( s == null || s.length() < 1 )
@@ -2301,6 +2759,14 @@
// -----------------------------------------------------------------------
+ /**
+ * Replace part of a string.
+ *
+ * @param string the string
+ * @param oldSub the substring to replace
+ * @param newSub the replacement string
+ * @return String
+ */
private static String replaceAll( String string,
String oldSub,
String newSub )
Modified:
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptReaderSource.java
URL:
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptReaderSource.java?rev=572813&r1=572812&r2=572813&view=diff
==============================================================================
---
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptReaderSource.java
(original)
+++
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptReaderSource.java
Tue Sep 4 13:46:47 2007
@@ -23,13 +23,21 @@
import java.io.LineNumberReader;
import java.io.Reader;
+/** Reader for apt source documents. */
public class AptReaderSource
implements AptSource
{
+ /** A reader. */
private LineNumberReader reader;
+ /** lineNumber. */
private int lineNumber;
+ /**
+ * Constructor: intialize reader.
+ *
+ * @param in the reader.
+ */
public AptReaderSource( Reader in )
{
reader = new LineNumberReader( in );
@@ -37,6 +45,7 @@
lineNumber = -1;
}
+ /** [EMAIL PROTECTED] */
public String getNextLine()
throws AptParseException
{
@@ -68,16 +77,19 @@
return line;
}
+ /** [EMAIL PROTECTED] */
public String getName()
{
return "";
}
+ /** [EMAIL PROTECTED] */
public int getLineNumber()
{
return lineNumber;
}
+ /** Closes the reader associated with this AptReaderSource. */
public void close()
{
if ( reader != null )
@@ -88,6 +100,7 @@
}
catch ( IOException ignored )
{
+ // TODO: log
}
}
reader = null;
Modified:
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java
URL:
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java?rev=572813&r1=572812&r2=572813&view=diff
==============================================================================
---
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java
(original)
+++
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSink.java
Tue Sep 4 13:46:47 2007
@@ -43,23 +43,58 @@
// Instance fields
// ----------------------------------------------------------------------
+ /** A buffer that holds the current text. */
private StringBuffer buffer;
+
+ /** A buffer that holds the table caption. */
private StringBuffer tableCaptionBuffer;
+
+ /** author. */
private String author;
+
+ /** title. */
private String title;
+
+ /** date. */
private String date;
+
+ /** tableCaptionFlag. */
private boolean tableCaptionFlag;
+
+ /** headerFlag. */
private boolean headerFlag;
+
+ /** bufferFlag. */
private boolean bufferFlag;
+
+ /** itemFlag. */
private boolean itemFlag;
+
+ /** verbatimFlag. */
private boolean verbatimFlag;
+
+ /** boxed verbatim. */
private boolean boxed;
+
+ /** gridFlag for tables. */
private boolean gridFlag;
+
+ /** number of cells in a table. */
private int cellCount;
+
+ /** The writer to use. */
private PrintWriter writer;
+
+ /** justification of table cells. */
private int cellJustif[];
+
+ /** a line of a row in a table. */
private String rowLine;
+
+ /** listNestingIndent. */
private String listNestingIndent;
+
+ /** listStyles. */
private Stack listStyles;
// ----------------------------------------------------------------------
Modified:
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSource.java
URL:
http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSource.java?rev=572813&r1=572812&r2=572813&view=diff
==============================================================================
---
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSource.java
(original)
+++
maven/doxia/doxia/trunk/doxia-modules/doxia-module-apt/src/main/java/org/apache/maven/doxia/module/apt/AptSource.java
Tue Sep 4 13:46:47 2007
@@ -19,13 +19,30 @@
* under the License.
*/
+/** An interface to read apt source documents. */
public interface AptSource
{
+ /**
+ * Returns a line of the apt source document.
+ *
+ * @return a line of the apt source.
+ * @throws AptParseException if the document can't be parsed.
+ */
String getNextLine()
throws AptParseException;
+ /**
+ * Returns the name the apt source document.
+ *
+ * @return the name the apt source document.
+ */
String getName();
+ /**
+ * Gets the current line number while parsing the document.
+ *
+ * @return the line number.
+ */
int getLineNumber();
}