[jboss-svn-commits] JBL Code SVN: r16782 - in labs/jbossforums/branches/forums101P24: forums/src/main/org/jboss/portlet/forums and 21 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Nov 24 18:20:49 EST 2007


Author: unibrew
Date: 2007-11-24 18:20:48 -0500 (Sat, 24 Nov 2007)
New Revision: 16782

Added:
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/AbstractParser.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEvent.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEventHandler.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEventNotifier.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/TextEvent.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/Token.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.flex
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/BBCodeParser.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/chars/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/chars/Chars.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/chars/MutableChars.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/CharacterEntityReferenceEvent.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/HTML4_0CharacterEntityReferenceParser.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/XML1_0CharacterEntityReferenceParser.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.flex
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/TagParser.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/linebreak/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/linebreak/LineBreakParser.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/AbstractRenderer.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/ToHTMLConfig.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/ToHTMLRenderer.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ASCII_CharStream.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/AbstractContext.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/BuildException.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ChildrenStrategy.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Context.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/DelegateContext.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ParseException.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Template.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.jj
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerConstants.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerTokenManager.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateBuilder.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateLoader.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateParser.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateRepository.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Token.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TokenMgrError.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/CLLoader.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/EntityTable.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/Loader.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/Stack.java
   labs/jbossforums/branches/forums101P24/thirdparty/dom4j/
   labs/jbossforums/branches/forums101P24/thirdparty/dom4j/component-info.xml
   labs/jbossforums/branches/forums101P24/thirdparty/dom4j/lib/
   labs/jbossforums/branches/forums101P24/thirdparty/dom4j/lib/dom4j.jar
   labs/jbossforums/branches/forums101P24/thirdparty/javassist/
   labs/jbossforums/branches/forums101P24/thirdparty/javassist/component-info.xml
   labs/jbossforums/branches/forums101P24/thirdparty/javassist/lib/
   labs/jbossforums/branches/forums101P24/thirdparty/javassist/lib/javassist.jar
   labs/jbossforums/branches/forums101P24/thirdparty/jflex/
   labs/jbossforums/branches/forums101P24/thirdparty/jflex/component-info.xml
   labs/jbossforums/branches/forums101P24/thirdparty/jflex/lib/
   labs/jbossforums/branches/forums101P24/thirdparty/jflex/lib/jflex.jar
   labs/jbossforums/branches/forums101P24/thirdparty/sun-javacc/
   labs/jbossforums/branches/forums101P24/thirdparty/sun-javacc/component-info.xml
   labs/jbossforums/branches/forums101P24/thirdparty/sun-javacc/lib/
   labs/jbossforums/branches/forums101P24/thirdparty/sun-javacc/lib/JavaCC.zip
Removed:
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/AbstractParser.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEvent.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEventHandler.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEventNotifier.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/TextEvent.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/Token.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.flex
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/BBCodeParser.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/chars/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/chars/Chars.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/chars/MutableChars.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/CharacterEntityReferenceEvent.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/HTML4_0CharacterEntityReferenceParser.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/XML1_0CharacterEntityReferenceParser.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.flex
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/TagParser.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/linebreak/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/linebreak/LineBreakParser.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/AbstractRenderer.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/ToHTMLConfig.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/ToHTMLRenderer.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ASCII_CharStream.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/AbstractContext.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/BuildException.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ChildrenStrategy.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Context.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/DelegateContext.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ParseException.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Template.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.jj
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerConstants.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerTokenManager.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateBuilder.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateLoader.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateParser.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateRepository.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Token.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TokenMgrError.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/CLLoader.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/EntityTable.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/Loader.java
   labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/Stack.java
   labs/jbossforums/branches/forums101P24/thirdparty/dom4j/component-info.xml
   labs/jbossforums/branches/forums101P24/thirdparty/dom4j/lib/
   labs/jbossforums/branches/forums101P24/thirdparty/dom4j/lib/dom4j.jar
   labs/jbossforums/branches/forums101P24/thirdparty/javassist/component-info.xml
   labs/jbossforums/branches/forums101P24/thirdparty/javassist/lib/
   labs/jbossforums/branches/forums101P24/thirdparty/javassist/lib/javassist.jar
   labs/jbossforums/branches/forums101P24/thirdparty/jflex/component-info.xml
   labs/jbossforums/branches/forums101P24/thirdparty/jflex/lib/
   labs/jbossforums/branches/forums101P24/thirdparty/jflex/lib/jflex.jar
   labs/jbossforums/branches/forums101P24/thirdparty/sun-javacc/component-info.xml
   labs/jbossforums/branches/forums101P24/thirdparty/sun-javacc/lib/
   labs/jbossforums/branches/forums101P24/thirdparty/sun-javacc/lib/JavaCC.zip
Modified:
   labs/jbossforums/branches/forums101P24/forums/build.xml
   labs/jbossforums/branches/forums101P24/tools/etc/buildfragments/libraries.ent
Log:
[JBFORUMS-267] I've copied bbcode/html parsers from JBoss Portal codebase to Forums.

Modified: labs/jbossforums/branches/forums101P24/forums/build.xml
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/build.xml	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/build.xml	2007-11-24 23:20:48 UTC (rev 16782)
@@ -82,6 +82,9 @@
 			<path refid="jbportal.classpath"/>			
 	        <path refid="facelets.classpath"/>		
 		<path refid="rome.classpath"/>	
+			<path refid="jflex.jflex.classpath" />
+			<path refid="jboss.javassist.classpath" />
+			<path refid="dom4j.dom4j.classpath" />
 		</path>
 
       <!-- Configure modules -->
@@ -115,7 +118,31 @@
 
 	</target>
 
+   <target name="configure-jflex">
+           <taskdef name="jflex"
+                    classname="JFlex.anttask.JFlexTask"
+                    classpathref="jflex.jflex.classpath"/>
+   </target>
 
+
+   <target name="generate-parsers" depends="init">
+     <mkdir dir="${build.gen.classes}/org/jboss/portlet/forums/format/template"/>
+      <javacc
+         buildparser="true"
+         buildtokenmanager="true"
+         target="${source.java}/org/jboss/portlet/forums/format/template/TemplateAnalyzer.jj"
+         outputdirectory="${source.java}/org/jboss/portlet/forums/format/template"
+         javacchome="${sun.javacc.lib}"/>
+      <jflex
+         file="${source.java}/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.flex"
+         destdir="${source.java}">
+      </jflex>
+      <jflex
+         file="${source.java}/org/jboss/portlet/forums/format/parser/html/Analyzer.flex"
+         destdir="${source.java}">
+      </jflex>
+   </target>
+
    <!--+====================================================================+-->
    <!--| Compile                                                            |-->
    <!--|                                                                    |-->
@@ -124,7 +151,7 @@
    <!--| documentation compiles.                                            |-->
    <!--+====================================================================+-->
 
-   <target name="compile" description="Compile all source files." depends="generate-classes,
+   <target name="compile" description="Compile all source files." depends="generate-classes,generate-parsers,
                _default:compile-classes,
                _default:compile-etc,
                _default:compile-resources">

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format)

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser)

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/AbstractParser.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/AbstractParser.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/AbstractParser.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,47 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.parser;
-
-
-/**
- * This is an abstract parser. All the parsed events will go though the event notifier interface.
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public abstract class AbstractParser implements ParseEventNotifier
-{
-
-   /** The event handler. */
-   protected ParseEventHandler handler;
-
-   /** Set the event handler on this parser. */
-   public void setHandler(ParseEventHandler handler)
-   {
-      this.handler = handler;
-   }
-
-   /** Ask the parser to its job. */
-   public abstract void parse(char[] chars, int offset, int length);
-
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/AbstractParser.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/AbstractParser.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/AbstractParser.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/AbstractParser.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.parser;
+
+
+/**
+ * This is an abstract parser. All the parsed events will go though the event notifier interface.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public abstract class AbstractParser implements ParseEventNotifier
+{
+
+   /** The event handler. */
+   protected ParseEventHandler handler;
+
+   /** Set the event handler on this parser. */
+   public void setHandler(ParseEventHandler handler)
+   {
+      this.handler = handler;
+   }
+
+   /** Ask the parser to its job. */
+   public abstract void parse(char[] chars, int offset, int length);
+
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEvent.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEvent.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEvent.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,28 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.parser;
-
-/** An event that is emmited by ParseEventNotifier implementations. */
-public interface ParseEvent
-{
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEvent.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEvent.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEvent.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEvent.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,28 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.parser;
+
+/** An event that is emmited by ParseEventNotifier implementations. */
+public interface ParseEvent
+{
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEventHandler.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEventHandler.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEventHandler.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,30 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.parser;
-
-
-/** Implementors want to receive events produced by a parser. */
-public interface ParseEventHandler
-{
-   void handle(ParseEvent event);
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEventHandler.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEventHandler.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEventHandler.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEventHandler.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,30 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.parser;
+
+
+/** Implementors want to receive events produced by a parser. */
+public interface ParseEventHandler
+{
+   void handle(ParseEvent event);
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEventNotifier.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEventNotifier.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEventNotifier.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,30 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.parser;
-
-
-/** Implemented by any class that wants to generate parsing events. */
-public interface ParseEventNotifier
-{
-   void setHandler(ParseEventHandler handler);
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEventNotifier.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEventNotifier.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEventNotifier.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/ParseEventNotifier.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,30 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.parser;
+
+
+/** Implemented by any class that wants to generate parsing events. */
+public interface ParseEventNotifier
+{
+   void setHandler(ParseEventHandler handler);
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/TextEvent.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/TextEvent.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/TextEvent.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,60 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.parser;
-
-
-/** An event implementation that says there is some text to handle. */
-public class TextEvent implements ParseEvent
-{
-
-   protected char[] chars = null;
-   protected int offset = -1;
-   protected int length = -1;
-
-   public void setText(char[] chars, int offset, int length)
-   {
-      this.chars = chars;
-      this.offset = offset;
-      this.length = length;
-   }
-
-   public char[] chars()
-   {
-      return chars;
-   }
-
-   public int offset()
-   {
-      return offset;
-   }
-
-   public int length()
-   {
-      return length;
-   }
-
-   public String toString()
-   {
-      return "text:" + new String(chars, offset, length);
-   }
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/TextEvent.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/TextEvent.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/TextEvent.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/TextEvent.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.parser;
+
+
+/** An event implementation that says there is some text to handle. */
+public class TextEvent implements ParseEvent
+{
+
+   protected char[] chars = null;
+   protected int offset = -1;
+   protected int length = -1;
+
+   public void setText(char[] chars, int offset, int length)
+   {
+      this.chars = chars;
+      this.offset = offset;
+      this.length = length;
+   }
+
+   public char[] chars()
+   {
+      return chars;
+   }
+
+   public int offset()
+   {
+      return offset;
+   }
+
+   public int length()
+   {
+      return length;
+   }
+
+   public String toString()
+   {
+      return "text:" + new String(chars, offset, length);
+   }
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/Token.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/Token.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/Token.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,38 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.parser;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class Token
-{
-   public int type = -1;
-   public String value = null;
-
-   public String toString()
-   {
-      return type + " " + value;
-   }
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/Token.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/Token.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/Token.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/Token.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.parser;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class Token
+{
+   public int type = -1;
+   public String value = null;
+
+   public String toString()
+   {
+      return type + " " + value;
+   }
+}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode)

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.flex
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.flex	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.flex	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,111 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.portlet.forums.format.parser.bbcode;
-
-import java.io.CharArrayReader;
-import org.jboss.portlet.forums.format.parser.Token;;
-
-%%
-
-%unicode
-%public
-%class Analyzer
-%type Token
-
-%{
-
-public static final int OPEN_B = 0;
-public static final int CLOSE_B = 1;
-public static final int OPEN_I = 2;
-public static final int CLOSE_I = 3;
-public static final int OPEN_U = 4;
-public static final int CLOSE_U = 5;
-public static final int OPEN_COLOR = 6;
-public static final int CLOSE_COLOR = 7;
-public static final int OPEN_SIZE = 8;
-public static final int CLOSE_SIZE = 9;
-public static final int OPEN_QUOTE_ANONYMOUS = 10;
-public static final int OPEN_QUOTE = 11;
-public static final int CLOSE_QUOTE = 12;
-public static final int OPEN_CODE = 13;
-public static final int CLOSE_CODE = 14;
-public static final int OPEN_LIST_UNORDERED = 15;
-public static final int OPEN_LIST_ORDERED_NUMERICAL = 16;
-public static final int OPEN_LIST_ORDERED_ALPHABETICAL = 17;
-public static final int CLOSE_LIST = 18;
-public static final int LIST_ITEM = 19;
-public static final int LINK = 20;
-public static final int TEXT = 21;
-
-private static final int FROM_1 = "[url".length();
-private static final int FROM_2 = "[url=".length();
-private static final int DELTA = "[/url]".length();
-
-public void reset(char[] chars, int off, int len)
-{
-   yyreset(new CharArrayReader(chars, off, len));
-}
-
-public Token next()
-{
-   try { return yylex(); }
-   catch(java.io.IOException e) { e.printStackTrace(); return null; }
-}
-
-private Token token = new Token();
-
-private Token token(int type, String value)
-{
-   token.type = type;
-   token.value = value;
-   return token;
-}
-
-%}
-
-%%
-
-<YYINITIAL>
-{
-   "[b]" { return token(OPEN_B, null); }
-   "[/b]" { return token(CLOSE_B, null); }
-   "[i]" { return token(OPEN_I, null); }
-   "[/i]" { return token(CLOSE_I, null); }
-   "[u]" { return token(OPEN_U, null); }
-   "[/u]" { return token(CLOSE_U, null); }
-   "[color="(([A-Za-z]+)|("#"[0-9A-Fa-f]{6}))"]" { return token(OPEN_COLOR, yytext().substring(7, yytext().length() - 1)); }
-   "[/color]" { return token(CLOSE_COLOR, null); }
-   "[size="[0-9]{1,2}"]" { return token(OPEN_SIZE, yytext().substring(6, yytext().length() - 1)); }
-   "[/size]" { return token(CLOSE_SIZE, null); }
-   "[quote]" { return token(OPEN_QUOTE_ANONYMOUS, null); }
-   "[quote="~["]"] { return token(OPEN_QUOTE, yytext().substring(7, yytext().length() - 1)); }
-   "[/quote]" { return token(CLOSE_QUOTE, null); }
-   "[code]" { return token(OPEN_CODE, null); }
-   "[/code]" { return token(CLOSE_CODE, null); }
-   "[list]" { return token(OPEN_LIST_UNORDERED, null); }
-   "[list=1]" { return token(OPEN_LIST_ORDERED_NUMERICAL, null); }
-   "[list=a]" { return token(OPEN_LIST_ORDERED_ALPHABETICAL, null); }
-   "[/list]" { return token(CLOSE_LIST, null); }
-   "[*]" { return token(LIST_ITEM, null); }
-   "[url"~["]"]~["["]"/url]" { return token(LINK, yytext().substring(4, yytext().length() - 6)); }
-   .|\n { return token(TEXT, yytext()); }
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.flex (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.flex)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.flex	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.flex	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,111 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portlet.forums.format.parser.bbcode;
+
+import java.io.CharArrayReader;
+import org.jboss.portlet.forums.format.parser.Token;;
+
+%%
+
+%unicode
+%public
+%class Analyzer
+%type Token
+
+%{
+
+public static final int OPEN_B = 0;
+public static final int CLOSE_B = 1;
+public static final int OPEN_I = 2;
+public static final int CLOSE_I = 3;
+public static final int OPEN_U = 4;
+public static final int CLOSE_U = 5;
+public static final int OPEN_COLOR = 6;
+public static final int CLOSE_COLOR = 7;
+public static final int OPEN_SIZE = 8;
+public static final int CLOSE_SIZE = 9;
+public static final int OPEN_QUOTE_ANONYMOUS = 10;
+public static final int OPEN_QUOTE = 11;
+public static final int CLOSE_QUOTE = 12;
+public static final int OPEN_CODE = 13;
+public static final int CLOSE_CODE = 14;
+public static final int OPEN_LIST_UNORDERED = 15;
+public static final int OPEN_LIST_ORDERED_NUMERICAL = 16;
+public static final int OPEN_LIST_ORDERED_ALPHABETICAL = 17;
+public static final int CLOSE_LIST = 18;
+public static final int LIST_ITEM = 19;
+public static final int LINK = 20;
+public static final int TEXT = 21;
+
+private static final int FROM_1 = "[url".length();
+private static final int FROM_2 = "[url=".length();
+private static final int DELTA = "[/url]".length();
+
+public void reset(char[] chars, int off, int len)
+{
+   yyreset(new CharArrayReader(chars, off, len));
+}
+
+public Token next()
+{
+   try { return yylex(); }
+   catch(java.io.IOException e) { e.printStackTrace(); return null; }
+}
+
+private Token token = new Token();
+
+private Token token(int type, String value)
+{
+   token.type = type;
+   token.value = value;
+   return token;
+}
+
+%}
+
+%%
+
+<YYINITIAL>
+{
+   "[b]" { return token(OPEN_B, null); }
+   "[/b]" { return token(CLOSE_B, null); }
+   "[i]" { return token(OPEN_I, null); }
+   "[/i]" { return token(CLOSE_I, null); }
+   "[u]" { return token(OPEN_U, null); }
+   "[/u]" { return token(CLOSE_U, null); }
+   "[color="(([A-Za-z]+)|("#"[0-9A-Fa-f]{6}))"]" { return token(OPEN_COLOR, yytext().substring(7, yytext().length() - 1)); }
+   "[/color]" { return token(CLOSE_COLOR, null); }
+   "[size="[0-9]{1,2}"]" { return token(OPEN_SIZE, yytext().substring(6, yytext().length() - 1)); }
+   "[/size]" { return token(CLOSE_SIZE, null); }
+   "[quote]" { return token(OPEN_QUOTE_ANONYMOUS, null); }
+   "[quote="~["]"] { return token(OPEN_QUOTE, yytext().substring(7, yytext().length() - 1)); }
+   "[/quote]" { return token(CLOSE_QUOTE, null); }
+   "[code]" { return token(OPEN_CODE, null); }
+   "[/code]" { return token(CLOSE_CODE, null); }
+   "[list]" { return token(OPEN_LIST_UNORDERED, null); }
+   "[list=1]" { return token(OPEN_LIST_ORDERED_NUMERICAL, null); }
+   "[list=a]" { return token(OPEN_LIST_ORDERED_ALPHABETICAL, null); }
+   "[/list]" { return token(CLOSE_LIST, null); }
+   "[*]" { return token(LIST_ITEM, null); }
+   "[url"~["]"]~["["]"/url]" { return token(LINK, yytext().substring(4, yytext().length() - 6)); }
+   .|\n { return token(TEXT, yytext()); }
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,722 +0,0 @@
-/* The following code was generated by JFlex 1.4.1 on 24.11.07 23:16 */
-
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.portlet.forums.format.parser.bbcode;
-
-import java.io.CharArrayReader;
-import org.jboss.portlet.forums.format.parser.Token;;
-
-
-/**
- * This class is a scanner generated by 
- * <a href="http://www.jflex.de/">JFlex</a> 1.4.1
- * on 24.11.07 23:16 from the specification file
- * <tt>/Users/rysiek/Work/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.flex</tt>
- */
-public class Analyzer {
-
-  /** This character denotes the end of file */
-  public static final int YYEOF = -1;
-
-  /** initial size of the lookahead buffer */
-  private static final int ZZ_BUFFERSIZE = 16384;
-
-  /** lexical states */
-  public static final int YYINITIAL = 0;
-
-  /** 
-   * Translates characters to character classes
-   */
-  private static final String ZZ_CMAP_PACKED = 
-    "\12\0\1\0\30\0\1\15\6\0\1\30\4\0\1\4\1\16\1\26"+
-    "\10\16\3\0\1\13\3\0\6\17\24\14\1\1\1\0\1\3\3\0"+
-    "\1\27\1\2\1\7\1\25\1\22\1\17\2\14\1\5\2\14\1\11"+
-    "\2\14\1\10\1\14\1\23\1\12\1\20\1\24\1\6\4\14\1\21"+
-    "\uff85\0";
-
-  /** 
-   * Translates characters to character classes
-   */
-  private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
-
-  /** 
-   * Translates DFA states to action switch labels.
-   */
-  private static final int [] ZZ_ACTION = zzUnpackAction();
-
-  private static final String ZZ_ACTION_PACKED_0 =
-    "\1\0\2\1\11\0\1\2\7\0\1\3\1\4\5\0"+
-    "\1\5\1\6\1\7\1\10\34\0\1\11\1\12\4\0"+
-    "\1\13\1\14\1\15\6\0\1\16\1\0\1\17\1\20"+
-    "\3\0\1\21\1\22\1\23\1\0\1\24\1\0\1\25"+
-    "\3\0\1\26\4\0";
-
-  private static int [] zzUnpackAction() {
-    int [] result = new int[96];
-    int offset = 0;
-    offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
-    return result;
-  }
-
-  private static int zzUnpackAction(String packed, int offset, int [] result) {
-    int i = 0;       /* index in packed string  */
-    int j = offset;  /* index in unpacked array */
-    int l = packed.length();
-    while (i < l) {
-      int count = packed.charAt(i++);
-      int value = packed.charAt(i++);
-      do result[j++] = value; while (--count > 0);
-    }
-    return j;
-  }
-
-
-  /** 
-   * Translates a state to a row index in the transition table
-   */
-  private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
-
-  private static final String ZZ_ROWMAP_PACKED_0 =
-    "\0\0\0\31\0\62\0\113\0\144\0\175\0\226\0\257"+
-    "\0\310\0\341\0\372\0\u0113\0\31\0\u012c\0\u0145\0\u015e"+
-    "\0\u0177\0\u0190\0\u01a9\0\u01c2\0\31\0\31\0\u01db\0\u01f4"+
-    "\0\u020d\0\u0226\0\u023f\0\31\0\31\0\31\0\31\0\u0258"+
-    "\0\u0271\0\u028a\0\u02a3\0\u02bc\0\u02d5\0\u02ee\0\u0307\0\u0320"+
-    "\0\u0339\0\u0352\0\u036b\0\u0384\0\u039d\0\u03b6\0\u03cf\0\u03e8"+
-    "\0\u0401\0\u041a\0\u0433\0\u044c\0\u0465\0\u047e\0\u0497\0\u04b0"+
-    "\0\u04c9\0\u04e2\0\u04fb\0\31\0\31\0\u0514\0\u052d\0\u0546"+
-    "\0\u055f\0\31\0\31\0\31\0\u0578\0\u0591\0\u05aa\0\u05c3"+
-    "\0\u05dc\0\u05f5\0\31\0\u060e\0\31\0\31\0\u0627\0\u0640"+
-    "\0\u0659\0\31\0\31\0\31\0\u0672\0\31\0\u068b\0\31"+
-    "\0\u06a4\0\u06bd\0\u06d6\0\31\0\u06ef\0\u0708\0\u0721\0\u073a";
-
-  private static int [] zzUnpackRowMap() {
-    int [] result = new int[96];
-    int offset = 0;
-    offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
-    return result;
-  }
-
-  private static int zzUnpackRowMap(String packed, int offset, int [] result) {
-    int i = 0;  /* index in packed string  */
-    int j = offset;  /* index in unpacked array */
-    int l = packed.length();
-    while (i < l) {
-      int high = packed.charAt(i++) << 16;
-      result[j++] = high | packed.charAt(i++);
-    }
-    return j;
-  }
-
-  /** 
-   * The transition table of the DFA
-   */
-  private static final int [] ZZ_TRANS = zzUnpackTrans();
-
-  private static final String ZZ_TRANS_PACKED_0 =
-    "\1\2\1\3\27\2\33\0\1\4\1\0\1\5\1\6"+
-    "\1\7\1\10\1\0\1\11\6\0\1\12\2\0\1\13"+
-    "\4\0\1\14\3\0\1\15\27\0\1\16\2\0\1\17"+
-    "\1\20\1\21\1\0\1\22\6\0\1\23\2\0\1\24"+
-    "\10\0\1\25\30\0\1\26\6\0\1\27\26\0\1\30"+
-    "\25\0\1\31\30\0\1\32\31\0\1\33\25\0\1\34"+
-    "\30\0\1\35\30\0\1\36\30\0\1\37\35\0\1\40"+
-    "\25\0\1\41\30\0\1\42\31\0\1\43\33\0\1\44"+
-    "\30\0\1\45\13\0\1\46\23\0\1\47\31\0\1\50"+
-    "\17\0\1\51\31\0\1\52\13\0\1\53\23\0\1\54"+
-    "\31\0\1\55\17\0\1\56\20\0\3\44\1\57\25\44"+
-    "\10\0\1\60\42\0\1\61\32\0\1\62\26\0\1\63"+
-    "\32\0\1\64\14\0\1\65\42\0\1\66\32\0\1\67"+
-    "\26\0\1\70\32\0\1\71\4\0\1\57\1\72\27\57"+
-    "\12\0\1\73\21\0\1\74\30\0\1\75\7\0\1\76"+
-    "\30\0\1\77\37\0\1\100\20\0\1\101\21\0\1\102"+
-    "\30\0\1\103\30\0\1\104\47\0\1\105\12\0\1\106"+
-    "\37\0\1\107\43\0\1\110\1\111\17\0\1\112\7\0"+
-    "\1\112\5\0\1\113\7\0\1\114\20\0\1\115\30\0"+
-    "\1\116\33\0\1\117\24\0\1\120\2\0\6\120\1\0"+
-    "\1\120\1\121\1\0\7\120\1\0\1\120\4\0\1\122"+
-    "\30\0\1\123\30\0\1\124\12\0\1\125\7\0\1\125"+
-    "\2\0\3\114\1\126\25\114\12\0\1\127\20\0\1\120"+
-    "\1\130\1\0\6\120\1\0\1\120\2\0\7\120\1\0"+
-    "\1\120\3\0\1\131\4\0\1\131\6\0\2\131\2\0"+
-    "\1\131\2\0\3\131\4\0\1\124\36\0\1\132\21\0"+
-    "\1\133\4\0\1\133\6\0\2\133\2\0\1\133\2\0"+
-    "\3\133\4\0\1\134\27\0\1\135\4\0\1\135\6\0"+
-    "\2\135\2\0\1\135\2\0\3\135\3\0\1\136\4\0"+
-    "\1\136\6\0\2\136\2\0\1\136\2\0\3\136\3\0"+
-    "\1\137\4\0\1\137\6\0\2\137\2\0\1\137\2\0"+
-    "\3\137\3\0\1\140\4\0\1\140\6\0\2\140\2\0"+
-    "\1\140\2\0\3\140\4\0\1\130\25\0";
-
-  private static int [] zzUnpackTrans() {
-    int [] result = new int[1875];
-    int offset = 0;
-    offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
-    return result;
-  }
-
-  private static int zzUnpackTrans(String packed, int offset, int [] result) {
-    int i = 0;       /* index in packed string  */
-    int j = offset;  /* index in unpacked array */
-    int l = packed.length();
-    while (i < l) {
-      int count = packed.charAt(i++);
-      int value = packed.charAt(i++);
-      value--;
-      do result[j++] = value; while (--count > 0);
-    }
-    return j;
-  }
-
-
-  /* error codes */
-  private static final int ZZ_UNKNOWN_ERROR = 0;
-  private static final int ZZ_NO_MATCH = 1;
-  private static final int ZZ_PUSHBACK_2BIG = 2;
-
-  /* error messages for the codes above */
-  private static final String ZZ_ERROR_MSG[] = {
-    "Unkown internal scanner error",
-    "Error: could not match input",
-    "Error: pushback value was too large"
-  };
-
-  /**
-   * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
-   */
-  private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
-
-  private static final String ZZ_ATTRIBUTE_PACKED_0 =
-    "\1\0\1\11\1\1\11\0\1\11\7\0\2\11\5\0"+
-    "\4\11\34\0\2\11\4\0\3\11\6\0\1\11\1\0"+
-    "\2\11\3\0\3\11\1\0\1\11\1\0\1\11\3\0"+
-    "\1\11\4\0";
-
-  private static int [] zzUnpackAttribute() {
-    int [] result = new int[96];
-    int offset = 0;
-    offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
-    return result;
-  }
-
-  private static int zzUnpackAttribute(String packed, int offset, int [] result) {
-    int i = 0;       /* index in packed string  */
-    int j = offset;  /* index in unpacked array */
-    int l = packed.length();
-    while (i < l) {
-      int count = packed.charAt(i++);
-      int value = packed.charAt(i++);
-      do result[j++] = value; while (--count > 0);
-    }
-    return j;
-  }
-
-  /** the input device */
-  private java.io.Reader zzReader;
-
-  /** the current state of the DFA */
-  private int zzState;
-
-  /** the current lexical state */
-  private int zzLexicalState = YYINITIAL;
-
-  /** this buffer contains the current text to be matched and is
-      the source of the yytext() string */
-  private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
-
-  /** the textposition at the last accepting state */
-  private int zzMarkedPos;
-
-  /** the textposition at the last state to be included in yytext */
-  private int zzPushbackPos;
-
-  /** the current text position in the buffer */
-  private int zzCurrentPos;
-
-  /** startRead marks the beginning of the yytext() string in the buffer */
-  private int zzStartRead;
-
-  /** endRead marks the last character in the buffer, that has been read
-      from input */
-  private int zzEndRead;
-
-  /** number of newlines encountered up to the start of the matched text */
-  private int yyline;
-
-  /** the number of characters up to the start of the matched text */
-  private int yychar;
-
-  /**
-   * the number of characters from the last newline up to the start of the 
-   * matched text
-   */
-  private int yycolumn;
-
-  /** 
-   * zzAtBOL == true <=> the scanner is currently at the beginning of a line
-   */
-  private boolean zzAtBOL = true;
-
-  /** zzAtEOF == true <=> the scanner is at the EOF */
-  private boolean zzAtEOF;
-
-  /* user code: */
-
-public static final int OPEN_B = 0;
-public static final int CLOSE_B = 1;
-public static final int OPEN_I = 2;
-public static final int CLOSE_I = 3;
-public static final int OPEN_U = 4;
-public static final int CLOSE_U = 5;
-public static final int OPEN_COLOR = 6;
-public static final int CLOSE_COLOR = 7;
-public static final int OPEN_SIZE = 8;
-public static final int CLOSE_SIZE = 9;
-public static final int OPEN_QUOTE_ANONYMOUS = 10;
-public static final int OPEN_QUOTE = 11;
-public static final int CLOSE_QUOTE = 12;
-public static final int OPEN_CODE = 13;
-public static final int CLOSE_CODE = 14;
-public static final int OPEN_LIST_UNORDERED = 15;
-public static final int OPEN_LIST_ORDERED_NUMERICAL = 16;
-public static final int OPEN_LIST_ORDERED_ALPHABETICAL = 17;
-public static final int CLOSE_LIST = 18;
-public static final int LIST_ITEM = 19;
-public static final int LINK = 20;
-public static final int TEXT = 21;
-
-private static final int FROM_1 = "[url".length();
-private static final int FROM_2 = "[url=".length();
-private static final int DELTA = "[/url]".length();
-
-public void reset(char[] chars, int off, int len)
-{
-   yyreset(new CharArrayReader(chars, off, len));
-}
-
-public Token next()
-{
-   try { return yylex(); }
-   catch(java.io.IOException e) { e.printStackTrace(); return null; }
-}
-
-private Token token = new Token();
-
-private Token token(int type, String value)
-{
-   token.type = type;
-   token.value = value;
-   return token;
-}
-
-
-
-  /**
-   * Creates a new scanner
-   * There is also a java.io.InputStream version of this constructor.
-   *
-   * @param   in  the java.io.Reader to read input from.
-   */
-  public Analyzer(java.io.Reader in) {
-    this.zzReader = in;
-  }
-
-  /**
-   * Creates a new scanner.
-   * There is also java.io.Reader version of this constructor.
-   *
-   * @param   in  the java.io.Inputstream to read input from.
-   */
-  public Analyzer(java.io.InputStream in) {
-    this(new java.io.InputStreamReader(in));
-  }
-
-  /** 
-   * Unpacks the compressed character translation table.
-   *
-   * @param packed   the packed character translation table
-   * @return         the unpacked character translation table
-   */
-  private static char [] zzUnpackCMap(String packed) {
-    char [] map = new char[0x10000];
-    int i = 0;  /* index in packed string  */
-    int j = 0;  /* index in unpacked array */
-    while (i < 82) {
-      int  count = packed.charAt(i++);
-      char value = packed.charAt(i++);
-      do map[j++] = value; while (--count > 0);
-    }
-    return map;
-  }
-
-
-  /**
-   * Refills the input buffer.
-   *
-   * @return      <code>false</code>, iff there was new input.
-   * 
-   * @exception   java.io.IOException  if any I/O-Error occurs
-   */
-  private boolean zzRefill() throws java.io.IOException {
-
-    /* first: make room (if you can) */
-    if (zzStartRead > 0) {
-      System.arraycopy(zzBuffer, zzStartRead,
-                       zzBuffer, 0,
-                       zzEndRead-zzStartRead);
-
-      /* translate stored positions */
-      zzEndRead-= zzStartRead;
-      zzCurrentPos-= zzStartRead;
-      zzMarkedPos-= zzStartRead;
-      zzPushbackPos-= zzStartRead;
-      zzStartRead = 0;
-    }
-
-    /* is the buffer big enough? */
-    if (zzCurrentPos >= zzBuffer.length) {
-      /* if not: blow it up */
-      char newBuffer[] = new char[zzCurrentPos*2];
-      System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
-      zzBuffer = newBuffer;
-    }
-
-    /* finally: fill the buffer with new input */
-    int numRead = zzReader.read(zzBuffer, zzEndRead,
-                                            zzBuffer.length-zzEndRead);
-
-    if (numRead < 0) {
-      return true;
-    }
-    else {
-      zzEndRead+= numRead;
-      return false;
-    }
-  }
-
-    
-  /**
-   * Closes the input stream.
-   */
-  public final void yyclose() throws java.io.IOException {
-    zzAtEOF = true;            /* indicate end of file */
-    zzEndRead = zzStartRead;  /* invalidate buffer    */
-
-    if (zzReader != null)
-      zzReader.close();
-  }
-
-
-  /**
-   * Resets the scanner to read from a new input stream.
-   * Does not close the old reader.
-   *
-   * All internal variables are reset, the old input stream 
-   * <b>cannot</b> be reused (internal buffer is discarded and lost).
-   * Lexical state is set to <tt>ZZ_INITIAL</tt>.
-   *
-   * @param reader   the new input stream 
-   */
-  public final void yyreset(java.io.Reader reader) {
-    zzReader = reader;
-    zzAtBOL  = true;
-    zzAtEOF  = false;
-    zzEndRead = zzStartRead = 0;
-    zzCurrentPos = zzMarkedPos = zzPushbackPos = 0;
-    yyline = yychar = yycolumn = 0;
-    zzLexicalState = YYINITIAL;
-  }
-
-
-  /**
-   * Returns the current lexical state.
-   */
-  public final int yystate() {
-    return zzLexicalState;
-  }
-
-
-  /**
-   * Enters a new lexical state
-   *
-   * @param newState the new lexical state
-   */
-  public final void yybegin(int newState) {
-    zzLexicalState = newState;
-  }
-
-
-  /**
-   * Returns the text matched by the current regular expression.
-   */
-  public final String yytext() {
-    return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
-  }
-
-
-  /**
-   * Returns the character at position <tt>pos</tt> from the 
-   * matched text. 
-   * 
-   * It is equivalent to yytext().charAt(pos), but faster
-   *
-   * @param pos the position of the character to fetch. 
-   *            A value from 0 to yylength()-1.
-   *
-   * @return the character at position pos
-   */
-  public final char yycharat(int pos) {
-    return zzBuffer[zzStartRead+pos];
-  }
-
-
-  /**
-   * Returns the length of the matched text region.
-   */
-  public final int yylength() {
-    return zzMarkedPos-zzStartRead;
-  }
-
-
-  /**
-   * Reports an error that occured while scanning.
-   *
-   * In a wellformed scanner (no or only correct usage of 
-   * yypushback(int) and a match-all fallback rule) this method 
-   * will only be called with things that "Can't Possibly Happen".
-   * If this method is called, something is seriously wrong
-   * (e.g. a JFlex bug producing a faulty scanner etc.).
-   *
-   * Usual syntax/scanner level error handling should be done
-   * in error fallback rules.
-   *
-   * @param   errorCode  the code of the errormessage to display
-   */
-  private void zzScanError(int errorCode) {
-    String message;
-    try {
-      message = ZZ_ERROR_MSG[errorCode];
-    }
-    catch (ArrayIndexOutOfBoundsException e) {
-      message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
-    }
-
-    throw new Error(message);
-  } 
-
-
-  /**
-   * Pushes the specified amount of characters back into the input stream.
-   *
-   * They will be read again by then next call of the scanning method
-   *
-   * @param number  the number of characters to be read again.
-   *                This number must not be greater than yylength()!
-   */
-  public void yypushback(int number)  {
-    if ( number > yylength() )
-      zzScanError(ZZ_PUSHBACK_2BIG);
-
-    zzMarkedPos -= number;
-  }
-
-
-  /**
-   * Resumes scanning until the next regular expression is matched,
-   * the end of input is encountered or an I/O-Error occurs.
-   *
-   * @return      the next token
-   * @exception   java.io.IOException  if any I/O-Error occurs
-   */
-  public Token yylex() throws java.io.IOException {
-    int zzInput;
-    int zzAction;
-
-    // cached fields:
-    int zzCurrentPosL;
-    int zzMarkedPosL;
-    int zzEndReadL = zzEndRead;
-    char [] zzBufferL = zzBuffer;
-    char [] zzCMapL = ZZ_CMAP;
-
-    int [] zzTransL = ZZ_TRANS;
-    int [] zzRowMapL = ZZ_ROWMAP;
-    int [] zzAttrL = ZZ_ATTRIBUTE;
-
-    while (true) {
-      zzMarkedPosL = zzMarkedPos;
-
-      zzAction = -1;
-
-      zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
-  
-      zzState = zzLexicalState;
-
-
-      zzForAction: {
-        while (true) {
-    
-          if (zzCurrentPosL < zzEndReadL)
-            zzInput = zzBufferL[zzCurrentPosL++];
-          else if (zzAtEOF) {
-            zzInput = YYEOF;
-            break zzForAction;
-          }
-          else {
-            // store back cached positions
-            zzCurrentPos  = zzCurrentPosL;
-            zzMarkedPos   = zzMarkedPosL;
-            boolean eof = zzRefill();
-            // get translated positions and possibly new buffer
-            zzCurrentPosL  = zzCurrentPos;
-            zzMarkedPosL   = zzMarkedPos;
-            zzBufferL      = zzBuffer;
-            zzEndReadL     = zzEndRead;
-            if (eof) {
-              zzInput = YYEOF;
-              break zzForAction;
-            }
-            else {
-              zzInput = zzBufferL[zzCurrentPosL++];
-            }
-          }
-          int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
-          if (zzNext == -1) break zzForAction;
-          zzState = zzNext;
-
-          int zzAttributes = zzAttrL[zzState];
-          if ( (zzAttributes & 1) == 1 ) {
-            zzAction = zzState;
-            zzMarkedPosL = zzCurrentPosL;
-            if ( (zzAttributes & 8) == 8 ) break zzForAction;
-          }
-
-        }
-      }
-
-      // store back cached position
-      zzMarkedPos = zzMarkedPosL;
-
-      switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
-        case 1: 
-          { return token(TEXT, yytext());
-          }
-        case 23: break;
-        case 16: 
-          { return token(CLOSE_QUOTE, null);
-          }
-        case 24: break;
-        case 10: 
-          { return token(OPEN_LIST_UNORDERED, null);
-          }
-        case 25: break;
-        case 18: 
-          { return token(OPEN_LIST_ORDERED_ALPHABETICAL, null);
-          }
-        case 26: break;
-        case 11: 
-          { return token(CLOSE_CODE, null);
-          }
-        case 27: break;
-        case 4: 
-          { return token(OPEN_U, null);
-          }
-        case 28: break;
-        case 7: 
-          { return token(CLOSE_I, null);
-          }
-        case 29: break;
-        case 14: 
-          { return token(OPEN_QUOTE_ANONYMOUS, null);
-          }
-        case 30: break;
-        case 12: 
-          { return token(CLOSE_LIST, null);
-          }
-        case 31: break;
-        case 3: 
-          { return token(OPEN_I, null);
-          }
-        case 32: break;
-        case 20: 
-          { return token(OPEN_QUOTE, yytext().substring(7, yytext().length() - 1));
-          }
-        case 33: break;
-        case 19: 
-          { return token(OPEN_SIZE, yytext().substring(6, yytext().length() - 1));
-          }
-        case 34: break;
-        case 2: 
-          { return token(OPEN_B, null);
-          }
-        case 35: break;
-        case 21: 
-          { return token(OPEN_COLOR, yytext().substring(7, yytext().length() - 1));
-          }
-        case 36: break;
-        case 8: 
-          { return token(CLOSE_U, null);
-          }
-        case 37: break;
-        case 22: 
-          { return token(LINK, yytext().substring(4, yytext().length() - 6));
-          }
-        case 38: break;
-        case 15: 
-          { return token(CLOSE_COLOR, null);
-          }
-        case 39: break;
-        case 13: 
-          { return token(CLOSE_SIZE, null);
-          }
-        case 40: break;
-        case 17: 
-          { return token(OPEN_LIST_ORDERED_NUMERICAL, null);
-          }
-        case 41: break;
-        case 5: 
-          { return token(LIST_ITEM, null);
-          }
-        case 42: break;
-        case 9: 
-          { return token(OPEN_CODE, null);
-          }
-        case 43: break;
-        case 6: 
-          { return token(CLOSE_B, null);
-          }
-        case 44: break;
-        default: 
-          if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
-            zzAtEOF = true;
-            return null;
-          } 
-          else {
-            zzScanError(ZZ_NO_MATCH);
-          }
-      }
-    }
-  }
-
-
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,722 @@
+/* The following code was generated by JFlex 1.4.1 on 24.11.07 23:16 */
+
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portlet.forums.format.parser.bbcode;
+
+import java.io.CharArrayReader;
+import org.jboss.portlet.forums.format.parser.Token;;
+
+
+/**
+ * This class is a scanner generated by 
+ * <a href="http://www.jflex.de/">JFlex</a> 1.4.1
+ * on 24.11.07 23:16 from the specification file
+ * <tt>/Users/rysiek/Work/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/Analyzer.flex</tt>
+ */
+public class Analyzer {
+
+  /** This character denotes the end of file */
+  public static final int YYEOF = -1;
+
+  /** initial size of the lookahead buffer */
+  private static final int ZZ_BUFFERSIZE = 16384;
+
+  /** lexical states */
+  public static final int YYINITIAL = 0;
+
+  /** 
+   * Translates characters to character classes
+   */
+  private static final String ZZ_CMAP_PACKED = 
+    "\12\0\1\0\30\0\1\15\6\0\1\30\4\0\1\4\1\16\1\26"+
+    "\10\16\3\0\1\13\3\0\6\17\24\14\1\1\1\0\1\3\3\0"+
+    "\1\27\1\2\1\7\1\25\1\22\1\17\2\14\1\5\2\14\1\11"+
+    "\2\14\1\10\1\14\1\23\1\12\1\20\1\24\1\6\4\14\1\21"+
+    "\uff85\0";
+
+  /** 
+   * Translates characters to character classes
+   */
+  private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
+
+  /** 
+   * Translates DFA states to action switch labels.
+   */
+  private static final int [] ZZ_ACTION = zzUnpackAction();
+
+  private static final String ZZ_ACTION_PACKED_0 =
+    "\1\0\2\1\11\0\1\2\7\0\1\3\1\4\5\0"+
+    "\1\5\1\6\1\7\1\10\34\0\1\11\1\12\4\0"+
+    "\1\13\1\14\1\15\6\0\1\16\1\0\1\17\1\20"+
+    "\3\0\1\21\1\22\1\23\1\0\1\24\1\0\1\25"+
+    "\3\0\1\26\4\0";
+
+  private static int [] zzUnpackAction() {
+    int [] result = new int[96];
+    int offset = 0;
+    offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
+    return result;
+  }
+
+  private static int zzUnpackAction(String packed, int offset, int [] result) {
+    int i = 0;       /* index in packed string  */
+    int j = offset;  /* index in unpacked array */
+    int l = packed.length();
+    while (i < l) {
+      int count = packed.charAt(i++);
+      int value = packed.charAt(i++);
+      do result[j++] = value; while (--count > 0);
+    }
+    return j;
+  }
+
+
+  /** 
+   * Translates a state to a row index in the transition table
+   */
+  private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
+
+  private static final String ZZ_ROWMAP_PACKED_0 =
+    "\0\0\0\31\0\62\0\113\0\144\0\175\0\226\0\257"+
+    "\0\310\0\341\0\372\0\u0113\0\31\0\u012c\0\u0145\0\u015e"+
+    "\0\u0177\0\u0190\0\u01a9\0\u01c2\0\31\0\31\0\u01db\0\u01f4"+
+    "\0\u020d\0\u0226\0\u023f\0\31\0\31\0\31\0\31\0\u0258"+
+    "\0\u0271\0\u028a\0\u02a3\0\u02bc\0\u02d5\0\u02ee\0\u0307\0\u0320"+
+    "\0\u0339\0\u0352\0\u036b\0\u0384\0\u039d\0\u03b6\0\u03cf\0\u03e8"+
+    "\0\u0401\0\u041a\0\u0433\0\u044c\0\u0465\0\u047e\0\u0497\0\u04b0"+
+    "\0\u04c9\0\u04e2\0\u04fb\0\31\0\31\0\u0514\0\u052d\0\u0546"+
+    "\0\u055f\0\31\0\31\0\31\0\u0578\0\u0591\0\u05aa\0\u05c3"+
+    "\0\u05dc\0\u05f5\0\31\0\u060e\0\31\0\31\0\u0627\0\u0640"+
+    "\0\u0659\0\31\0\31\0\31\0\u0672\0\31\0\u068b\0\31"+
+    "\0\u06a4\0\u06bd\0\u06d6\0\31\0\u06ef\0\u0708\0\u0721\0\u073a";
+
+  private static int [] zzUnpackRowMap() {
+    int [] result = new int[96];
+    int offset = 0;
+    offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
+    return result;
+  }
+
+  private static int zzUnpackRowMap(String packed, int offset, int [] result) {
+    int i = 0;  /* index in packed string  */
+    int j = offset;  /* index in unpacked array */
+    int l = packed.length();
+    while (i < l) {
+      int high = packed.charAt(i++) << 16;
+      result[j++] = high | packed.charAt(i++);
+    }
+    return j;
+  }
+
+  /** 
+   * The transition table of the DFA
+   */
+  private static final int [] ZZ_TRANS = zzUnpackTrans();
+
+  private static final String ZZ_TRANS_PACKED_0 =
+    "\1\2\1\3\27\2\33\0\1\4\1\0\1\5\1\6"+
+    "\1\7\1\10\1\0\1\11\6\0\1\12\2\0\1\13"+
+    "\4\0\1\14\3\0\1\15\27\0\1\16\2\0\1\17"+
+    "\1\20\1\21\1\0\1\22\6\0\1\23\2\0\1\24"+
+    "\10\0\1\25\30\0\1\26\6\0\1\27\26\0\1\30"+
+    "\25\0\1\31\30\0\1\32\31\0\1\33\25\0\1\34"+
+    "\30\0\1\35\30\0\1\36\30\0\1\37\35\0\1\40"+
+    "\25\0\1\41\30\0\1\42\31\0\1\43\33\0\1\44"+
+    "\30\0\1\45\13\0\1\46\23\0\1\47\31\0\1\50"+
+    "\17\0\1\51\31\0\1\52\13\0\1\53\23\0\1\54"+
+    "\31\0\1\55\17\0\1\56\20\0\3\44\1\57\25\44"+
+    "\10\0\1\60\42\0\1\61\32\0\1\62\26\0\1\63"+
+    "\32\0\1\64\14\0\1\65\42\0\1\66\32\0\1\67"+
+    "\26\0\1\70\32\0\1\71\4\0\1\57\1\72\27\57"+
+    "\12\0\1\73\21\0\1\74\30\0\1\75\7\0\1\76"+
+    "\30\0\1\77\37\0\1\100\20\0\1\101\21\0\1\102"+
+    "\30\0\1\103\30\0\1\104\47\0\1\105\12\0\1\106"+
+    "\37\0\1\107\43\0\1\110\1\111\17\0\1\112\7\0"+
+    "\1\112\5\0\1\113\7\0\1\114\20\0\1\115\30\0"+
+    "\1\116\33\0\1\117\24\0\1\120\2\0\6\120\1\0"+
+    "\1\120\1\121\1\0\7\120\1\0\1\120\4\0\1\122"+
+    "\30\0\1\123\30\0\1\124\12\0\1\125\7\0\1\125"+
+    "\2\0\3\114\1\126\25\114\12\0\1\127\20\0\1\120"+
+    "\1\130\1\0\6\120\1\0\1\120\2\0\7\120\1\0"+
+    "\1\120\3\0\1\131\4\0\1\131\6\0\2\131\2\0"+
+    "\1\131\2\0\3\131\4\0\1\124\36\0\1\132\21\0"+
+    "\1\133\4\0\1\133\6\0\2\133\2\0\1\133\2\0"+
+    "\3\133\4\0\1\134\27\0\1\135\4\0\1\135\6\0"+
+    "\2\135\2\0\1\135\2\0\3\135\3\0\1\136\4\0"+
+    "\1\136\6\0\2\136\2\0\1\136\2\0\3\136\3\0"+
+    "\1\137\4\0\1\137\6\0\2\137\2\0\1\137\2\0"+
+    "\3\137\3\0\1\140\4\0\1\140\6\0\2\140\2\0"+
+    "\1\140\2\0\3\140\4\0\1\130\25\0";
+
+  private static int [] zzUnpackTrans() {
+    int [] result = new int[1875];
+    int offset = 0;
+    offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
+    return result;
+  }
+
+  private static int zzUnpackTrans(String packed, int offset, int [] result) {
+    int i = 0;       /* index in packed string  */
+    int j = offset;  /* index in unpacked array */
+    int l = packed.length();
+    while (i < l) {
+      int count = packed.charAt(i++);
+      int value = packed.charAt(i++);
+      value--;
+      do result[j++] = value; while (--count > 0);
+    }
+    return j;
+  }
+
+
+  /* error codes */
+  private static final int ZZ_UNKNOWN_ERROR = 0;
+  private static final int ZZ_NO_MATCH = 1;
+  private static final int ZZ_PUSHBACK_2BIG = 2;
+
+  /* error messages for the codes above */
+  private static final String ZZ_ERROR_MSG[] = {
+    "Unkown internal scanner error",
+    "Error: could not match input",
+    "Error: pushback value was too large"
+  };
+
+  /**
+   * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
+   */
+  private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
+
+  private static final String ZZ_ATTRIBUTE_PACKED_0 =
+    "\1\0\1\11\1\1\11\0\1\11\7\0\2\11\5\0"+
+    "\4\11\34\0\2\11\4\0\3\11\6\0\1\11\1\0"+
+    "\2\11\3\0\3\11\1\0\1\11\1\0\1\11\3\0"+
+    "\1\11\4\0";
+
+  private static int [] zzUnpackAttribute() {
+    int [] result = new int[96];
+    int offset = 0;
+    offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
+    return result;
+  }
+
+  private static int zzUnpackAttribute(String packed, int offset, int [] result) {
+    int i = 0;       /* index in packed string  */
+    int j = offset;  /* index in unpacked array */
+    int l = packed.length();
+    while (i < l) {
+      int count = packed.charAt(i++);
+      int value = packed.charAt(i++);
+      do result[j++] = value; while (--count > 0);
+    }
+    return j;
+  }
+
+  /** the input device */
+  private java.io.Reader zzReader;
+
+  /** the current state of the DFA */
+  private int zzState;
+
+  /** the current lexical state */
+  private int zzLexicalState = YYINITIAL;
+
+  /** this buffer contains the current text to be matched and is
+      the source of the yytext() string */
+  private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
+
+  /** the textposition at the last accepting state */
+  private int zzMarkedPos;
+
+  /** the textposition at the last state to be included in yytext */
+  private int zzPushbackPos;
+
+  /** the current text position in the buffer */
+  private int zzCurrentPos;
+
+  /** startRead marks the beginning of the yytext() string in the buffer */
+  private int zzStartRead;
+
+  /** endRead marks the last character in the buffer, that has been read
+      from input */
+  private int zzEndRead;
+
+  /** number of newlines encountered up to the start of the matched text */
+  private int yyline;
+
+  /** the number of characters up to the start of the matched text */
+  private int yychar;
+
+  /**
+   * the number of characters from the last newline up to the start of the 
+   * matched text
+   */
+  private int yycolumn;
+
+  /** 
+   * zzAtBOL == true <=> the scanner is currently at the beginning of a line
+   */
+  private boolean zzAtBOL = true;
+
+  /** zzAtEOF == true <=> the scanner is at the EOF */
+  private boolean zzAtEOF;
+
+  /* user code: */
+
+public static final int OPEN_B = 0;
+public static final int CLOSE_B = 1;
+public static final int OPEN_I = 2;
+public static final int CLOSE_I = 3;
+public static final int OPEN_U = 4;
+public static final int CLOSE_U = 5;
+public static final int OPEN_COLOR = 6;
+public static final int CLOSE_COLOR = 7;
+public static final int OPEN_SIZE = 8;
+public static final int CLOSE_SIZE = 9;
+public static final int OPEN_QUOTE_ANONYMOUS = 10;
+public static final int OPEN_QUOTE = 11;
+public static final int CLOSE_QUOTE = 12;
+public static final int OPEN_CODE = 13;
+public static final int CLOSE_CODE = 14;
+public static final int OPEN_LIST_UNORDERED = 15;
+public static final int OPEN_LIST_ORDERED_NUMERICAL = 16;
+public static final int OPEN_LIST_ORDERED_ALPHABETICAL = 17;
+public static final int CLOSE_LIST = 18;
+public static final int LIST_ITEM = 19;
+public static final int LINK = 20;
+public static final int TEXT = 21;
+
+private static final int FROM_1 = "[url".length();
+private static final int FROM_2 = "[url=".length();
+private static final int DELTA = "[/url]".length();
+
+public void reset(char[] chars, int off, int len)
+{
+   yyreset(new CharArrayReader(chars, off, len));
+}
+
+public Token next()
+{
+   try { return yylex(); }
+   catch(java.io.IOException e) { e.printStackTrace(); return null; }
+}
+
+private Token token = new Token();
+
+private Token token(int type, String value)
+{
+   token.type = type;
+   token.value = value;
+   return token;
+}
+
+
+
+  /**
+   * Creates a new scanner
+   * There is also a java.io.InputStream version of this constructor.
+   *
+   * @param   in  the java.io.Reader to read input from.
+   */
+  public Analyzer(java.io.Reader in) {
+    this.zzReader = in;
+  }
+
+  /**
+   * Creates a new scanner.
+   * There is also java.io.Reader version of this constructor.
+   *
+   * @param   in  the java.io.Inputstream to read input from.
+   */
+  public Analyzer(java.io.InputStream in) {
+    this(new java.io.InputStreamReader(in));
+  }
+
+  /** 
+   * Unpacks the compressed character translation table.
+   *
+   * @param packed   the packed character translation table
+   * @return         the unpacked character translation table
+   */
+  private static char [] zzUnpackCMap(String packed) {
+    char [] map = new char[0x10000];
+    int i = 0;  /* index in packed string  */
+    int j = 0;  /* index in unpacked array */
+    while (i < 82) {
+      int  count = packed.charAt(i++);
+      char value = packed.charAt(i++);
+      do map[j++] = value; while (--count > 0);
+    }
+    return map;
+  }
+
+
+  /**
+   * Refills the input buffer.
+   *
+   * @return      <code>false</code>, iff there was new input.
+   * 
+   * @exception   java.io.IOException  if any I/O-Error occurs
+   */
+  private boolean zzRefill() throws java.io.IOException {
+
+    /* first: make room (if you can) */
+    if (zzStartRead > 0) {
+      System.arraycopy(zzBuffer, zzStartRead,
+                       zzBuffer, 0,
+                       zzEndRead-zzStartRead);
+
+      /* translate stored positions */
+      zzEndRead-= zzStartRead;
+      zzCurrentPos-= zzStartRead;
+      zzMarkedPos-= zzStartRead;
+      zzPushbackPos-= zzStartRead;
+      zzStartRead = 0;
+    }
+
+    /* is the buffer big enough? */
+    if (zzCurrentPos >= zzBuffer.length) {
+      /* if not: blow it up */
+      char newBuffer[] = new char[zzCurrentPos*2];
+      System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
+      zzBuffer = newBuffer;
+    }
+
+    /* finally: fill the buffer with new input */
+    int numRead = zzReader.read(zzBuffer, zzEndRead,
+                                            zzBuffer.length-zzEndRead);
+
+    if (numRead < 0) {
+      return true;
+    }
+    else {
+      zzEndRead+= numRead;
+      return false;
+    }
+  }
+
+    
+  /**
+   * Closes the input stream.
+   */
+  public final void yyclose() throws java.io.IOException {
+    zzAtEOF = true;            /* indicate end of file */
+    zzEndRead = zzStartRead;  /* invalidate buffer    */
+
+    if (zzReader != null)
+      zzReader.close();
+  }
+
+
+  /**
+   * Resets the scanner to read from a new input stream.
+   * Does not close the old reader.
+   *
+   * All internal variables are reset, the old input stream 
+   * <b>cannot</b> be reused (internal buffer is discarded and lost).
+   * Lexical state is set to <tt>ZZ_INITIAL</tt>.
+   *
+   * @param reader   the new input stream 
+   */
+  public final void yyreset(java.io.Reader reader) {
+    zzReader = reader;
+    zzAtBOL  = true;
+    zzAtEOF  = false;
+    zzEndRead = zzStartRead = 0;
+    zzCurrentPos = zzMarkedPos = zzPushbackPos = 0;
+    yyline = yychar = yycolumn = 0;
+    zzLexicalState = YYINITIAL;
+  }
+
+
+  /**
+   * Returns the current lexical state.
+   */
+  public final int yystate() {
+    return zzLexicalState;
+  }
+
+
+  /**
+   * Enters a new lexical state
+   *
+   * @param newState the new lexical state
+   */
+  public final void yybegin(int newState) {
+    zzLexicalState = newState;
+  }
+
+
+  /**
+   * Returns the text matched by the current regular expression.
+   */
+  public final String yytext() {
+    return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
+  }
+
+
+  /**
+   * Returns the character at position <tt>pos</tt> from the 
+   * matched text. 
+   * 
+   * It is equivalent to yytext().charAt(pos), but faster
+   *
+   * @param pos the position of the character to fetch. 
+   *            A value from 0 to yylength()-1.
+   *
+   * @return the character at position pos
+   */
+  public final char yycharat(int pos) {
+    return zzBuffer[zzStartRead+pos];
+  }
+
+
+  /**
+   * Returns the length of the matched text region.
+   */
+  public final int yylength() {
+    return zzMarkedPos-zzStartRead;
+  }
+
+
+  /**
+   * Reports an error that occured while scanning.
+   *
+   * In a wellformed scanner (no or only correct usage of 
+   * yypushback(int) and a match-all fallback rule) this method 
+   * will only be called with things that "Can't Possibly Happen".
+   * If this method is called, something is seriously wrong
+   * (e.g. a JFlex bug producing a faulty scanner etc.).
+   *
+   * Usual syntax/scanner level error handling should be done
+   * in error fallback rules.
+   *
+   * @param   errorCode  the code of the errormessage to display
+   */
+  private void zzScanError(int errorCode) {
+    String message;
+    try {
+      message = ZZ_ERROR_MSG[errorCode];
+    }
+    catch (ArrayIndexOutOfBoundsException e) {
+      message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
+    }
+
+    throw new Error(message);
+  } 
+
+
+  /**
+   * Pushes the specified amount of characters back into the input stream.
+   *
+   * They will be read again by then next call of the scanning method
+   *
+   * @param number  the number of characters to be read again.
+   *                This number must not be greater than yylength()!
+   */
+  public void yypushback(int number)  {
+    if ( number > yylength() )
+      zzScanError(ZZ_PUSHBACK_2BIG);
+
+    zzMarkedPos -= number;
+  }
+
+
+  /**
+   * Resumes scanning until the next regular expression is matched,
+   * the end of input is encountered or an I/O-Error occurs.
+   *
+   * @return      the next token
+   * @exception   java.io.IOException  if any I/O-Error occurs
+   */
+  public Token yylex() throws java.io.IOException {
+    int zzInput;
+    int zzAction;
+
+    // cached fields:
+    int zzCurrentPosL;
+    int zzMarkedPosL;
+    int zzEndReadL = zzEndRead;
+    char [] zzBufferL = zzBuffer;
+    char [] zzCMapL = ZZ_CMAP;
+
+    int [] zzTransL = ZZ_TRANS;
+    int [] zzRowMapL = ZZ_ROWMAP;
+    int [] zzAttrL = ZZ_ATTRIBUTE;
+
+    while (true) {
+      zzMarkedPosL = zzMarkedPos;
+
+      zzAction = -1;
+
+      zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
+  
+      zzState = zzLexicalState;
+
+
+      zzForAction: {
+        while (true) {
+    
+          if (zzCurrentPosL < zzEndReadL)
+            zzInput = zzBufferL[zzCurrentPosL++];
+          else if (zzAtEOF) {
+            zzInput = YYEOF;
+            break zzForAction;
+          }
+          else {
+            // store back cached positions
+            zzCurrentPos  = zzCurrentPosL;
+            zzMarkedPos   = zzMarkedPosL;
+            boolean eof = zzRefill();
+            // get translated positions and possibly new buffer
+            zzCurrentPosL  = zzCurrentPos;
+            zzMarkedPosL   = zzMarkedPos;
+            zzBufferL      = zzBuffer;
+            zzEndReadL     = zzEndRead;
+            if (eof) {
+              zzInput = YYEOF;
+              break zzForAction;
+            }
+            else {
+              zzInput = zzBufferL[zzCurrentPosL++];
+            }
+          }
+          int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
+          if (zzNext == -1) break zzForAction;
+          zzState = zzNext;
+
+          int zzAttributes = zzAttrL[zzState];
+          if ( (zzAttributes & 1) == 1 ) {
+            zzAction = zzState;
+            zzMarkedPosL = zzCurrentPosL;
+            if ( (zzAttributes & 8) == 8 ) break zzForAction;
+          }
+
+        }
+      }
+
+      // store back cached position
+      zzMarkedPos = zzMarkedPosL;
+
+      switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
+        case 1: 
+          { return token(TEXT, yytext());
+          }
+        case 23: break;
+        case 16: 
+          { return token(CLOSE_QUOTE, null);
+          }
+        case 24: break;
+        case 10: 
+          { return token(OPEN_LIST_UNORDERED, null);
+          }
+        case 25: break;
+        case 18: 
+          { return token(OPEN_LIST_ORDERED_ALPHABETICAL, null);
+          }
+        case 26: break;
+        case 11: 
+          { return token(CLOSE_CODE, null);
+          }
+        case 27: break;
+        case 4: 
+          { return token(OPEN_U, null);
+          }
+        case 28: break;
+        case 7: 
+          { return token(CLOSE_I, null);
+          }
+        case 29: break;
+        case 14: 
+          { return token(OPEN_QUOTE_ANONYMOUS, null);
+          }
+        case 30: break;
+        case 12: 
+          { return token(CLOSE_LIST, null);
+          }
+        case 31: break;
+        case 3: 
+          { return token(OPEN_I, null);
+          }
+        case 32: break;
+        case 20: 
+          { return token(OPEN_QUOTE, yytext().substring(7, yytext().length() - 1));
+          }
+        case 33: break;
+        case 19: 
+          { return token(OPEN_SIZE, yytext().substring(6, yytext().length() - 1));
+          }
+        case 34: break;
+        case 2: 
+          { return token(OPEN_B, null);
+          }
+        case 35: break;
+        case 21: 
+          { return token(OPEN_COLOR, yytext().substring(7, yytext().length() - 1));
+          }
+        case 36: break;
+        case 8: 
+          { return token(CLOSE_U, null);
+          }
+        case 37: break;
+        case 22: 
+          { return token(LINK, yytext().substring(4, yytext().length() - 6));
+          }
+        case 38: break;
+        case 15: 
+          { return token(CLOSE_COLOR, null);
+          }
+        case 39: break;
+        case 13: 
+          { return token(CLOSE_SIZE, null);
+          }
+        case 40: break;
+        case 17: 
+          { return token(OPEN_LIST_ORDERED_NUMERICAL, null);
+          }
+        case 41: break;
+        case 5: 
+          { return token(LIST_ITEM, null);
+          }
+        case 42: break;
+        case 9: 
+          { return token(OPEN_CODE, null);
+          }
+        case 43: break;
+        case 6: 
+          { return token(CLOSE_B, null);
+          }
+        case 44: break;
+        default: 
+          if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
+            zzAtEOF = true;
+            return null;
+          } 
+          else {
+            zzScanError(ZZ_NO_MATCH);
+          }
+      }
+    }
+  }
+
+
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/BBCodeParser.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/BBCodeParser.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/BBCodeParser.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,325 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.parser.bbcode;
-
-import org.jboss.portlet.forums.format.parser.AbstractParser;
-import org.jboss.portlet.forums.format.parser.ParseEvent;
-import org.jboss.portlet.forums.format.parser.TextEvent;
-import org.jboss.portlet.forums.format.parser.Token;
-import org.jboss.portlet.forums.format.parser.chars.MutableChars;
-import org.jboss.portlet.forums.format.util.Stack;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.util.Iterator;
-
-/**
- * This nasty class parse BB code and create events.
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class BBCodeParser
-   extends AbstractParser
-{
-
-   // Public constants
-
-   public static final int EVENT_NORMAL = 0;
-   public static final int EVENT_BOLD = 1;
-   public static final int EVENT_ITALIC = 2;
-   public static final int EVENT_UNDERLINE = 3;
-   public static final int EVENT_COLOR = 4;
-   public static final int EVENT_SIZE = 5;
-   public static final int EVENT_QUOTE = 6;
-   public static final int EVENT_CODE = 7;
-   public static final int EVENT_ITEM = 8;
-   public static final int EVENT_LINK = 9;
-   public static final int EVENT_UNORDERED_LIST = 10;
-   public static final int EVENT_ALPHABETICALLY_ORDERED_LIST = 11;
-   public static final int EVENT_NUMERICALLY_ORDERED_LIST = 12;
-
-   public static final String BUNDLE_KEY_CODE = "Message_code";
-   public static final String BUNDLE_KEY_QUOTE = "Message_quote";
-   public static final String BUNDLE_KEY_WROTE = "Message_wrote";
-
-   // The parser state
-
-   public static final Reader NULL_READER = new Reader()
-   {
-      public int read(char cbuf[], int off, int len) throws IOException
-      {
-         return 0;
-      }
-
-      public void close() throws IOException
-      {
-      }
-   };
-
-   private Analyzer analyzer = new Analyzer(BBCodeParser.NULL_READER);
-   private CodeKey myKey = new CodeKey();
-   private MutableChars buffer = new MutableChars();
-   private TextEvent textEvent = new TextEvent();
-   private OpenEvent openEvent = new OpenEvent();
-
-   private Stack stack = new Stack(10)
-   {
-      protected Stack.Key createKey()
-      {
-         return new CloseEvent();
-      }
-
-      protected boolean equals(Stack.Key key1, Stack.Key key2)
-      {
-         return ((CodeKey)key1).getType() == ((CodeKey)key2).getType();
-      }
-   };
-
-   public BBCodeParser()
-   {
-   }
-
-   public void parse(char[] chars, int offset, int length)
-   {
-      // First we initialize the parser state
-      stack.reset();
-      analyzer.reset(chars, offset, length);
-      buffer.reset();
-
-      // First
-      _start(EVENT_NORMAL, null);
-
-      // Enter the switch loop
-      while (true)
-      {
-         // Get the next token
-         Token t = analyzer.next();
-
-         if (t == null)
-         {
-            // No more tokens to read
-            break;
-         }
-
-         // According to the token we fire the approriate events
-         switch (t.type)
-         {
-            case Analyzer.OPEN_B:
-               _start(EVENT_BOLD, null);
-               break;
-            case Analyzer.CLOSE_B:
-               _end(EVENT_BOLD);
-               break;
-
-            case Analyzer.OPEN_I:
-               _start(EVENT_ITALIC, null);
-               break;
-            case Analyzer.CLOSE_I:
-               _end(EVENT_ITALIC);
-               break;
-
-            case Analyzer.OPEN_U:
-               _start(EVENT_UNDERLINE, null);
-               break;
-            case Analyzer.CLOSE_U:
-               _end(EVENT_UNDERLINE);
-               break;
-
-            case Analyzer.OPEN_COLOR:
-               _start(EVENT_COLOR, t.value);
-               break;
-            case Analyzer.CLOSE_COLOR:
-               _end(EVENT_COLOR);
-               break;
-
-            case Analyzer.OPEN_SIZE:
-               _start(EVENT_SIZE, t.value);
-               break;
-            case Analyzer.CLOSE_SIZE:
-               _end(EVENT_SIZE);
-               break;
-
-            case Analyzer.OPEN_QUOTE_ANONYMOUS:
-               _start(EVENT_QUOTE, null);
-               break;
-            case Analyzer.OPEN_QUOTE:
-               _start(EVENT_QUOTE, t.value);
-               break;
-            case Analyzer.CLOSE_QUOTE:
-               _end(EVENT_QUOTE);
-               break;
-
-            case Analyzer.OPEN_CODE:
-               _start(EVENT_CODE, null);
-               break;
-            case Analyzer.CLOSE_CODE:
-               _end(EVENT_CODE);
-               break;
-
-            case Analyzer.OPEN_LIST_UNORDERED:
-               _start(EVENT_UNORDERED_LIST, null);
-               break;
-            case Analyzer.OPEN_LIST_ORDERED_NUMERICAL:
-               _start(EVENT_NUMERICALLY_ORDERED_LIST, null);
-               break;
-            case Analyzer.OPEN_LIST_ORDERED_ALPHABETICAL:
-               _start(EVENT_ALPHABETICALLY_ORDERED_LIST, null);
-               break;
-
-            case Analyzer.CLOSE_LIST:
-               // If we match a list token on the stack at
-               // level -1 (because of the list item that should
-               // be pushed on the stack) we close
-               CodeKey tmp = (CodeKey)stack.peek(0);
-               if (tmp != null)
-               {
-                  int type = tmp.type;
-                  if (type == EVENT_UNORDERED_LIST ||
-                     type == EVENT_NUMERICALLY_ORDERED_LIST ||
-                     type == EVENT_ALPHABETICALLY_ORDERED_LIST)
-                  {
-                     _end(type);
-                  }
-               }
-               break;
-
-            case Analyzer.LIST_ITEM:
-               // If we have a sibling item close it
-               CodeKey tmp2 = (CodeKey)stack.peek(0);
-               if (tmp2 != null && tmp2.type == EVENT_ITEM)
-               {
-                  _end(EVENT_ITEM);
-               }
-               _start(EVENT_ITEM, null);
-               break;
-
-            case Analyzer.LINK:
-               int bracket = t.value.indexOf(']');
-               if (bracket > 0)
-               {
-                  boolean hasEquals = t.value.charAt(0) == '=';
-                  if (hasEquals)
-                  {
-                     // todo add support for the link value which is not used yet
-                     String url = t.value.substring(1, bracket);
-                     String link = t.value.substring(bracket + 1);
-                     _start(EVENT_LINK, url);
-                     _end(EVENT_LINK);
-                  }
-               }
-               else
-               {
-                  _start(EVENT_LINK, t.value.substring(1));
-                  _end(EVENT_LINK);
-               }
-
-               break;
-
-            case Analyzer.TEXT:
-               buffer.append(t.value.charAt(0));
-               break;
-
-            default:
-               throw new IllegalStateException("This should not be possible");
-         }
-      }
-
-      // Last
-      _end(EVENT_NORMAL);
-   }
-
-   private void _text()
-   {
-      if (buffer.length() > 0)
-      {
-         textEvent.setText(buffer.chars(), 0, buffer.length());
-         buffer.reset();
-         handler.handle(textEvent);
-      }
-   }
-
-   private void _start(int type, String string)
-   {
-      _text();
-      CloseEvent closeEvent = (CloseEvent)stack.push();
-      openEvent.type = closeEvent.type = type;
-      openEvent.string = string;
-      handler.handle(openEvent);
-   }
-
-   private void _end(int type)
-   {
-      myKey.type = type;
-      Iterator i = stack.pop(myKey);
-      if (i.hasNext())
-      {
-         _text();
-         do
-         {
-            handler.handle((CloseEvent)i.next());
-         }
-         while (i.hasNext());
-      }
-   }
-
-   private static class CodeKey implements Stack.Key
-   {
-      protected int type;
-      protected String string;
-
-      public CodeKey()
-      {
-         type = -1;
-         string = null;
-      }
-
-      public int getType()
-      {
-         return type;
-      }
-
-      public String getString()
-      {
-         return string;
-      }
-   }
-
-   public static class OpenEvent extends CodeKey implements ParseEvent
-   {
-      public String toString()
-      {
-         return "open: " + type + " " + string;
-      }
-   }
-
-   public static class CloseEvent extends CodeKey implements ParseEvent
-   {
-      public String toString()
-      {
-         return "close: " + type + " " + string;
-      }
-   }
-}
-
-

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/BBCodeParser.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/BBCodeParser.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/BBCodeParser.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/bbcode/BBCodeParser.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,325 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.parser.bbcode;
+
+import org.jboss.portlet.forums.format.parser.AbstractParser;
+import org.jboss.portlet.forums.format.parser.ParseEvent;
+import org.jboss.portlet.forums.format.parser.TextEvent;
+import org.jboss.portlet.forums.format.parser.Token;
+import org.jboss.portlet.forums.format.parser.chars.MutableChars;
+import org.jboss.portlet.forums.format.util.Stack;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.Iterator;
+
+/**
+ * This nasty class parse BB code and create events.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class BBCodeParser
+   extends AbstractParser
+{
+
+   // Public constants
+
+   public static final int EVENT_NORMAL = 0;
+   public static final int EVENT_BOLD = 1;
+   public static final int EVENT_ITALIC = 2;
+   public static final int EVENT_UNDERLINE = 3;
+   public static final int EVENT_COLOR = 4;
+   public static final int EVENT_SIZE = 5;
+   public static final int EVENT_QUOTE = 6;
+   public static final int EVENT_CODE = 7;
+   public static final int EVENT_ITEM = 8;
+   public static final int EVENT_LINK = 9;
+   public static final int EVENT_UNORDERED_LIST = 10;
+   public static final int EVENT_ALPHABETICALLY_ORDERED_LIST = 11;
+   public static final int EVENT_NUMERICALLY_ORDERED_LIST = 12;
+
+   public static final String BUNDLE_KEY_CODE = "Message_code";
+   public static final String BUNDLE_KEY_QUOTE = "Message_quote";
+   public static final String BUNDLE_KEY_WROTE = "Message_wrote";
+
+   // The parser state
+
+   public static final Reader NULL_READER = new Reader()
+   {
+      public int read(char cbuf[], int off, int len) throws IOException
+      {
+         return 0;
+      }
+
+      public void close() throws IOException
+      {
+      }
+   };
+
+   private Analyzer analyzer = new Analyzer(BBCodeParser.NULL_READER);
+   private CodeKey myKey = new CodeKey();
+   private MutableChars buffer = new MutableChars();
+   private TextEvent textEvent = new TextEvent();
+   private OpenEvent openEvent = new OpenEvent();
+
+   private Stack stack = new Stack(10)
+   {
+      protected Stack.Key createKey()
+      {
+         return new CloseEvent();
+      }
+
+      protected boolean equals(Stack.Key key1, Stack.Key key2)
+      {
+         return ((CodeKey)key1).getType() == ((CodeKey)key2).getType();
+      }
+   };
+
+   public BBCodeParser()
+   {
+   }
+
+   public void parse(char[] chars, int offset, int length)
+   {
+      // First we initialize the parser state
+      stack.reset();
+      analyzer.reset(chars, offset, length);
+      buffer.reset();
+
+      // First
+      _start(EVENT_NORMAL, null);
+
+      // Enter the switch loop
+      while (true)
+      {
+         // Get the next token
+         Token t = analyzer.next();
+
+         if (t == null)
+         {
+            // No more tokens to read
+            break;
+         }
+
+         // According to the token we fire the approriate events
+         switch (t.type)
+         {
+            case Analyzer.OPEN_B:
+               _start(EVENT_BOLD, null);
+               break;
+            case Analyzer.CLOSE_B:
+               _end(EVENT_BOLD);
+               break;
+
+            case Analyzer.OPEN_I:
+               _start(EVENT_ITALIC, null);
+               break;
+            case Analyzer.CLOSE_I:
+               _end(EVENT_ITALIC);
+               break;
+
+            case Analyzer.OPEN_U:
+               _start(EVENT_UNDERLINE, null);
+               break;
+            case Analyzer.CLOSE_U:
+               _end(EVENT_UNDERLINE);
+               break;
+
+            case Analyzer.OPEN_COLOR:
+               _start(EVENT_COLOR, t.value);
+               break;
+            case Analyzer.CLOSE_COLOR:
+               _end(EVENT_COLOR);
+               break;
+
+            case Analyzer.OPEN_SIZE:
+               _start(EVENT_SIZE, t.value);
+               break;
+            case Analyzer.CLOSE_SIZE:
+               _end(EVENT_SIZE);
+               break;
+
+            case Analyzer.OPEN_QUOTE_ANONYMOUS:
+               _start(EVENT_QUOTE, null);
+               break;
+            case Analyzer.OPEN_QUOTE:
+               _start(EVENT_QUOTE, t.value);
+               break;
+            case Analyzer.CLOSE_QUOTE:
+               _end(EVENT_QUOTE);
+               break;
+
+            case Analyzer.OPEN_CODE:
+               _start(EVENT_CODE, null);
+               break;
+            case Analyzer.CLOSE_CODE:
+               _end(EVENT_CODE);
+               break;
+
+            case Analyzer.OPEN_LIST_UNORDERED:
+               _start(EVENT_UNORDERED_LIST, null);
+               break;
+            case Analyzer.OPEN_LIST_ORDERED_NUMERICAL:
+               _start(EVENT_NUMERICALLY_ORDERED_LIST, null);
+               break;
+            case Analyzer.OPEN_LIST_ORDERED_ALPHABETICAL:
+               _start(EVENT_ALPHABETICALLY_ORDERED_LIST, null);
+               break;
+
+            case Analyzer.CLOSE_LIST:
+               // If we match a list token on the stack at
+               // level -1 (because of the list item that should
+               // be pushed on the stack) we close
+               CodeKey tmp = (CodeKey)stack.peek(0);
+               if (tmp != null)
+               {
+                  int type = tmp.type;
+                  if (type == EVENT_UNORDERED_LIST ||
+                     type == EVENT_NUMERICALLY_ORDERED_LIST ||
+                     type == EVENT_ALPHABETICALLY_ORDERED_LIST)
+                  {
+                     _end(type);
+                  }
+               }
+               break;
+
+            case Analyzer.LIST_ITEM:
+               // If we have a sibling item close it
+               CodeKey tmp2 = (CodeKey)stack.peek(0);
+               if (tmp2 != null && tmp2.type == EVENT_ITEM)
+               {
+                  _end(EVENT_ITEM);
+               }
+               _start(EVENT_ITEM, null);
+               break;
+
+            case Analyzer.LINK:
+               int bracket = t.value.indexOf(']');
+               if (bracket > 0)
+               {
+                  boolean hasEquals = t.value.charAt(0) == '=';
+                  if (hasEquals)
+                  {
+                     // todo add support for the link value which is not used yet
+                     String url = t.value.substring(1, bracket);
+                     String link = t.value.substring(bracket + 1);
+                     _start(EVENT_LINK, url);
+                     _end(EVENT_LINK);
+                  }
+               }
+               else
+               {
+                  _start(EVENT_LINK, t.value.substring(1));
+                  _end(EVENT_LINK);
+               }
+
+               break;
+
+            case Analyzer.TEXT:
+               buffer.append(t.value.charAt(0));
+               break;
+
+            default:
+               throw new IllegalStateException("This should not be possible");
+         }
+      }
+
+      // Last
+      _end(EVENT_NORMAL);
+   }
+
+   private void _text()
+   {
+      if (buffer.length() > 0)
+      {
+         textEvent.setText(buffer.chars(), 0, buffer.length());
+         buffer.reset();
+         handler.handle(textEvent);
+      }
+   }
+
+   private void _start(int type, String string)
+   {
+      _text();
+      CloseEvent closeEvent = (CloseEvent)stack.push();
+      openEvent.type = closeEvent.type = type;
+      openEvent.string = string;
+      handler.handle(openEvent);
+   }
+
+   private void _end(int type)
+   {
+      myKey.type = type;
+      Iterator i = stack.pop(myKey);
+      if (i.hasNext())
+      {
+         _text();
+         do
+         {
+            handler.handle((CloseEvent)i.next());
+         }
+         while (i.hasNext());
+      }
+   }
+
+   private static class CodeKey implements Stack.Key
+   {
+      protected int type;
+      protected String string;
+
+      public CodeKey()
+      {
+         type = -1;
+         string = null;
+      }
+
+      public int getType()
+      {
+         return type;
+      }
+
+      public String getString()
+      {
+         return string;
+      }
+   }
+
+   public static class OpenEvent extends CodeKey implements ParseEvent
+   {
+      public String toString()
+      {
+         return "open: " + type + " " + string;
+      }
+   }
+
+   public static class CloseEvent extends CodeKey implements ParseEvent
+   {
+      public String toString()
+      {
+         return "close: " + type + " " + string;
+      }
+   }
+}
+
+

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/chars (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/chars)

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/chars/Chars.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/chars/Chars.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/chars/Chars.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,48 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.parser.chars;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-
-/**
- * An ordered collection of char.
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public interface Chars
-{
-   /** Append the chars to a Writer. */
-   void appendTo(Writer writer) throws IOException;
-
-   /** Get a Reader for the chars. */
-   Reader getReader();
-
-   /** Returns how many chars there are. */
-   int length();
-
-   /** Returns a String made of the chars. */
-   String toString();
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/chars/Chars.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/chars/Chars.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/chars/Chars.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/chars/Chars.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,48 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.parser.chars;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+
+/**
+ * An ordered collection of char.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public interface Chars
+{
+   /** Append the chars to a Writer. */
+   void appendTo(Writer writer) throws IOException;
+
+   /** Get a Reader for the chars. */
+   Reader getReader();
+
+   /** Returns how many chars there are. */
+   int length();
+
+   /** Returns a String made of the chars. */
+   String toString();
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/chars/MutableChars.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/chars/MutableChars.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/chars/MutableChars.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,154 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.parser.chars;
-
-import java.io.CharArrayReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class MutableChars implements Chars
-{
-
-   protected int index;
-   protected char[] chars;
-   protected Writer writer;
-
-   public MutableChars(int length)
-   {
-      this(new char[length]);
-   }
-
-   public MutableChars()
-   {
-      this(20);
-   }
-
-   public MutableChars(char[] chars)
-   {
-      this.index = 0;
-      this.chars = chars;
-      this.writer = new MyWriter();
-   }
-
-   public MutableChars(String s)
-   {
-      this(s.toCharArray());
-   }
-
-   private void increase()
-   {
-      char[] temp = new char[1 + chars.length * 2];
-      System.arraycopy(chars, 0, temp, 0, chars.length);
-      chars = temp;
-   }
-
-   public MutableChars append(String s)
-   {
-      int mark = index;
-      index += s.length();
-      while (index > chars.length - 1)
-      {
-         increase();
-      }
-      s.getChars(0, s.length(), chars, mark);
-      return this;
-   }
-
-   public MutableChars append(char cbuf[], int off, int len)
-   {
-      int mark = index;
-      index += len;
-      while (index > chars.length - 1)
-      {
-         increase();
-      }
-      System.arraycopy(cbuf, off, chars, mark, len);
-      return this;
-   }
-
-   public MutableChars append(char c)
-   {
-      if (index > chars.length - 1) // ~ to index >= length
-      {
-         increase();
-      }
-      chars[index++] = c;
-      return this;
-   }
-
-   public void reset()
-   {
-      index = 0;
-   }
-
-   public void appendTo(Writer writer) throws IOException
-   {
-      writer.write(chars, 0, index);
-   }
-
-   public String toString()
-   {
-      return new String(chars, 0, index);
-   }
-
-   public Reader getReader()
-   {
-      return new CharArrayReader(chars, 0, index);
-   }
-
-   public int length()
-   {
-      return index;
-   }
-
-   public Writer getWriter()
-   {
-      return writer;
-   }
-
-   public char[] chars()
-   {
-      return chars;
-   }
-
-   public class MyWriter extends Writer
-   {
-      public void write(char cbuf[], int off, int len) throws IOException
-      {
-         MutableChars.this.append(cbuf, off, len);
-      }
-
-      public void flush() throws IOException
-      {
-      }
-
-      public void close() throws IOException
-      {
-      }
-   }
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/chars/MutableChars.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/chars/MutableChars.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/chars/MutableChars.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/chars/MutableChars.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,154 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.parser.chars;
+
+import java.io.CharArrayReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class MutableChars implements Chars
+{
+
+   protected int index;
+   protected char[] chars;
+   protected Writer writer;
+
+   public MutableChars(int length)
+   {
+      this(new char[length]);
+   }
+
+   public MutableChars()
+   {
+      this(20);
+   }
+
+   public MutableChars(char[] chars)
+   {
+      this.index = 0;
+      this.chars = chars;
+      this.writer = new MyWriter();
+   }
+
+   public MutableChars(String s)
+   {
+      this(s.toCharArray());
+   }
+
+   private void increase()
+   {
+      char[] temp = new char[1 + chars.length * 2];
+      System.arraycopy(chars, 0, temp, 0, chars.length);
+      chars = temp;
+   }
+
+   public MutableChars append(String s)
+   {
+      int mark = index;
+      index += s.length();
+      while (index > chars.length - 1)
+      {
+         increase();
+      }
+      s.getChars(0, s.length(), chars, mark);
+      return this;
+   }
+
+   public MutableChars append(char cbuf[], int off, int len)
+   {
+      int mark = index;
+      index += len;
+      while (index > chars.length - 1)
+      {
+         increase();
+      }
+      System.arraycopy(cbuf, off, chars, mark, len);
+      return this;
+   }
+
+   public MutableChars append(char c)
+   {
+      if (index > chars.length - 1) // ~ to index >= length
+      {
+         increase();
+      }
+      chars[index++] = c;
+      return this;
+   }
+
+   public void reset()
+   {
+      index = 0;
+   }
+
+   public void appendTo(Writer writer) throws IOException
+   {
+      writer.write(chars, 0, index);
+   }
+
+   public String toString()
+   {
+      return new String(chars, 0, index);
+   }
+
+   public Reader getReader()
+   {
+      return new CharArrayReader(chars, 0, index);
+   }
+
+   public int length()
+   {
+      return index;
+   }
+
+   public Writer getWriter()
+   {
+      return writer;
+   }
+
+   public char[] chars()
+   {
+      return chars;
+   }
+
+   public class MyWriter extends Writer
+   {
+      public void write(char cbuf[], int off, int len) throws IOException
+      {
+         MutableChars.this.append(cbuf, off, len);
+      }
+
+      public void flush() throws IOException
+      {
+      }
+
+      public void close() throws IOException
+      {
+      }
+   }
+}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/entity)

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/CharacterEntityReferenceEvent.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/entity/CharacterEntityReferenceEvent.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/CharacterEntityReferenceEvent.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,37 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.parser.entity;
-
-import org.jboss.portlet.forums.format.parser.TextEvent;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class CharacterEntityReferenceEvent extends TextEvent
-{
-   public String toString()
-   {
-      return "charref:" + new String(chars, offset, length);
-   }
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/CharacterEntityReferenceEvent.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/entity/CharacterEntityReferenceEvent.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/CharacterEntityReferenceEvent.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/CharacterEntityReferenceEvent.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.parser.entity;
+
+import org.jboss.portlet.forums.format.parser.TextEvent;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class CharacterEntityReferenceEvent extends TextEvent
+{
+   public String toString()
+   {
+      return "charref:" + new String(chars, offset, length);
+   }
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/HTML4_0CharacterEntityReferenceParser.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/entity/HTML4_0CharacterEntityReferenceParser.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/HTML4_0CharacterEntityReferenceParser.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,79 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.parser.entity;
-
-import org.jboss.portlet.forums.format.parser.AbstractParser;
-import org.jboss.portlet.forums.format.parser.TextEvent;
-import org.jboss.portlet.forums.format.util.EntityTable;
-
-/**
- * Convert chars that have an an HTML 4 character reference.
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class HTML4_0CharacterEntityReferenceParser extends AbstractParser
-{
-
-   private final TextEvent textEvent = new TextEvent();
-   private final CharacterEntityReferenceEvent cere = new CharacterEntityReferenceEvent();
-   private final char[] buffer = new char[10];
-
-   public void parse(char[] chars, int startOffset, int length)
-   {
-      // Calculate the startOffset of the last chars to process
-      int endOffset = startOffset + length;
-      int previousOffset = startOffset;
-
-      // Iterates over all the chars
-      for (int currentOffset = startOffset; currentOffset < endOffset; currentOffset++)
-      {
-         char c = chars[currentOffset];
-         String result = EntityTable.FULL.lookup(c);
-         if (result != null)
-         {
-            if (currentOffset > previousOffset)
-            {
-               textEvent.setText(chars, previousOffset, currentOffset - previousOffset);
-               handler.handle(textEvent);
-            }
-
-            int size = result.length();
-            buffer[0] = '&';
-            result.getChars(0, size, buffer, 1);
-            buffer[size + 1] = ';';
-            cere.setText(buffer, 0, size + 2);
-            handler.handle(cere);
-            previousOffset = currentOffset + 1;
-         }
-      }
-
-      // Send the last chunck
-      if (endOffset > previousOffset)
-      {
-         textEvent.setText(chars, previousOffset, endOffset - previousOffset);
-         handler.handle(textEvent);
-      }
-   }
-
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/HTML4_0CharacterEntityReferenceParser.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/entity/HTML4_0CharacterEntityReferenceParser.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/HTML4_0CharacterEntityReferenceParser.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/HTML4_0CharacterEntityReferenceParser.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,79 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.parser.entity;
+
+import org.jboss.portlet.forums.format.parser.AbstractParser;
+import org.jboss.portlet.forums.format.parser.TextEvent;
+import org.jboss.portlet.forums.format.util.EntityTable;
+
+/**
+ * Convert chars that have an an HTML 4 character reference.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class HTML4_0CharacterEntityReferenceParser extends AbstractParser
+{
+
+   private final TextEvent textEvent = new TextEvent();
+   private final CharacterEntityReferenceEvent cere = new CharacterEntityReferenceEvent();
+   private final char[] buffer = new char[10];
+
+   public void parse(char[] chars, int startOffset, int length)
+   {
+      // Calculate the startOffset of the last chars to process
+      int endOffset = startOffset + length;
+      int previousOffset = startOffset;
+
+      // Iterates over all the chars
+      for (int currentOffset = startOffset; currentOffset < endOffset; currentOffset++)
+      {
+         char c = chars[currentOffset];
+         String result = EntityTable.FULL.lookup(c);
+         if (result != null)
+         {
+            if (currentOffset > previousOffset)
+            {
+               textEvent.setText(chars, previousOffset, currentOffset - previousOffset);
+               handler.handle(textEvent);
+            }
+
+            int size = result.length();
+            buffer[0] = '&';
+            result.getChars(0, size, buffer, 1);
+            buffer[size + 1] = ';';
+            cere.setText(buffer, 0, size + 2);
+            handler.handle(cere);
+            previousOffset = currentOffset + 1;
+         }
+      }
+
+      // Send the last chunck
+      if (endOffset > previousOffset)
+      {
+         textEvent.setText(chars, previousOffset, endOffset - previousOffset);
+         handler.handle(textEvent);
+      }
+   }
+
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/XML1_0CharacterEntityReferenceParser.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/entity/XML1_0CharacterEntityReferenceParser.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/XML1_0CharacterEntityReferenceParser.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,94 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.parser.entity;
-
-import org.jboss.portlet.forums.format.parser.AbstractParser;
-import org.jboss.portlet.forums.format.parser.TextEvent;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Detect XML 1.0 character entity references.
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class XML1_0CharacterEntityReferenceParser extends AbstractParser
-{
-
-   private final TextEvent textEvent = new TextEvent();
-   private final CharacterEntityReferenceEvent cere = new CharacterEntityReferenceEvent();
-
-   private static Pattern pattern = Pattern.compile("&#(?:(?:x[0-9a-fA-F]{1,4})|(?:[0-9]{1,5}));");
-
-   public void parse(char[] chars, int offset, int length)
-   {
-      CharSequence seq = new CharSequenceImpl(chars, offset, length);
-      Matcher matcher = pattern.matcher(seq);
-      int from = offset;
-      while (matcher.find())
-      {
-         int to = matcher.start();
-         textEvent.setText(chars, from, to - from);
-         handler.handle(textEvent);
-         from = matcher.end();
-         cere.setText(chars, to, from - to);
-         handler.handle(cere);
-      }
-      if (from < offset + length)
-      {
-         textEvent.setText(chars, from, offset + length - from);
-         handler.handle(textEvent);
-      }
-   }
-
-   private static class CharSequenceImpl implements CharSequence
-   {
-      private final char[] chars;
-      private final int offset;
-      private final int length;
-
-      public CharSequenceImpl(char[] chars, int offset, int length)
-      {
-         this.chars = chars;
-         this.offset = offset;
-         this.length = length;
-      }
-
-      public int length()
-      {
-         return length;
-      }
-
-      public char charAt(int index)
-      {
-         return chars[offset + index];
-      }
-
-      public CharSequence subSequence(int start, int end)
-      {
-         return new CharSequenceImpl(chars, start, end - start);
-      }
-   }
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/XML1_0CharacterEntityReferenceParser.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/entity/XML1_0CharacterEntityReferenceParser.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/XML1_0CharacterEntityReferenceParser.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/entity/XML1_0CharacterEntityReferenceParser.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,94 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.parser.entity;
+
+import org.jboss.portlet.forums.format.parser.AbstractParser;
+import org.jboss.portlet.forums.format.parser.TextEvent;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Detect XML 1.0 character entity references.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class XML1_0CharacterEntityReferenceParser extends AbstractParser
+{
+
+   private final TextEvent textEvent = new TextEvent();
+   private final CharacterEntityReferenceEvent cere = new CharacterEntityReferenceEvent();
+
+   private static Pattern pattern = Pattern.compile("&#(?:(?:x[0-9a-fA-F]{1,4})|(?:[0-9]{1,5}));");
+
+   public void parse(char[] chars, int offset, int length)
+   {
+      CharSequence seq = new CharSequenceImpl(chars, offset, length);
+      Matcher matcher = pattern.matcher(seq);
+      int from = offset;
+      while (matcher.find())
+      {
+         int to = matcher.start();
+         textEvent.setText(chars, from, to - from);
+         handler.handle(textEvent);
+         from = matcher.end();
+         cere.setText(chars, to, from - to);
+         handler.handle(cere);
+      }
+      if (from < offset + length)
+      {
+         textEvent.setText(chars, from, offset + length - from);
+         handler.handle(textEvent);
+      }
+   }
+
+   private static class CharSequenceImpl implements CharSequence
+   {
+      private final char[] chars;
+      private final int offset;
+      private final int length;
+
+      public CharSequenceImpl(char[] chars, int offset, int length)
+      {
+         this.chars = chars;
+         this.offset = offset;
+         this.length = length;
+      }
+
+      public int length()
+      {
+         return length;
+      }
+
+      public char charAt(int index)
+      {
+         return chars[offset + index];
+      }
+
+      public CharSequence subSequence(int start, int end)
+      {
+         return new CharSequenceImpl(chars, start, end - start);
+      }
+   }
+}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/html)

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.flex
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.flex	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.flex	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,77 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.portlet.forums.format.parser.html;
-
-import java.io.CharArrayReader;
-import org.jboss.portlet.forums.format.parser.Token;
-
-%%
-
-%unicode
-%public
-%class Analyzer
-%type Token
-
-%{
-
-public static final int STAG = 0;
-public static final int ETAG = 1;
-public static final int EMPTY = 2;
-public static final int CDATA = 3;
-
-
-public void reset(char[] chars, int off, int len)
-{
-   yyreset(new CharArrayReader(chars, off, len));
-}
-
-public Token next()
-{
-   try { return yylex(); }
-   catch(java.io.IOException e) { e.printStackTrace(); return null; }
-}
-
-private Token token = new Token();
-
-private Token token(int type, String value)
-{
-   token.type = type;
-   token.value = value;
-   return token;
-}
-
-%}
-
-S = (" "|"\t"|"\r"|"\n")+
-Name = [A-Za-z]+
-Attribute = [A-Za-z]+(" "|"\t"|"\r"|"\n")*"="(" "|"\t"|"\r"|"\n")*[\"']~[\"']
-
-%%
-
-<YYINITIAL>
-{
-   "<"{Name}({S}{Attribute})*{S}?">" { return token(STAG, yytext()); }
-   "</"{Name}{S}?">" { return token(ETAG, yytext()); }
-   "<"{Name}({S}{Attribute})*{S}?"/>" { return token(EMPTY, yytext()); }
-   .|\n { return token(CDATA, yytext()); }
-}
-

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.flex (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.flex)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.flex	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.flex	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,77 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portlet.forums.format.parser.html;
+
+import java.io.CharArrayReader;
+import org.jboss.portlet.forums.format.parser.Token;
+
+%%
+
+%unicode
+%public
+%class Analyzer
+%type Token
+
+%{
+
+public static final int STAG = 0;
+public static final int ETAG = 1;
+public static final int EMPTY = 2;
+public static final int CDATA = 3;
+
+
+public void reset(char[] chars, int off, int len)
+{
+   yyreset(new CharArrayReader(chars, off, len));
+}
+
+public Token next()
+{
+   try { return yylex(); }
+   catch(java.io.IOException e) { e.printStackTrace(); return null; }
+}
+
+private Token token = new Token();
+
+private Token token(int type, String value)
+{
+   token.type = type;
+   token.value = value;
+   return token;
+}
+
+%}
+
+S = (" "|"\t"|"\r"|"\n")+
+Name = [A-Za-z]+
+Attribute = [A-Za-z]+(" "|"\t"|"\r"|"\n")*"="(" "|"\t"|"\r"|"\n")*[\"']~[\"']
+
+%%
+
+<YYINITIAL>
+{
+   "<"{Name}({S}{Attribute})*{S}?">" { return token(STAG, yytext()); }
+   "</"{Name}{S}?">" { return token(ETAG, yytext()); }
+   "<"{Name}({S}{Attribute})*{S}?"/>" { return token(EMPTY, yytext()); }
+   .|\n { return token(CDATA, yytext()); }
+}
+

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,587 +0,0 @@
-/* The following code was generated by JFlex 1.4.1 on 24.11.07 23:16 */
-
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.portlet.forums.format.parser.html;
-
-import java.io.CharArrayReader;
-import org.jboss.portlet.forums.format.parser.Token;
-
-
-/**
- * This class is a scanner generated by 
- * <a href="http://www.jflex.de/">JFlex</a> 1.4.1
- * on 24.11.07 23:16 from the specification file
- * <tt>/Users/rysiek/Work/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.flex</tt>
- */
-public class Analyzer {
-
-  /** This character denotes the end of file */
-  public static final int YYEOF = -1;
-
-  /** initial size of the lookahead buffer */
-  private static final int ZZ_BUFFERSIZE = 16384;
-
-  /** lexical states */
-  public static final int YYINITIAL = 0;
-
-  /** 
-   * Translates characters to character classes
-   */
-  private static final String ZZ_CMAP_PACKED = 
-    "\11\0\1\1\1\1\2\0\1\1\22\0\1\1\1\0\1\4\4\0"+
-    "\1\4\7\0\1\7\14\0\1\5\1\3\1\6\2\0\32\2\6\0"+
-    "\32\2\uff85\0";
-
-  /** 
-   * Translates characters to character classes
-   */
-  private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
-
-  /** 
-   * Translates DFA states to action switch labels.
-   */
-  private static final int [] ZZ_ACTION = zzUnpackAction();
-
-  private static final String ZZ_ACTION_PACKED_0 =
-    "\1\0\2\1\3\0\1\2\3\0\1\3\1\0\1\4"+
-    "\4\0";
-
-  private static int [] zzUnpackAction() {
-    int [] result = new int[17];
-    int offset = 0;
-    offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
-    return result;
-  }
-
-  private static int zzUnpackAction(String packed, int offset, int [] result) {
-    int i = 0;       /* index in packed string  */
-    int j = offset;  /* index in unpacked array */
-    int l = packed.length();
-    while (i < l) {
-      int count = packed.charAt(i++);
-      int value = packed.charAt(i++);
-      do result[j++] = value; while (--count > 0);
-    }
-    return j;
-  }
-
-
-  /** 
-   * Translates a state to a row index in the transition table
-   */
-  private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
-
-  private static final String ZZ_ROWMAP_PACKED_0 =
-    "\0\0\0\10\0\20\0\30\0\40\0\50\0\10\0\60"+
-    "\0\70\0\100\0\10\0\110\0\10\0\120\0\130\0\140"+
-    "\0\150";
-
-  private static int [] zzUnpackRowMap() {
-    int [] result = new int[17];
-    int offset = 0;
-    offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
-    return result;
-  }
-
-  private static int zzUnpackRowMap(String packed, int offset, int [] result) {
-    int i = 0;  /* index in packed string  */
-    int j = offset;  /* index in unpacked array */
-    int l = packed.length();
-    while (i < l) {
-      int high = packed.charAt(i++) << 16;
-      result[j++] = high | packed.charAt(i++);
-    }
-    return j;
-  }
-
-  /** 
-   * The transition table of the DFA
-   */
-  private static final int [] ZZ_TRANS = zzUnpackTrans();
-
-  private static final String ZZ_TRANS_PACKED_0 =
-    "\5\2\1\3\2\2\12\0\1\4\4\0\1\5\1\0"+
-    "\1\6\1\4\3\0\1\7\1\10\2\0\1\11\6\0"+
-    "\1\6\1\12\3\0\1\7\1\10\6\0\1\13\2\0"+
-    "\1\14\1\11\3\0\1\15\2\0\1\16\1\12\1\17"+
-    "\5\0\1\14\4\0\1\15\2\0\1\16\1\0\1\17"+
-    "\5\0\1\17\2\0\1\20\3\0\4\20\1\21\3\20"+
-    "\1\0\1\6\4\0\1\7\1\10";
-
-  private static int [] zzUnpackTrans() {
-    int [] result = new int[112];
-    int offset = 0;
-    offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
-    return result;
-  }
-
-  private static int zzUnpackTrans(String packed, int offset, int [] result) {
-    int i = 0;       /* index in packed string  */
-    int j = offset;  /* index in unpacked array */
-    int l = packed.length();
-    while (i < l) {
-      int count = packed.charAt(i++);
-      int value = packed.charAt(i++);
-      value--;
-      do result[j++] = value; while (--count > 0);
-    }
-    return j;
-  }
-
-
-  /* error codes */
-  private static final int ZZ_UNKNOWN_ERROR = 0;
-  private static final int ZZ_NO_MATCH = 1;
-  private static final int ZZ_PUSHBACK_2BIG = 2;
-
-  /* error messages for the codes above */
-  private static final String ZZ_ERROR_MSG[] = {
-    "Unkown internal scanner error",
-    "Error: could not match input",
-    "Error: pushback value was too large"
-  };
-
-  /**
-   * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
-   */
-  private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
-
-  private static final String ZZ_ATTRIBUTE_PACKED_0 =
-    "\1\0\1\11\1\1\3\0\1\11\3\0\1\11\1\0"+
-    "\1\11\4\0";
-
-  private static int [] zzUnpackAttribute() {
-    int [] result = new int[17];
-    int offset = 0;
-    offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
-    return result;
-  }
-
-  private static int zzUnpackAttribute(String packed, int offset, int [] result) {
-    int i = 0;       /* index in packed string  */
-    int j = offset;  /* index in unpacked array */
-    int l = packed.length();
-    while (i < l) {
-      int count = packed.charAt(i++);
-      int value = packed.charAt(i++);
-      do result[j++] = value; while (--count > 0);
-    }
-    return j;
-  }
-
-  /** the input device */
-  private java.io.Reader zzReader;
-
-  /** the current state of the DFA */
-  private int zzState;
-
-  /** the current lexical state */
-  private int zzLexicalState = YYINITIAL;
-
-  /** this buffer contains the current text to be matched and is
-      the source of the yytext() string */
-  private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
-
-  /** the textposition at the last accepting state */
-  private int zzMarkedPos;
-
-  /** the textposition at the last state to be included in yytext */
-  private int zzPushbackPos;
-
-  /** the current text position in the buffer */
-  private int zzCurrentPos;
-
-  /** startRead marks the beginning of the yytext() string in the buffer */
-  private int zzStartRead;
-
-  /** endRead marks the last character in the buffer, that has been read
-      from input */
-  private int zzEndRead;
-
-  /** number of newlines encountered up to the start of the matched text */
-  private int yyline;
-
-  /** the number of characters up to the start of the matched text */
-  private int yychar;
-
-  /**
-   * the number of characters from the last newline up to the start of the 
-   * matched text
-   */
-  private int yycolumn;
-
-  /** 
-   * zzAtBOL == true <=> the scanner is currently at the beginning of a line
-   */
-  private boolean zzAtBOL = true;
-
-  /** zzAtEOF == true <=> the scanner is at the EOF */
-  private boolean zzAtEOF;
-
-  /* user code: */
-
-public static final int STAG = 0;
-public static final int ETAG = 1;
-public static final int EMPTY = 2;
-public static final int CDATA = 3;
-
-
-public void reset(char[] chars, int off, int len)
-{
-   yyreset(new CharArrayReader(chars, off, len));
-}
-
-public Token next()
-{
-   try { return yylex(); }
-   catch(java.io.IOException e) { e.printStackTrace(); return null; }
-}
-
-private Token token = new Token();
-
-private Token token(int type, String value)
-{
-   token.type = type;
-   token.value = value;
-   return token;
-}
-
-
-
-  /**
-   * Creates a new scanner
-   * There is also a java.io.InputStream version of this constructor.
-   *
-   * @param   in  the java.io.Reader to read input from.
-   */
-  public Analyzer(java.io.Reader in) {
-    this.zzReader = in;
-  }
-
-  /**
-   * Creates a new scanner.
-   * There is also java.io.Reader version of this constructor.
-   *
-   * @param   in  the java.io.Inputstream to read input from.
-   */
-  public Analyzer(java.io.InputStream in) {
-    this(new java.io.InputStreamReader(in));
-  }
-
-  /** 
-   * Unpacks the compressed character translation table.
-   *
-   * @param packed   the packed character translation table
-   * @return         the unpacked character translation table
-   */
-  private static char [] zzUnpackCMap(String packed) {
-    char [] map = new char[0x10000];
-    int i = 0;  /* index in packed string  */
-    int j = 0;  /* index in unpacked array */
-    while (i < 44) {
-      int  count = packed.charAt(i++);
-      char value = packed.charAt(i++);
-      do map[j++] = value; while (--count > 0);
-    }
-    return map;
-  }
-
-
-  /**
-   * Refills the input buffer.
-   *
-   * @return      <code>false</code>, iff there was new input.
-   * 
-   * @exception   java.io.IOException  if any I/O-Error occurs
-   */
-  private boolean zzRefill() throws java.io.IOException {
-
-    /* first: make room (if you can) */
-    if (zzStartRead > 0) {
-      System.arraycopy(zzBuffer, zzStartRead,
-                       zzBuffer, 0,
-                       zzEndRead-zzStartRead);
-
-      /* translate stored positions */
-      zzEndRead-= zzStartRead;
-      zzCurrentPos-= zzStartRead;
-      zzMarkedPos-= zzStartRead;
-      zzPushbackPos-= zzStartRead;
-      zzStartRead = 0;
-    }
-
-    /* is the buffer big enough? */
-    if (zzCurrentPos >= zzBuffer.length) {
-      /* if not: blow it up */
-      char newBuffer[] = new char[zzCurrentPos*2];
-      System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
-      zzBuffer = newBuffer;
-    }
-
-    /* finally: fill the buffer with new input */
-    int numRead = zzReader.read(zzBuffer, zzEndRead,
-                                            zzBuffer.length-zzEndRead);
-
-    if (numRead < 0) {
-      return true;
-    }
-    else {
-      zzEndRead+= numRead;
-      return false;
-    }
-  }
-
-    
-  /**
-   * Closes the input stream.
-   */
-  public final void yyclose() throws java.io.IOException {
-    zzAtEOF = true;            /* indicate end of file */
-    zzEndRead = zzStartRead;  /* invalidate buffer    */
-
-    if (zzReader != null)
-      zzReader.close();
-  }
-
-
-  /**
-   * Resets the scanner to read from a new input stream.
-   * Does not close the old reader.
-   *
-   * All internal variables are reset, the old input stream 
-   * <b>cannot</b> be reused (internal buffer is discarded and lost).
-   * Lexical state is set to <tt>ZZ_INITIAL</tt>.
-   *
-   * @param reader   the new input stream 
-   */
-  public final void yyreset(java.io.Reader reader) {
-    zzReader = reader;
-    zzAtBOL  = true;
-    zzAtEOF  = false;
-    zzEndRead = zzStartRead = 0;
-    zzCurrentPos = zzMarkedPos = zzPushbackPos = 0;
-    yyline = yychar = yycolumn = 0;
-    zzLexicalState = YYINITIAL;
-  }
-
-
-  /**
-   * Returns the current lexical state.
-   */
-  public final int yystate() {
-    return zzLexicalState;
-  }
-
-
-  /**
-   * Enters a new lexical state
-   *
-   * @param newState the new lexical state
-   */
-  public final void yybegin(int newState) {
-    zzLexicalState = newState;
-  }
-
-
-  /**
-   * Returns the text matched by the current regular expression.
-   */
-  public final String yytext() {
-    return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
-  }
-
-
-  /**
-   * Returns the character at position <tt>pos</tt> from the 
-   * matched text. 
-   * 
-   * It is equivalent to yytext().charAt(pos), but faster
-   *
-   * @param pos the position of the character to fetch. 
-   *            A value from 0 to yylength()-1.
-   *
-   * @return the character at position pos
-   */
-  public final char yycharat(int pos) {
-    return zzBuffer[zzStartRead+pos];
-  }
-
-
-  /**
-   * Returns the length of the matched text region.
-   */
-  public final int yylength() {
-    return zzMarkedPos-zzStartRead;
-  }
-
-
-  /**
-   * Reports an error that occured while scanning.
-   *
-   * In a wellformed scanner (no or only correct usage of 
-   * yypushback(int) and a match-all fallback rule) this method 
-   * will only be called with things that "Can't Possibly Happen".
-   * If this method is called, something is seriously wrong
-   * (e.g. a JFlex bug producing a faulty scanner etc.).
-   *
-   * Usual syntax/scanner level error handling should be done
-   * in error fallback rules.
-   *
-   * @param   errorCode  the code of the errormessage to display
-   */
-  private void zzScanError(int errorCode) {
-    String message;
-    try {
-      message = ZZ_ERROR_MSG[errorCode];
-    }
-    catch (ArrayIndexOutOfBoundsException e) {
-      message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
-    }
-
-    throw new Error(message);
-  } 
-
-
-  /**
-   * Pushes the specified amount of characters back into the input stream.
-   *
-   * They will be read again by then next call of the scanning method
-   *
-   * @param number  the number of characters to be read again.
-   *                This number must not be greater than yylength()!
-   */
-  public void yypushback(int number)  {
-    if ( number > yylength() )
-      zzScanError(ZZ_PUSHBACK_2BIG);
-
-    zzMarkedPos -= number;
-  }
-
-
-  /**
-   * Resumes scanning until the next regular expression is matched,
-   * the end of input is encountered or an I/O-Error occurs.
-   *
-   * @return      the next token
-   * @exception   java.io.IOException  if any I/O-Error occurs
-   */
-  public Token yylex() throws java.io.IOException {
-    int zzInput;
-    int zzAction;
-
-    // cached fields:
-    int zzCurrentPosL;
-    int zzMarkedPosL;
-    int zzEndReadL = zzEndRead;
-    char [] zzBufferL = zzBuffer;
-    char [] zzCMapL = ZZ_CMAP;
-
-    int [] zzTransL = ZZ_TRANS;
-    int [] zzRowMapL = ZZ_ROWMAP;
-    int [] zzAttrL = ZZ_ATTRIBUTE;
-
-    while (true) {
-      zzMarkedPosL = zzMarkedPos;
-
-      zzAction = -1;
-
-      zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
-  
-      zzState = zzLexicalState;
-
-
-      zzForAction: {
-        while (true) {
-    
-          if (zzCurrentPosL < zzEndReadL)
-            zzInput = zzBufferL[zzCurrentPosL++];
-          else if (zzAtEOF) {
-            zzInput = YYEOF;
-            break zzForAction;
-          }
-          else {
-            // store back cached positions
-            zzCurrentPos  = zzCurrentPosL;
-            zzMarkedPos   = zzMarkedPosL;
-            boolean eof = zzRefill();
-            // get translated positions and possibly new buffer
-            zzCurrentPosL  = zzCurrentPos;
-            zzMarkedPosL   = zzMarkedPos;
-            zzBufferL      = zzBuffer;
-            zzEndReadL     = zzEndRead;
-            if (eof) {
-              zzInput = YYEOF;
-              break zzForAction;
-            }
-            else {
-              zzInput = zzBufferL[zzCurrentPosL++];
-            }
-          }
-          int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
-          if (zzNext == -1) break zzForAction;
-          zzState = zzNext;
-
-          int zzAttributes = zzAttrL[zzState];
-          if ( (zzAttributes & 1) == 1 ) {
-            zzAction = zzState;
-            zzMarkedPosL = zzCurrentPosL;
-            if ( (zzAttributes & 8) == 8 ) break zzForAction;
-          }
-
-        }
-      }
-
-      // store back cached position
-      zzMarkedPos = zzMarkedPosL;
-
-      switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
-        case 3: 
-          { return token(EMPTY, yytext());
-          }
-        case 5: break;
-        case 4: 
-          { return token(ETAG, yytext());
-          }
-        case 6: break;
-        case 2: 
-          { return token(STAG, yytext());
-          }
-        case 7: break;
-        case 1: 
-          { return token(CDATA, yytext());
-          }
-        case 8: break;
-        default: 
-          if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
-            zzAtEOF = true;
-            return null;
-          } 
-          else {
-            zzScanError(ZZ_NO_MATCH);
-          }
-      }
-    }
-  }
-
-
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,587 @@
+/* The following code was generated by JFlex 1.4.1 on 24.11.07 23:16 */
+
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2005, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.portlet.forums.format.parser.html;
+
+import java.io.CharArrayReader;
+import org.jboss.portlet.forums.format.parser.Token;
+
+
+/**
+ * This class is a scanner generated by 
+ * <a href="http://www.jflex.de/">JFlex</a> 1.4.1
+ * on 24.11.07 23:16 from the specification file
+ * <tt>/Users/rysiek/Work/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/html/Analyzer.flex</tt>
+ */
+public class Analyzer {
+
+  /** This character denotes the end of file */
+  public static final int YYEOF = -1;
+
+  /** initial size of the lookahead buffer */
+  private static final int ZZ_BUFFERSIZE = 16384;
+
+  /** lexical states */
+  public static final int YYINITIAL = 0;
+
+  /** 
+   * Translates characters to character classes
+   */
+  private static final String ZZ_CMAP_PACKED = 
+    "\11\0\1\1\1\1\2\0\1\1\22\0\1\1\1\0\1\4\4\0"+
+    "\1\4\7\0\1\7\14\0\1\5\1\3\1\6\2\0\32\2\6\0"+
+    "\32\2\uff85\0";
+
+  /** 
+   * Translates characters to character classes
+   */
+  private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED);
+
+  /** 
+   * Translates DFA states to action switch labels.
+   */
+  private static final int [] ZZ_ACTION = zzUnpackAction();
+
+  private static final String ZZ_ACTION_PACKED_0 =
+    "\1\0\2\1\3\0\1\2\3\0\1\3\1\0\1\4"+
+    "\4\0";
+
+  private static int [] zzUnpackAction() {
+    int [] result = new int[17];
+    int offset = 0;
+    offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
+    return result;
+  }
+
+  private static int zzUnpackAction(String packed, int offset, int [] result) {
+    int i = 0;       /* index in packed string  */
+    int j = offset;  /* index in unpacked array */
+    int l = packed.length();
+    while (i < l) {
+      int count = packed.charAt(i++);
+      int value = packed.charAt(i++);
+      do result[j++] = value; while (--count > 0);
+    }
+    return j;
+  }
+
+
+  /** 
+   * Translates a state to a row index in the transition table
+   */
+  private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
+
+  private static final String ZZ_ROWMAP_PACKED_0 =
+    "\0\0\0\10\0\20\0\30\0\40\0\50\0\10\0\60"+
+    "\0\70\0\100\0\10\0\110\0\10\0\120\0\130\0\140"+
+    "\0\150";
+
+  private static int [] zzUnpackRowMap() {
+    int [] result = new int[17];
+    int offset = 0;
+    offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
+    return result;
+  }
+
+  private static int zzUnpackRowMap(String packed, int offset, int [] result) {
+    int i = 0;  /* index in packed string  */
+    int j = offset;  /* index in unpacked array */
+    int l = packed.length();
+    while (i < l) {
+      int high = packed.charAt(i++) << 16;
+      result[j++] = high | packed.charAt(i++);
+    }
+    return j;
+  }
+
+  /** 
+   * The transition table of the DFA
+   */
+  private static final int [] ZZ_TRANS = zzUnpackTrans();
+
+  private static final String ZZ_TRANS_PACKED_0 =
+    "\5\2\1\3\2\2\12\0\1\4\4\0\1\5\1\0"+
+    "\1\6\1\4\3\0\1\7\1\10\2\0\1\11\6\0"+
+    "\1\6\1\12\3\0\1\7\1\10\6\0\1\13\2\0"+
+    "\1\14\1\11\3\0\1\15\2\0\1\16\1\12\1\17"+
+    "\5\0\1\14\4\0\1\15\2\0\1\16\1\0\1\17"+
+    "\5\0\1\17\2\0\1\20\3\0\4\20\1\21\3\20"+
+    "\1\0\1\6\4\0\1\7\1\10";
+
+  private static int [] zzUnpackTrans() {
+    int [] result = new int[112];
+    int offset = 0;
+    offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
+    return result;
+  }
+
+  private static int zzUnpackTrans(String packed, int offset, int [] result) {
+    int i = 0;       /* index in packed string  */
+    int j = offset;  /* index in unpacked array */
+    int l = packed.length();
+    while (i < l) {
+      int count = packed.charAt(i++);
+      int value = packed.charAt(i++);
+      value--;
+      do result[j++] = value; while (--count > 0);
+    }
+    return j;
+  }
+
+
+  /* error codes */
+  private static final int ZZ_UNKNOWN_ERROR = 0;
+  private static final int ZZ_NO_MATCH = 1;
+  private static final int ZZ_PUSHBACK_2BIG = 2;
+
+  /* error messages for the codes above */
+  private static final String ZZ_ERROR_MSG[] = {
+    "Unkown internal scanner error",
+    "Error: could not match input",
+    "Error: pushback value was too large"
+  };
+
+  /**
+   * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
+   */
+  private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
+
+  private static final String ZZ_ATTRIBUTE_PACKED_0 =
+    "\1\0\1\11\1\1\3\0\1\11\3\0\1\11\1\0"+
+    "\1\11\4\0";
+
+  private static int [] zzUnpackAttribute() {
+    int [] result = new int[17];
+    int offset = 0;
+    offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
+    return result;
+  }
+
+  private static int zzUnpackAttribute(String packed, int offset, int [] result) {
+    int i = 0;       /* index in packed string  */
+    int j = offset;  /* index in unpacked array */
+    int l = packed.length();
+    while (i < l) {
+      int count = packed.charAt(i++);
+      int value = packed.charAt(i++);
+      do result[j++] = value; while (--count > 0);
+    }
+    return j;
+  }
+
+  /** the input device */
+  private java.io.Reader zzReader;
+
+  /** the current state of the DFA */
+  private int zzState;
+
+  /** the current lexical state */
+  private int zzLexicalState = YYINITIAL;
+
+  /** this buffer contains the current text to be matched and is
+      the source of the yytext() string */
+  private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
+
+  /** the textposition at the last accepting state */
+  private int zzMarkedPos;
+
+  /** the textposition at the last state to be included in yytext */
+  private int zzPushbackPos;
+
+  /** the current text position in the buffer */
+  private int zzCurrentPos;
+
+  /** startRead marks the beginning of the yytext() string in the buffer */
+  private int zzStartRead;
+
+  /** endRead marks the last character in the buffer, that has been read
+      from input */
+  private int zzEndRead;
+
+  /** number of newlines encountered up to the start of the matched text */
+  private int yyline;
+
+  /** the number of characters up to the start of the matched text */
+  private int yychar;
+
+  /**
+   * the number of characters from the last newline up to the start of the 
+   * matched text
+   */
+  private int yycolumn;
+
+  /** 
+   * zzAtBOL == true <=> the scanner is currently at the beginning of a line
+   */
+  private boolean zzAtBOL = true;
+
+  /** zzAtEOF == true <=> the scanner is at the EOF */
+  private boolean zzAtEOF;
+
+  /* user code: */
+
+public static final int STAG = 0;
+public static final int ETAG = 1;
+public static final int EMPTY = 2;
+public static final int CDATA = 3;
+
+
+public void reset(char[] chars, int off, int len)
+{
+   yyreset(new CharArrayReader(chars, off, len));
+}
+
+public Token next()
+{
+   try { return yylex(); }
+   catch(java.io.IOException e) { e.printStackTrace(); return null; }
+}
+
+private Token token = new Token();
+
+private Token token(int type, String value)
+{
+   token.type = type;
+   token.value = value;
+   return token;
+}
+
+
+
+  /**
+   * Creates a new scanner
+   * There is also a java.io.InputStream version of this constructor.
+   *
+   * @param   in  the java.io.Reader to read input from.
+   */
+  public Analyzer(java.io.Reader in) {
+    this.zzReader = in;
+  }
+
+  /**
+   * Creates a new scanner.
+   * There is also java.io.Reader version of this constructor.
+   *
+   * @param   in  the java.io.Inputstream to read input from.
+   */
+  public Analyzer(java.io.InputStream in) {
+    this(new java.io.InputStreamReader(in));
+  }
+
+  /** 
+   * Unpacks the compressed character translation table.
+   *
+   * @param packed   the packed character translation table
+   * @return         the unpacked character translation table
+   */
+  private static char [] zzUnpackCMap(String packed) {
+    char [] map = new char[0x10000];
+    int i = 0;  /* index in packed string  */
+    int j = 0;  /* index in unpacked array */
+    while (i < 44) {
+      int  count = packed.charAt(i++);
+      char value = packed.charAt(i++);
+      do map[j++] = value; while (--count > 0);
+    }
+    return map;
+  }
+
+
+  /**
+   * Refills the input buffer.
+   *
+   * @return      <code>false</code>, iff there was new input.
+   * 
+   * @exception   java.io.IOException  if any I/O-Error occurs
+   */
+  private boolean zzRefill() throws java.io.IOException {
+
+    /* first: make room (if you can) */
+    if (zzStartRead > 0) {
+      System.arraycopy(zzBuffer, zzStartRead,
+                       zzBuffer, 0,
+                       zzEndRead-zzStartRead);
+
+      /* translate stored positions */
+      zzEndRead-= zzStartRead;
+      zzCurrentPos-= zzStartRead;
+      zzMarkedPos-= zzStartRead;
+      zzPushbackPos-= zzStartRead;
+      zzStartRead = 0;
+    }
+
+    /* is the buffer big enough? */
+    if (zzCurrentPos >= zzBuffer.length) {
+      /* if not: blow it up */
+      char newBuffer[] = new char[zzCurrentPos*2];
+      System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
+      zzBuffer = newBuffer;
+    }
+
+    /* finally: fill the buffer with new input */
+    int numRead = zzReader.read(zzBuffer, zzEndRead,
+                                            zzBuffer.length-zzEndRead);
+
+    if (numRead < 0) {
+      return true;
+    }
+    else {
+      zzEndRead+= numRead;
+      return false;
+    }
+  }
+
+    
+  /**
+   * Closes the input stream.
+   */
+  public final void yyclose() throws java.io.IOException {
+    zzAtEOF = true;            /* indicate end of file */
+    zzEndRead = zzStartRead;  /* invalidate buffer    */
+
+    if (zzReader != null)
+      zzReader.close();
+  }
+
+
+  /**
+   * Resets the scanner to read from a new input stream.
+   * Does not close the old reader.
+   *
+   * All internal variables are reset, the old input stream 
+   * <b>cannot</b> be reused (internal buffer is discarded and lost).
+   * Lexical state is set to <tt>ZZ_INITIAL</tt>.
+   *
+   * @param reader   the new input stream 
+   */
+  public final void yyreset(java.io.Reader reader) {
+    zzReader = reader;
+    zzAtBOL  = true;
+    zzAtEOF  = false;
+    zzEndRead = zzStartRead = 0;
+    zzCurrentPos = zzMarkedPos = zzPushbackPos = 0;
+    yyline = yychar = yycolumn = 0;
+    zzLexicalState = YYINITIAL;
+  }
+
+
+  /**
+   * Returns the current lexical state.
+   */
+  public final int yystate() {
+    return zzLexicalState;
+  }
+
+
+  /**
+   * Enters a new lexical state
+   *
+   * @param newState the new lexical state
+   */
+  public final void yybegin(int newState) {
+    zzLexicalState = newState;
+  }
+
+
+  /**
+   * Returns the text matched by the current regular expression.
+   */
+  public final String yytext() {
+    return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
+  }
+
+
+  /**
+   * Returns the character at position <tt>pos</tt> from the 
+   * matched text. 
+   * 
+   * It is equivalent to yytext().charAt(pos), but faster
+   *
+   * @param pos the position of the character to fetch. 
+   *            A value from 0 to yylength()-1.
+   *
+   * @return the character at position pos
+   */
+  public final char yycharat(int pos) {
+    return zzBuffer[zzStartRead+pos];
+  }
+
+
+  /**
+   * Returns the length of the matched text region.
+   */
+  public final int yylength() {
+    return zzMarkedPos-zzStartRead;
+  }
+
+
+  /**
+   * Reports an error that occured while scanning.
+   *
+   * In a wellformed scanner (no or only correct usage of 
+   * yypushback(int) and a match-all fallback rule) this method 
+   * will only be called with things that "Can't Possibly Happen".
+   * If this method is called, something is seriously wrong
+   * (e.g. a JFlex bug producing a faulty scanner etc.).
+   *
+   * Usual syntax/scanner level error handling should be done
+   * in error fallback rules.
+   *
+   * @param   errorCode  the code of the errormessage to display
+   */
+  private void zzScanError(int errorCode) {
+    String message;
+    try {
+      message = ZZ_ERROR_MSG[errorCode];
+    }
+    catch (ArrayIndexOutOfBoundsException e) {
+      message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
+    }
+
+    throw new Error(message);
+  } 
+
+
+  /**
+   * Pushes the specified amount of characters back into the input stream.
+   *
+   * They will be read again by then next call of the scanning method
+   *
+   * @param number  the number of characters to be read again.
+   *                This number must not be greater than yylength()!
+   */
+  public void yypushback(int number)  {
+    if ( number > yylength() )
+      zzScanError(ZZ_PUSHBACK_2BIG);
+
+    zzMarkedPos -= number;
+  }
+
+
+  /**
+   * Resumes scanning until the next regular expression is matched,
+   * the end of input is encountered or an I/O-Error occurs.
+   *
+   * @return      the next token
+   * @exception   java.io.IOException  if any I/O-Error occurs
+   */
+  public Token yylex() throws java.io.IOException {
+    int zzInput;
+    int zzAction;
+
+    // cached fields:
+    int zzCurrentPosL;
+    int zzMarkedPosL;
+    int zzEndReadL = zzEndRead;
+    char [] zzBufferL = zzBuffer;
+    char [] zzCMapL = ZZ_CMAP;
+
+    int [] zzTransL = ZZ_TRANS;
+    int [] zzRowMapL = ZZ_ROWMAP;
+    int [] zzAttrL = ZZ_ATTRIBUTE;
+
+    while (true) {
+      zzMarkedPosL = zzMarkedPos;
+
+      zzAction = -1;
+
+      zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
+  
+      zzState = zzLexicalState;
+
+
+      zzForAction: {
+        while (true) {
+    
+          if (zzCurrentPosL < zzEndReadL)
+            zzInput = zzBufferL[zzCurrentPosL++];
+          else if (zzAtEOF) {
+            zzInput = YYEOF;
+            break zzForAction;
+          }
+          else {
+            // store back cached positions
+            zzCurrentPos  = zzCurrentPosL;
+            zzMarkedPos   = zzMarkedPosL;
+            boolean eof = zzRefill();
+            // get translated positions and possibly new buffer
+            zzCurrentPosL  = zzCurrentPos;
+            zzMarkedPosL   = zzMarkedPos;
+            zzBufferL      = zzBuffer;
+            zzEndReadL     = zzEndRead;
+            if (eof) {
+              zzInput = YYEOF;
+              break zzForAction;
+            }
+            else {
+              zzInput = zzBufferL[zzCurrentPosL++];
+            }
+          }
+          int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
+          if (zzNext == -1) break zzForAction;
+          zzState = zzNext;
+
+          int zzAttributes = zzAttrL[zzState];
+          if ( (zzAttributes & 1) == 1 ) {
+            zzAction = zzState;
+            zzMarkedPosL = zzCurrentPosL;
+            if ( (zzAttributes & 8) == 8 ) break zzForAction;
+          }
+
+        }
+      }
+
+      // store back cached position
+      zzMarkedPos = zzMarkedPosL;
+
+      switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
+        case 3: 
+          { return token(EMPTY, yytext());
+          }
+        case 5: break;
+        case 4: 
+          { return token(ETAG, yytext());
+          }
+        case 6: break;
+        case 2: 
+          { return token(STAG, yytext());
+          }
+        case 7: break;
+        case 1: 
+          { return token(CDATA, yytext());
+          }
+        case 8: break;
+        default: 
+          if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
+            zzAtEOF = true;
+            return null;
+          } 
+          else {
+            zzScanError(ZZ_NO_MATCH);
+          }
+      }
+    }
+  }
+
+
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/TagParser.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/html/TagParser.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/TagParser.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,223 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.parser.html;
-
-import org.jboss.portlet.forums.format.parser.AbstractParser;
-import org.jboss.portlet.forums.format.parser.ParseEvent;
-import org.jboss.portlet.forums.format.parser.TextEvent;
-import org.jboss.portlet.forums.format.parser.Token;
-import org.jboss.portlet.forums.format.parser.bbcode.BBCodeParser;
-import org.jboss.portlet.forums.format.parser.chars.MutableChars;
-import org.jboss.portlet.forums.format.util.Stack;
-
-import java.util.Iterator;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class TagParser
-   extends AbstractParser
-{
-
-   public static final int EVENT_NORMAL = 0;
-   public static final int EVENT_TAG = 1;
-
-   private MutableChars buffer = new MutableChars();
-   private Analyzer analyzer = new Analyzer(BBCodeParser.NULL_READER);
-
-   private OpenEvent openEvent = new OpenEvent();
-   private TextEvent textEvent = new TextEvent();
-
-   private Stack stack = new Stack(10)
-   {
-      protected Stack.Key createKey()
-      {
-         return new CloseEvent();
-      }
-
-      protected boolean equals(Stack.Key o1, Stack.Key o2)
-      {
-         HTMLKey key1 = (HTMLKey)o1;
-         HTMLKey key2 = (HTMLKey)o2;
-         if (key1.getType() != key2.getType())
-         {
-            return false;
-         }
-         if (key1.getType() == 1)
-         {
-            return key1.getTag().equals(key2.getTag());
-         }
-         return false;
-      }
-   };
-
-   public TagParser()
-   {
-   }
-
-   private HTMLKey temporaryKey = new HTMLKey();
-
-   public void parse(char[] chars, int off, int len)
-   {
-
-      // Build the stream
-      stack.reset();
-      analyzer.reset(chars, off, len);
-      buffer.reset();
-
-      //
-      CloseEvent closeEvent = (CloseEvent)stack.push();
-      closeEvent.type = openEvent.type = EVENT_NORMAL;
-      closeEvent.tag = openEvent.tag = null;
-      openEvent.attributes = null;
-      handler.handle(openEvent);
-
-      while (true)
-      {
-         // Get the next token
-         Token t = analyzer.next();
-
-         if (t == null)
-         {
-            // No more token to read
-            break;
-         }
-
-         switch (t.type)
-         {
-            case Analyzer.STAG:
-            {
-               closeEvent = (CloseEvent)stack.push();
-               String tag = t.value;
-               int start = 1;
-               int end = tag.indexOf(' ', 1);
-               if (end == -1)
-               {
-                  openEvent.type = closeEvent.type = EVENT_TAG;
-                  openEvent.tag = closeEvent.tag = tag.substring(start, tag.length() - 1);
-                  openEvent.attributes = "";
-               }
-               else
-               {
-                  openEvent.type = closeEvent.type = EVENT_TAG;
-                  openEvent.tag = closeEvent.tag = tag.substring(start, end);
-                  openEvent.attributes = tag.substring(end, tag.length() - 1);
-               }
-               text();
-               handler.handle(openEvent);
-               break;
-            }
-            case Analyzer.ETAG:
-            {
-               temporaryKey.type = 1;
-               temporaryKey.tag = t.value.substring(2, t.value.length() - 1);
-               Iterator i = stack.pop(temporaryKey);
-               if (i.hasNext())
-               {
-                  text();
-                  do
-                  {
-                     handler.handle((CloseEvent)i.next());
-                  }
-                  while (i.hasNext());
-               }
-               break;
-            }
-            case Analyzer.EMPTY:
-            {
-//               String tag = t.value;
-//               int start = 1;
-//               int end = tag.indexOf(' ', 1);
-//               if (end == -1)
-//               {
-//                  end = tag.length() - 2;
-//               }
-//               String name = tag.substring(start, end);
-//               helper.empty(1, name);
-               break;
-            }
-            case Analyzer.CDATA:
-               buffer.append(t.value.charAt(0));
-               break;
-            default:
-               throw new IllegalStateException("Unexpected token : " + t.type);
-         }
-      }
-
-      //
-      text();
-      temporaryKey.type = EVENT_NORMAL;
-      Iterator i = stack.pop(temporaryKey);
-      while (i.hasNext())
-      {
-         handler.handle((CloseEvent)i.next());
-      }
-   }
-
-   private void text()
-   {
-      if (buffer.length() > 0)
-      {
-         textEvent.setText(buffer.chars(), 0, buffer.length());
-         buffer.reset();
-         handler.handle(textEvent);
-      }
-   }
-
-   private static class HTMLKey implements Stack.Key
-   {
-      int type;
-      String tag;
-
-      private HTMLKey()
-      {
-         type = -1;
-         tag = null;
-      }
-
-      public int getType()
-      {
-         return type;
-      }
-
-      public String getTag()
-      {
-         return tag;
-      }
-   }
-
-   public static class OpenEvent extends HTMLKey implements ParseEvent
-   {
-      private String attributes;
-
-      public String getAttribute()
-      {
-         return attributes;
-      }
-   }
-
-   public static class CloseEvent extends HTMLKey implements ParseEvent
-   {
-   }
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/TagParser.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/html/TagParser.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/TagParser.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/html/TagParser.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,223 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.parser.html;
+
+import org.jboss.portlet.forums.format.parser.AbstractParser;
+import org.jboss.portlet.forums.format.parser.ParseEvent;
+import org.jboss.portlet.forums.format.parser.TextEvent;
+import org.jboss.portlet.forums.format.parser.Token;
+import org.jboss.portlet.forums.format.parser.bbcode.BBCodeParser;
+import org.jboss.portlet.forums.format.parser.chars.MutableChars;
+import org.jboss.portlet.forums.format.util.Stack;
+
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class TagParser
+   extends AbstractParser
+{
+
+   public static final int EVENT_NORMAL = 0;
+   public static final int EVENT_TAG = 1;
+
+   private MutableChars buffer = new MutableChars();
+   private Analyzer analyzer = new Analyzer(BBCodeParser.NULL_READER);
+
+   private OpenEvent openEvent = new OpenEvent();
+   private TextEvent textEvent = new TextEvent();
+
+   private Stack stack = new Stack(10)
+   {
+      protected Stack.Key createKey()
+      {
+         return new CloseEvent();
+      }
+
+      protected boolean equals(Stack.Key o1, Stack.Key o2)
+      {
+         HTMLKey key1 = (HTMLKey)o1;
+         HTMLKey key2 = (HTMLKey)o2;
+         if (key1.getType() != key2.getType())
+         {
+            return false;
+         }
+         if (key1.getType() == 1)
+         {
+            return key1.getTag().equals(key2.getTag());
+         }
+         return false;
+      }
+   };
+
+   public TagParser()
+   {
+   }
+
+   private HTMLKey temporaryKey = new HTMLKey();
+
+   public void parse(char[] chars, int off, int len)
+   {
+
+      // Build the stream
+      stack.reset();
+      analyzer.reset(chars, off, len);
+      buffer.reset();
+
+      //
+      CloseEvent closeEvent = (CloseEvent)stack.push();
+      closeEvent.type = openEvent.type = EVENT_NORMAL;
+      closeEvent.tag = openEvent.tag = null;
+      openEvent.attributes = null;
+      handler.handle(openEvent);
+
+      while (true)
+      {
+         // Get the next token
+         Token t = analyzer.next();
+
+         if (t == null)
+         {
+            // No more token to read
+            break;
+         }
+
+         switch (t.type)
+         {
+            case Analyzer.STAG:
+            {
+               closeEvent = (CloseEvent)stack.push();
+               String tag = t.value;
+               int start = 1;
+               int end = tag.indexOf(' ', 1);
+               if (end == -1)
+               {
+                  openEvent.type = closeEvent.type = EVENT_TAG;
+                  openEvent.tag = closeEvent.tag = tag.substring(start, tag.length() - 1);
+                  openEvent.attributes = "";
+               }
+               else
+               {
+                  openEvent.type = closeEvent.type = EVENT_TAG;
+                  openEvent.tag = closeEvent.tag = tag.substring(start, end);
+                  openEvent.attributes = tag.substring(end, tag.length() - 1);
+               }
+               text();
+               handler.handle(openEvent);
+               break;
+            }
+            case Analyzer.ETAG:
+            {
+               temporaryKey.type = 1;
+               temporaryKey.tag = t.value.substring(2, t.value.length() - 1);
+               Iterator i = stack.pop(temporaryKey);
+               if (i.hasNext())
+               {
+                  text();
+                  do
+                  {
+                     handler.handle((CloseEvent)i.next());
+                  }
+                  while (i.hasNext());
+               }
+               break;
+            }
+            case Analyzer.EMPTY:
+            {
+//               String tag = t.value;
+//               int start = 1;
+//               int end = tag.indexOf(' ', 1);
+//               if (end == -1)
+//               {
+//                  end = tag.length() - 2;
+//               }
+//               String name = tag.substring(start, end);
+//               helper.empty(1, name);
+               break;
+            }
+            case Analyzer.CDATA:
+               buffer.append(t.value.charAt(0));
+               break;
+            default:
+               throw new IllegalStateException("Unexpected token : " + t.type);
+         }
+      }
+
+      //
+      text();
+      temporaryKey.type = EVENT_NORMAL;
+      Iterator i = stack.pop(temporaryKey);
+      while (i.hasNext())
+      {
+         handler.handle((CloseEvent)i.next());
+      }
+   }
+
+   private void text()
+   {
+      if (buffer.length() > 0)
+      {
+         textEvent.setText(buffer.chars(), 0, buffer.length());
+         buffer.reset();
+         handler.handle(textEvent);
+      }
+   }
+
+   private static class HTMLKey implements Stack.Key
+   {
+      int type;
+      String tag;
+
+      private HTMLKey()
+      {
+         type = -1;
+         tag = null;
+      }
+
+      public int getType()
+      {
+         return type;
+      }
+
+      public String getTag()
+      {
+         return tag;
+      }
+   }
+
+   public static class OpenEvent extends HTMLKey implements ParseEvent
+   {
+      private String attributes;
+
+      public String getAttribute()
+      {
+         return attributes;
+      }
+   }
+
+   public static class CloseEvent extends HTMLKey implements ParseEvent
+   {
+   }
+}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/linebreak (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/linebreak)

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/linebreak/LineBreakParser.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/linebreak/LineBreakParser.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/linebreak/LineBreakParser.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,70 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.parser.linebreak;
-
-import org.jboss.portlet.forums.format.parser.AbstractParser;
-import org.jboss.portlet.forums.format.parser.ParseEvent;
-import org.jboss.portlet.forums.format.parser.TextEvent;
-
-/**
- * Break the parsed chars into text events and line break events.
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class LineBreakParser extends AbstractParser
-{
-
-   private static final LineBreakEvent event = new LineBreakEvent();
-
-   private final TextEvent textEvent = new TextEvent();
-
-   public void parse(char[] chars, int startOffset, int length)
-   {
-      int endOffset = startOffset + length;
-      int previousOffset = startOffset;
-      for (int currentOffset = startOffset; currentOffset < endOffset; currentOffset++)
-      {
-         char c = chars[currentOffset];
-         if (c == '\n')
-         {
-            if (currentOffset > previousOffset)
-            {
-               textEvent.setText(chars, previousOffset, currentOffset - previousOffset);
-               handler.handle(textEvent);
-            }
-            handler.handle(event);
-            previousOffset = currentOffset + 1;
-         }
-      }
-      if (endOffset > previousOffset)
-      {
-         textEvent.setText(chars, previousOffset, endOffset - previousOffset);
-         handler.handle(textEvent);
-      }
-   }
-
-   public static class LineBreakEvent implements ParseEvent
-   {
-   }
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/linebreak/LineBreakParser.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/parser/linebreak/LineBreakParser.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/linebreak/LineBreakParser.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/parser/linebreak/LineBreakParser.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.parser.linebreak;
+
+import org.jboss.portlet.forums.format.parser.AbstractParser;
+import org.jboss.portlet.forums.format.parser.ParseEvent;
+import org.jboss.portlet.forums.format.parser.TextEvent;
+
+/**
+ * Break the parsed chars into text events and line break events.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class LineBreakParser extends AbstractParser
+{
+
+   private static final LineBreakEvent event = new LineBreakEvent();
+
+   private final TextEvent textEvent = new TextEvent();
+
+   public void parse(char[] chars, int startOffset, int length)
+   {
+      int endOffset = startOffset + length;
+      int previousOffset = startOffset;
+      for (int currentOffset = startOffset; currentOffset < endOffset; currentOffset++)
+      {
+         char c = chars[currentOffset];
+         if (c == '\n')
+         {
+            if (currentOffset > previousOffset)
+            {
+               textEvent.setText(chars, previousOffset, currentOffset - previousOffset);
+               handler.handle(textEvent);
+            }
+            handler.handle(event);
+            previousOffset = currentOffset + 1;
+         }
+      }
+      if (endOffset > previousOffset)
+      {
+         textEvent.setText(chars, previousOffset, endOffset - previousOffset);
+         handler.handle(textEvent);
+      }
+   }
+
+   public static class LineBreakEvent implements ParseEvent
+   {
+   }
+}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/render)

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/AbstractRenderer.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/render/AbstractRenderer.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/AbstractRenderer.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,85 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.render;
-
-import org.apache.log4j.Logger;
-
-import java.io.IOException;
-import java.io.Writer;
-
-/** An abstract renderer. */
-public abstract class AbstractRenderer
-{
-
-
-   /** The logger. */
-   protected final Logger log = Logger.getLogger(getClass());
-
-   /** Hold the final result. */
-   protected Writer writer = null;
-
-   /** Render. */
-   public abstract void render(char[] chars, int offset, int length);
-
-
-   /** Render. */
-   public void render(String string)
-   {
-      char[] tmp = string.toCharArray();
-      render(tmp, 0, tmp.length);
-   }
-
-   /** Set the write that will hold the rendered result. */
-   public final void setWriter(Writer writer)
-   {
-      this.writer = writer;
-   }
-
-   /** Helper method that catch any IOException throw by the write. */
-   protected final void write(String s)
-   {
-      try
-      {
-         writer.write(s);
-      }
-      catch (IOException e)
-      {
-         log.error("Cannot write to output", e);
-      }
-   }
-
-   /** @see #write(java.lang.String) */
-   protected final void write(char[] chars, int offset, int length)
-   {
-      try
-      {
-         writer.write(chars, offset, length);
-      }
-      catch (IOException e)
-      {
-         log.error("Cannot write to output", e);
-      }
-   }
-
-
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/AbstractRenderer.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/render/AbstractRenderer.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/AbstractRenderer.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/AbstractRenderer.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,85 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.render;
+
+import org.apache.log4j.Logger;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/** An abstract renderer. */
+public abstract class AbstractRenderer
+{
+
+
+   /** The logger. */
+   protected final Logger log = Logger.getLogger(getClass());
+
+   /** Hold the final result. */
+   protected Writer writer = null;
+
+   /** Render. */
+   public abstract void render(char[] chars, int offset, int length);
+
+
+   /** Render. */
+   public void render(String string)
+   {
+      char[] tmp = string.toCharArray();
+      render(tmp, 0, tmp.length);
+   }
+
+   /** Set the write that will hold the rendered result. */
+   public final void setWriter(Writer writer)
+   {
+      this.writer = writer;
+   }
+
+   /** Helper method that catch any IOException throw by the write. */
+   protected final void write(String s)
+   {
+      try
+      {
+         writer.write(s);
+      }
+      catch (IOException e)
+      {
+         log.error("Cannot write to output", e);
+      }
+   }
+
+   /** @see #write(java.lang.String) */
+   protected final void write(char[] chars, int offset, int length)
+   {
+      try
+      {
+         writer.write(chars, offset, length);
+      }
+      catch (IOException e)
+      {
+         log.error("Cannot write to output", e);
+      }
+   }
+
+
+}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml)

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/ToHTMLConfig.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/ToHTMLConfig.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/ToHTMLConfig.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,241 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.render.bbcodehtml;
-
-import org.apache.log4j.Logger;
-import org.jboss.portlet.forums.format.template.BuildException;
-import org.jboss.portlet.forums.format.template.Template;
-import org.jboss.portlet.forums.format.template.TemplateLoader;
-import org.jboss.portlet.forums.format.template.TemplateRepository;
-import org.jboss.portlet.forums.format.util.CLLoader;
-import org.jboss.portlet.forums.format.util.Loader;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- */
-public class ToHTMLConfig
-{
-
-   /** Template name constants. */
-
-   public static final String TPL_THEME_CODE_B_CLOSE = "b_close";
-   public static final String TPL_THEME_CODE_B_OPEN = "b_open";
-   public static final String TPL_THEME_CODE_CODE_CLOSE = "code_close";
-   public static final String TPL_THEME_CODE_CODE_OPEN = "code_open";
-   public static final String TPL_THEME_CODE_COLOR_CLOSE = "color_close";
-   public static final String TPL_THEME_CODE_COLOR_OPEN = "color_open";
-   public static final String TPL_THEME_CODE_EMAIL = "email";
-   public static final String TPL_THEME_CODE_I_CLOSE = "i_close";
-   public static final String TPL_THEME_CODE_I_OPEN = "i_open";
-   public static final String TPL_THEME_CODE_IMG = "img";
-   public static final String TPL_THEME_CODE_LISTITEM = "listitem";
-   public static final String TPL_THEME_CODE_OLIST_CLOSE = "olist_close";
-   public static final String TPL_THEME_CODE_OLIST_OPEN = "olist_open";
-   public static final String TPL_THEME_CODE_QUOTE_CLOSE = "quote_close";
-   public static final String TPL_THEME_CODE_QUOTE_OPEN = "quote_open";
-   public static final String TPL_THEME_CODE_QUOTE_USERNAME_OPEN = "quote_username_open";
-   public static final String TPL_THEME_CODE_SIZE_CLOSE = "size_close";
-   public static final String TPL_THEME_CODE_SIZE_OPEN = "size_open";
-   public static final String TPL_THEME_CODE_U_CLOSE = "u_close";
-   public static final String TPL_THEME_CODE_U_OPEN = "u_open";
-   public static final String TPL_THEME_CODE_ULIST_CLOSE = "ulist_close";
-   public static final String TPL_THEME_CODE_ULIST_OPEN = "ulist_open";
-   public static final String TPL_THEME_CODE_URL = "url";
-
-   public static final int FILTER_MODE_ALWAYS_PRINT = 0;
-   public static final int FILTER_MODE_NEVER_PRINT = 1;
-   public static final int FILTER_MODE_PRINT_IF_NOT_IN_TAGS = 2;
-   public static final int FILTER_MODE_PRINT_IF_IN_TAGS = 3;
-
-   public static final int OUTPUT_MODE_REMOVE = 0;
-   public static final int OUTPUT_MODE_DISPLAY = 1;
-
-   private static final Loader loader = new CLLoader(ToHTMLRenderer.class.getClassLoader(), "");
-   private static final TemplateRepository defaultRepository = createRepository(loader);
-
-   Template r_ulist_open;
-   Template r_ulist_close;
-   Template r_olist_open;
-   Template r_olist_close;
-   Template r_listitem;
-   Template r_quote_open;
-   Template r_quote_close;
-   Template r_quote_username_open;
-   Template r_code_open;
-   Template r_code_close;
-   Template r_b_open;
-   Template r_b_close;
-   Template r_u_open;
-   Template r_u_close;
-   Template r_i_open;
-   Template r_i_close;
-   Template r_color_open;
-   Template r_color_close;
-   Template r_size_open;
-   Template r_size_close;
-   Template r_img;
-   Template r_url;
-   Template r_email;
-
-   private Set tags = new HashSet();
-   private int filterMode = FILTER_MODE_ALWAYS_PRINT;
-   private int ouputMode = OUTPUT_MODE_REMOVE;
-   private int maxTextWidth = 100;
-
-   public ToHTMLConfig()
-   {
-      setRepository(defaultRepository);
-   }
-
-   public void setLoader(Loader loader)
-   {
-      TemplateRepository repository = createRepository(loader);
-      setRepository(repository);
-   }
-
-   public int getMaxTextWidth()
-   {
-      return maxTextWidth;
-   }
-
-   public void setMaxTextWidth(int maxTextWidth)
-   {
-      this.maxTextWidth = maxTextWidth;
-   }
-
-   public void setTags(Set tags)
-   {
-      this.tags = tags;
-   }
-
-   public Set getTags()
-   {
-      return tags;
-   }
-
-   public int getFilterMode()
-   {
-      return filterMode;
-   }
-
-   public void setFilterMode(int filterMode)
-   {
-      this.filterMode = filterMode;
-   }
-
-   public int getOuputMode()
-   {
-      return ouputMode;
-   }
-
-   public void setOuputMode(int ouputMode)
-   {
-      this.ouputMode = ouputMode;
-   }
-
-   public boolean print(String tag)
-   {
-      switch (filterMode)
-      {
-         case FILTER_MODE_NEVER_PRINT:
-            return false;
-         case FILTER_MODE_PRINT_IF_NOT_IN_TAGS:
-            return !tags.contains(tag);
-         case FILTER_MODE_PRINT_IF_IN_TAGS:
-            return tags.contains(tag);
-         case FILTER_MODE_ALWAYS_PRINT:
-            return true;
-      }
-      return false;
-   }
-
-   private void setRepository(TemplateRepository repository)
-   {
-      r_ulist_open = repository.createTemplate(TPL_THEME_CODE_ULIST_OPEN);
-      r_ulist_close = repository.createTemplate(TPL_THEME_CODE_ULIST_CLOSE);
-      r_olist_open = repository.createTemplate(TPL_THEME_CODE_OLIST_OPEN);
-      r_olist_close = repository.createTemplate(TPL_THEME_CODE_OLIST_CLOSE);
-      r_listitem = repository.createTemplate(TPL_THEME_CODE_LISTITEM);
-      r_quote_open = repository.createTemplate(TPL_THEME_CODE_QUOTE_OPEN);
-      r_quote_close = repository.createTemplate(TPL_THEME_CODE_QUOTE_CLOSE);
-      r_quote_username_open = repository.createTemplate(TPL_THEME_CODE_QUOTE_USERNAME_OPEN);
-      r_code_open = repository.createTemplate(TPL_THEME_CODE_CODE_OPEN);
-      r_code_close = repository.createTemplate(TPL_THEME_CODE_CODE_CLOSE);
-      r_b_open = repository.createTemplate(TPL_THEME_CODE_B_OPEN);
-      r_b_close = repository.createTemplate(TPL_THEME_CODE_B_CLOSE);
-      r_u_open = repository.createTemplate(TPL_THEME_CODE_U_OPEN);
-      r_u_close = repository.createTemplate(TPL_THEME_CODE_U_CLOSE);
-      r_i_open = repository.createTemplate(TPL_THEME_CODE_I_OPEN);
-      r_i_close = repository.createTemplate(TPL_THEME_CODE_I_CLOSE);
-      r_color_open = repository.createTemplate(TPL_THEME_CODE_COLOR_OPEN);
-      r_color_close = repository.createTemplate(TPL_THEME_CODE_COLOR_CLOSE);
-      r_size_open = repository.createTemplate(TPL_THEME_CODE_SIZE_OPEN);
-      r_size_close = repository.createTemplate(TPL_THEME_CODE_SIZE_CLOSE);
-      r_img = repository.createTemplate(TPL_THEME_CODE_IMG);
-      r_url = repository.createTemplate(TPL_THEME_CODE_URL);
-      r_email = repository.createTemplate(TPL_THEME_CODE_EMAIL);
-   }
-
-   private static void loadTemplate(TemplateLoader repository, String name)
-   {
-      try
-      {
-         repository.addTemplate(name, "/" + name + ".tpl");
-      }
-      catch (BuildException e)
-      {
-         Logger.getLogger(ToHTMLRenderer.class).error("Cannot load template : " + name, e);
-      }
-   }
-
-   private static TemplateLoader createRepository(Loader loader)
-   {
-      TemplateLoader repository = new TemplateLoader(loader);
-      loadTemplate(repository, TPL_THEME_CODE_ULIST_OPEN);
-      loadTemplate(repository, TPL_THEME_CODE_ULIST_CLOSE);
-      loadTemplate(repository, TPL_THEME_CODE_OLIST_OPEN);
-      loadTemplate(repository, TPL_THEME_CODE_OLIST_CLOSE);
-      loadTemplate(repository, TPL_THEME_CODE_LISTITEM);
-      loadTemplate(repository, TPL_THEME_CODE_QUOTE_OPEN);
-      loadTemplate(repository, TPL_THEME_CODE_QUOTE_CLOSE);
-      loadTemplate(repository, TPL_THEME_CODE_QUOTE_USERNAME_OPEN);
-      loadTemplate(repository, TPL_THEME_CODE_CODE_OPEN);
-      loadTemplate(repository, TPL_THEME_CODE_CODE_CLOSE);
-      loadTemplate(repository, TPL_THEME_CODE_B_OPEN);
-      loadTemplate(repository, TPL_THEME_CODE_B_CLOSE);
-      loadTemplate(repository, TPL_THEME_CODE_U_OPEN);
-      loadTemplate(repository, TPL_THEME_CODE_U_CLOSE);
-      loadTemplate(repository, TPL_THEME_CODE_I_OPEN);
-      loadTemplate(repository, TPL_THEME_CODE_I_CLOSE);
-      loadTemplate(repository, TPL_THEME_CODE_COLOR_OPEN);
-      loadTemplate(repository, TPL_THEME_CODE_COLOR_CLOSE);
-      loadTemplate(repository, TPL_THEME_CODE_SIZE_OPEN);
-      loadTemplate(repository, TPL_THEME_CODE_SIZE_CLOSE);
-      loadTemplate(repository, TPL_THEME_CODE_IMG);
-      loadTemplate(repository, TPL_THEME_CODE_URL);
-      loadTemplate(repository, TPL_THEME_CODE_EMAIL);
-      return repository;
-   }
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/ToHTMLConfig.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/ToHTMLConfig.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/ToHTMLConfig.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/ToHTMLConfig.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,241 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.render.bbcodehtml;
+
+import org.apache.log4j.Logger;
+import org.jboss.portlet.forums.format.template.BuildException;
+import org.jboss.portlet.forums.format.template.Template;
+import org.jboss.portlet.forums.format.template.TemplateLoader;
+import org.jboss.portlet.forums.format.template.TemplateRepository;
+import org.jboss.portlet.forums.format.util.CLLoader;
+import org.jboss.portlet.forums.format.util.Loader;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ */
+public class ToHTMLConfig
+{
+
+   /** Template name constants. */
+
+   public static final String TPL_THEME_CODE_B_CLOSE = "b_close";
+   public static final String TPL_THEME_CODE_B_OPEN = "b_open";
+   public static final String TPL_THEME_CODE_CODE_CLOSE = "code_close";
+   public static final String TPL_THEME_CODE_CODE_OPEN = "code_open";
+   public static final String TPL_THEME_CODE_COLOR_CLOSE = "color_close";
+   public static final String TPL_THEME_CODE_COLOR_OPEN = "color_open";
+   public static final String TPL_THEME_CODE_EMAIL = "email";
+   public static final String TPL_THEME_CODE_I_CLOSE = "i_close";
+   public static final String TPL_THEME_CODE_I_OPEN = "i_open";
+   public static final String TPL_THEME_CODE_IMG = "img";
+   public static final String TPL_THEME_CODE_LISTITEM = "listitem";
+   public static final String TPL_THEME_CODE_OLIST_CLOSE = "olist_close";
+   public static final String TPL_THEME_CODE_OLIST_OPEN = "olist_open";
+   public static final String TPL_THEME_CODE_QUOTE_CLOSE = "quote_close";
+   public static final String TPL_THEME_CODE_QUOTE_OPEN = "quote_open";
+   public static final String TPL_THEME_CODE_QUOTE_USERNAME_OPEN = "quote_username_open";
+   public static final String TPL_THEME_CODE_SIZE_CLOSE = "size_close";
+   public static final String TPL_THEME_CODE_SIZE_OPEN = "size_open";
+   public static final String TPL_THEME_CODE_U_CLOSE = "u_close";
+   public static final String TPL_THEME_CODE_U_OPEN = "u_open";
+   public static final String TPL_THEME_CODE_ULIST_CLOSE = "ulist_close";
+   public static final String TPL_THEME_CODE_ULIST_OPEN = "ulist_open";
+   public static final String TPL_THEME_CODE_URL = "url";
+
+   public static final int FILTER_MODE_ALWAYS_PRINT = 0;
+   public static final int FILTER_MODE_NEVER_PRINT = 1;
+   public static final int FILTER_MODE_PRINT_IF_NOT_IN_TAGS = 2;
+   public static final int FILTER_MODE_PRINT_IF_IN_TAGS = 3;
+
+   public static final int OUTPUT_MODE_REMOVE = 0;
+   public static final int OUTPUT_MODE_DISPLAY = 1;
+
+   private static final Loader loader = new CLLoader(ToHTMLRenderer.class.getClassLoader(), "");
+   private static final TemplateRepository defaultRepository = createRepository(loader);
+
+   Template r_ulist_open;
+   Template r_ulist_close;
+   Template r_olist_open;
+   Template r_olist_close;
+   Template r_listitem;
+   Template r_quote_open;
+   Template r_quote_close;
+   Template r_quote_username_open;
+   Template r_code_open;
+   Template r_code_close;
+   Template r_b_open;
+   Template r_b_close;
+   Template r_u_open;
+   Template r_u_close;
+   Template r_i_open;
+   Template r_i_close;
+   Template r_color_open;
+   Template r_color_close;
+   Template r_size_open;
+   Template r_size_close;
+   Template r_img;
+   Template r_url;
+   Template r_email;
+
+   private Set tags = new HashSet();
+   private int filterMode = FILTER_MODE_ALWAYS_PRINT;
+   private int ouputMode = OUTPUT_MODE_REMOVE;
+   private int maxTextWidth = 100;
+
+   public ToHTMLConfig()
+   {
+      setRepository(defaultRepository);
+   }
+
+   public void setLoader(Loader loader)
+   {
+      TemplateRepository repository = createRepository(loader);
+      setRepository(repository);
+   }
+
+   public int getMaxTextWidth()
+   {
+      return maxTextWidth;
+   }
+
+   public void setMaxTextWidth(int maxTextWidth)
+   {
+      this.maxTextWidth = maxTextWidth;
+   }
+
+   public void setTags(Set tags)
+   {
+      this.tags = tags;
+   }
+
+   public Set getTags()
+   {
+      return tags;
+   }
+
+   public int getFilterMode()
+   {
+      return filterMode;
+   }
+
+   public void setFilterMode(int filterMode)
+   {
+      this.filterMode = filterMode;
+   }
+
+   public int getOuputMode()
+   {
+      return ouputMode;
+   }
+
+   public void setOuputMode(int ouputMode)
+   {
+      this.ouputMode = ouputMode;
+   }
+
+   public boolean print(String tag)
+   {
+      switch (filterMode)
+      {
+         case FILTER_MODE_NEVER_PRINT:
+            return false;
+         case FILTER_MODE_PRINT_IF_NOT_IN_TAGS:
+            return !tags.contains(tag);
+         case FILTER_MODE_PRINT_IF_IN_TAGS:
+            return tags.contains(tag);
+         case FILTER_MODE_ALWAYS_PRINT:
+            return true;
+      }
+      return false;
+   }
+
+   private void setRepository(TemplateRepository repository)
+   {
+      r_ulist_open = repository.createTemplate(TPL_THEME_CODE_ULIST_OPEN);
+      r_ulist_close = repository.createTemplate(TPL_THEME_CODE_ULIST_CLOSE);
+      r_olist_open = repository.createTemplate(TPL_THEME_CODE_OLIST_OPEN);
+      r_olist_close = repository.createTemplate(TPL_THEME_CODE_OLIST_CLOSE);
+      r_listitem = repository.createTemplate(TPL_THEME_CODE_LISTITEM);
+      r_quote_open = repository.createTemplate(TPL_THEME_CODE_QUOTE_OPEN);
+      r_quote_close = repository.createTemplate(TPL_THEME_CODE_QUOTE_CLOSE);
+      r_quote_username_open = repository.createTemplate(TPL_THEME_CODE_QUOTE_USERNAME_OPEN);
+      r_code_open = repository.createTemplate(TPL_THEME_CODE_CODE_OPEN);
+      r_code_close = repository.createTemplate(TPL_THEME_CODE_CODE_CLOSE);
+      r_b_open = repository.createTemplate(TPL_THEME_CODE_B_OPEN);
+      r_b_close = repository.createTemplate(TPL_THEME_CODE_B_CLOSE);
+      r_u_open = repository.createTemplate(TPL_THEME_CODE_U_OPEN);
+      r_u_close = repository.createTemplate(TPL_THEME_CODE_U_CLOSE);
+      r_i_open = repository.createTemplate(TPL_THEME_CODE_I_OPEN);
+      r_i_close = repository.createTemplate(TPL_THEME_CODE_I_CLOSE);
+      r_color_open = repository.createTemplate(TPL_THEME_CODE_COLOR_OPEN);
+      r_color_close = repository.createTemplate(TPL_THEME_CODE_COLOR_CLOSE);
+      r_size_open = repository.createTemplate(TPL_THEME_CODE_SIZE_OPEN);
+      r_size_close = repository.createTemplate(TPL_THEME_CODE_SIZE_CLOSE);
+      r_img = repository.createTemplate(TPL_THEME_CODE_IMG);
+      r_url = repository.createTemplate(TPL_THEME_CODE_URL);
+      r_email = repository.createTemplate(TPL_THEME_CODE_EMAIL);
+   }
+
+   private static void loadTemplate(TemplateLoader repository, String name)
+   {
+      try
+      {
+         repository.addTemplate(name, "/" + name + ".tpl");
+      }
+      catch (BuildException e)
+      {
+         Logger.getLogger(ToHTMLRenderer.class).error("Cannot load template : " + name, e);
+      }
+   }
+
+   private static TemplateLoader createRepository(Loader loader)
+   {
+      TemplateLoader repository = new TemplateLoader(loader);
+      loadTemplate(repository, TPL_THEME_CODE_ULIST_OPEN);
+      loadTemplate(repository, TPL_THEME_CODE_ULIST_CLOSE);
+      loadTemplate(repository, TPL_THEME_CODE_OLIST_OPEN);
+      loadTemplate(repository, TPL_THEME_CODE_OLIST_CLOSE);
+      loadTemplate(repository, TPL_THEME_CODE_LISTITEM);
+      loadTemplate(repository, TPL_THEME_CODE_QUOTE_OPEN);
+      loadTemplate(repository, TPL_THEME_CODE_QUOTE_CLOSE);
+      loadTemplate(repository, TPL_THEME_CODE_QUOTE_USERNAME_OPEN);
+      loadTemplate(repository, TPL_THEME_CODE_CODE_OPEN);
+      loadTemplate(repository, TPL_THEME_CODE_CODE_CLOSE);
+      loadTemplate(repository, TPL_THEME_CODE_B_OPEN);
+      loadTemplate(repository, TPL_THEME_CODE_B_CLOSE);
+      loadTemplate(repository, TPL_THEME_CODE_U_OPEN);
+      loadTemplate(repository, TPL_THEME_CODE_U_CLOSE);
+      loadTemplate(repository, TPL_THEME_CODE_I_OPEN);
+      loadTemplate(repository, TPL_THEME_CODE_I_CLOSE);
+      loadTemplate(repository, TPL_THEME_CODE_COLOR_OPEN);
+      loadTemplate(repository, TPL_THEME_CODE_COLOR_CLOSE);
+      loadTemplate(repository, TPL_THEME_CODE_SIZE_OPEN);
+      loadTemplate(repository, TPL_THEME_CODE_SIZE_CLOSE);
+      loadTemplate(repository, TPL_THEME_CODE_IMG);
+      loadTemplate(repository, TPL_THEME_CODE_URL);
+      loadTemplate(repository, TPL_THEME_CODE_EMAIL);
+      return repository;
+   }
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/ToHTMLRenderer.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/ToHTMLRenderer.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/ToHTMLRenderer.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,366 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.render.bbcodehtml;
-
-import org.jboss.portlet.forums.format.parser.ParseEvent;
-import org.jboss.portlet.forums.format.parser.ParseEventHandler;
-import org.jboss.portlet.forums.format.parser.TextEvent;
-import org.jboss.portlet.forums.format.parser.bbcode.BBCodeParser;
-import org.jboss.portlet.forums.format.parser.entity.CharacterEntityReferenceEvent;
-import org.jboss.portlet.forums.format.parser.entity.HTML4_0CharacterEntityReferenceParser;
-import org.jboss.portlet.forums.format.parser.entity.XML1_0CharacterEntityReferenceParser;
-import org.jboss.portlet.forums.format.parser.html.TagParser;
-import org.jboss.portlet.forums.format.parser.linebreak.LineBreakParser;
-import org.jboss.portlet.forums.format.render.AbstractRenderer;
-import org.jboss.portlet.forums.format.template.DelegateContext;
-
-import java.util.ResourceBundle;
-
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class ToHTMLRenderer extends AbstractRenderer
-{
-
-   /*
-    * Different parsers.
-    */
-
-   private final BBCodeParser codeParser = new BBCodeParser();
-   private final TagParser tagParser = new TagParser();
-   private final XML1_0CharacterEntityReferenceParser XMLCERP = new XML1_0CharacterEntityReferenceParser();
-   private final HTML4_0CharacterEntityReferenceParser HTMLCERP = new HTML4_0CharacterEntityReferenceParser();
-   private final LineBreakParser lineBreakParser = new LineBreakParser();
-
-   /** Context used by the code handler templates. */
-   private final DelegateContext ctx = new DelegateContext();
-
-   /** Code depth. */
-   private int isInPre = 0;
-
-   /** Config. */
-   private ToHTMLConfig config;
-
-   /*
-    * Templates.
-    */
-
-   /** Setup the renderer with the given template repository. */
-   public ToHTMLRenderer(ToHTMLConfig config, ResourceBundle bundle)
-   {
-      if (config == null)
-      {
-         throw new IllegalArgumentException("no config");
-      }
-      if (bundle == null)
-      {
-         throw new IllegalArgumentException("no bundle");
-      }
-      this.config = config;
-      codeParser.setHandler(bbCodeHandler);
-      tagParser.setHandler(tagHandler);
-      XMLCERP.setHandler(XMLCRPHandler);
-      HTMLCERP.setHandler(HTMLCRPHandler);
-      lineBreakParser.setHandler(lineBreakHandler);
-      ctx.put("L_CODE", bundle.getString(BBCodeParser.BUNDLE_KEY_CODE));
-      ctx.put("L_QUOTE", bundle.getString(BBCodeParser.BUNDLE_KEY_QUOTE));
-      ctx.put("L_WROTE", bundle.getString(BBCodeParser.BUNDLE_KEY_WROTE));
-   }
-
-   public ToHTMLRenderer(ResourceBundle bundle)
-   {
-      this(new ToHTMLConfig(), bundle);
-   }
-
-   public ToHTMLConfig getConfig()
-   {
-      return config;
-   }
-
-   public void setConfig(ToHTMLConfig config)
-   {
-      this.config = config;
-   }
-
-   public void render(char[] chars, int offset, int length)
-   {
-      codeParser.parse(chars, offset, length);
-   }
-
-   public ParseEventHandler bbCodeHandler = new ParseEventHandler()
-   {
-      public void handle(ParseEvent event)
-      {
-         if (event instanceof BBCodeParser.OpenEvent)
-         {
-            BBCodeParser.OpenEvent openEvent = (BBCodeParser.OpenEvent)event;
-            String string = openEvent.getString();
-            switch (openEvent.getType())
-            {
-               case BBCodeParser.EVENT_BOLD:
-                  config.r_b_open.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_ITALIC:
-                  config.r_i_open.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_UNDERLINE:
-                  config.r_u_open.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_COLOR:
-                  ctx.put("COLOR", string);
-                  config.r_color_open.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_SIZE:
-                  ctx.put("SIZE", string);
-                  config.r_size_open.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_QUOTE:
-                  if (string == null)
-                  {
-                     config.r_quote_open.render(ctx, writer);
-                  }
-                  else
-                  {
-                     ctx.put("USERNAME", string);
-                     config.r_quote_username_open.render(ctx, writer);
-                  }
-                  break;
-               case BBCodeParser.EVENT_CODE:
-                  isInPre++;
-                  config.r_code_open.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_UNORDERED_LIST:
-                  config.r_ulist_open.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_NUMERICALLY_ORDERED_LIST:
-                  ctx.put("LIST_TYPE", "1");
-                  config.r_olist_open.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_ALPHABETICALLY_ORDERED_LIST:
-                  ctx.put("LIST_TYPE", "a");
-                  config.r_olist_open.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_ITEM:
-                  config.r_listitem.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_LINK:
-                  ctx.put("URL", string);
-                  ctx.put("DESCRIPTION", string);
-                  config.r_url.render(ctx, writer);
-                  break;
-            }
-         }
-         else if (event instanceof BBCodeParser.CloseEvent)
-         {
-            BBCodeParser.CloseEvent closeEvent = (BBCodeParser.CloseEvent)event;
-            switch (closeEvent.getType())
-            {
-               case BBCodeParser.EVENT_BOLD:
-                  config.r_b_close.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_ITALIC:
-                  config.r_i_close.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_UNDERLINE:
-                  config.r_u_close.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_COLOR:
-                  config.r_color_close.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_SIZE:
-                  config.r_size_close.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_QUOTE:
-                  config.r_quote_close.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_CODE:
-                  isInPre--;
-                  config.r_code_close.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_UNORDERED_LIST:
-                  config.r_ulist_close.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_NUMERICALLY_ORDERED_LIST:
-                  config.r_olist_close.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_ALPHABETICALLY_ORDERED_LIST:
-                  config.r_olist_close.render(ctx, writer);
-                  break;
-               case BBCodeParser.EVENT_ITEM:
-                  break;
-               case BBCodeParser.EVENT_LINK:
-                  break;
-            }
-         }
-         else
-         {
-            TextEvent textEvent = (TextEvent)event;
-            if (isInPre > 0)
-            {
-               XMLCERP.parse(textEvent.chars(), textEvent.offset(), textEvent.length());
-            }
-            else
-            {
-               tagParser.parse(textEvent.chars(), textEvent.offset(), textEvent.length());
-            }
-         }
-      }
-   };
-
-   public ParseEventHandler tagHandler = new ParseEventHandler()
-   {
-      public void handle(ParseEvent event)
-      {
-         if (event instanceof TagParser.OpenEvent)
-         {
-            TagParser.OpenEvent openEvent = (TagParser.OpenEvent)event;
-            switch (openEvent.getType())
-            {
-               case TagParser.EVENT_TAG:
-                  String tag = openEvent.getTag();
-                  if (config.print(tag))
-                  {
-                     if ("pre".equals(tag))
-                     {
-                        isInPre++;
-                     }
-                     write("<");
-                     write(tag);
-                     write(openEvent.getAttribute());
-                     write(">");
-                  }
-                  else if (config.getOuputMode() == ToHTMLConfig.OUTPUT_MODE_DISPLAY)
-                  {
-                     write("&lt;");
-                     write(tag);
-                     write(openEvent.getAttribute());
-                     write("&gt;");
-                  }
-                  break;
-            }
-         }
-         else if (event instanceof TagParser.CloseEvent)
-         {
-            TagParser.CloseEvent closeEvent = (TagParser.CloseEvent)event;
-            switch (closeEvent.getType())
-            {
-               case TagParser.EVENT_TAG:
-                  String tag = closeEvent.getTag();
-                  if (config.print(tag))
-                  {
-                     if ("pre".equals(tag))
-                     {
-                        isInPre--;
-                     }
-                     write("</");
-                     write(tag);
-                     write(">");
-                  }
-                  else if (config.getOuputMode() == ToHTMLConfig.OUTPUT_MODE_DISPLAY)
-                  {
-                     write("&lt;/");
-                     write(tag);
-                     write("&gt;");
-                  }
-                  break;
-            }
-         }
-         else
-         {
-            TextEvent textEvent = (TextEvent)event;
-            XMLCERP.parse(textEvent.chars(), textEvent.offset(), textEvent.length());
-         }
-      }
-   };
-
-   public ParseEventHandler XMLCRPHandler = new ParseEventHandler()
-   {
-      public void handle(ParseEvent event)
-      {
-         if (event instanceof CharacterEntityReferenceEvent)
-         {
-            CharacterEntityReferenceEvent cere = (CharacterEntityReferenceEvent)event;
-            lineBreakParser.parse(cere.chars(), cere.offset(), cere.length());
-         }
-         else
-         {
-            TextEvent te = (TextEvent)event;
-            HTMLCERP.parse(te.chars(), te.offset(), te.length());
-         }
-      }
-   };
-
-   public ParseEventHandler HTMLCRPHandler = new ParseEventHandler()
-   {
-      public void handle(ParseEvent event)
-      {
-         TextEvent textEvent = (TextEvent)event;
-         lineBreakParser.parse(textEvent.chars(), textEvent.offset(), textEvent.length());
-      }
-   };
-
-   public ParseEventHandler lineBreakHandler = new ParseEventHandler()
-   {
-      public void handle(ParseEvent event)
-      {
-         if (event instanceof TextEvent)
-         {
-            TextEvent textEvent = (TextEvent)event;
-            if (isInPre == 0)
-            {
-               write(textEvent.chars(), textEvent.offset(), textEvent.length());
-            }
-            else
-            {
-               // Break the content in small chunks
-               char[] chars = textEvent.chars();
-               int offset = textEvent.offset();
-               int length = textEvent.length();
-               int maxSize = config.getMaxTextWidth();
-               while (length > maxSize)
-               {
-                  write(chars, offset, maxSize);
-                  length -= maxSize;
-                  offset += maxSize;
-                  write("\n");
-               }
-               // Ouput the last chunk
-               write(chars, offset, length);
-            }
-         }
-         else
-         {
-            if (isInPre == 0)
-            {
-               write("<br/>");
-            }
-            else
-            {
-               write("\n");
-            }
-         }
-      }
-   };
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/ToHTMLRenderer.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/ToHTMLRenderer.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/ToHTMLRenderer.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/render/bbcodehtml/ToHTMLRenderer.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,366 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.render.bbcodehtml;
+
+import org.jboss.portlet.forums.format.parser.ParseEvent;
+import org.jboss.portlet.forums.format.parser.ParseEventHandler;
+import org.jboss.portlet.forums.format.parser.TextEvent;
+import org.jboss.portlet.forums.format.parser.bbcode.BBCodeParser;
+import org.jboss.portlet.forums.format.parser.entity.CharacterEntityReferenceEvent;
+import org.jboss.portlet.forums.format.parser.entity.HTML4_0CharacterEntityReferenceParser;
+import org.jboss.portlet.forums.format.parser.entity.XML1_0CharacterEntityReferenceParser;
+import org.jboss.portlet.forums.format.parser.html.TagParser;
+import org.jboss.portlet.forums.format.parser.linebreak.LineBreakParser;
+import org.jboss.portlet.forums.format.render.AbstractRenderer;
+import org.jboss.portlet.forums.format.template.DelegateContext;
+
+import java.util.ResourceBundle;
+
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class ToHTMLRenderer extends AbstractRenderer
+{
+
+   /*
+    * Different parsers.
+    */
+
+   private final BBCodeParser codeParser = new BBCodeParser();
+   private final TagParser tagParser = new TagParser();
+   private final XML1_0CharacterEntityReferenceParser XMLCERP = new XML1_0CharacterEntityReferenceParser();
+   private final HTML4_0CharacterEntityReferenceParser HTMLCERP = new HTML4_0CharacterEntityReferenceParser();
+   private final LineBreakParser lineBreakParser = new LineBreakParser();
+
+   /** Context used by the code handler templates. */
+   private final DelegateContext ctx = new DelegateContext();
+
+   /** Code depth. */
+   private int isInPre = 0;
+
+   /** Config. */
+   private ToHTMLConfig config;
+
+   /*
+    * Templates.
+    */
+
+   /** Setup the renderer with the given template repository. */
+   public ToHTMLRenderer(ToHTMLConfig config, ResourceBundle bundle)
+   {
+      if (config == null)
+      {
+         throw new IllegalArgumentException("no config");
+      }
+      if (bundle == null)
+      {
+         throw new IllegalArgumentException("no bundle");
+      }
+      this.config = config;
+      codeParser.setHandler(bbCodeHandler);
+      tagParser.setHandler(tagHandler);
+      XMLCERP.setHandler(XMLCRPHandler);
+      HTMLCERP.setHandler(HTMLCRPHandler);
+      lineBreakParser.setHandler(lineBreakHandler);
+      ctx.put("L_CODE", bundle.getString(BBCodeParser.BUNDLE_KEY_CODE));
+      ctx.put("L_QUOTE", bundle.getString(BBCodeParser.BUNDLE_KEY_QUOTE));
+      ctx.put("L_WROTE", bundle.getString(BBCodeParser.BUNDLE_KEY_WROTE));
+   }
+
+   public ToHTMLRenderer(ResourceBundle bundle)
+   {
+      this(new ToHTMLConfig(), bundle);
+   }
+
+   public ToHTMLConfig getConfig()
+   {
+      return config;
+   }
+
+   public void setConfig(ToHTMLConfig config)
+   {
+      this.config = config;
+   }
+
+   public void render(char[] chars, int offset, int length)
+   {
+      codeParser.parse(chars, offset, length);
+   }
+
+   public ParseEventHandler bbCodeHandler = new ParseEventHandler()
+   {
+      public void handle(ParseEvent event)
+      {
+         if (event instanceof BBCodeParser.OpenEvent)
+         {
+            BBCodeParser.OpenEvent openEvent = (BBCodeParser.OpenEvent)event;
+            String string = openEvent.getString();
+            switch (openEvent.getType())
+            {
+               case BBCodeParser.EVENT_BOLD:
+                  config.r_b_open.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_ITALIC:
+                  config.r_i_open.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_UNDERLINE:
+                  config.r_u_open.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_COLOR:
+                  ctx.put("COLOR", string);
+                  config.r_color_open.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_SIZE:
+                  ctx.put("SIZE", string);
+                  config.r_size_open.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_QUOTE:
+                  if (string == null)
+                  {
+                     config.r_quote_open.render(ctx, writer);
+                  }
+                  else
+                  {
+                     ctx.put("USERNAME", string);
+                     config.r_quote_username_open.render(ctx, writer);
+                  }
+                  break;
+               case BBCodeParser.EVENT_CODE:
+                  isInPre++;
+                  config.r_code_open.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_UNORDERED_LIST:
+                  config.r_ulist_open.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_NUMERICALLY_ORDERED_LIST:
+                  ctx.put("LIST_TYPE", "1");
+                  config.r_olist_open.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_ALPHABETICALLY_ORDERED_LIST:
+                  ctx.put("LIST_TYPE", "a");
+                  config.r_olist_open.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_ITEM:
+                  config.r_listitem.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_LINK:
+                  ctx.put("URL", string);
+                  ctx.put("DESCRIPTION", string);
+                  config.r_url.render(ctx, writer);
+                  break;
+            }
+         }
+         else if (event instanceof BBCodeParser.CloseEvent)
+         {
+            BBCodeParser.CloseEvent closeEvent = (BBCodeParser.CloseEvent)event;
+            switch (closeEvent.getType())
+            {
+               case BBCodeParser.EVENT_BOLD:
+                  config.r_b_close.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_ITALIC:
+                  config.r_i_close.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_UNDERLINE:
+                  config.r_u_close.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_COLOR:
+                  config.r_color_close.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_SIZE:
+                  config.r_size_close.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_QUOTE:
+                  config.r_quote_close.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_CODE:
+                  isInPre--;
+                  config.r_code_close.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_UNORDERED_LIST:
+                  config.r_ulist_close.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_NUMERICALLY_ORDERED_LIST:
+                  config.r_olist_close.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_ALPHABETICALLY_ORDERED_LIST:
+                  config.r_olist_close.render(ctx, writer);
+                  break;
+               case BBCodeParser.EVENT_ITEM:
+                  break;
+               case BBCodeParser.EVENT_LINK:
+                  break;
+            }
+         }
+         else
+         {
+            TextEvent textEvent = (TextEvent)event;
+            if (isInPre > 0)
+            {
+               XMLCERP.parse(textEvent.chars(), textEvent.offset(), textEvent.length());
+            }
+            else
+            {
+               tagParser.parse(textEvent.chars(), textEvent.offset(), textEvent.length());
+            }
+         }
+      }
+   };
+
+   public ParseEventHandler tagHandler = new ParseEventHandler()
+   {
+      public void handle(ParseEvent event)
+      {
+         if (event instanceof TagParser.OpenEvent)
+         {
+            TagParser.OpenEvent openEvent = (TagParser.OpenEvent)event;
+            switch (openEvent.getType())
+            {
+               case TagParser.EVENT_TAG:
+                  String tag = openEvent.getTag();
+                  if (config.print(tag))
+                  {
+                     if ("pre".equals(tag))
+                     {
+                        isInPre++;
+                     }
+                     write("<");
+                     write(tag);
+                     write(openEvent.getAttribute());
+                     write(">");
+                  }
+                  else if (config.getOuputMode() == ToHTMLConfig.OUTPUT_MODE_DISPLAY)
+                  {
+                     write("&lt;");
+                     write(tag);
+                     write(openEvent.getAttribute());
+                     write("&gt;");
+                  }
+                  break;
+            }
+         }
+         else if (event instanceof TagParser.CloseEvent)
+         {
+            TagParser.CloseEvent closeEvent = (TagParser.CloseEvent)event;
+            switch (closeEvent.getType())
+            {
+               case TagParser.EVENT_TAG:
+                  String tag = closeEvent.getTag();
+                  if (config.print(tag))
+                  {
+                     if ("pre".equals(tag))
+                     {
+                        isInPre--;
+                     }
+                     write("</");
+                     write(tag);
+                     write(">");
+                  }
+                  else if (config.getOuputMode() == ToHTMLConfig.OUTPUT_MODE_DISPLAY)
+                  {
+                     write("&lt;/");
+                     write(tag);
+                     write("&gt;");
+                  }
+                  break;
+            }
+         }
+         else
+         {
+            TextEvent textEvent = (TextEvent)event;
+            XMLCERP.parse(textEvent.chars(), textEvent.offset(), textEvent.length());
+         }
+      }
+   };
+
+   public ParseEventHandler XMLCRPHandler = new ParseEventHandler()
+   {
+      public void handle(ParseEvent event)
+      {
+         if (event instanceof CharacterEntityReferenceEvent)
+         {
+            CharacterEntityReferenceEvent cere = (CharacterEntityReferenceEvent)event;
+            lineBreakParser.parse(cere.chars(), cere.offset(), cere.length());
+         }
+         else
+         {
+            TextEvent te = (TextEvent)event;
+            HTMLCERP.parse(te.chars(), te.offset(), te.length());
+         }
+      }
+   };
+
+   public ParseEventHandler HTMLCRPHandler = new ParseEventHandler()
+   {
+      public void handle(ParseEvent event)
+      {
+         TextEvent textEvent = (TextEvent)event;
+         lineBreakParser.parse(textEvent.chars(), textEvent.offset(), textEvent.length());
+      }
+   };
+
+   public ParseEventHandler lineBreakHandler = new ParseEventHandler()
+   {
+      public void handle(ParseEvent event)
+      {
+         if (event instanceof TextEvent)
+         {
+            TextEvent textEvent = (TextEvent)event;
+            if (isInPre == 0)
+            {
+               write(textEvent.chars(), textEvent.offset(), textEvent.length());
+            }
+            else
+            {
+               // Break the content in small chunks
+               char[] chars = textEvent.chars();
+               int offset = textEvent.offset();
+               int length = textEvent.length();
+               int maxSize = config.getMaxTextWidth();
+               while (length > maxSize)
+               {
+                  write(chars, offset, maxSize);
+                  length -= maxSize;
+                  offset += maxSize;
+                  write("\n");
+               }
+               // Ouput the last chunk
+               write(chars, offset, length);
+            }
+         }
+         else
+         {
+            if (isInPre == 0)
+            {
+               write("<br/>");
+            }
+            else
+            {
+               write("\n");
+            }
+         }
+      }
+   };
+}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template)

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ASCII_CharStream.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/ASCII_CharStream.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ASCII_CharStream.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,386 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. ASCII_CharStream.java Version 0.7pre6 */
-/*****************************************
- *                                       *
- *  JBoss Portal: The OpenSource Portal  *
- *                                       *
- *   Distributable under LGPL license.   *
- *   See terms of license at gnu.org.    *
- *                                       *
- *****************************************/
-
-package org.jboss.portlet.forums.format.template;
-
-/**
- * An implementation of interface CharStream, where the stream is assumed to
- * contain only ASCII characters (without unicode processing).
- */
-
-public final class ASCII_CharStream
-{
-  public static final boolean staticFlag = false;
-  int bufsize;
-  int available;
-  int tokenBegin;
-  public int bufpos = -1;
-  private int bufline[];
-  private int bufcolumn[];
-
-  private int column = 0;
-  private int line = 1;
-
-  private boolean prevCharIsCR = false;
-  private boolean prevCharIsLF = false;
-
-  private java.io.Reader inputStream;
-
-  private char[] buffer;
-  private int maxNextCharInd = 0;
-  private int inBuf = 0;
-
-  private final void ExpandBuff(boolean wrapAround)
-  {
-     char[] newbuffer = new char[bufsize + 2048];
-     int newbufline[] = new int[bufsize + 2048];
-     int newbufcolumn[] = new int[bufsize + 2048];
-
-     try
-     {
-        if (wrapAround)
-        {
-           System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
-           System.arraycopy(buffer, 0, newbuffer,
-                                             bufsize - tokenBegin, bufpos);
-           buffer = newbuffer;
-
-           System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
-           System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
-           bufline = newbufline;
-
-           System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
-           System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
-           bufcolumn = newbufcolumn;
-
-           maxNextCharInd = (bufpos += (bufsize - tokenBegin));
-        }
-        else
-        {
-           System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
-           buffer = newbuffer;
-
-           System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
-           bufline = newbufline;
-
-           System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
-           bufcolumn = newbufcolumn;
-
-           maxNextCharInd = (bufpos -= tokenBegin);
-        }
-     }
-     catch (Throwable t)
-     {
-        throw new Error(t.getMessage());
-     }
-
-
-     bufsize += 2048;
-     available = bufsize;
-     tokenBegin = 0;
-  }
-
-  private final void FillBuff() throws java.io.IOException
-  {
-     if (maxNextCharInd == available)
-     {
-        if (available == bufsize)
-        {
-           if (tokenBegin > 2048)
-           {
-              bufpos = maxNextCharInd = 0;
-              available = tokenBegin;
-           }
-           else if (tokenBegin < 0)
-              bufpos = maxNextCharInd = 0;
-           else
-              ExpandBuff(false);
-        }
-        else if (available > tokenBegin)
-           available = bufsize;
-        else if ((tokenBegin - available) < 2048)
-           ExpandBuff(true);
-        else
-           available = tokenBegin;
-     }
-
-     int i;
-     try {
-        if ((i = inputStream.read(buffer, maxNextCharInd,
-                                    available - maxNextCharInd)) == -1)
-        {
-           inputStream.close();
-           throw new java.io.IOException();
-        }
-        else
-           maxNextCharInd += i;
-        return;
-     }
-     catch(java.io.IOException e) {
-        --bufpos;
-        backup(0);
-        if (tokenBegin == -1)
-           tokenBegin = bufpos;
-        throw e;
-     }
-  }
-
-  public final char BeginToken() throws java.io.IOException
-  {
-     tokenBegin = -1;
-     char c = readChar();
-     tokenBegin = bufpos;
-
-     return c;
-  }
-
-  private final void UpdateLineColumn(char c)
-  {
-     column++;
-
-     if (prevCharIsLF)
-     {
-        prevCharIsLF = false;
-        line += (column = 1);
-     }
-     else if (prevCharIsCR)
-     {
-        prevCharIsCR = false;
-        if (c == '\n')
-        {
-           prevCharIsLF = true;
-        }
-        else
-           line += (column = 1);
-     }
-
-     switch (c)
-     {
-        case '\r' :
-           prevCharIsCR = true;
-           break;
-        case '\n' :
-           prevCharIsLF = true;
-           break;
-        case '\t' :
-           column--;
-           column += (8 - (column & 07));
-           break;
-        default :
-           break;
-     }
-
-     bufline[bufpos] = line;
-     bufcolumn[bufpos] = column;
-  }
-
-  public final char readChar() throws java.io.IOException
-  {
-     if (inBuf > 0)
-     {
-        --inBuf;
-        return (char)((char)0xff & buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos]);
-     }
-
-     if (++bufpos >= maxNextCharInd)
-        FillBuff();
-
-     char c = (char)((char)0xff & buffer[bufpos]);
-
-     UpdateLineColumn(c);
-     return (c);
-  }
-
-  /**
-   * @deprecated 
-   * @see #getEndColumn
-   */
-
-  public final int getColumn() {
-     return bufcolumn[bufpos];
-  }
-
-  /**
-   * @deprecated 
-   * @see #getEndLine
-   */
-
-  public final int getLine() {
-     return bufline[bufpos];
-  }
-
-  public final int getEndColumn() {
-     return bufcolumn[bufpos];
-  }
-
-  public final int getEndLine() {
-     return bufline[bufpos];
-  }
-
-  public final int getBeginColumn() {
-     return bufcolumn[tokenBegin];
-  }
-
-  public final int getBeginLine() {
-     return bufline[tokenBegin];
-  }
-
-  public final void backup(int amount) {
-
-    inBuf += amount;
-    if ((bufpos -= amount) < 0)
-       bufpos += bufsize;
-  }
-
-  public ASCII_CharStream(java.io.Reader dstream, int startline,
-  int startcolumn, int buffersize)
-  {
-    inputStream = dstream;
-    line = startline;
-    column = startcolumn - 1;
-
-    available = bufsize = buffersize;
-    buffer = new char[buffersize];
-    bufline = new int[buffersize];
-    bufcolumn = new int[buffersize];
-  }
-
-  public ASCII_CharStream(java.io.Reader dstream, int startline,
-                                                           int startcolumn)
-  {
-     this(dstream, startline, startcolumn, 4096);
-  }
-  public void ReInit(java.io.Reader dstream, int startline,
-  int startcolumn, int buffersize)
-  {
-    inputStream = dstream;
-    line = startline;
-    column = startcolumn - 1;
-
-    if (buffer == null || buffersize != buffer.length)
-    {
-      available = bufsize = buffersize;
-      buffer = new char[buffersize];
-      bufline = new int[buffersize];
-      bufcolumn = new int[buffersize];
-    }
-    prevCharIsLF = prevCharIsCR = false;
-    tokenBegin = inBuf = maxNextCharInd = 0;
-    bufpos = -1;
-  }
-
-  public void ReInit(java.io.Reader dstream, int startline,
-                                                           int startcolumn)
-  {
-     ReInit(dstream, startline, startcolumn, 4096);
-  }
-  public ASCII_CharStream(java.io.InputStream dstream, int startline,
-  int startcolumn, int buffersize)
-  {
-     this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
-  }
-
-  public ASCII_CharStream(java.io.InputStream dstream, int startline,
-                                                           int startcolumn)
-  {
-     this(dstream, startline, startcolumn, 4096);
-  }
-
-  public void ReInit(java.io.InputStream dstream, int startline,
-  int startcolumn, int buffersize)
-  {
-     ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
-  }
-  public void ReInit(java.io.InputStream dstream, int startline,
-                                                           int startcolumn)
-  {
-     ReInit(dstream, startline, startcolumn, 4096);
-  }
-  public final String GetImage()
-  {
-     if (bufpos >= tokenBegin)
-        return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
-     else
-        return new String(buffer, tokenBegin, bufsize - tokenBegin) +
-                              new String(buffer, 0, bufpos + 1);
-  }
-
-  public final char[] GetSuffix(int len)
-  {
-     char[] ret = new char[len];
-
-     if ((bufpos + 1) >= len)
-        System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
-     else
-     {
-        System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
-                                                          len - bufpos - 1);
-        System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
-     }
-
-     return ret;
-  }
-
-  public void Done()
-  {
-     buffer = null;
-     bufline = null;
-     bufcolumn = null;
-  }
-
-  /**
-   * Method to adjust line and column numbers for the start of a token.<BR>
-   */
-  public void adjustBeginLineColumn(int newLine, int newCol)
-  {
-     int start = tokenBegin;
-     int len;
-
-     if (bufpos >= tokenBegin)
-     {
-        len = bufpos - tokenBegin + inBuf + 1;
-     }
-     else
-     {
-        len = bufsize - tokenBegin + bufpos + 1 + inBuf;
-     }
-
-     int i = 0, j = 0, k = 0;
-     int nextColDiff = 0, columnDiff = 0;
-
-     while (i < len &&
-            bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
-     {
-        bufline[j] = newLine;
-        nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
-        bufcolumn[j] = newCol + columnDiff;
-        columnDiff = nextColDiff;
-        i++;
-     } 
-
-     if (i < len)
-     {
-        bufline[j] = newLine++;
-        bufcolumn[j] = newCol + columnDiff;
-
-        while (i++ < len)
-        {
-           if (bufline[j = start % bufsize] != bufline[++start % bufsize])
-              bufline[j] = newLine++;
-           else
-              bufline[j] = newLine;
-        }
-     }
-
-     line = bufline[j];
-     column = bufcolumn[j];
-  }
-
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ASCII_CharStream.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/ASCII_CharStream.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ASCII_CharStream.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ASCII_CharStream.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,386 @@
+/* Generated By:JavaCC: Do not edit this line. ASCII_CharStream.java Version 0.7pre6 */
+/*****************************************
+ *                                       *
+ *  JBoss Portal: The OpenSource Portal  *
+ *                                       *
+ *   Distributable under LGPL license.   *
+ *   See terms of license at gnu.org.    *
+ *                                       *
+ *****************************************/
+
+package org.jboss.portlet.forums.format.template;
+
+/**
+ * An implementation of interface CharStream, where the stream is assumed to
+ * contain only ASCII characters (without unicode processing).
+ */
+
+public final class ASCII_CharStream
+{
+  public static final boolean staticFlag = false;
+  int bufsize;
+  int available;
+  int tokenBegin;
+  public int bufpos = -1;
+  private int bufline[];
+  private int bufcolumn[];
+
+  private int column = 0;
+  private int line = 1;
+
+  private boolean prevCharIsCR = false;
+  private boolean prevCharIsLF = false;
+
+  private java.io.Reader inputStream;
+
+  private char[] buffer;
+  private int maxNextCharInd = 0;
+  private int inBuf = 0;
+
+  private final void ExpandBuff(boolean wrapAround)
+  {
+     char[] newbuffer = new char[bufsize + 2048];
+     int newbufline[] = new int[bufsize + 2048];
+     int newbufcolumn[] = new int[bufsize + 2048];
+
+     try
+     {
+        if (wrapAround)
+        {
+           System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+           System.arraycopy(buffer, 0, newbuffer,
+                                             bufsize - tokenBegin, bufpos);
+           buffer = newbuffer;
+
+           System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+           System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+           bufline = newbufline;
+
+           System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+           System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+           bufcolumn = newbufcolumn;
+
+           maxNextCharInd = (bufpos += (bufsize - tokenBegin));
+        }
+        else
+        {
+           System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+           buffer = newbuffer;
+
+           System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+           bufline = newbufline;
+
+           System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+           bufcolumn = newbufcolumn;
+
+           maxNextCharInd = (bufpos -= tokenBegin);
+        }
+     }
+     catch (Throwable t)
+     {
+        throw new Error(t.getMessage());
+     }
+
+
+     bufsize += 2048;
+     available = bufsize;
+     tokenBegin = 0;
+  }
+
+  private final void FillBuff() throws java.io.IOException
+  {
+     if (maxNextCharInd == available)
+     {
+        if (available == bufsize)
+        {
+           if (tokenBegin > 2048)
+           {
+              bufpos = maxNextCharInd = 0;
+              available = tokenBegin;
+           }
+           else if (tokenBegin < 0)
+              bufpos = maxNextCharInd = 0;
+           else
+              ExpandBuff(false);
+        }
+        else if (available > tokenBegin)
+           available = bufsize;
+        else if ((tokenBegin - available) < 2048)
+           ExpandBuff(true);
+        else
+           available = tokenBegin;
+     }
+
+     int i;
+     try {
+        if ((i = inputStream.read(buffer, maxNextCharInd,
+                                    available - maxNextCharInd)) == -1)
+        {
+           inputStream.close();
+           throw new java.io.IOException();
+        }
+        else
+           maxNextCharInd += i;
+        return;
+     }
+     catch(java.io.IOException e) {
+        --bufpos;
+        backup(0);
+        if (tokenBegin == -1)
+           tokenBegin = bufpos;
+        throw e;
+     }
+  }
+
+  public final char BeginToken() throws java.io.IOException
+  {
+     tokenBegin = -1;
+     char c = readChar();
+     tokenBegin = bufpos;
+
+     return c;
+  }
+
+  private final void UpdateLineColumn(char c)
+  {
+     column++;
+
+     if (prevCharIsLF)
+     {
+        prevCharIsLF = false;
+        line += (column = 1);
+     }
+     else if (prevCharIsCR)
+     {
+        prevCharIsCR = false;
+        if (c == '\n')
+        {
+           prevCharIsLF = true;
+        }
+        else
+           line += (column = 1);
+     }
+
+     switch (c)
+     {
+        case '\r' :
+           prevCharIsCR = true;
+           break;
+        case '\n' :
+           prevCharIsLF = true;
+           break;
+        case '\t' :
+           column--;
+           column += (8 - (column & 07));
+           break;
+        default :
+           break;
+     }
+
+     bufline[bufpos] = line;
+     bufcolumn[bufpos] = column;
+  }
+
+  public final char readChar() throws java.io.IOException
+  {
+     if (inBuf > 0)
+     {
+        --inBuf;
+        return (char)((char)0xff & buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos]);
+     }
+
+     if (++bufpos >= maxNextCharInd)
+        FillBuff();
+
+     char c = (char)((char)0xff & buffer[bufpos]);
+
+     UpdateLineColumn(c);
+     return (c);
+  }
+
+  /**
+   * @deprecated 
+   * @see #getEndColumn
+   */
+
+  public final int getColumn() {
+     return bufcolumn[bufpos];
+  }
+
+  /**
+   * @deprecated 
+   * @see #getEndLine
+   */
+
+  public final int getLine() {
+     return bufline[bufpos];
+  }
+
+  public final int getEndColumn() {
+     return bufcolumn[bufpos];
+  }
+
+  public final int getEndLine() {
+     return bufline[bufpos];
+  }
+
+  public final int getBeginColumn() {
+     return bufcolumn[tokenBegin];
+  }
+
+  public final int getBeginLine() {
+     return bufline[tokenBegin];
+  }
+
+  public final void backup(int amount) {
+
+    inBuf += amount;
+    if ((bufpos -= amount) < 0)
+       bufpos += bufsize;
+  }
+
+  public ASCII_CharStream(java.io.Reader dstream, int startline,
+  int startcolumn, int buffersize)
+  {
+    inputStream = dstream;
+    line = startline;
+    column = startcolumn - 1;
+
+    available = bufsize = buffersize;
+    buffer = new char[buffersize];
+    bufline = new int[buffersize];
+    bufcolumn = new int[buffersize];
+  }
+
+  public ASCII_CharStream(java.io.Reader dstream, int startline,
+                                                           int startcolumn)
+  {
+     this(dstream, startline, startcolumn, 4096);
+  }
+  public void ReInit(java.io.Reader dstream, int startline,
+  int startcolumn, int buffersize)
+  {
+    inputStream = dstream;
+    line = startline;
+    column = startcolumn - 1;
+
+    if (buffer == null || buffersize != buffer.length)
+    {
+      available = bufsize = buffersize;
+      buffer = new char[buffersize];
+      bufline = new int[buffersize];
+      bufcolumn = new int[buffersize];
+    }
+    prevCharIsLF = prevCharIsCR = false;
+    tokenBegin = inBuf = maxNextCharInd = 0;
+    bufpos = -1;
+  }
+
+  public void ReInit(java.io.Reader dstream, int startline,
+                                                           int startcolumn)
+  {
+     ReInit(dstream, startline, startcolumn, 4096);
+  }
+  public ASCII_CharStream(java.io.InputStream dstream, int startline,
+  int startcolumn, int buffersize)
+  {
+     this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+  }
+
+  public ASCII_CharStream(java.io.InputStream dstream, int startline,
+                                                           int startcolumn)
+  {
+     this(dstream, startline, startcolumn, 4096);
+  }
+
+  public void ReInit(java.io.InputStream dstream, int startline,
+  int startcolumn, int buffersize)
+  {
+     ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+  }
+  public void ReInit(java.io.InputStream dstream, int startline,
+                                                           int startcolumn)
+  {
+     ReInit(dstream, startline, startcolumn, 4096);
+  }
+  public final String GetImage()
+  {
+     if (bufpos >= tokenBegin)
+        return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+     else
+        return new String(buffer, tokenBegin, bufsize - tokenBegin) +
+                              new String(buffer, 0, bufpos + 1);
+  }
+
+  public final char[] GetSuffix(int len)
+  {
+     char[] ret = new char[len];
+
+     if ((bufpos + 1) >= len)
+        System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+     else
+     {
+        System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
+                                                          len - bufpos - 1);
+        System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+     }
+
+     return ret;
+  }
+
+  public void Done()
+  {
+     buffer = null;
+     bufline = null;
+     bufcolumn = null;
+  }
+
+  /**
+   * Method to adjust line and column numbers for the start of a token.<BR>
+   */
+  public void adjustBeginLineColumn(int newLine, int newCol)
+  {
+     int start = tokenBegin;
+     int len;
+
+     if (bufpos >= tokenBegin)
+     {
+        len = bufpos - tokenBegin + inBuf + 1;
+     }
+     else
+     {
+        len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+     }
+
+     int i = 0, j = 0, k = 0;
+     int nextColDiff = 0, columnDiff = 0;
+
+     while (i < len &&
+            bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
+     {
+        bufline[j] = newLine;
+        nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+        bufcolumn[j] = newCol + columnDiff;
+        columnDiff = nextColDiff;
+        i++;
+     } 
+
+     if (i < len)
+     {
+        bufline[j] = newLine++;
+        bufcolumn[j] = newCol + columnDiff;
+
+        while (i++ < len)
+        {
+           if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+              bufline[j] = newLine++;
+           else
+              bufline[j] = newLine;
+        }
+     }
+
+     line = bufline[j];
+     column = bufcolumn[j];
+  }
+
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/AbstractContext.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/AbstractContext.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/AbstractContext.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,47 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.template;
-
-import java.util.Iterator;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public abstract class AbstractContext implements Context
-{
-   public Iterator childIterator(String name)
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public String get(String o)
-   {
-      throw new UnsupportedOperationException();
-   }
-
-   public Context put(String key, String value)
-   {
-      throw new UnsupportedOperationException();
-   }
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/AbstractContext.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/AbstractContext.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/AbstractContext.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/AbstractContext.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.template;
+
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public abstract class AbstractContext implements Context
+{
+   public Iterator childIterator(String name)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public String get(String o)
+   {
+      throw new UnsupportedOperationException();
+   }
+
+   public Context put(String key, String value)
+   {
+      throw new UnsupportedOperationException();
+   }
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/BuildException.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/BuildException.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/BuildException.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,56 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.template;
-
-import org.jboss.util.NestedException;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class BuildException
-   extends NestedException
-{
-
-   /** The serialVersionUID */
-   private static final long serialVersionUID = -2549615796913473453L;
-
-   public BuildException()
-   {
-   }
-
-   public BuildException(String message)
-   {
-      super(message);
-   }
-
-   public BuildException(Exception nested)
-   {
-      super(nested);
-   }
-
-   public BuildException(String message, Exception nested)
-   {
-      super(message, nested);
-   }
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/BuildException.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/BuildException.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/BuildException.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/BuildException.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,56 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.template;
+
+import org.jboss.util.NestedException;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class BuildException
+   extends NestedException
+{
+
+   /** The serialVersionUID */
+   private static final long serialVersionUID = -2549615796913473453L;
+
+   public BuildException()
+   {
+   }
+
+   public BuildException(String message)
+   {
+      super(message);
+   }
+
+   public BuildException(Exception nested)
+   {
+      super(nested);
+   }
+
+   public BuildException(String message, Exception nested)
+   {
+      super(message, nested);
+   }
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ChildrenStrategy.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/ChildrenStrategy.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ChildrenStrategy.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,62 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.template;
-
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class ChildrenStrategy
-{
-
-   public ChildrenStrategy(Map children)
-   {
-      this.children = children;
-   }
-
-   private Map children;
-
-   public void append(String name, Context ctx)
-   {
-      List child = (List)children.get(name);
-      if (child == null)
-      {
-         child = new LinkedList();
-         children.put(name, child);
-      }
-      child.add(ctx);
-   }
-
-   public Iterator childIterator(String name)
-   {
-      List child = (List)children.get(name);
-      return child != null ? child.iterator() : Collections.EMPTY_LIST.iterator();
-   }
-
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ChildrenStrategy.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/ChildrenStrategy.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ChildrenStrategy.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ChildrenStrategy.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,62 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.template;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class ChildrenStrategy
+{
+
+   public ChildrenStrategy(Map children)
+   {
+      this.children = children;
+   }
+
+   private Map children;
+
+   public void append(String name, Context ctx)
+   {
+      List child = (List)children.get(name);
+      if (child == null)
+      {
+         child = new LinkedList();
+         children.put(name, child);
+      }
+      child.add(ctx);
+   }
+
+   public Iterator childIterator(String name)
+   {
+      List child = (List)children.get(name);
+      return child != null ? child.iterator() : Collections.EMPTY_LIST.iterator();
+   }
+
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Context.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/Context.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Context.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,80 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.template;
-
-import java.util.Collections;
-import java.util.Iterator;
-
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public interface Context
-{
-   /** null context */
-   Context NULL_CONTEXT = new AbstractContext()
-   {
-      final Iterator it = Collections.EMPTY_LIST.iterator();
-
-      public Iterator childIterator(String name)
-      {
-         return it;
-      }
-
-      public String get(String key)
-      {
-         return "";
-      }
-
-      public Context put(String key, String value)
-      {
-         return this;
-      }
-   };
-
-   /**
-    * get the template data from the context
-    *
-    * @param key template variable name
-    * @return template value
-    */
-   public String get(String key);
-
-   /**
-    * add data to be rendered in the template through variable substitution
-    *
-    * @param key   template variable name
-    * @param value value to render in template
-    * @return context to place data into
-    */
-   public Context put(String key, String value);
-
-   /**
-    * get an iterator for the nested/loop data contexts
-    *
-    * @param name template variable prefix name
-    * @return iterator for the children
-    */
-   Iterator childIterator(String name);
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Context.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/Context.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Context.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Context.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,80 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.template;
+
+import java.util.Collections;
+import java.util.Iterator;
+
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public interface Context
+{
+   /** null context */
+   Context NULL_CONTEXT = new AbstractContext()
+   {
+      final Iterator it = Collections.EMPTY_LIST.iterator();
+
+      public Iterator childIterator(String name)
+      {
+         return it;
+      }
+
+      public String get(String key)
+      {
+         return "";
+      }
+
+      public Context put(String key, String value)
+      {
+         return this;
+      }
+   };
+
+   /**
+    * get the template data from the context
+    *
+    * @param key template variable name
+    * @return template value
+    */
+   public String get(String key);
+
+   /**
+    * add data to be rendered in the template through variable substitution
+    *
+    * @param key   template variable name
+    * @param value value to render in template
+    * @return context to place data into
+    */
+   public Context put(String key, String value);
+
+   /**
+    * get an iterator for the nested/loop data contexts
+    *
+    * @param name template variable prefix name
+    * @return iterator for the children
+    */
+   Iterator childIterator(String name);
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/DelegateContext.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/DelegateContext.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/DelegateContext.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,127 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.template;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class DelegateContext implements Context
-{
-   /** context's children */
-   private ChildrenStrategy children;
-
-   /** template name/value pairs for substitution */
-   private Map delegate;
-
-   /** creates a new DelegateContext object. */
-   public DelegateContext()
-   {
-      this(new HashMap(), new HashMap());
-   }
-
-   /**
-    * creates a new DelegateContext object.
-    *
-    * @param delegate name/value pairs for "root" data
-    * @param children name/value pairs for nested or loop data
-    */
-   public DelegateContext(Map delegate, Map children)
-   {
-      this.delegate = delegate;
-      this.children = new ChildrenStrategy(children);
-   }
-
-   /**
-    * create a new "root" data context and name/value pairs to be used as nested or loop data
-    *
-    * @param children name/value pairs for nested or loop data
-    * @return context to continue adding template data too
-    */
-   public static final DelegateContext createWithChildren(Map children)
-   {
-      return new DelegateContext(new HashMap(), children);
-   }
-
-   /**
-    * create a new data context with already existing name/value pairs
-    *
-    * @param values existing name/value pair map
-    * @return context to continue adding template data too
-    */
-   public static final DelegateContext createWithValues(Map values)
-   {
-      return new DelegateContext(values, new HashMap());
-   }
-
-   /**
-    * add an existing data context into this context for use in template loops or nested template data.
-    *
-    * @param name variable prefix name
-    * @param ctx  context to add
-    */
-   public void append(String name, Context ctx)
-   {
-      children.append(name, ctx);
-   }
-
-   /** @see org.jboss.portal.format.template.Context#childIterator(java.lang.String) */
-   public Iterator childIterator(String name)
-   {
-      return children.childIterator(name);
-   }
-
-   /** @see org.jboss.portal.format.template.Context#get(java.lang.String) */
-   public String get(String key)
-   {
-      return (String)delegate.get(key);
-   }
-
-   /**
-    * create a new object to place data for use in template loops or nested template data. tpl var format: {
-    * prefix.VAR_NAME }
-    *
-    * @param name variable prefix name
-    * @return delegate context that will contain the loop or nested data
-    */
-   public DelegateContext next(String name)
-   {
-      DelegateContext ctx = new DelegateContext();
-      append(name, ctx);
-
-      return ctx;
-   }
-
-   /** @see org.jboss.portal.format.template.Context#put(java.lang.String,java.lang.String) */
-   public Context put(String key, String value)
-   {
-      delegate.put(key, value);
-
-      return this;
-   }
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/DelegateContext.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/DelegateContext.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/DelegateContext.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/DelegateContext.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,127 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.template;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class DelegateContext implements Context
+{
+   /** context's children */
+   private ChildrenStrategy children;
+
+   /** template name/value pairs for substitution */
+   private Map delegate;
+
+   /** creates a new DelegateContext object. */
+   public DelegateContext()
+   {
+      this(new HashMap(), new HashMap());
+   }
+
+   /**
+    * creates a new DelegateContext object.
+    *
+    * @param delegate name/value pairs for "root" data
+    * @param children name/value pairs for nested or loop data
+    */
+   public DelegateContext(Map delegate, Map children)
+   {
+      this.delegate = delegate;
+      this.children = new ChildrenStrategy(children);
+   }
+
+   /**
+    * create a new "root" data context and name/value pairs to be used as nested or loop data
+    *
+    * @param children name/value pairs for nested or loop data
+    * @return context to continue adding template data too
+    */
+   public static final DelegateContext createWithChildren(Map children)
+   {
+      return new DelegateContext(new HashMap(), children);
+   }
+
+   /**
+    * create a new data context with already existing name/value pairs
+    *
+    * @param values existing name/value pair map
+    * @return context to continue adding template data too
+    */
+   public static final DelegateContext createWithValues(Map values)
+   {
+      return new DelegateContext(values, new HashMap());
+   }
+
+   /**
+    * add an existing data context into this context for use in template loops or nested template data.
+    *
+    * @param name variable prefix name
+    * @param ctx  context to add
+    */
+   public void append(String name, Context ctx)
+   {
+      children.append(name, ctx);
+   }
+
+   /** @see org.jboss.portal.format.template.Context#childIterator(java.lang.String) */
+   public Iterator childIterator(String name)
+   {
+      return children.childIterator(name);
+   }
+
+   /** @see org.jboss.portal.format.template.Context#get(java.lang.String) */
+   public String get(String key)
+   {
+      return (String)delegate.get(key);
+   }
+
+   /**
+    * create a new object to place data for use in template loops or nested template data. tpl var format: {
+    * prefix.VAR_NAME }
+    *
+    * @param name variable prefix name
+    * @return delegate context that will contain the loop or nested data
+    */
+   public DelegateContext next(String name)
+   {
+      DelegateContext ctx = new DelegateContext();
+      append(name, ctx);
+
+      return ctx;
+   }
+
+   /** @see org.jboss.portal.format.template.Context#put(java.lang.String,java.lang.String) */
+   public Context put(String key, String value)
+   {
+      delegate.put(key, value);
+
+      return this;
+   }
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ParseException.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/ParseException.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ParseException.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,200 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 0.7pre6 */
-/*****************************************
- *                                       *
- *  JBoss Portal: The OpenSource Portal  *
- *                                       *
- *   Distributable under LGPL license.   *
- *   See terms of license at gnu.org.    *
- *                                       *
- *****************************************/
-
-package org.jboss.portlet.forums.format.template;
-
-/**
- * This exception is thrown when parse errors are encountered.
- * You can explicitly create objects of this exception type by
- * calling the method generateParseException in the generated
- * parser.
- *
- * You can modify this class to customize your error reporting
- * mechanisms so long as you retain the public fields.
- */
-public class ParseException extends Exception {
-
-  /**
-   * This constructor is used by the method "generateParseException"
-   * in the generated parser.  Calling this constructor generates
-   * a new object of this type with the fields "currentToken",
-   * "expectedTokenSequences", and "tokenImage" set.  The boolean
-   * flag "specialConstructor" is also set to true to indicate that
-   * this constructor was used to create this object.
-   * This constructor calls its super class with the empty string
-   * to force the "toString" method of parent class "Throwable" to
-   * print the error message in the form:
-   *     ParseException: <result of getMessage>
-   */
-  public ParseException(Token currentTokenVal,
-                        int[][] expectedTokenSequencesVal,
-                        String[] tokenImageVal
-                       )
-  {
-    super("");
-    specialConstructor = true;
-    currentToken = currentTokenVal;
-    expectedTokenSequences = expectedTokenSequencesVal;
-    tokenImage = tokenImageVal;
-  }
-
-  /**
-   * The following constructors are for use by you for whatever
-   * purpose you can think of.  Constructing the exception in this
-   * manner makes the exception behave in the normal way - i.e., as
-   * documented in the class "Throwable".  The fields "errorToken",
-   * "expectedTokenSequences", and "tokenImage" do not contain
-   * relevant information.  The JavaCC generated code does not use
-   * these constructors.
-   */
-
-  public ParseException() {
-    super();
-    specialConstructor = false;
-  }
-
-  public ParseException(String message) {
-    super(message);
-    specialConstructor = false;
-  }
-
-  /**
-   * This variable determines which constructor was used to create
-   * this object and thereby affects the semantics of the
-   * "getMessage" method (see below).
-   */
-  protected boolean specialConstructor;
-
-  /**
-   * This is the last token that has been consumed successfully.  If
-   * this object has been created due to a parse error, the token
-   * followng this token will (therefore) be the first error token.
-   */
-  public Token currentToken;
-
-  /**
-   * Each entry in this array is an array of integers.  Each array
-   * of integers represents a sequence of tokens (by their ordinal
-   * values) that is expected at this point of the parse.
-   */
-  public int[][] expectedTokenSequences;
-
-  /**
-   * This is a reference to the "tokenImage" array of the generated
-   * parser within which the parse error occurred.  This array is
-   * defined in the generated ...Constants interface.
-   */
-  public String[] tokenImage;
-
-  /**
-   * This method has the standard behavior when this object has been
-   * created using the standard constructors.  Otherwise, it uses
-   * "currentToken" and "expectedTokenSequences" to generate a parse
-   * error message and returns it.  If this object has been created
-   * due to a parse error, and you do not catch it (it gets thrown
-   * from the parser), then this method is called during the printing
-   * of the final stack trace, and hence the correct error message
-   * gets displayed.
-   */
-  public String getMessage() {
-    if (!specialConstructor) {
-      return super.getMessage();
-    }
-    String expected = "";
-    int maxSize = 0;
-    for (int i = 0; i < expectedTokenSequences.length; i++) {
-      if (maxSize < expectedTokenSequences[i].length) {
-        maxSize = expectedTokenSequences[i].length;
-      }
-      for (int j = 0; j < expectedTokenSequences[i].length; j++) {
-        expected += tokenImage[expectedTokenSequences[i][j]] + " ";
-      }
-      if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
-        expected += "...";
-      }
-      expected += eol + "    ";
-    }
-    String retval = "Encountered \"";
-    Token tok = currentToken.next;
-    for (int i = 0; i < maxSize; i++) {
-      if (i != 0) retval += " ";
-      if (tok.kind == 0) {
-        retval += tokenImage[0];
-        break;
-      }
-      retval += add_escapes(tok.image);
-      tok = tok.next; 
-    }
-    retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn + "." + eol;
-    if (expectedTokenSequences.length == 1) {
-      retval += "Was expecting:" + eol + "    ";
-    } else {
-      retval += "Was expecting one of:" + eol + "    ";
-    }
-    retval += expected;
-    return retval;
-  }
-
-  /**
-   * The end of line string for this machine.
-   */
-  protected String eol = System.getProperty("line.separator", "\n");
- 
-  /**
-   * Used to convert raw characters to their escaped version
-   * when these raw version cannot be used as part of an ASCII
-   * string literal.
-   */
-  protected String add_escapes(String str) {
-      StringBuffer retval = new StringBuffer();
-      char ch;
-      for (int i = 0; i < str.length(); i++) {
-        switch (str.charAt(i))
-        {
-           case 0 :
-              continue;
-           case '\b':
-              retval.append("\\b");
-              continue;
-           case '\t':
-              retval.append("\\t");
-              continue;
-           case '\n':
-              retval.append("\\n");
-              continue;
-           case '\f':
-              retval.append("\\f");
-              continue;
-           case '\r':
-              retval.append("\\r");
-              continue;
-           case '\"':
-              retval.append("\\\"");
-              continue;
-           case '\'':
-              retval.append("\\\'");
-              continue;
-           case '\\':
-              retval.append("\\\\");
-              continue;
-           default:
-              if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
-                 String s = "0000" + Integer.toString(ch, 16);
-                 retval.append("\\u" + s.substring(s.length() - 4, s.length()));
-              } else {
-                 retval.append(ch);
-              }
-              continue;
-        }
-      }
-      return retval.toString();
-   }
-
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ParseException.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/ParseException.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ParseException.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/ParseException.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,200 @@
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 0.7pre6 */
+/*****************************************
+ *                                       *
+ *  JBoss Portal: The OpenSource Portal  *
+ *                                       *
+ *   Distributable under LGPL license.   *
+ *   See terms of license at gnu.org.    *
+ *                                       *
+ *****************************************/
+
+package org.jboss.portlet.forums.format.template;
+
+/**
+ * This exception is thrown when parse errors are encountered.
+ * You can explicitly create objects of this exception type by
+ * calling the method generateParseException in the generated
+ * parser.
+ *
+ * You can modify this class to customize your error reporting
+ * mechanisms so long as you retain the public fields.
+ */
+public class ParseException extends Exception {
+
+  /**
+   * This constructor is used by the method "generateParseException"
+   * in the generated parser.  Calling this constructor generates
+   * a new object of this type with the fields "currentToken",
+   * "expectedTokenSequences", and "tokenImage" set.  The boolean
+   * flag "specialConstructor" is also set to true to indicate that
+   * this constructor was used to create this object.
+   * This constructor calls its super class with the empty string
+   * to force the "toString" method of parent class "Throwable" to
+   * print the error message in the form:
+   *     ParseException: <result of getMessage>
+   */
+  public ParseException(Token currentTokenVal,
+                        int[][] expectedTokenSequencesVal,
+                        String[] tokenImageVal
+                       )
+  {
+    super("");
+    specialConstructor = true;
+    currentToken = currentTokenVal;
+    expectedTokenSequences = expectedTokenSequencesVal;
+    tokenImage = tokenImageVal;
+  }
+
+  /**
+   * The following constructors are for use by you for whatever
+   * purpose you can think of.  Constructing the exception in this
+   * manner makes the exception behave in the normal way - i.e., as
+   * documented in the class "Throwable".  The fields "errorToken",
+   * "expectedTokenSequences", and "tokenImage" do not contain
+   * relevant information.  The JavaCC generated code does not use
+   * these constructors.
+   */
+
+  public ParseException() {
+    super();
+    specialConstructor = false;
+  }
+
+  public ParseException(String message) {
+    super(message);
+    specialConstructor = false;
+  }
+
+  /**
+   * This variable determines which constructor was used to create
+   * this object and thereby affects the semantics of the
+   * "getMessage" method (see below).
+   */
+  protected boolean specialConstructor;
+
+  /**
+   * This is the last token that has been consumed successfully.  If
+   * this object has been created due to a parse error, the token
+   * followng this token will (therefore) be the first error token.
+   */
+  public Token currentToken;
+
+  /**
+   * Each entry in this array is an array of integers.  Each array
+   * of integers represents a sequence of tokens (by their ordinal
+   * values) that is expected at this point of the parse.
+   */
+  public int[][] expectedTokenSequences;
+
+  /**
+   * This is a reference to the "tokenImage" array of the generated
+   * parser within which the parse error occurred.  This array is
+   * defined in the generated ...Constants interface.
+   */
+  public String[] tokenImage;
+
+  /**
+   * This method has the standard behavior when this object has been
+   * created using the standard constructors.  Otherwise, it uses
+   * "currentToken" and "expectedTokenSequences" to generate a parse
+   * error message and returns it.  If this object has been created
+   * due to a parse error, and you do not catch it (it gets thrown
+   * from the parser), then this method is called during the printing
+   * of the final stack trace, and hence the correct error message
+   * gets displayed.
+   */
+  public String getMessage() {
+    if (!specialConstructor) {
+      return super.getMessage();
+    }
+    String expected = "";
+    int maxSize = 0;
+    for (int i = 0; i < expectedTokenSequences.length; i++) {
+      if (maxSize < expectedTokenSequences[i].length) {
+        maxSize = expectedTokenSequences[i].length;
+      }
+      for (int j = 0; j < expectedTokenSequences[i].length; j++) {
+        expected += tokenImage[expectedTokenSequences[i][j]] + " ";
+      }
+      if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
+        expected += "...";
+      }
+      expected += eol + "    ";
+    }
+    String retval = "Encountered \"";
+    Token tok = currentToken.next;
+    for (int i = 0; i < maxSize; i++) {
+      if (i != 0) retval += " ";
+      if (tok.kind == 0) {
+        retval += tokenImage[0];
+        break;
+      }
+      retval += add_escapes(tok.image);
+      tok = tok.next; 
+    }
+    retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn + "." + eol;
+    if (expectedTokenSequences.length == 1) {
+      retval += "Was expecting:" + eol + "    ";
+    } else {
+      retval += "Was expecting one of:" + eol + "    ";
+    }
+    retval += expected;
+    return retval;
+  }
+
+  /**
+   * The end of line string for this machine.
+   */
+  protected String eol = System.getProperty("line.separator", "\n");
+ 
+  /**
+   * Used to convert raw characters to their escaped version
+   * when these raw version cannot be used as part of an ASCII
+   * string literal.
+   */
+  protected String add_escapes(String str) {
+      StringBuffer retval = new StringBuffer();
+      char ch;
+      for (int i = 0; i < str.length(); i++) {
+        switch (str.charAt(i))
+        {
+           case 0 :
+              continue;
+           case '\b':
+              retval.append("\\b");
+              continue;
+           case '\t':
+              retval.append("\\t");
+              continue;
+           case '\n':
+              retval.append("\\n");
+              continue;
+           case '\f':
+              retval.append("\\f");
+              continue;
+           case '\r':
+              retval.append("\\r");
+              continue;
+           case '\"':
+              retval.append("\\\"");
+              continue;
+           case '\'':
+              retval.append("\\\'");
+              continue;
+           case '\\':
+              retval.append("\\\\");
+              continue;
+           default:
+              if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+                 String s = "0000" + Integer.toString(ch, 16);
+                 retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+              } else {
+                 retval.append(ch);
+              }
+              continue;
+        }
+      }
+      return retval.toString();
+   }
+
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Template.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/Template.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Template.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,60 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.template;
-
-import org.apache.log4j.Logger;
-
-import java.io.StringWriter;
-import java.io.Writer;
-
-/** @author <a href="mailto:julien at jboss.org">Julien Viet</a> */
-public abstract class Template
-{
-
-   public final Logger log = Logger.getLogger(getClass());
-
-   protected final Context local;
-
-   public Template(Context local)
-   {
-      this.local = local;
-   }
-
-   public final String render(Context ctx)
-   {
-      StringWriter writer = new StringWriter();
-      render(ctx, writer);
-      return writer.toString();
-   }
-
-   public final Context getLocalContext()
-   {
-      return local;
-   }
-
-   /** This may be subclassed. */
-   public void render(Context ctx, Writer writer)
-   {
-   }
-
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Template.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/Template.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Template.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Template.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.template;
+
+import org.apache.log4j.Logger;
+
+import java.io.StringWriter;
+import java.io.Writer;
+
+/** @author <a href="mailto:julien at jboss.org">Julien Viet</a> */
+public abstract class Template
+{
+
+   public final Logger log = Logger.getLogger(getClass());
+
+   protected final Context local;
+
+   public Template(Context local)
+   {
+      this.local = local;
+   }
+
+   public final String render(Context ctx)
+   {
+      StringWriter writer = new StringWriter();
+      render(ctx, writer);
+      return writer.toString();
+   }
+
+   public final Context getLocalContext()
+   {
+      return local;
+   }
+
+   /** This may be subclassed. */
+   public void render(Context ctx, Writer writer)
+   {
+   }
+
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,159 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. TemplateAnalyzer.java */
-/*****************************************
- *                                       *
- *  JBoss Portal: The OpenSource Portal  *
- *                                       *
- *   Distributable under LGPL license.   *
- *   See terms of license at gnu.org.    *
- *                                       *
- *****************************************/
-
-package org.jboss.portlet.forums.format.template;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- */
-public class TemplateAnalyzer implements TemplateAnalyzerConstants {
-
-  public TemplateAnalyzerTokenManager token_source;
-  ASCII_CharStream jj_input_stream;
-  public Token token, jj_nt;
-  private int jj_ntk;
-  private int jj_gen;
-  final private int[] jj_la1 = new int[0];
-  final private int[] jj_la1_0 = {};
-
-  public TemplateAnalyzer(java.io.InputStream stream) {
-    jj_input_stream = new ASCII_CharStream(stream, 1, 1);
-    token_source = new TemplateAnalyzerTokenManager(jj_input_stream);
-    token = new Token();
-    jj_ntk = -1;
-    jj_gen = 0;
-    for (int i = 0; i < 0; i++) jj_la1[i] = -1;
-  }
-
-  public void ReInit(java.io.InputStream stream) {
-    jj_input_stream.ReInit(stream, 1, 1);
-    token_source.ReInit(jj_input_stream);
-    token = new Token();
-    jj_ntk = -1;
-    jj_gen = 0;
-    for (int i = 0; i < 0; i++) jj_la1[i] = -1;
-  }
-
-  public TemplateAnalyzer(java.io.Reader stream) {
-    jj_input_stream = new ASCII_CharStream(stream, 1, 1);
-    token_source = new TemplateAnalyzerTokenManager(jj_input_stream);
-    token = new Token();
-    jj_ntk = -1;
-    jj_gen = 0;
-    for (int i = 0; i < 0; i++) jj_la1[i] = -1;
-  }
-
-  public void ReInit(java.io.Reader stream) {
-    jj_input_stream.ReInit(stream, 1, 1);
-    token_source.ReInit(jj_input_stream);
-    token = new Token();
-    jj_ntk = -1;
-    jj_gen = 0;
-    for (int i = 0; i < 0; i++) jj_la1[i] = -1;
-  }
-
-  public TemplateAnalyzer(TemplateAnalyzerTokenManager tm) {
-    token_source = tm;
-    token = new Token();
-    jj_ntk = -1;
-    jj_gen = 0;
-    for (int i = 0; i < 0; i++) jj_la1[i] = -1;
-  }
-
-  public void ReInit(TemplateAnalyzerTokenManager tm) {
-    token_source = tm;
-    token = new Token();
-    jj_ntk = -1;
-    jj_gen = 0;
-    for (int i = 0; i < 0; i++) jj_la1[i] = -1;
-  }
-
-  final private Token jj_consume_token(int kind) throws ParseException {
-    Token oldToken;
-    if ((oldToken = token).next != null) token = token.next;
-    else token = token.next = token_source.getNextToken();
-    jj_ntk = -1;
-    if (token.kind == kind) {
-      jj_gen++;
-      return token;
-    }
-    token = oldToken;
-    jj_kind = kind;
-    throw generateParseException();
-  }
-
-  final public Token getNextToken() {
-    if (token.next != null) token = token.next;
-    else token = token.next = token_source.getNextToken();
-    jj_ntk = -1;
-    jj_gen++;
-    return token;
-  }
-
-  final public Token getToken(int index) {
-    Token t = token;
-    for (int i = 0; i < index; i++) {
-      if (t.next != null) t = t.next;
-      else t = t.next = token_source.getNextToken();
-    }
-    return t;
-  }
-
-  final private int jj_ntk() {
-    if ((jj_nt=token.next) == null)
-      return (jj_ntk = (token.next=token_source.getNextToken()).kind);
-    else
-      return (jj_ntk = jj_nt.kind);
-  }
-
-  private java.util.Vector jj_expentries = new java.util.Vector();
-  private int[] jj_expentry;
-  private int jj_kind = -1;
-
-  final public ParseException generateParseException() {
-    jj_expentries.removeAllElements();
-    boolean[] la1tokens = new boolean[8];
-    for (int i = 0; i < 8; i++) {
-      la1tokens[i] = false;
-    }
-    if (jj_kind >= 0) {
-      la1tokens[jj_kind] = true;
-      jj_kind = -1;
-    }
-    for (int i = 0; i < 0; i++) {
-      if (jj_la1[i] == jj_gen) {
-        for (int j = 0; j < 32; j++) {
-          if ((jj_la1_0[i] & (1<<j)) != 0) {
-            la1tokens[j] = true;
-          }
-        }
-      }
-    }
-    for (int i = 0; i < 8; i++) {
-      if (la1tokens[i]) {
-        jj_expentry = new int[1];
-        jj_expentry[0] = i;
-        jj_expentries.addElement(jj_expentry);
-      }
-    }
-    int[][] exptokseq = new int[jj_expentries.size()][];
-    for (int i = 0; i < jj_expentries.size(); i++) {
-      exptokseq[i] = (int[])jj_expentries.elementAt(i);
-    }
-    return new ParseException(token, exptokseq, tokenImage);
-  }
-
-  final public void enable_tracing() {
-  }
-
-  final public void disable_tracing() {
-  }
-
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,159 @@
+/* Generated By:JavaCC: Do not edit this line. TemplateAnalyzer.java */
+/*****************************************
+ *                                       *
+ *  JBoss Portal: The OpenSource Portal  *
+ *                                       *
+ *   Distributable under LGPL license.   *
+ *   See terms of license at gnu.org.    *
+ *                                       *
+ *****************************************/
+
+package org.jboss.portlet.forums.format.template;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ */
+public class TemplateAnalyzer implements TemplateAnalyzerConstants {
+
+  public TemplateAnalyzerTokenManager token_source;
+  ASCII_CharStream jj_input_stream;
+  public Token token, jj_nt;
+  private int jj_ntk;
+  private int jj_gen;
+  final private int[] jj_la1 = new int[0];
+  final private int[] jj_la1_0 = {};
+
+  public TemplateAnalyzer(java.io.InputStream stream) {
+    jj_input_stream = new ASCII_CharStream(stream, 1, 1);
+    token_source = new TemplateAnalyzerTokenManager(jj_input_stream);
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 0; i++) jj_la1[i] = -1;
+  }
+
+  public void ReInit(java.io.InputStream stream) {
+    jj_input_stream.ReInit(stream, 1, 1);
+    token_source.ReInit(jj_input_stream);
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 0; i++) jj_la1[i] = -1;
+  }
+
+  public TemplateAnalyzer(java.io.Reader stream) {
+    jj_input_stream = new ASCII_CharStream(stream, 1, 1);
+    token_source = new TemplateAnalyzerTokenManager(jj_input_stream);
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 0; i++) jj_la1[i] = -1;
+  }
+
+  public void ReInit(java.io.Reader stream) {
+    jj_input_stream.ReInit(stream, 1, 1);
+    token_source.ReInit(jj_input_stream);
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 0; i++) jj_la1[i] = -1;
+  }
+
+  public TemplateAnalyzer(TemplateAnalyzerTokenManager tm) {
+    token_source = tm;
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 0; i++) jj_la1[i] = -1;
+  }
+
+  public void ReInit(TemplateAnalyzerTokenManager tm) {
+    token_source = tm;
+    token = new Token();
+    jj_ntk = -1;
+    jj_gen = 0;
+    for (int i = 0; i < 0; i++) jj_la1[i] = -1;
+  }
+
+  final private Token jj_consume_token(int kind) throws ParseException {
+    Token oldToken;
+    if ((oldToken = token).next != null) token = token.next;
+    else token = token.next = token_source.getNextToken();
+    jj_ntk = -1;
+    if (token.kind == kind) {
+      jj_gen++;
+      return token;
+    }
+    token = oldToken;
+    jj_kind = kind;
+    throw generateParseException();
+  }
+
+  final public Token getNextToken() {
+    if (token.next != null) token = token.next;
+    else token = token.next = token_source.getNextToken();
+    jj_ntk = -1;
+    jj_gen++;
+    return token;
+  }
+
+  final public Token getToken(int index) {
+    Token t = token;
+    for (int i = 0; i < index; i++) {
+      if (t.next != null) t = t.next;
+      else t = t.next = token_source.getNextToken();
+    }
+    return t;
+  }
+
+  final private int jj_ntk() {
+    if ((jj_nt=token.next) == null)
+      return (jj_ntk = (token.next=token_source.getNextToken()).kind);
+    else
+      return (jj_ntk = jj_nt.kind);
+  }
+
+  private java.util.Vector jj_expentries = new java.util.Vector();
+  private int[] jj_expentry;
+  private int jj_kind = -1;
+
+  final public ParseException generateParseException() {
+    jj_expentries.removeAllElements();
+    boolean[] la1tokens = new boolean[8];
+    for (int i = 0; i < 8; i++) {
+      la1tokens[i] = false;
+    }
+    if (jj_kind >= 0) {
+      la1tokens[jj_kind] = true;
+      jj_kind = -1;
+    }
+    for (int i = 0; i < 0; i++) {
+      if (jj_la1[i] == jj_gen) {
+        for (int j = 0; j < 32; j++) {
+          if ((jj_la1_0[i] & (1<<j)) != 0) {
+            la1tokens[j] = true;
+          }
+        }
+      }
+    }
+    for (int i = 0; i < 8; i++) {
+      if (la1tokens[i]) {
+        jj_expentry = new int[1];
+        jj_expentry[0] = i;
+        jj_expentries.addElement(jj_expentry);
+      }
+    }
+    int[][] exptokseq = new int[jj_expentries.size()][];
+    for (int i = 0; i < jj_expentries.size(); i++) {
+      exptokseq[i] = (int[])jj_expentries.elementAt(i);
+    }
+    return new ParseException(token, exptokseq, tokenImage);
+  }
+
+  final public void enable_tracing() {
+  }
+
+  final public void disable_tracing() {
+  }
+
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.jj
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.jj	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.jj	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,65 +0,0 @@
-options
-{
-  STATIC = false;
-}
-
-PARSER_BEGIN(TemplateAnalyzer)
-
-/*****************************************
- *                                       *
- *  JBoss Portal: The OpenSource Portal  *
- *                                       *
- *   Distributable under LGPL license.   *
- *   See terms of license at gnu.org.    *
- *                                       *
- *****************************************/
-
-package org.jboss.portlet.forums.format.template;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- */
-public class TemplateAnalyzer
-{
-}
-
-PARSER_END(TemplateAnalyzer)
-
-<DEFAULT> TOKEN :
-{
-   <BEGIN: "<!-- BEGIN " (~[" "])+ " -->" >
-}
-
-<DEFAULT> TOKEN :
-{
-   <END: "<!-- END " (~[" "])+ " -->" >
-}
-
-<DEFAULT> TOKEN :
-{
-   <PROPERTY: "${" (~["}"])* "}" >
-}
-
-<DEFAULT> TOKEN :
-{
-   <REF: "{" (<LITTERAL> ".")* <LITTERAL> "}" >
-}
-
-<DEFAULT> TOKEN :
-{
-   <#LITTERAL: (["A"-"Z","a"-"z","0"-"9","-","_"])* >
-}
-
-<DEFAULT> TOKEN :
-{
-   <TEXT: ~["\n"] >
-}
-
-<DEFAULT> TOKEN :
-{
-   <NEWLINE: "\n" >
-}
-
-
-
-

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.jj (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.jj)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.jj	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzer.jj	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,65 @@
+options
+{
+  STATIC = false;
+}
+
+PARSER_BEGIN(TemplateAnalyzer)
+
+/*****************************************
+ *                                       *
+ *  JBoss Portal: The OpenSource Portal  *
+ *                                       *
+ *   Distributable under LGPL license.   *
+ *   See terms of license at gnu.org.    *
+ *                                       *
+ *****************************************/
+
+package org.jboss.portlet.forums.format.template;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ */
+public class TemplateAnalyzer
+{
+}
+
+PARSER_END(TemplateAnalyzer)
+
+<DEFAULT> TOKEN :
+{
+   <BEGIN: "<!-- BEGIN " (~[" "])+ " -->" >
+}
+
+<DEFAULT> TOKEN :
+{
+   <END: "<!-- END " (~[" "])+ " -->" >
+}
+
+<DEFAULT> TOKEN :
+{
+   <PROPERTY: "${" (~["}"])* "}" >
+}
+
+<DEFAULT> TOKEN :
+{
+   <REF: "{" (<LITTERAL> ".")* <LITTERAL> "}" >
+}
+
+<DEFAULT> TOKEN :
+{
+   <#LITTERAL: (["A"-"Z","a"-"z","0"-"9","-","_"])* >
+}
+
+<DEFAULT> TOKEN :
+{
+   <TEXT: ~["\n"] >
+}
+
+<DEFAULT> TOKEN :
+{
+   <NEWLINE: "\n" >
+}
+
+
+
+

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerConstants.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerConstants.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerConstants.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,37 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. TemplateAnalyzerConstants.java */
-/*****************************************
- *                                       *
- *  JBoss Portal: The OpenSource Portal  *
- *                                       *
- *   Distributable under LGPL license.   *
- *   See terms of license at gnu.org.    *
- *                                       *
- *****************************************/
-
-package org.jboss.portlet.forums.format.template;
-
-public interface TemplateAnalyzerConstants {
-
-  int EOF = 0;
-  int BEGIN = 1;
-  int END = 2;
-  int PROPERTY = 3;
-  int REF = 4;
-  int LITTERAL = 5;
-  int TEXT = 6;
-  int NEWLINE = 7;
-
-  int DEFAULT = 0;
-
-  String[] tokenImage = {
-    "<EOF>",
-    "<BEGIN>",
-    "<END>",
-    "<PROPERTY>",
-    "<REF>",
-    "<LITTERAL>",
-    "<TEXT>",
-    "\"\\n\"",
-  };
-
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerConstants.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerConstants.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerConstants.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerConstants.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,37 @@
+/* Generated By:JavaCC: Do not edit this line. TemplateAnalyzerConstants.java */
+/*****************************************
+ *                                       *
+ *  JBoss Portal: The OpenSource Portal  *
+ *                                       *
+ *   Distributable under LGPL license.   *
+ *   See terms of license at gnu.org.    *
+ *                                       *
+ *****************************************/
+
+package org.jboss.portlet.forums.format.template;
+
+public interface TemplateAnalyzerConstants {
+
+  int EOF = 0;
+  int BEGIN = 1;
+  int END = 2;
+  int PROPERTY = 3;
+  int REF = 4;
+  int LITTERAL = 5;
+  int TEXT = 6;
+  int NEWLINE = 7;
+
+  int DEFAULT = 0;
+
+  String[] tokenImage = {
+    "<EOF>",
+    "<BEGIN>",
+    "<END>",
+    "<PROPERTY>",
+    "<REF>",
+    "<LITTERAL>",
+    "<TEXT>",
+    "\"\\n\"",
+  };
+
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerTokenManager.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerTokenManager.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerTokenManager.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,481 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. TemplateAnalyzerTokenManager.java */
-/*****************************************
- *                                       *
- *  JBoss Portal: The OpenSource Portal  *
- *                                       *
- *   Distributable under LGPL license.   *
- *   See terms of license at gnu.org.    *
- *                                       *
- *****************************************/
-
-package org.jboss.portlet.forums.format.template;
-
-public class TemplateAnalyzerTokenManager implements TemplateAnalyzerConstants
-{
-private final int jjStopStringLiteralDfa_0(int pos, long active0)
-{
-   switch (pos)
-   {
-      default :
-         return -1;
-   }
-}
-private final int jjStartNfa_0(int pos, long active0)
-{
-   return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
-}
-private final int jjStopAtPos(int pos, int kind)
-{
-   jjmatchedKind = kind;
-   jjmatchedPos = pos;
-   return pos + 1;
-}
-private final int jjStartNfaWithStates_0(int pos, int kind, int state)
-{
-   jjmatchedKind = kind;
-   jjmatchedPos = pos;
-   try { curChar = input_stream.readChar(); }
-   catch(java.io.IOException e) { return pos + 1; }
-   return jjMoveNfa_0(state, pos + 1);
-}
-private final int jjMoveStringLiteralDfa0_0()
-{
-   switch(curChar)
-   {
-      case 10:
-         return jjStopAtPos(0, 7);
-      default :
-         return jjMoveNfa_0(3, 0);
-   }
-}
-private final void jjCheckNAdd(int state)
-{
-   if (jjrounds[state] != jjround)
-   {
-      jjstateSet[jjnewStateCnt++] = state;
-      jjrounds[state] = jjround;
-   }
-}
-private final void jjAddStates(int start, int end)
-{
-   do {
-      jjstateSet[jjnewStateCnt++] = jjnextStates[start];
-   } while (start++ != end);
-}
-private final void jjCheckNAddTwoStates(int state1, int state2)
-{
-   jjCheckNAdd(state1);
-   jjCheckNAdd(state2);
-}
-private final void jjCheckNAddStates(int start, int end)
-{
-   do {
-      jjCheckNAdd(jjnextStates[start]);
-   } while (start++ != end);
-}
-private final void jjCheckNAddStates(int start)
-{
-   jjCheckNAdd(jjnextStates[start]);
-   jjCheckNAdd(jjnextStates[start + 1]);
-}
-static final long[] jjbitVec0 = {
-   0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
-};
-private final int jjMoveNfa_0(int startState, int curPos)
-{
-   int[] nextStates;
-   int startsAt = 0;
-   jjnewStateCnt = 40;
-   int i = 1;
-   jjstateSet[0] = startState;
-   int j, kind = 0x7fffffff;
-   for (;;)
-   {
-      if (++jjround == 0x7fffffff)
-         ReInitRounds();
-      if (curChar < 64)
-      {
-         long l = 1L << curChar;
-         MatchLoop: do
-         {
-            switch(jjstateSet[--i])
-            {
-               case 3:
-                  if ((0xfffffffffffffbffL & l) != 0L)
-                  {
-                     if (kind > 6)
-                        kind = 6;
-                  }
-                  if (curChar == 60)
-                     jjAddStates(0, 1);
-                  else if (curChar == 36)
-                     jjstateSet[jjnewStateCnt++] = 0;
-                  break;
-               case 1:
-                  jjAddStates(2, 3);
-                  break;
-               case 5:
-                  if (curChar == 46)
-                     jjCheckNAddStates(4, 6);
-                  break;
-               case 7:
-                  if ((0x3ff200000000000L & l) != 0L)
-                     jjCheckNAddStates(7, 10);
-                  break;
-               case 8:
-                  if ((0x3ff200000000000L & l) != 0L)
-                     jjCheckNAddTwoStates(8, 5);
-                  break;
-               case 9:
-                  if ((0x3ff200000000000L & l) != 0L)
-                     jjCheckNAddTwoStates(9, 6);
-                  break;
-               case 10:
-                  if ((0xfffffffffffffbffL & l) != 0L && kind > 6)
-                     kind = 6;
-                  break;
-               case 11:
-                  if (curChar == 60)
-                     jjAddStates(0, 1);
-                  break;
-               case 12:
-                  if (curChar == 32)
-                     jjCheckNAdd(13);
-                  break;
-               case 13:
-                  if ((0xfffffffeffffffffL & l) != 0L)
-                     jjCheckNAddTwoStates(13, 17);
-                  break;
-               case 14:
-                  if (curChar == 62 && kind > 1)
-                     kind = 1;
-                  break;
-               case 15:
-                  if (curChar == 45)
-                     jjstateSet[jjnewStateCnt++] = 14;
-                  break;
-               case 16:
-                  if (curChar == 45)
-                     jjstateSet[jjnewStateCnt++] = 15;
-                  break;
-               case 17:
-                  if (curChar == 32)
-                     jjstateSet[jjnewStateCnt++] = 16;
-                  break;
-               case 23:
-                  if (curChar == 32)
-                     jjstateSet[jjnewStateCnt++] = 22;
-                  break;
-               case 24:
-                  if (curChar == 45)
-                     jjstateSet[jjnewStateCnt++] = 23;
-                  break;
-               case 25:
-                  if (curChar == 45)
-                     jjstateSet[jjnewStateCnt++] = 24;
-                  break;
-               case 26:
-                  if (curChar == 33)
-                     jjstateSet[jjnewStateCnt++] = 25;
-                  break;
-               case 27:
-                  if (curChar == 32)
-                     jjCheckNAdd(28);
-                  break;
-               case 28:
-                  if ((0xfffffffeffffffffL & l) != 0L)
-                     jjCheckNAddTwoStates(28, 32);
-                  break;
-               case 29:
-                  if (curChar == 62 && kind > 2)
-                     kind = 2;
-                  break;
-               case 30:
-                  if (curChar == 45)
-                     jjstateSet[jjnewStateCnt++] = 29;
-                  break;
-               case 31:
-                  if (curChar == 45)
-                     jjstateSet[jjnewStateCnt++] = 30;
-                  break;
-               case 32:
-                  if (curChar == 32)
-                     jjstateSet[jjnewStateCnt++] = 31;
-                  break;
-               case 36:
-                  if (curChar == 32)
-                     jjstateSet[jjnewStateCnt++] = 35;
-                  break;
-               case 37:
-                  if (curChar == 45)
-                     jjstateSet[jjnewStateCnt++] = 36;
-                  break;
-               case 38:
-                  if (curChar == 45)
-                     jjstateSet[jjnewStateCnt++] = 37;
-                  break;
-               case 39:
-                  if (curChar == 33)
-                     jjstateSet[jjnewStateCnt++] = 38;
-                  break;
-               default : break;
-            }
-         } while(i != startsAt);
-      }
-      else if (curChar < 128)
-      {
-         long l = 1L << (curChar & 077);
-         MatchLoop: do
-         {
-            switch(jjstateSet[--i])
-            {
-               case 3:
-                  if (kind > 6)
-                     kind = 6;
-                  if (curChar == 123)
-                     jjCheckNAddStates(4, 6);
-                  break;
-               case 0:
-                  if (curChar == 123)
-                     jjCheckNAddTwoStates(1, 2);
-                  break;
-               case 1:
-                  if ((0xdfffffffffffffffL & l) != 0L)
-                     jjCheckNAddTwoStates(1, 2);
-                  break;
-               case 2:
-                  if (curChar == 125 && kind > 3)
-                     kind = 3;
-                  break;
-               case 4:
-                  if (curChar == 123)
-                     jjCheckNAddStates(4, 6);
-                  break;
-               case 6:
-                  if (curChar == 125 && kind > 4)
-                     kind = 4;
-                  break;
-               case 7:
-                  if ((0x7fffffe87fffffeL & l) != 0L)
-                     jjCheckNAddStates(7, 10);
-                  break;
-               case 8:
-                  if ((0x7fffffe87fffffeL & l) != 0L)
-                     jjCheckNAddTwoStates(8, 5);
-                  break;
-               case 9:
-                  if ((0x7fffffe87fffffeL & l) != 0L)
-                     jjCheckNAddTwoStates(9, 6);
-                  break;
-               case 10:
-                  if (kind > 6)
-                     kind = 6;
-                  break;
-               case 13:
-                  jjAddStates(11, 12);
-                  break;
-               case 18:
-                  if (curChar == 78)
-                     jjstateSet[jjnewStateCnt++] = 12;
-                  break;
-               case 19:
-                  if (curChar == 73)
-                     jjstateSet[jjnewStateCnt++] = 18;
-                  break;
-               case 20:
-                  if (curChar == 71)
-                     jjstateSet[jjnewStateCnt++] = 19;
-                  break;
-               case 21:
-                  if (curChar == 69)
-                     jjstateSet[jjnewStateCnt++] = 20;
-                  break;
-               case 22:
-                  if (curChar == 66)
-                     jjstateSet[jjnewStateCnt++] = 21;
-                  break;
-               case 28:
-                  jjAddStates(13, 14);
-                  break;
-               case 33:
-                  if (curChar == 68)
-                     jjstateSet[jjnewStateCnt++] = 27;
-                  break;
-               case 34:
-                  if (curChar == 78)
-                     jjstateSet[jjnewStateCnt++] = 33;
-                  break;
-               case 35:
-                  if (curChar == 69)
-                     jjstateSet[jjnewStateCnt++] = 34;
-                  break;
-               default : break;
-            }
-         } while(i != startsAt);
-      }
-      else
-      {
-         int i2 = (curChar & 0xff) >> 6;
-         long l2 = 1L << (curChar & 077);
-         MatchLoop: do
-         {
-            switch(jjstateSet[--i])
-            {
-               case 3:
-                  if ((jjbitVec0[i2] & l2) != 0L && kind > 6)
-                     kind = 6;
-                  break;
-               case 1:
-                  if ((jjbitVec0[i2] & l2) != 0L)
-                     jjAddStates(2, 3);
-                  break;
-               case 13:
-                  if ((jjbitVec0[i2] & l2) != 0L)
-                     jjAddStates(11, 12);
-                  break;
-               case 28:
-                  if ((jjbitVec0[i2] & l2) != 0L)
-                     jjAddStates(13, 14);
-                  break;
-               default : break;
-            }
-         } while(i != startsAt);
-      }
-      if (kind != 0x7fffffff)
-      {
-         jjmatchedKind = kind;
-         jjmatchedPos = curPos;
-         kind = 0x7fffffff;
-      }
-      ++curPos;
-      if ((i = jjnewStateCnt) == (startsAt = 40 - (jjnewStateCnt = startsAt)))
-         return curPos;
-      try { curChar = input_stream.readChar(); }
-      catch(java.io.IOException e) { return curPos; }
-   }
-}
-static final int[] jjnextStates = {
-   26, 39, 1, 2, 5, 6, 7, 8, 5, 9, 6, 13, 17, 28, 32, 
-};
-public static final String[] jjstrLiteralImages = {
-"", null, null, null, null, null, null, "\12", };
-public static final String[] lexStateNames = {
-   "DEFAULT", 
-};
-private ASCII_CharStream input_stream;
-private final int[] jjrounds = new int[40];
-private final int[] jjstateSet = new int[80];
-protected char curChar;
-public TemplateAnalyzerTokenManager(ASCII_CharStream stream)
-{
-   if (ASCII_CharStream.staticFlag)
-      throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
-   input_stream = stream;
-}
-public TemplateAnalyzerTokenManager(ASCII_CharStream stream, int lexState)
-{
-   this(stream);
-   SwitchTo(lexState);
-}
-public void ReInit(ASCII_CharStream stream)
-{
-   jjmatchedPos = jjnewStateCnt = 0;
-   curLexState = defaultLexState;
-   input_stream = stream;
-   ReInitRounds();
-}
-private final void ReInitRounds()
-{
-   int i;
-   jjround = 0x80000001;
-   for (i = 40; i-- > 0;)
-      jjrounds[i] = 0x80000000;
-}
-public void ReInit(ASCII_CharStream stream, int lexState)
-{
-   ReInit(stream);
-   SwitchTo(lexState);
-}
-public void SwitchTo(int lexState)
-{
-   if (lexState >= 1 || lexState < 0)
-      throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
-   else
-      curLexState = lexState;
-}
-
-private final Token jjFillToken()
-{
-   Token t = Token.newToken(jjmatchedKind);
-   t.kind = jjmatchedKind;
-   String im = jjstrLiteralImages[jjmatchedKind];
-   t.image = (im == null) ? input_stream.GetImage() : im;
-   t.beginLine = input_stream.getBeginLine();
-   t.beginColumn = input_stream.getBeginColumn();
-   t.endLine = input_stream.getEndLine();
-   t.endColumn = input_stream.getEndColumn();
-   return t;
-}
-
-int curLexState = 0;
-int defaultLexState = 0;
-int jjnewStateCnt;
-int jjround;
-int jjmatchedPos;
-int jjmatchedKind;
-
-public final Token getNextToken() 
-{
-  int kind;
-  Token specialToken = null;
-  Token matchedToken;
-  int curPos = 0;
-
-  EOFLoop :
-  for (;;)
-  {   
-   try   
-   {     
-      curChar = input_stream.BeginToken();
-   }     
-   catch(java.io.IOException e)
-   {        
-      jjmatchedKind = 0;
-      matchedToken = jjFillToken();
-      return matchedToken;
-   }
-
-   jjmatchedKind = 0x7fffffff;
-   jjmatchedPos = 0;
-   curPos = jjMoveStringLiteralDfa0_0();
-   if (jjmatchedKind != 0x7fffffff)
-   {
-      if (jjmatchedPos + 1 < curPos)
-         input_stream.backup(curPos - jjmatchedPos - 1);
-         matchedToken = jjFillToken();
-         return matchedToken;
-   }
-   int error_line = input_stream.getEndLine();
-   int error_column = input_stream.getEndColumn();
-   String error_after = null;
-   boolean EOFSeen = false;
-   try { input_stream.readChar(); input_stream.backup(1); }
-   catch (java.io.IOException e1) {
-      EOFSeen = true;
-      error_after = curPos <= 1 ? "" : input_stream.GetImage();
-      if (curChar == '\n' || curChar == '\r') {
-         error_line++;
-         error_column = 0;
-      }
-      else
-         error_column++;
-   }
-   if (!EOFSeen) {
-      input_stream.backup(1);
-      error_after = curPos <= 1 ? "" : input_stream.GetImage();
-   }
-   throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
-  }
-}
-
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerTokenManager.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerTokenManager.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerTokenManager.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateAnalyzerTokenManager.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,481 @@
+/* Generated By:JavaCC: Do not edit this line. TemplateAnalyzerTokenManager.java */
+/*****************************************
+ *                                       *
+ *  JBoss Portal: The OpenSource Portal  *
+ *                                       *
+ *   Distributable under LGPL license.   *
+ *   See terms of license at gnu.org.    *
+ *                                       *
+ *****************************************/
+
+package org.jboss.portlet.forums.format.template;
+
+public class TemplateAnalyzerTokenManager implements TemplateAnalyzerConstants
+{
+private final int jjStopStringLiteralDfa_0(int pos, long active0)
+{
+   switch (pos)
+   {
+      default :
+         return -1;
+   }
+}
+private final int jjStartNfa_0(int pos, long active0)
+{
+   return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
+}
+private final int jjStopAtPos(int pos, int kind)
+{
+   jjmatchedKind = kind;
+   jjmatchedPos = pos;
+   return pos + 1;
+}
+private final int jjStartNfaWithStates_0(int pos, int kind, int state)
+{
+   jjmatchedKind = kind;
+   jjmatchedPos = pos;
+   try { curChar = input_stream.readChar(); }
+   catch(java.io.IOException e) { return pos + 1; }
+   return jjMoveNfa_0(state, pos + 1);
+}
+private final int jjMoveStringLiteralDfa0_0()
+{
+   switch(curChar)
+   {
+      case 10:
+         return jjStopAtPos(0, 7);
+      default :
+         return jjMoveNfa_0(3, 0);
+   }
+}
+private final void jjCheckNAdd(int state)
+{
+   if (jjrounds[state] != jjround)
+   {
+      jjstateSet[jjnewStateCnt++] = state;
+      jjrounds[state] = jjround;
+   }
+}
+private final void jjAddStates(int start, int end)
+{
+   do {
+      jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+   } while (start++ != end);
+}
+private final void jjCheckNAddTwoStates(int state1, int state2)
+{
+   jjCheckNAdd(state1);
+   jjCheckNAdd(state2);
+}
+private final void jjCheckNAddStates(int start, int end)
+{
+   do {
+      jjCheckNAdd(jjnextStates[start]);
+   } while (start++ != end);
+}
+private final void jjCheckNAddStates(int start)
+{
+   jjCheckNAdd(jjnextStates[start]);
+   jjCheckNAdd(jjnextStates[start + 1]);
+}
+static final long[] jjbitVec0 = {
+   0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
+};
+private final int jjMoveNfa_0(int startState, int curPos)
+{
+   int[] nextStates;
+   int startsAt = 0;
+   jjnewStateCnt = 40;
+   int i = 1;
+   jjstateSet[0] = startState;
+   int j, kind = 0x7fffffff;
+   for (;;)
+   {
+      if (++jjround == 0x7fffffff)
+         ReInitRounds();
+      if (curChar < 64)
+      {
+         long l = 1L << curChar;
+         MatchLoop: do
+         {
+            switch(jjstateSet[--i])
+            {
+               case 3:
+                  if ((0xfffffffffffffbffL & l) != 0L)
+                  {
+                     if (kind > 6)
+                        kind = 6;
+                  }
+                  if (curChar == 60)
+                     jjAddStates(0, 1);
+                  else if (curChar == 36)
+                     jjstateSet[jjnewStateCnt++] = 0;
+                  break;
+               case 1:
+                  jjAddStates(2, 3);
+                  break;
+               case 5:
+                  if (curChar == 46)
+                     jjCheckNAddStates(4, 6);
+                  break;
+               case 7:
+                  if ((0x3ff200000000000L & l) != 0L)
+                     jjCheckNAddStates(7, 10);
+                  break;
+               case 8:
+                  if ((0x3ff200000000000L & l) != 0L)
+                     jjCheckNAddTwoStates(8, 5);
+                  break;
+               case 9:
+                  if ((0x3ff200000000000L & l) != 0L)
+                     jjCheckNAddTwoStates(9, 6);
+                  break;
+               case 10:
+                  if ((0xfffffffffffffbffL & l) != 0L && kind > 6)
+                     kind = 6;
+                  break;
+               case 11:
+                  if (curChar == 60)
+                     jjAddStates(0, 1);
+                  break;
+               case 12:
+                  if (curChar == 32)
+                     jjCheckNAdd(13);
+                  break;
+               case 13:
+                  if ((0xfffffffeffffffffL & l) != 0L)
+                     jjCheckNAddTwoStates(13, 17);
+                  break;
+               case 14:
+                  if (curChar == 62 && kind > 1)
+                     kind = 1;
+                  break;
+               case 15:
+                  if (curChar == 45)
+                     jjstateSet[jjnewStateCnt++] = 14;
+                  break;
+               case 16:
+                  if (curChar == 45)
+                     jjstateSet[jjnewStateCnt++] = 15;
+                  break;
+               case 17:
+                  if (curChar == 32)
+                     jjstateSet[jjnewStateCnt++] = 16;
+                  break;
+               case 23:
+                  if (curChar == 32)
+                     jjstateSet[jjnewStateCnt++] = 22;
+                  break;
+               case 24:
+                  if (curChar == 45)
+                     jjstateSet[jjnewStateCnt++] = 23;
+                  break;
+               case 25:
+                  if (curChar == 45)
+                     jjstateSet[jjnewStateCnt++] = 24;
+                  break;
+               case 26:
+                  if (curChar == 33)
+                     jjstateSet[jjnewStateCnt++] = 25;
+                  break;
+               case 27:
+                  if (curChar == 32)
+                     jjCheckNAdd(28);
+                  break;
+               case 28:
+                  if ((0xfffffffeffffffffL & l) != 0L)
+                     jjCheckNAddTwoStates(28, 32);
+                  break;
+               case 29:
+                  if (curChar == 62 && kind > 2)
+                     kind = 2;
+                  break;
+               case 30:
+                  if (curChar == 45)
+                     jjstateSet[jjnewStateCnt++] = 29;
+                  break;
+               case 31:
+                  if (curChar == 45)
+                     jjstateSet[jjnewStateCnt++] = 30;
+                  break;
+               case 32:
+                  if (curChar == 32)
+                     jjstateSet[jjnewStateCnt++] = 31;
+                  break;
+               case 36:
+                  if (curChar == 32)
+                     jjstateSet[jjnewStateCnt++] = 35;
+                  break;
+               case 37:
+                  if (curChar == 45)
+                     jjstateSet[jjnewStateCnt++] = 36;
+                  break;
+               case 38:
+                  if (curChar == 45)
+                     jjstateSet[jjnewStateCnt++] = 37;
+                  break;
+               case 39:
+                  if (curChar == 33)
+                     jjstateSet[jjnewStateCnt++] = 38;
+                  break;
+               default : break;
+            }
+         } while(i != startsAt);
+      }
+      else if (curChar < 128)
+      {
+         long l = 1L << (curChar & 077);
+         MatchLoop: do
+         {
+            switch(jjstateSet[--i])
+            {
+               case 3:
+                  if (kind > 6)
+                     kind = 6;
+                  if (curChar == 123)
+                     jjCheckNAddStates(4, 6);
+                  break;
+               case 0:
+                  if (curChar == 123)
+                     jjCheckNAddTwoStates(1, 2);
+                  break;
+               case 1:
+                  if ((0xdfffffffffffffffL & l) != 0L)
+                     jjCheckNAddTwoStates(1, 2);
+                  break;
+               case 2:
+                  if (curChar == 125 && kind > 3)
+                     kind = 3;
+                  break;
+               case 4:
+                  if (curChar == 123)
+                     jjCheckNAddStates(4, 6);
+                  break;
+               case 6:
+                  if (curChar == 125 && kind > 4)
+                     kind = 4;
+                  break;
+               case 7:
+                  if ((0x7fffffe87fffffeL & l) != 0L)
+                     jjCheckNAddStates(7, 10);
+                  break;
+               case 8:
+                  if ((0x7fffffe87fffffeL & l) != 0L)
+                     jjCheckNAddTwoStates(8, 5);
+                  break;
+               case 9:
+                  if ((0x7fffffe87fffffeL & l) != 0L)
+                     jjCheckNAddTwoStates(9, 6);
+                  break;
+               case 10:
+                  if (kind > 6)
+                     kind = 6;
+                  break;
+               case 13:
+                  jjAddStates(11, 12);
+                  break;
+               case 18:
+                  if (curChar == 78)
+                     jjstateSet[jjnewStateCnt++] = 12;
+                  break;
+               case 19:
+                  if (curChar == 73)
+                     jjstateSet[jjnewStateCnt++] = 18;
+                  break;
+               case 20:
+                  if (curChar == 71)
+                     jjstateSet[jjnewStateCnt++] = 19;
+                  break;
+               case 21:
+                  if (curChar == 69)
+                     jjstateSet[jjnewStateCnt++] = 20;
+                  break;
+               case 22:
+                  if (curChar == 66)
+                     jjstateSet[jjnewStateCnt++] = 21;
+                  break;
+               case 28:
+                  jjAddStates(13, 14);
+                  break;
+               case 33:
+                  if (curChar == 68)
+                     jjstateSet[jjnewStateCnt++] = 27;
+                  break;
+               case 34:
+                  if (curChar == 78)
+                     jjstateSet[jjnewStateCnt++] = 33;
+                  break;
+               case 35:
+                  if (curChar == 69)
+                     jjstateSet[jjnewStateCnt++] = 34;
+                  break;
+               default : break;
+            }
+         } while(i != startsAt);
+      }
+      else
+      {
+         int i2 = (curChar & 0xff) >> 6;
+         long l2 = 1L << (curChar & 077);
+         MatchLoop: do
+         {
+            switch(jjstateSet[--i])
+            {
+               case 3:
+                  if ((jjbitVec0[i2] & l2) != 0L && kind > 6)
+                     kind = 6;
+                  break;
+               case 1:
+                  if ((jjbitVec0[i2] & l2) != 0L)
+                     jjAddStates(2, 3);
+                  break;
+               case 13:
+                  if ((jjbitVec0[i2] & l2) != 0L)
+                     jjAddStates(11, 12);
+                  break;
+               case 28:
+                  if ((jjbitVec0[i2] & l2) != 0L)
+                     jjAddStates(13, 14);
+                  break;
+               default : break;
+            }
+         } while(i != startsAt);
+      }
+      if (kind != 0x7fffffff)
+      {
+         jjmatchedKind = kind;
+         jjmatchedPos = curPos;
+         kind = 0x7fffffff;
+      }
+      ++curPos;
+      if ((i = jjnewStateCnt) == (startsAt = 40 - (jjnewStateCnt = startsAt)))
+         return curPos;
+      try { curChar = input_stream.readChar(); }
+      catch(java.io.IOException e) { return curPos; }
+   }
+}
+static final int[] jjnextStates = {
+   26, 39, 1, 2, 5, 6, 7, 8, 5, 9, 6, 13, 17, 28, 32, 
+};
+public static final String[] jjstrLiteralImages = {
+"", null, null, null, null, null, null, "\12", };
+public static final String[] lexStateNames = {
+   "DEFAULT", 
+};
+private ASCII_CharStream input_stream;
+private final int[] jjrounds = new int[40];
+private final int[] jjstateSet = new int[80];
+protected char curChar;
+public TemplateAnalyzerTokenManager(ASCII_CharStream stream)
+{
+   if (ASCII_CharStream.staticFlag)
+      throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
+   input_stream = stream;
+}
+public TemplateAnalyzerTokenManager(ASCII_CharStream stream, int lexState)
+{
+   this(stream);
+   SwitchTo(lexState);
+}
+public void ReInit(ASCII_CharStream stream)
+{
+   jjmatchedPos = jjnewStateCnt = 0;
+   curLexState = defaultLexState;
+   input_stream = stream;
+   ReInitRounds();
+}
+private final void ReInitRounds()
+{
+   int i;
+   jjround = 0x80000001;
+   for (i = 40; i-- > 0;)
+      jjrounds[i] = 0x80000000;
+}
+public void ReInit(ASCII_CharStream stream, int lexState)
+{
+   ReInit(stream);
+   SwitchTo(lexState);
+}
+public void SwitchTo(int lexState)
+{
+   if (lexState >= 1 || lexState < 0)
+      throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
+   else
+      curLexState = lexState;
+}
+
+private final Token jjFillToken()
+{
+   Token t = Token.newToken(jjmatchedKind);
+   t.kind = jjmatchedKind;
+   String im = jjstrLiteralImages[jjmatchedKind];
+   t.image = (im == null) ? input_stream.GetImage() : im;
+   t.beginLine = input_stream.getBeginLine();
+   t.beginColumn = input_stream.getBeginColumn();
+   t.endLine = input_stream.getEndLine();
+   t.endColumn = input_stream.getEndColumn();
+   return t;
+}
+
+int curLexState = 0;
+int defaultLexState = 0;
+int jjnewStateCnt;
+int jjround;
+int jjmatchedPos;
+int jjmatchedKind;
+
+public final Token getNextToken() 
+{
+  int kind;
+  Token specialToken = null;
+  Token matchedToken;
+  int curPos = 0;
+
+  EOFLoop :
+  for (;;)
+  {   
+   try   
+   {     
+      curChar = input_stream.BeginToken();
+   }     
+   catch(java.io.IOException e)
+   {        
+      jjmatchedKind = 0;
+      matchedToken = jjFillToken();
+      return matchedToken;
+   }
+
+   jjmatchedKind = 0x7fffffff;
+   jjmatchedPos = 0;
+   curPos = jjMoveStringLiteralDfa0_0();
+   if (jjmatchedKind != 0x7fffffff)
+   {
+      if (jjmatchedPos + 1 < curPos)
+         input_stream.backup(curPos - jjmatchedPos - 1);
+         matchedToken = jjFillToken();
+         return matchedToken;
+   }
+   int error_line = input_stream.getEndLine();
+   int error_column = input_stream.getEndColumn();
+   String error_after = null;
+   boolean EOFSeen = false;
+   try { input_stream.readChar(); input_stream.backup(1); }
+   catch (java.io.IOException e1) {
+      EOFSeen = true;
+      error_after = curPos <= 1 ? "" : input_stream.GetImage();
+      if (curChar == '\n' || curChar == '\r') {
+         error_line++;
+         error_column = 0;
+      }
+      else
+         error_column++;
+   }
+   if (!EOFSeen) {
+      input_stream.backup(1);
+      error_after = curPos <= 1 ? "" : input_stream.GetImage();
+   }
+   throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
+  }
+}
+
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateBuilder.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateBuilder.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateBuilder.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,206 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.template;
-
-import javassist.CannotCompileException;
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.CtConstructor;
-import javassist.CtField;
-import javassist.CtMethod;
-import javassist.CtNewMethod;
-import javassist.LoaderClassPath;
-import javassist.Modifier;
-import javassist.NotFoundException;
-import org.apache.log4j.Logger;
-import org.dom4j.Document;
-import org.dom4j.Element;
-import org.dom4j.Node;
-import org.dom4j.Text;
-
-import java.io.Writer;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Set;
-
-/** @author <a href="mailto:julien at jboss.org">Julien Viet</a> */
-public class TemplateBuilder
-{
-
-   private static final String CONTEXT = Context.class.getName();
-   private static final String ITERATOR = Iterator.class.getName();
-
-   private final ClassPool pool;
-   private final Element node;
-   private final int index;
-   private final Logger log;
-   private final Set propertyNames;
-   private CtClass cc;
-
-   public static int classNameCounter = 0;
-
-   public TemplateBuilder(Document doc, Set propertyNames)
-   {
-      this(doc.getRootElement(), propertyNames);
-   }
-
-   public TemplateBuilder(Element node, Set propertyNames)
-   {
-      this(new ClassPool(null), node, propertyNames);
-      pool.appendClassPath(new LoaderClassPath(Thread.currentThread().getContextClassLoader()));
-   }
-
-   public TemplateBuilder(ClassPool pool, Document doc, Set names)
-   {
-      this(pool, doc.getRootElement(), names);
-   }
-
-   public TemplateBuilder(ClassPool pool, Element node, Set names)
-   {
-      this.index = classNameCounter++;
-      this.pool = pool;
-      this.node = node;
-      this.propertyNames = names;
-      this.log = Logger.getLogger(getClass() + "." + index);
-   }
-
-   public CtClass getGeneratedClass()
-   {
-      return cc;
-   }
-
-   public void build() throws BuildException
-   {
-      try
-      {
-         cc = pool.makeClass("org.jboss.nukes.common.template.Generated" + index);
-         cc.setSuperclass(pool.get(Template.class.getName()));
-         cc.setModifiers(Modifier.PUBLIC);
-
-         addConstructor();
-         implementRender();
-      }
-      catch (CannotCompileException e)
-      {
-         throw new BuildException("Unexpected error, cannot build template", e);
-      }
-      catch (NotFoundException e)
-      {
-         throw new BuildException("Unexpected error, cannot build template", e);
-      }
-   }
-
-   private void addConstructor() throws CannotCompileException, NotFoundException
-   {
-      CtConstructor ctor = new CtConstructor(new CtClass[]{pool.get(CONTEXT)}, cc);
-      ctor.setBody("{ super($1); }");
-      cc.addConstructor(ctor);
-      log.debug("Added constructor on template " + cc.getName());
-   }
-
-   private void implementRender() throws CannotCompileException, NotFoundException
-   {
-      LinkedList stack = new LinkedList();
-      stack.add("");
-      StringBuffer buffer = new StringBuffer();
-      buffer.append("public void render(").append(Context.class.getName()).append(" ctx, ").append(Writer.class.getName()).append(" writer)\n").
-         append("{\n").
-         append("   ").append(CONTEXT).append(" ctx_ = $1;\n");
-      generateRender(stack, buffer, "   ", node);
-      buffer.append("}\n");
-      String code = buffer.toString();
-      CtMethod method = CtNewMethod.make(code, cc);
-      cc.addMethod(method);
-      CtField gc = new CtField(pool.get(String.class.getName()), "_generated_code", cc);
-      gc.setModifiers(Modifier.PUBLIC | Modifier.STATIC);
-      CtField.Initializer initializer = CtField.Initializer.constant(code);
-      cc.addField(gc, initializer);
-      log.debug("Created render method on template " + cc.getName() + " with body " + code);
-   }
-
-   private void generateRender(LinkedList stack, StringBuffer buffer, String indent, Element node)
-   {
-      buffer.append(indent).append("String s_").append(stack.size()).append(" = null;\n");
-      for (Iterator i = node.content().iterator(); i.hasNext();)
-      {
-         Node item = (Node)i.next();
-         if (item instanceof Text)
-         {
-            String text = item.getText().trim();
-            text = org.jboss.portal.common.util.Tools.replace(text, "\n", "\\n");
-            text = org.jboss.portal.common.util.Tools.replace(text, "\"", "\\\"");
-            buffer.append(indent).append("$2.write(\"").append(text).append("\");\n");
-         }
-         else if (item instanceof Element)
-         {
-            Element elt = (Element)item;
-            if ("loop".equals(elt.getName()))
-            {
-               String name = elt.attributeValue("name");
-               String iterator = "it_" + name;
-               String context = "ctx_" + name;
-               buffer.append(indent).append("for (").append(ITERATOR).append(" ").append(iterator).append(" = ").append("ctx_").append(stack.getLast()).append(".childIterator(\"").append(name).append("\");").
-                  append(iterator).append(".hasNext();").
-                  append(")\n").
-                  append(indent).append("{\n").
-                  append(indent).append("   ").append(CONTEXT).append(" ").append(context).append(" = (").append(CONTEXT).append(")").append(iterator).append(".next();\n");
-               stack.add(name);
-               generateRender(stack, buffer, indent + "   ", elt.element("node"));
-               stack.removeLast();
-               buffer.append(indent).append("}\n");
-            }
-            else if ("ref".equals(elt.getName()))
-            {
-               String name = elt.attributeValue("name");
-               int depth = Integer.parseInt(elt.attributeValue("depth"));
-               String target = null;
-               if (depth == 0)
-               {
-                  target = propertyNames.contains(name) ? "$0.local" : "ctx_";
-               }
-               else
-               {
-                  target = "ctx_" + (String)stack.get(depth);
-               }
-               if (target != null)
-               {
-                  buffer.append(indent).append("s_").append(stack.size()).append(" = (java.lang.String)").append(target).append(".get(\"").append(name).append("\");\n").
-                     append(indent).append("if (s_").append(stack.size()).append(" != null)\n").
-                     append(indent).append("{\n").
-                     append(indent).append("   $2.write(s_").append(stack.size()).append(");\n").
-                     append(indent).append("}\n").
-                     append(indent).append("else if (log.isDebugEnabled())\n").
-                     append(indent).append("{\n").
-                     append(indent).append("   log.debug(\"field ").append(name).append(" is null\");\n").
-                     append(indent).append("}\n");
-               }
-               else
-               {
-//                  log.warn("Path not usable ");
-               }
-            }
-         }
-      }
-   }
-
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateBuilder.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateBuilder.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateBuilder.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateBuilder.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,206 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.template;
+
+import javassist.CannotCompileException;
+import javassist.ClassPool;
+import javassist.CtClass;
+import javassist.CtConstructor;
+import javassist.CtField;
+import javassist.CtMethod;
+import javassist.CtNewMethod;
+import javassist.LoaderClassPath;
+import javassist.Modifier;
+import javassist.NotFoundException;
+import org.apache.log4j.Logger;
+import org.dom4j.Document;
+import org.dom4j.Element;
+import org.dom4j.Node;
+import org.dom4j.Text;
+
+import java.io.Writer;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Set;
+
+/** @author <a href="mailto:julien at jboss.org">Julien Viet</a> */
+public class TemplateBuilder
+{
+
+   private static final String CONTEXT = Context.class.getName();
+   private static final String ITERATOR = Iterator.class.getName();
+
+   private final ClassPool pool;
+   private final Element node;
+   private final int index;
+   private final Logger log;
+   private final Set propertyNames;
+   private CtClass cc;
+
+   public static int classNameCounter = 0;
+
+   public TemplateBuilder(Document doc, Set propertyNames)
+   {
+      this(doc.getRootElement(), propertyNames);
+   }
+
+   public TemplateBuilder(Element node, Set propertyNames)
+   {
+      this(new ClassPool(null), node, propertyNames);
+      pool.appendClassPath(new LoaderClassPath(Thread.currentThread().getContextClassLoader()));
+   }
+
+   public TemplateBuilder(ClassPool pool, Document doc, Set names)
+   {
+      this(pool, doc.getRootElement(), names);
+   }
+
+   public TemplateBuilder(ClassPool pool, Element node, Set names)
+   {
+      this.index = classNameCounter++;
+      this.pool = pool;
+      this.node = node;
+      this.propertyNames = names;
+      this.log = Logger.getLogger(getClass() + "." + index);
+   }
+
+   public CtClass getGeneratedClass()
+   {
+      return cc;
+   }
+
+   public void build() throws BuildException
+   {
+      try
+      {
+         cc = pool.makeClass("org.jboss.nukes.common.template.Generated" + index);
+         cc.setSuperclass(pool.get(Template.class.getName()));
+         cc.setModifiers(Modifier.PUBLIC);
+
+         addConstructor();
+         implementRender();
+      }
+      catch (CannotCompileException e)
+      {
+         throw new BuildException("Unexpected error, cannot build template", e);
+      }
+      catch (NotFoundException e)
+      {
+         throw new BuildException("Unexpected error, cannot build template", e);
+      }
+   }
+
+   private void addConstructor() throws CannotCompileException, NotFoundException
+   {
+      CtConstructor ctor = new CtConstructor(new CtClass[]{pool.get(CONTEXT)}, cc);
+      ctor.setBody("{ super($1); }");
+      cc.addConstructor(ctor);
+      log.debug("Added constructor on template " + cc.getName());
+   }
+
+   private void implementRender() throws CannotCompileException, NotFoundException
+   {
+      LinkedList stack = new LinkedList();
+      stack.add("");
+      StringBuffer buffer = new StringBuffer();
+      buffer.append("public void render(").append(Context.class.getName()).append(" ctx, ").append(Writer.class.getName()).append(" writer)\n").
+         append("{\n").
+         append("   ").append(CONTEXT).append(" ctx_ = $1;\n");
+      generateRender(stack, buffer, "   ", node);
+      buffer.append("}\n");
+      String code = buffer.toString();
+      CtMethod method = CtNewMethod.make(code, cc);
+      cc.addMethod(method);
+      CtField gc = new CtField(pool.get(String.class.getName()), "_generated_code", cc);
+      gc.setModifiers(Modifier.PUBLIC | Modifier.STATIC);
+      CtField.Initializer initializer = CtField.Initializer.constant(code);
+      cc.addField(gc, initializer);
+      log.debug("Created render method on template " + cc.getName() + " with body " + code);
+   }
+
+   private void generateRender(LinkedList stack, StringBuffer buffer, String indent, Element node)
+   {
+      buffer.append(indent).append("String s_").append(stack.size()).append(" = null;\n");
+      for (Iterator i = node.content().iterator(); i.hasNext();)
+      {
+         Node item = (Node)i.next();
+         if (item instanceof Text)
+         {
+            String text = item.getText().trim();
+            text = org.jboss.portal.common.util.Tools.replace(text, "\n", "\\n");
+            text = org.jboss.portal.common.util.Tools.replace(text, "\"", "\\\"");
+            buffer.append(indent).append("$2.write(\"").append(text).append("\");\n");
+         }
+         else if (item instanceof Element)
+         {
+            Element elt = (Element)item;
+            if ("loop".equals(elt.getName()))
+            {
+               String name = elt.attributeValue("name");
+               String iterator = "it_" + name;
+               String context = "ctx_" + name;
+               buffer.append(indent).append("for (").append(ITERATOR).append(" ").append(iterator).append(" = ").append("ctx_").append(stack.getLast()).append(".childIterator(\"").append(name).append("\");").
+                  append(iterator).append(".hasNext();").
+                  append(")\n").
+                  append(indent).append("{\n").
+                  append(indent).append("   ").append(CONTEXT).append(" ").append(context).append(" = (").append(CONTEXT).append(")").append(iterator).append(".next();\n");
+               stack.add(name);
+               generateRender(stack, buffer, indent + "   ", elt.element("node"));
+               stack.removeLast();
+               buffer.append(indent).append("}\n");
+            }
+            else if ("ref".equals(elt.getName()))
+            {
+               String name = elt.attributeValue("name");
+               int depth = Integer.parseInt(elt.attributeValue("depth"));
+               String target = null;
+               if (depth == 0)
+               {
+                  target = propertyNames.contains(name) ? "$0.local" : "ctx_";
+               }
+               else
+               {
+                  target = "ctx_" + (String)stack.get(depth);
+               }
+               if (target != null)
+               {
+                  buffer.append(indent).append("s_").append(stack.size()).append(" = (java.lang.String)").append(target).append(".get(\"").append(name).append("\");\n").
+                     append(indent).append("if (s_").append(stack.size()).append(" != null)\n").
+                     append(indent).append("{\n").
+                     append(indent).append("   $2.write(s_").append(stack.size()).append(");\n").
+                     append(indent).append("}\n").
+                     append(indent).append("else if (log.isDebugEnabled())\n").
+                     append(indent).append("{\n").
+                     append(indent).append("   log.debug(\"field ").append(name).append(" is null\");\n").
+                     append(indent).append("}\n");
+               }
+               else
+               {
+//                  log.warn("Path not usable ");
+               }
+            }
+         }
+      }
+   }
+
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateLoader.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateLoader.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateLoader.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,180 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.template;
-
-import org.dom4j.Document;
-import org.jboss.portlet.forums.format.util.CLLoader;
-import org.jboss.portlet.forums.format.util.Loader;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 7374 $
- */
-public class TemplateLoader extends TemplateRepository
-{
-
-   private Loader loader;
-//   private Map defaults = new HashMap();
-
-   public TemplateLoader(Loader loader)
-   {
-      setLoader(loader);
-   }
-
-   public Loader getLoader()
-   {
-      return loader;
-   }
-
-   public void setLoader(Loader loader)
-   {
-      if (loader == null)
-      {
-         throw new IllegalArgumentException("loader cannot be null");
-      }
-      this.loader = loader;
-   }
-
-//   public void load(String name)
-//   {
-//      InputStream in = loader.load(name + ".properties");
-//      if (in != null)
-//      {
-//         Properties props = new Properties();
-//      }
-//      else
-//      {
-//
-//      }
-//   }
-
-//   /**
-//    * Creates a template instance.
-//    */
-//   public Template createTemplate(String name)
-//   {
-//      Properties props = (Properties)defaults.get(name);
-//      Context ctx = Context.NULL_CONTEXT;
-//      if (props != null)
-//      {
-//         ctx = new HashContext();
-//         ctx.putAll(props);
-//      }
-//      return createTemplate(name, ctx);
-//   }
-
-//   public void addTemplate(String name)
-//   {
-//      addTemplate(name, name);
-//   }
-//
-//
-
-   public void addTemplate(String name, String loadName) throws BuildException
-   {
-      Document doc = loadTemplate(loadName);
-      addTemplate(name, doc);
-   }
-
-   public void addTemplate(String name, String loadName, Set names) throws BuildException
-   {
-      Document doc = loadTemplate(loadName);
-      addTemplate(name, doc, names);
-   }
-
-//   public void addSubTemplate(String templateName, String loadName, String xpath, Set names)
-//   {
-//      Document template = loadTemplate(loadName);
-//      addTemplate(templateName, (Element)template.selectSingleNode(xpath), names);
-//   }
-
-//   public void addSubTemplate(String templateName, String loadName, String xpath)
-//   {
-//      InputStream pin = null;
-//      try
-//      {
-//         Properties props = new Properties();
-//         pin = loader.loadProperties(loadName);
-//         if (pin != null)
-//         {
-//            defaults.put(loadName, props);
-//            props.load(pin);
-//         }
-//         addSubTemplate(templateName, props.keySet());
-//      }
-//      catch(IOException e)
-//      {
-//         e.printStackTrace();
-//      }
-//      finally
-//      {
-//         Tools.safeClose(pin);
-//      }
-//   }
-
-   /** Simply loads a template and returns it. */
-   public Document loadTemplate(String name) throws BuildException
-   {
-      InputStream tin = null;
-      try
-      {
-         tin = loader.load(name);
-         if (tin != null)
-         {
-            Reader reader = new InputStreamReader(tin);
-            TemplateParser parser = new TemplateParser(reader);
-            return parser.parse();
-         }
-         else
-         {
-            throw new BuildException("Template " + name + " not found");
-         }
-      }
-      catch (ParseException e)
-      {
-         throw new BuildException("Cannot parse the template source " + name, e);
-      }
-      finally
-      {
-         try
-         {
-            tin.close();
-         }
-         catch (IOException e)
-         {
-             throw new BuildException("Could not close templates InputStreamReader."+name,e);
-         }
-      }
-   }
-
-   public static TemplateLoader create(ClassLoader cl, String base)
-   {
-      return new TemplateLoader(new CLLoader(cl, base));
-   }
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateLoader.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateLoader.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateLoader.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateLoader.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,180 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.template;
+
+import org.dom4j.Document;
+import org.jboss.portlet.forums.format.util.CLLoader;
+import org.jboss.portlet.forums.format.util.Loader;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 7374 $
+ */
+public class TemplateLoader extends TemplateRepository
+{
+
+   private Loader loader;
+//   private Map defaults = new HashMap();
+
+   public TemplateLoader(Loader loader)
+   {
+      setLoader(loader);
+   }
+
+   public Loader getLoader()
+   {
+      return loader;
+   }
+
+   public void setLoader(Loader loader)
+   {
+      if (loader == null)
+      {
+         throw new IllegalArgumentException("loader cannot be null");
+      }
+      this.loader = loader;
+   }
+
+//   public void load(String name)
+//   {
+//      InputStream in = loader.load(name + ".properties");
+//      if (in != null)
+//      {
+//         Properties props = new Properties();
+//      }
+//      else
+//      {
+//
+//      }
+//   }
+
+//   /**
+//    * Creates a template instance.
+//    */
+//   public Template createTemplate(String name)
+//   {
+//      Properties props = (Properties)defaults.get(name);
+//      Context ctx = Context.NULL_CONTEXT;
+//      if (props != null)
+//      {
+//         ctx = new HashContext();
+//         ctx.putAll(props);
+//      }
+//      return createTemplate(name, ctx);
+//   }
+
+//   public void addTemplate(String name)
+//   {
+//      addTemplate(name, name);
+//   }
+//
+//
+
+   public void addTemplate(String name, String loadName) throws BuildException
+   {
+      Document doc = loadTemplate(loadName);
+      addTemplate(name, doc);
+   }
+
+   public void addTemplate(String name, String loadName, Set names) throws BuildException
+   {
+      Document doc = loadTemplate(loadName);
+      addTemplate(name, doc, names);
+   }
+
+//   public void addSubTemplate(String templateName, String loadName, String xpath, Set names)
+//   {
+//      Document template = loadTemplate(loadName);
+//      addTemplate(templateName, (Element)template.selectSingleNode(xpath), names);
+//   }
+
+//   public void addSubTemplate(String templateName, String loadName, String xpath)
+//   {
+//      InputStream pin = null;
+//      try
+//      {
+//         Properties props = new Properties();
+//         pin = loader.loadProperties(loadName);
+//         if (pin != null)
+//         {
+//            defaults.put(loadName, props);
+//            props.load(pin);
+//         }
+//         addSubTemplate(templateName, props.keySet());
+//      }
+//      catch(IOException e)
+//      {
+//         e.printStackTrace();
+//      }
+//      finally
+//      {
+//         Tools.safeClose(pin);
+//      }
+//   }
+
+   /** Simply loads a template and returns it. */
+   public Document loadTemplate(String name) throws BuildException
+   {
+      InputStream tin = null;
+      try
+      {
+         tin = loader.load(name);
+         if (tin != null)
+         {
+            Reader reader = new InputStreamReader(tin);
+            TemplateParser parser = new TemplateParser(reader);
+            return parser.parse();
+         }
+         else
+         {
+            throw new BuildException("Template " + name + " not found");
+         }
+      }
+      catch (ParseException e)
+      {
+         throw new BuildException("Cannot parse the template source " + name, e);
+      }
+      finally
+      {
+         try
+         {
+            tin.close();
+         }
+         catch (IOException e)
+         {
+             throw new BuildException("Could not close templates InputStreamReader."+name,e);
+         }
+      }
+   }
+
+   public static TemplateLoader create(ClassLoader cl, String base)
+   {
+      return new TemplateLoader(new CLLoader(cl, base));
+   }
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateParser.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateParser.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateParser.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,192 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.template;
-
-import org.dom4j.Document;
-import org.dom4j.DocumentFactory;
-import org.dom4j.Element;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.LinkedList;
-
-/** @author <a href="mailto:julien at jboss.org">Julien Viet</a> */
-public final class TemplateParser
-   implements TemplateAnalyzerConstants
-{
-
-   private Reader source;
-   private TemplateAnalyzerTokenManager analyzer;
-   private LinkedList stack = new LinkedList();
-   private Document template;
-   private Element current;
-   private StringBuffer text = null;
-
-   public TemplateParser(File source) throws FileNotFoundException
-   {
-      this(new FileReader(source));
-   }
-
-   public TemplateParser(String source)
-   {
-      this(new StringReader(source));
-   }
-
-   public TemplateParser(Reader source)
-   {
-      this.source = source;
-      analyzer = new TemplateAnalyzerTokenManager(new ASCII_CharStream(source, 1, 1));
-      template = DocumentFactory.getInstance().createDocument();
-      current = template.addElement("node");
-   }
-
-   /** This method should be called only once. If it is called more than once there are no garanty on the result. */
-   public Document parse() throws ParseException
-   {
-      while (true)
-      {
-         // getChild the next token
-         Token t = analyzer.getNextToken();
-
-         if (t.image.length() == 0)
-         {
-            if (text != null)
-            {
-               current.addText(text.toString());
-               text = null;
-            }
-
-            // no more token to read
-            if (current != template.getRootElement())
-            {
-               throw new ParseException("An opening loop is not closed");
-            }
-            return template;
-         }
-
-         switch (t.kind)
-         {
-            case BEGIN:
-               if (text != null)
-               {
-                  current.addText(text.toString());
-                  text = null;
-               }
-               Element loop = current.addElement("loop");
-               loop.addAttribute("name", t.image.substring("<!-- BEGIN ".length(), t.image.length() - " -->".length()));
-               push(loop.addElement("node"));
-               break;
-
-            case END:
-               if (text != null)
-               {
-                  current.addText(text.toString());
-                  text = null;
-               }
-               if (!"node".equals(current.getName()))
-               {
-                  throw new ParseException("Unexpected closing loop");
-               }
-               pop();
-//            if (!((Loop)current.getContent().getLast()).validate(t.image))
-//            {
-//               throw new ParseException("Closing loop does not match");
-//            }
-               break;
-
-            case PROPERTY:
-            case TEXT:
-               if (text == null)
-               {
-                  text = new StringBuffer();
-               }
-               text.append(t.image);
-               break;
-            case NEWLINE:
-               if (text == null)
-               {
-                  text = new StringBuffer();
-               }
-               text.append("\n");
-               break;
-
-
-            case REF:
-               if (text != null)
-               {
-                  current.addText(text.toString());
-                  text = null;
-               }
-               Element ref = current.addElement("ref");
-               String tmp = t.image.substring(1, t.image.length() - 1);
-               int count = 0;
-               int previous = -1;
-               while (true)
-               {
-                  int index = tmp.indexOf('.', previous + 1);
-                  if (index == -1)
-                  {
-                     String name = tmp.substring(previous + 1);
-                     ref.addAttribute("name", name);
-                     break;
-                  }
-                  count++;
-                  previous = index;
-               }
-               ref.addAttribute("depth", "" + count);
-               break;
-
-            default:
-               throw new ParseException("Unexpected token");
-         }
-      }
-   }
-
-   public void close()
-   {
-      try
-      {
-         source.close();
-      }
-      catch (IOException ignore)
-      {
-         //
-      }
-   }
-
-   private void push(Element node)
-   {
-      stack.addLast(current);
-      current = node;
-   }
-
-   private void pop()
-   {
-      current = (Element)stack.removeLast();
-   }
-
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateParser.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateParser.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateParser.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateParser.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,192 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.template;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentFactory;
+import org.dom4j.Element;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.LinkedList;
+
+/** @author <a href="mailto:julien at jboss.org">Julien Viet</a> */
+public final class TemplateParser
+   implements TemplateAnalyzerConstants
+{
+
+   private Reader source;
+   private TemplateAnalyzerTokenManager analyzer;
+   private LinkedList stack = new LinkedList();
+   private Document template;
+   private Element current;
+   private StringBuffer text = null;
+
+   public TemplateParser(File source) throws FileNotFoundException
+   {
+      this(new FileReader(source));
+   }
+
+   public TemplateParser(String source)
+   {
+      this(new StringReader(source));
+   }
+
+   public TemplateParser(Reader source)
+   {
+      this.source = source;
+      analyzer = new TemplateAnalyzerTokenManager(new ASCII_CharStream(source, 1, 1));
+      template = DocumentFactory.getInstance().createDocument();
+      current = template.addElement("node");
+   }
+
+   /** This method should be called only once. If it is called more than once there are no garanty on the result. */
+   public Document parse() throws ParseException
+   {
+      while (true)
+      {
+         // getChild the next token
+         Token t = analyzer.getNextToken();
+
+         if (t.image.length() == 0)
+         {
+            if (text != null)
+            {
+               current.addText(text.toString());
+               text = null;
+            }
+
+            // no more token to read
+            if (current != template.getRootElement())
+            {
+               throw new ParseException("An opening loop is not closed");
+            }
+            return template;
+         }
+
+         switch (t.kind)
+         {
+            case BEGIN:
+               if (text != null)
+               {
+                  current.addText(text.toString());
+                  text = null;
+               }
+               Element loop = current.addElement("loop");
+               loop.addAttribute("name", t.image.substring("<!-- BEGIN ".length(), t.image.length() - " -->".length()));
+               push(loop.addElement("node"));
+               break;
+
+            case END:
+               if (text != null)
+               {
+                  current.addText(text.toString());
+                  text = null;
+               }
+               if (!"node".equals(current.getName()))
+               {
+                  throw new ParseException("Unexpected closing loop");
+               }
+               pop();
+//            if (!((Loop)current.getContent().getLast()).validate(t.image))
+//            {
+//               throw new ParseException("Closing loop does not match");
+//            }
+               break;
+
+            case PROPERTY:
+            case TEXT:
+               if (text == null)
+               {
+                  text = new StringBuffer();
+               }
+               text.append(t.image);
+               break;
+            case NEWLINE:
+               if (text == null)
+               {
+                  text = new StringBuffer();
+               }
+               text.append("\n");
+               break;
+
+
+            case REF:
+               if (text != null)
+               {
+                  current.addText(text.toString());
+                  text = null;
+               }
+               Element ref = current.addElement("ref");
+               String tmp = t.image.substring(1, t.image.length() - 1);
+               int count = 0;
+               int previous = -1;
+               while (true)
+               {
+                  int index = tmp.indexOf('.', previous + 1);
+                  if (index == -1)
+                  {
+                     String name = tmp.substring(previous + 1);
+                     ref.addAttribute("name", name);
+                     break;
+                  }
+                  count++;
+                  previous = index;
+               }
+               ref.addAttribute("depth", "" + count);
+               break;
+
+            default:
+               throw new ParseException("Unexpected token");
+         }
+      }
+   }
+
+   public void close()
+   {
+      try
+      {
+         source.close();
+      }
+      catch (IOException ignore)
+      {
+         //
+      }
+   }
+
+   private void push(Element node)
+   {
+      stack.addLast(current);
+      current = node;
+   }
+
+   private void pop()
+   {
+      current = (Element)stack.removeLast();
+   }
+
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateRepository.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateRepository.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateRepository.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,198 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.template;
-
-import javassist.CannotCompileException;
-import javassist.CtClass;
-import org.apache.log4j.Logger;
-import org.dom4j.Document;
-import org.dom4j.Element;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-/** @author <a href="mailto:julien at jboss.org">Julien Viet</a> */
-public class TemplateRepository
-{
-
-   /** The class logger. */
-   private final Logger log = Logger.getLogger(getClass());
-
-   /** Template name -> template object. */
-   private Map templates = new HashMap();
-
-   /** Template name -> Class object. */
-   private Map classes = new HashMap();
-
-   /** Compile the template definitions to bytecode. */
-   private TemplateClassLoader tcl = new TemplateClassLoader(Thread.currentThread().getContextClassLoader());
-
-   public TemplateRepository()
-   {
-   }
-
-   public Template createTemplate(String name)
-   {
-      return createTemplate(name, Context.NULL_CONTEXT);
-   }
-
-   /**
-    * Creates a new template instance.
-    *
-    * @param name the template name
-    * @param ctx  the context with the template properties
-    * @return the template instance or null if it is not found
-    */
-   public Template createTemplate(String name, Context ctx)
-   {
-      Template template = null;
-      try
-      {
-         Class clazz = (Class)classes.get(name);
-         if (clazz != null)
-         {
-            Constructor ctor = clazz.getConstructor(new Class[]{Context.class});
-            template = (Template)ctor.newInstance(new Object[]{ctx});
-         }
-         else
-         {
-            log.warn("Template " + name + " not found");
-         }
-      }
-      catch (Exception e)
-      {
-         log.error("Cannot instantiate template " + name, e);
-         throw new RuntimeException("An unexpected exception occured during the template instantiation");
-      }
-      return template;
-   }
-
-   public void addTemplate(String name, Document doc) throws BuildException
-   {
-      addTemplate(name, doc, Collections.EMPTY_SET);
-   }
-
-   public void addTemplate(String name, Element node) throws BuildException
-   {
-      addTemplate(name, node, Collections.EMPTY_SET);
-   }
-
-   public void addTemplate(String name, Document doc, Set names) throws BuildException
-   {
-      addTemplate(name, doc.getRootElement(), names);
-   }
-
-   public void addTemplate(String name, Element node, Set names) throws BuildException
-   {
-      // Keep the original template
-      templates.put(name, node);
-      log.debug("Loaded template " + name);
-
-      // Generate the class
-      Class clazz = generate(node, names);
-      log.debug("Template " + name + " generated " + clazz.getName());
-
-      // Save the class for later
-      classes.put(name, clazz);
-   }
-
-   private Class generate(Element node, Set names) throws BuildException
-   {
-      try
-      {
-         // This is the classloader that will load the template
-         String className = tcl.addTemplate(node, names);
-
-         // Return the class corresponding to the template
-         return tcl.loadClass(className);
-      }
-      catch (ClassNotFoundException e)
-      {
-         throw new BuildException("Unexpected error, cannot compile template", e);
-      }
-   }
-
-   public void clear()
-   {
-      classes.clear();
-      templates.clear();
-      tcl = new TemplateClassLoader(Thread.currentThread().getContextClassLoader());
-   }
-
-   public static class TemplateClassLoader extends ClassLoader
-   {
-
-      private final Map classes;
-
-      public TemplateClassLoader(ClassLoader parent)
-      {
-         super(parent);
-         this.classes = new HashMap();
-      }
-
-      public String addTemplate(Document doc, Set names) throws BuildException
-      {
-         return addTemplate(doc.getRootElement(), names);
-      }
-
-      public String addTemplate(Element node, Set names) throws BuildException
-      {
-         try
-         {
-            TemplateBuilder builder = new TemplateBuilder(node, names);
-            builder.build();
-            CtClass cc = builder.getGeneratedClass();
-            classes.put(cc.getName(), cc.toBytecode());
-            return cc.getName();
-         }
-         catch (IOException e)
-         {
-            throw new BuildException("Unexpected error cannot compile template", e);
-         }
-         catch (CannotCompileException e)
-         {
-            throw new BuildException("Unexpected error cannot compile template", e);
-         }
-      }
-
-      public Collection getClassNames()
-      {
-         return Collections.unmodifiableCollection(classes.keySet());
-      }
-
-      protected Class findClass(String name) throws ClassNotFoundException
-      {
-         byte[] bytes = (byte[])classes.get(name);
-         if (bytes == null)
-         {
-            throw new ClassNotFoundException("Class " + name + " does not exists");
-         }
-         return defineClass(name, bytes, 0, bytes.length);
-      }
-   }
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateRepository.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/TemplateRepository.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateRepository.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TemplateRepository.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,198 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.template;
+
+import javassist.CannotCompileException;
+import javassist.CtClass;
+import org.apache.log4j.Logger;
+import org.dom4j.Document;
+import org.dom4j.Element;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/** @author <a href="mailto:julien at jboss.org">Julien Viet</a> */
+public class TemplateRepository
+{
+
+   /** The class logger. */
+   private final Logger log = Logger.getLogger(getClass());
+
+   /** Template name -> template object. */
+   private Map templates = new HashMap();
+
+   /** Template name -> Class object. */
+   private Map classes = new HashMap();
+
+   /** Compile the template definitions to bytecode. */
+   private TemplateClassLoader tcl = new TemplateClassLoader(Thread.currentThread().getContextClassLoader());
+
+   public TemplateRepository()
+   {
+   }
+
+   public Template createTemplate(String name)
+   {
+      return createTemplate(name, Context.NULL_CONTEXT);
+   }
+
+   /**
+    * Creates a new template instance.
+    *
+    * @param name the template name
+    * @param ctx  the context with the template properties
+    * @return the template instance or null if it is not found
+    */
+   public Template createTemplate(String name, Context ctx)
+   {
+      Template template = null;
+      try
+      {
+         Class clazz = (Class)classes.get(name);
+         if (clazz != null)
+         {
+            Constructor ctor = clazz.getConstructor(new Class[]{Context.class});
+            template = (Template)ctor.newInstance(new Object[]{ctx});
+         }
+         else
+         {
+            log.warn("Template " + name + " not found");
+         }
+      }
+      catch (Exception e)
+      {
+         log.error("Cannot instantiate template " + name, e);
+         throw new RuntimeException("An unexpected exception occured during the template instantiation");
+      }
+      return template;
+   }
+
+   public void addTemplate(String name, Document doc) throws BuildException
+   {
+      addTemplate(name, doc, Collections.EMPTY_SET);
+   }
+
+   public void addTemplate(String name, Element node) throws BuildException
+   {
+      addTemplate(name, node, Collections.EMPTY_SET);
+   }
+
+   public void addTemplate(String name, Document doc, Set names) throws BuildException
+   {
+      addTemplate(name, doc.getRootElement(), names);
+   }
+
+   public void addTemplate(String name, Element node, Set names) throws BuildException
+   {
+      // Keep the original template
+      templates.put(name, node);
+      log.debug("Loaded template " + name);
+
+      // Generate the class
+      Class clazz = generate(node, names);
+      log.debug("Template " + name + " generated " + clazz.getName());
+
+      // Save the class for later
+      classes.put(name, clazz);
+   }
+
+   private Class generate(Element node, Set names) throws BuildException
+   {
+      try
+      {
+         // This is the classloader that will load the template
+         String className = tcl.addTemplate(node, names);
+
+         // Return the class corresponding to the template
+         return tcl.loadClass(className);
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new BuildException("Unexpected error, cannot compile template", e);
+      }
+   }
+
+   public void clear()
+   {
+      classes.clear();
+      templates.clear();
+      tcl = new TemplateClassLoader(Thread.currentThread().getContextClassLoader());
+   }
+
+   public static class TemplateClassLoader extends ClassLoader
+   {
+
+      private final Map classes;
+
+      public TemplateClassLoader(ClassLoader parent)
+      {
+         super(parent);
+         this.classes = new HashMap();
+      }
+
+      public String addTemplate(Document doc, Set names) throws BuildException
+      {
+         return addTemplate(doc.getRootElement(), names);
+      }
+
+      public String addTemplate(Element node, Set names) throws BuildException
+      {
+         try
+         {
+            TemplateBuilder builder = new TemplateBuilder(node, names);
+            builder.build();
+            CtClass cc = builder.getGeneratedClass();
+            classes.put(cc.getName(), cc.toBytecode());
+            return cc.getName();
+         }
+         catch (IOException e)
+         {
+            throw new BuildException("Unexpected error cannot compile template", e);
+         }
+         catch (CannotCompileException e)
+         {
+            throw new BuildException("Unexpected error cannot compile template", e);
+         }
+      }
+
+      public Collection getClassNames()
+      {
+         return Collections.unmodifiableCollection(classes.keySet());
+      }
+
+      protected Class findClass(String name) throws ClassNotFoundException
+      {
+         byte[] bytes = (byte[])classes.get(name);
+         if (bytes == null)
+         {
+            throw new ClassNotFoundException("Class " + name + " does not exists");
+         }
+         return defineClass(name, bytes, 0, bytes.length);
+      }
+   }
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Token.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/Token.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Token.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,90 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
-/*****************************************
- *                                       *
- *  JBoss Portal: The OpenSource Portal  *
- *                                       *
- *   Distributable under LGPL license.   *
- *   See terms of license at gnu.org.    *
- *                                       *
- *****************************************/
-
-package org.jboss.portlet.forums.format.template;
-
-/**
- * Describes the input token stream.
- */
-
-public class Token {
-
-  /**
-   * An integer that describes the kind of this token.  This numbering
-   * system is determined by JavaCCParser, and a table of these numbers is
-   * stored in the file ...Constants.java.
-   */
-  public int kind;
-
-  /**
-   * beginLine and beginColumn describe the position of the first character
-   * of this token; endLine and endColumn describe the position of the
-   * last character of this token.
-   */
-  public int beginLine, beginColumn, endLine, endColumn;
-
-  /**
-   * The string image of the token.
-   */
-  public String image;
-
-  /**
-   * A reference to the next regular (non-special) token from the input
-   * stream.  If this is the last token from the input stream, or if the
-   * token manager has not read tokens beyond this one, this field is
-   * set to null.  This is true only if this token is also a regular
-   * token.  Otherwise, see below for a description of the contents of
-   * this field.
-   */
-  public Token next;
-
-  /**
-   * This field is used to access special tokens that occur prior to this
-   * token, but after the immediately preceding regular (non-special) token.
-   * If there are no such special tokens, this field is set to null.
-   * When there are more than one such special token, this field refers
-   * to the last of these special tokens, which in turn refers to the next
-   * previous special token through its specialToken field, and so on
-   * until the first special token (whose specialToken field is null).
-   * The next fields of special tokens refer to other special tokens that
-   * immediately follow it (without an intervening regular token).  If there
-   * is no such token, this field is null.
-   */
-  public Token specialToken;
-
-  /**
-   * Returns the image.
-   */
-  public final String toString()
-  {
-     return image;
-  }
-
-  /**
-   * Returns a new Token object, by default. However, if you want, you
-   * can create and return subclass objects based on the value of ofKind.
-   * Simply add the cases to the switch for all those special cases.
-   * For example, if you have a subclass of Token called IDToken that
-   * you want to create if ofKind is ID, simlpy add something like :
-   *
-   *    case MyParserConstants.ID : return new IDToken();
-   *
-   * to the following switch statement. Then you can cast matchedToken
-   * variable to the appropriate type and use it in your lexical actions.
-   */
-  public static final Token newToken(int ofKind)
-  {
-     switch(ofKind)
-     {
-       default : return new Token();
-     }
-  }
-
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Token.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/Token.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Token.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/Token.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,90 @@
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 0.7pre3 */
+/*****************************************
+ *                                       *
+ *  JBoss Portal: The OpenSource Portal  *
+ *                                       *
+ *   Distributable under LGPL license.   *
+ *   See terms of license at gnu.org.    *
+ *                                       *
+ *****************************************/
+
+package org.jboss.portlet.forums.format.template;
+
+/**
+ * Describes the input token stream.
+ */
+
+public class Token {
+
+  /**
+   * An integer that describes the kind of this token.  This numbering
+   * system is determined by JavaCCParser, and a table of these numbers is
+   * stored in the file ...Constants.java.
+   */
+  public int kind;
+
+  /**
+   * beginLine and beginColumn describe the position of the first character
+   * of this token; endLine and endColumn describe the position of the
+   * last character of this token.
+   */
+  public int beginLine, beginColumn, endLine, endColumn;
+
+  /**
+   * The string image of the token.
+   */
+  public String image;
+
+  /**
+   * A reference to the next regular (non-special) token from the input
+   * stream.  If this is the last token from the input stream, or if the
+   * token manager has not read tokens beyond this one, this field is
+   * set to null.  This is true only if this token is also a regular
+   * token.  Otherwise, see below for a description of the contents of
+   * this field.
+   */
+  public Token next;
+
+  /**
+   * This field is used to access special tokens that occur prior to this
+   * token, but after the immediately preceding regular (non-special) token.
+   * If there are no such special tokens, this field is set to null.
+   * When there are more than one such special token, this field refers
+   * to the last of these special tokens, which in turn refers to the next
+   * previous special token through its specialToken field, and so on
+   * until the first special token (whose specialToken field is null).
+   * The next fields of special tokens refer to other special tokens that
+   * immediately follow it (without an intervening regular token).  If there
+   * is no such token, this field is null.
+   */
+  public Token specialToken;
+
+  /**
+   * Returns the image.
+   */
+  public final String toString()
+  {
+     return image;
+  }
+
+  /**
+   * Returns a new Token object, by default. However, if you want, you
+   * can create and return subclass objects based on the value of ofKind.
+   * Simply add the cases to the switch for all those special cases.
+   * For example, if you have a subclass of Token called IDToken that
+   * you want to create if ofKind is ID, simlpy add something like :
+   *
+   *    case MyParserConstants.ID : return new IDToken();
+   *
+   * to the following switch statement. Then you can cast matchedToken
+   * variable to the appropriate type and use it in your lexical actions.
+   */
+  public static final Token newToken(int ofKind)
+  {
+     switch(ofKind)
+     {
+       default : return new Token();
+     }
+  }
+
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TokenMgrError.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/TokenMgrError.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TokenMgrError.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,142 +0,0 @@
-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 0.7pre2 */
-/*****************************************
- *                                       *
- *  JBoss Portal: The OpenSource Portal  *
- *                                       *
- *   Distributable under LGPL license.   *
- *   See terms of license at gnu.org.    *
- *                                       *
- *****************************************/
-
-package org.jboss.portlet.forums.format.template;
-
-public class TokenMgrError extends Error
-{
-   /*
-    * Ordinals for various reasons why an Error of this type can be thrown.
-    */
-
-   /**
-    * Lexical error occured.
-    */
-   static final int LEXICAL_ERROR = 0;
-
-   /**
-    * An attempt wass made to create a second instance of a static token manager.
-    */
-   static final int STATIC_LEXER_ERROR = 1;
-
-   /**
-    * Tried to change to an invalid lexical state.
-    */
-   static final int INVALID_LEXICAL_STATE = 2;
-
-   /**
-    * Detected (and bailed out of) an infinite loop in the token manager.
-    */
-   static final int LOOP_DETECTED = 3;
-
-   /**
-    * Indicates the reason why the exception is thrown. It will have
-    * one of the above 4 values.
-    */
-   int errorCode;
-
-   /**
-    * Replaces unprintable characters by their espaced (or unicode escaped)
-    * equivalents in the given string
-    */
-   protected static final String addEscapes(String str) {
-      StringBuffer retval = new StringBuffer();
-      char ch;
-      for (int i = 0; i < str.length(); i++) {
-        switch (str.charAt(i))
-        {
-           case 0 :
-              continue;
-           case '\b':
-              retval.append("\\b");
-              continue;
-           case '\t':
-              retval.append("\\t");
-              continue;
-           case '\n':
-              retval.append("\\n");
-              continue;
-           case '\f':
-              retval.append("\\f");
-              continue;
-           case '\r':
-              retval.append("\\r");
-              continue;
-           case '\"':
-              retval.append("\\\"");
-              continue;
-           case '\'':
-              retval.append("\\\'");
-              continue;
-           case '\\':
-              retval.append("\\\\");
-              continue;
-           default:
-              if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
-                 String s = "0000" + Integer.toString(ch, 16);
-                 retval.append("\\u" + s.substring(s.length() - 4, s.length()));
-              } else {
-                 retval.append(ch);
-              }
-              continue;
-        }
-      }
-      return retval.toString();
-   }
-
-   /**
-    * Returns a detailed message for the Error when it is thrown by the
-    * token manager to indicate a lexical error.
-    * Parameters : 
-    *    EOFSeen     : indicates if EOF caused the lexicl error
-    *    curLexState : lexical state in which this error occured
-    *    errorLine   : line number when the error occured
-    *    errorColumn : column number when the error occured
-    *    errorAfter  : prefix that was seen before this error occured
-    *    curchar     : the offending character
-    * Note: You can customize the lexical error message by modifying this method.
-    */
-   private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
-      return("Lexical error at line " +
-           errorLine + ", column " +
-           errorColumn + ".  Encountered: " +
-           (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
-           "after : \"" + addEscapes(errorAfter) + "\"");
-   }
-
-   /**
-    * You can also modify the body of this method to customize your error messages.
-    * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
-    * of end-users concern, so you can return something like : 
-    *
-    *     "Internal Error : Please file a bug report .... "
-    *
-    * from this method for such cases in the release version of your parser.
-    */
-   public String getMessage() {
-      return super.getMessage();
-   }
-
-   /*
-    * Constructors of various flavors follow.
-    */
-
-   public TokenMgrError() {
-   }
-
-   public TokenMgrError(String message, int reason) {
-      super(message);
-      errorCode = reason;
-   }
-
-   public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
-      this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
-   }
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TokenMgrError.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/template/TokenMgrError.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TokenMgrError.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/template/TokenMgrError.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,142 @@
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 0.7pre2 */
+/*****************************************
+ *                                       *
+ *  JBoss Portal: The OpenSource Portal  *
+ *                                       *
+ *   Distributable under LGPL license.   *
+ *   See terms of license at gnu.org.    *
+ *                                       *
+ *****************************************/
+
+package org.jboss.portlet.forums.format.template;
+
+public class TokenMgrError extends Error
+{
+   /*
+    * Ordinals for various reasons why an Error of this type can be thrown.
+    */
+
+   /**
+    * Lexical error occured.
+    */
+   static final int LEXICAL_ERROR = 0;
+
+   /**
+    * An attempt wass made to create a second instance of a static token manager.
+    */
+   static final int STATIC_LEXER_ERROR = 1;
+
+   /**
+    * Tried to change to an invalid lexical state.
+    */
+   static final int INVALID_LEXICAL_STATE = 2;
+
+   /**
+    * Detected (and bailed out of) an infinite loop in the token manager.
+    */
+   static final int LOOP_DETECTED = 3;
+
+   /**
+    * Indicates the reason why the exception is thrown. It will have
+    * one of the above 4 values.
+    */
+   int errorCode;
+
+   /**
+    * Replaces unprintable characters by their espaced (or unicode escaped)
+    * equivalents in the given string
+    */
+   protected static final String addEscapes(String str) {
+      StringBuffer retval = new StringBuffer();
+      char ch;
+      for (int i = 0; i < str.length(); i++) {
+        switch (str.charAt(i))
+        {
+           case 0 :
+              continue;
+           case '\b':
+              retval.append("\\b");
+              continue;
+           case '\t':
+              retval.append("\\t");
+              continue;
+           case '\n':
+              retval.append("\\n");
+              continue;
+           case '\f':
+              retval.append("\\f");
+              continue;
+           case '\r':
+              retval.append("\\r");
+              continue;
+           case '\"':
+              retval.append("\\\"");
+              continue;
+           case '\'':
+              retval.append("\\\'");
+              continue;
+           case '\\':
+              retval.append("\\\\");
+              continue;
+           default:
+              if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
+                 String s = "0000" + Integer.toString(ch, 16);
+                 retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+              } else {
+                 retval.append(ch);
+              }
+              continue;
+        }
+      }
+      return retval.toString();
+   }
+
+   /**
+    * Returns a detailed message for the Error when it is thrown by the
+    * token manager to indicate a lexical error.
+    * Parameters : 
+    *    EOFSeen     : indicates if EOF caused the lexicl error
+    *    curLexState : lexical state in which this error occured
+    *    errorLine   : line number when the error occured
+    *    errorColumn : column number when the error occured
+    *    errorAfter  : prefix that was seen before this error occured
+    *    curchar     : the offending character
+    * Note: You can customize the lexical error message by modifying this method.
+    */
+   private static final String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
+      return("Lexical error at line " +
+           errorLine + ", column " +
+           errorColumn + ".  Encountered: " +
+           (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
+           "after : \"" + addEscapes(errorAfter) + "\"");
+   }
+
+   /**
+    * You can also modify the body of this method to customize your error messages.
+    * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
+    * of end-users concern, so you can return something like : 
+    *
+    *     "Internal Error : Please file a bug report .... "
+    *
+    * from this method for such cases in the release version of your parser.
+    */
+   public String getMessage() {
+      return super.getMessage();
+   }
+
+   /*
+    * Constructors of various flavors follow.
+    */
+
+   public TokenMgrError() {
+   }
+
+   public TokenMgrError(String message, int reason) {
+      super(message);
+      errorCode = reason;
+   }
+
+   public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
+      this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
+   }
+}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/util)

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/CLLoader.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/util/CLLoader.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/CLLoader.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,74 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.util;
-
-import java.io.InputStream;
-
-/**
- * Loader implementation that loads through a ClassLoader.
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public class CLLoader implements Loader
-{
-
-   private final ClassLoader cl;
-   private String base;
-
-   public CLLoader()
-   {
-      this(Thread.currentThread().getContextClassLoader(), null);
-   }
-
-   public CLLoader(ClassLoader cl, String base)
-   {
-      this.cl = cl;
-      setBase(base);
-   }
-
-   public CLLoader(ClassLoader cl)
-   {
-      this(cl, null);
-   }
-
-   public CLLoader(String base)
-   {
-      this(Thread.currentThread().getContextClassLoader(), base);
-   }
-
-   public String getBase()
-   {
-      return base;
-   }
-
-   public void setBase(String base)
-   {
-      this.base = base != null ? base : "";
-   }
-
-   public InputStream load(String name)
-   {
-      return cl.getResourceAsStream(base.length() == 0 ? name.substring(1) : base + name);
-   }
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/CLLoader.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/util/CLLoader.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/CLLoader.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/CLLoader.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,74 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.util;
+
+import java.io.InputStream;
+
+/**
+ * Loader implementation that loads through a ClassLoader.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public class CLLoader implements Loader
+{
+
+   private final ClassLoader cl;
+   private String base;
+
+   public CLLoader()
+   {
+      this(Thread.currentThread().getContextClassLoader(), null);
+   }
+
+   public CLLoader(ClassLoader cl, String base)
+   {
+      this.cl = cl;
+      setBase(base);
+   }
+
+   public CLLoader(ClassLoader cl)
+   {
+      this(cl, null);
+   }
+
+   public CLLoader(String base)
+   {
+      this(Thread.currentThread().getContextClassLoader(), base);
+   }
+
+   public String getBase()
+   {
+      return base;
+   }
+
+   public void setBase(String base)
+   {
+      this.base = base != null ? base : "";
+   }
+
+   public InputStream load(String name)
+   {
+      return cl.getResourceAsStream(base.length() == 0 ? name.substring(1) : base + name);
+   }
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/EntityTable.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/util/EntityTable.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/EntityTable.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,366 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.util;
-
-/** This table provides lookup for converting a char to its HTML entity representation. */
-public class EntityTable
-{
-
-   /** All HTML entities. */
-   public static final EntityTable FULL = new EntityTable();
-
-   /** All HTML entities except the HTML chars which are used to do HTML itself. */
-   public static final EntityTable BASIC = new BasicEntityTable();
-
-   private static class BasicEntityTable extends EntityTable
-   {
-      public BasicEntityTable()
-      {
-         remove('<');
-         remove('>');
-         remove('"');
-         remove('&');
-      }
-   }
-
-   private String[] charToEntity = new String[65536];
-
-   protected EntityTable()
-   {
-      put(160, "nbsp");
-      put(161, "iexcl");
-      put(162, "cent");
-      put(163, "pound");
-      put(164, "curren");
-      put(165, "yen");
-      put(166, "brvbar");
-      put(167, "sect");
-      put(168, "uml");
-      put(169, "copy");
-      put(170, "ordf");
-      put(171, "laquo");
-      put(172, "not");
-      put(173, "shy");
-      put(174, "reg");
-      put(175, "macr");
-      put(176, "deg");
-      put(177, "plusmn");
-      put(178, "sup2");
-      put(179, "sup3");
-      put(180, "acute");
-      put(181, "micro");
-      put(182, "para");
-      put(183, "middot");
-      put(184, "cedil");
-      put(185, "sup1");
-      put(186, "ordm");
-      put(187, "raquo");
-      put(188, "frac14");
-      put(189, "frac12");
-      put(190, "frac34");
-      put(191, "iquest");
-      put(192, "Agrave");
-      put(193, "Aacute");
-      put(194, "Acirc");
-      put(195, "Atilde");
-      put(196, "Auml");
-      put(197, "Aring");
-      put(198, "AElig");
-      put(199, "Ccedil");
-      put(200, "Egrave");
-      put(201, "Eacute");
-      put(202, "Ecirc");
-      put(203, "Euml");
-      put(204, "Igrave");
-      put(205, "Iacute");
-      put(206, "Icirc");
-      put(207, "Iuml");
-      put(208, "ETH");
-      put(209, "Ntilde");
-      put(210, "Ograve");
-      put(211, "Oacute");
-      put(212, "Ocirc");
-      put(213, "Otilde");
-      put(214, "Ouml");
-      put(215, "times");
-      put(216, "Oslash");
-      put(217, "Ugrave");
-      put(218, "Uacute");
-      put(219, "Ucirc");
-      put(220, "Uuml");
-      put(221, "Yacute");
-      put(222, "THORN");
-      put(223, "szlig");
-      put(224, "agrave");
-      put(225, "aacute");
-      put(226, "acirc");
-      put(227, "atilde");
-      put(228, "auml");
-      put(229, "aring");
-      put(230, "aelig");
-      put(231, "ccedil");
-      put(232, "egrave");
-      put(233, "eacute");
-      put(234, "ecirc");
-      put(235, "euml");
-      put(236, "igrave");
-      put(237, "iacute");
-      put(238, "icirc");
-      put(239, "iuml");
-      put(240, "eth");
-      put(241, "ntilde");
-      put(242, "ograve");
-      put(243, "oacute");
-      put(244, "ocirc");
-      put(245, "otilde");
-      put(246, "ouml");
-      put(247, "divide");
-      put(248, "oslash");
-      put(249, "ugrave");
-      put(250, "uacute");
-      put(251, "ucirc");
-      put(252, "uuml");
-      put(253, "yacute");
-      put(254, "thorn");
-      put(255, "yuml");
-      put(402, "fnof");
-      put(913, "Alpha");
-      put(914, "Beta");
-      put(915, "Gamma");
-      put(916, "Delta");
-      put(917, "Epsilon");
-      put(918, "Zeta");
-      put(919, "Eta");
-      put(920, "Theta");
-      put(921, "Iota");
-      put(922, "Kappa");
-      put(923, "Lambda");
-      put(924, "Mu");
-      put(925, "Nu");
-      put(926, "Xi");
-      put(927, "Omicron");
-      put(928, "Pi");
-      put(929, "Rho");
-      put(931, "Sigma");
-      put(932, "Tau");
-      put(933, "Upsilon");
-      put(934, "Phi");
-      put(935, "Chi");
-      put(936, "Psi");
-      put(937, "Omega");
-      put(945, "alpha");
-      put(946, "beta");
-      put(947, "gamma");
-      put(948, "delta");
-      put(949, "epsilon");
-      put(950, "zeta");
-      put(951, "eta");
-      put(952, "theta");
-      put(953, "iota");
-      put(954, "kappa");
-      put(955, "lambda");
-      put(956, "mu");
-      put(957, "nu");
-      put(958, "xi");
-      put(959, "omicron");
-      put(960, "pi");
-      put(961, "rho");
-      put(962, "sigmaf");
-      put(963, "sigma");
-      put(964, "tau");
-      put(965, "upsilon");
-      put(966, "phi");
-      put(967, "chi");
-      put(968, "psi");
-      put(969, "omega");
-      put(977, "thetasym");
-      put(978, "upsih");
-      put(982, "piv");
-      put(8226, "bull");
-      put(8230, "hellip");
-      put(8242, "prime");
-      put(8243, "Prime");
-      put(8254, "oline");
-      put(8260, "frasl");
-      put(8472, "weierp");
-      put(8465, "image");
-      put(8476, "real");
-      put(8482, "trade");
-      put(8501, "alefsym");
-      put(8592, "larr");
-      put(8593, "uarr");
-      put(8594, "rarr");
-      put(8595, "darr");
-      put(8596, "harr");
-      put(8629, "crarr");
-      put(8656, "lArr");
-      put(8657, "uArr");
-      put(8658, "rArr");
-      put(8659, "dArr");
-      put(8660, "hArr");
-      put(8704, "forall");
-      put(8706, "part");
-      put(8707, "exist");
-      put(8709, "empty");
-      put(8711, "nabla");
-      put(8712, "isin");
-      put(8713, "notin");
-      put(8715, "ni");
-      put(8719, "prod");
-      put(8721, "sum");
-      put(8722, "minus");
-      put(8727, "lowast");
-      put(8730, "radic");
-      put(8733, "prop");
-      put(8734, "infin");
-      put(8736, "ang");
-      put(8743, "and");
-      put(8744, "or");
-      put(8745, "cap");
-      put(8746, "cup");
-      put(8747, "int");
-      put(8756, "there4");
-      put(8764, "sim");
-      put(8773, "cong");
-      put(8776, "asymp");
-      put(8800, "ne");
-      put(8801, "equiv");
-      put(8804, "le");
-      put(8805, "ge");
-      put(8834, "sub");
-      put(8835, "sup");
-      put(8836, "nsub");
-      put(8838, "sube");
-      put(8839, "supe");
-      put(8853, "oplus");
-      put(8855, "otimes");
-      put(8869, "perp");
-      put(8901, "sdot");
-      put(8968, "lceil");
-      put(8969, "rceil");
-      put(8970, "lfloor");
-      put(8971, "rfloor");
-      put(9001, "lang");
-      put(9002, "rang");
-      put(9674, "loz");
-      put(9824, "spades");
-      put(9827, "clubs");
-      put(9829, "hearts");
-      put(9830, "diams");
-      put(34, "quot");
-      put(38, "amp");
-      put(60, "lt");
-      put(62, "gt");
-      put(338, "OElig");
-      put(339, "oelig");
-      put(352, "Scaron");
-      put(353, "scaron");
-      put(376, "Yuml");
-      put(710, "circ");
-      put(732, "tilde");
-      put(8194, "ensp");
-      put(8195, "emsp");
-      put(8201, "thinsp");
-      put(8204, "zwnj");
-      put(8205, "zwj");
-      put(8206, "lrm");
-      put(8207, "rlm");
-      put(8211, "ndash");
-      put(8212, "mdash");
-      put(8216, "lsquo");
-      put(8217, "rsquo");
-      put(8218, "sbquo");
-      put(8220, "ldquo");
-      put(8221, "rdquo");
-      put(8222, "bdquo");
-      put(8224, "dagger");
-      put(8225, "Dagger");
-      put(8240, "permil");
-      put(8249, "lsaquo");
-      put(8250, "rsaquo");
-      put(8364, "euro");
-   }
-
-   protected final void put(int c, String entity)
-   {
-      charToEntity[c] = entity;
-   }
-
-   protected final void remove(int c)
-   {
-      charToEntity[c] = null;
-   }
-
-   /** Returns null if no entity is found or return the converted entity. */
-   public final String lookup(char c)
-   {
-      return charToEntity[c];
-   }
-
-   public final String convertEntities(String txt)
-   {
-      // Get the chars it's faster
-      char[] chars = txt.toCharArray();
-
-      // The new result if any
-      StringBuffer result = null;
-
-      // The index of the last copied char
-      int previous = 0;
-
-      // Perform lookup char by char
-      for (int current = 0; current < chars.length; current++)
-      {
-         // Lookup
-         String replacement = lookup(chars[current]);
-
-         // Do we have a replacement
-         if (replacement != null)
-         {
-            // We lazy create the result
-            if (result == null)
-            {
-               // Allocate 1/2 more than the current txt size
-               result = new StringBuffer(txt.length() * 3 / 2);
-            }
-            // Append the previous chars if any
-            result.append(chars, previous, current - previous);
-            // Append the replaced entity
-            result.append('&').append(replacement).append(';');
-            // Update the previous pointer
-            previous = current + 1;
-         }
-      }
-
-      // If we have a result we need to complete it
-      if (result != null)
-      {
-         result.append(chars, previous, chars.length - previous);
-         return result.toString();
-      }
-      else
-      {
-         return txt;
-      }
-   }
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/EntityTable.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/util/EntityTable.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/EntityTable.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/EntityTable.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,366 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.util;
+
+/** This table provides lookup for converting a char to its HTML entity representation. */
+public class EntityTable
+{
+
+   /** All HTML entities. */
+   public static final EntityTable FULL = new EntityTable();
+
+   /** All HTML entities except the HTML chars which are used to do HTML itself. */
+   public static final EntityTable BASIC = new BasicEntityTable();
+
+   private static class BasicEntityTable extends EntityTable
+   {
+      public BasicEntityTable()
+      {
+         remove('<');
+         remove('>');
+         remove('"');
+         remove('&');
+      }
+   }
+
+   private String[] charToEntity = new String[65536];
+
+   protected EntityTable()
+   {
+      put(160, "nbsp");
+      put(161, "iexcl");
+      put(162, "cent");
+      put(163, "pound");
+      put(164, "curren");
+      put(165, "yen");
+      put(166, "brvbar");
+      put(167, "sect");
+      put(168, "uml");
+      put(169, "copy");
+      put(170, "ordf");
+      put(171, "laquo");
+      put(172, "not");
+      put(173, "shy");
+      put(174, "reg");
+      put(175, "macr");
+      put(176, "deg");
+      put(177, "plusmn");
+      put(178, "sup2");
+      put(179, "sup3");
+      put(180, "acute");
+      put(181, "micro");
+      put(182, "para");
+      put(183, "middot");
+      put(184, "cedil");
+      put(185, "sup1");
+      put(186, "ordm");
+      put(187, "raquo");
+      put(188, "frac14");
+      put(189, "frac12");
+      put(190, "frac34");
+      put(191, "iquest");
+      put(192, "Agrave");
+      put(193, "Aacute");
+      put(194, "Acirc");
+      put(195, "Atilde");
+      put(196, "Auml");
+      put(197, "Aring");
+      put(198, "AElig");
+      put(199, "Ccedil");
+      put(200, "Egrave");
+      put(201, "Eacute");
+      put(202, "Ecirc");
+      put(203, "Euml");
+      put(204, "Igrave");
+      put(205, "Iacute");
+      put(206, "Icirc");
+      put(207, "Iuml");
+      put(208, "ETH");
+      put(209, "Ntilde");
+      put(210, "Ograve");
+      put(211, "Oacute");
+      put(212, "Ocirc");
+      put(213, "Otilde");
+      put(214, "Ouml");
+      put(215, "times");
+      put(216, "Oslash");
+      put(217, "Ugrave");
+      put(218, "Uacute");
+      put(219, "Ucirc");
+      put(220, "Uuml");
+      put(221, "Yacute");
+      put(222, "THORN");
+      put(223, "szlig");
+      put(224, "agrave");
+      put(225, "aacute");
+      put(226, "acirc");
+      put(227, "atilde");
+      put(228, "auml");
+      put(229, "aring");
+      put(230, "aelig");
+      put(231, "ccedil");
+      put(232, "egrave");
+      put(233, "eacute");
+      put(234, "ecirc");
+      put(235, "euml");
+      put(236, "igrave");
+      put(237, "iacute");
+      put(238, "icirc");
+      put(239, "iuml");
+      put(240, "eth");
+      put(241, "ntilde");
+      put(242, "ograve");
+      put(243, "oacute");
+      put(244, "ocirc");
+      put(245, "otilde");
+      put(246, "ouml");
+      put(247, "divide");
+      put(248, "oslash");
+      put(249, "ugrave");
+      put(250, "uacute");
+      put(251, "ucirc");
+      put(252, "uuml");
+      put(253, "yacute");
+      put(254, "thorn");
+      put(255, "yuml");
+      put(402, "fnof");
+      put(913, "Alpha");
+      put(914, "Beta");
+      put(915, "Gamma");
+      put(916, "Delta");
+      put(917, "Epsilon");
+      put(918, "Zeta");
+      put(919, "Eta");
+      put(920, "Theta");
+      put(921, "Iota");
+      put(922, "Kappa");
+      put(923, "Lambda");
+      put(924, "Mu");
+      put(925, "Nu");
+      put(926, "Xi");
+      put(927, "Omicron");
+      put(928, "Pi");
+      put(929, "Rho");
+      put(931, "Sigma");
+      put(932, "Tau");
+      put(933, "Upsilon");
+      put(934, "Phi");
+      put(935, "Chi");
+      put(936, "Psi");
+      put(937, "Omega");
+      put(945, "alpha");
+      put(946, "beta");
+      put(947, "gamma");
+      put(948, "delta");
+      put(949, "epsilon");
+      put(950, "zeta");
+      put(951, "eta");
+      put(952, "theta");
+      put(953, "iota");
+      put(954, "kappa");
+      put(955, "lambda");
+      put(956, "mu");
+      put(957, "nu");
+      put(958, "xi");
+      put(959, "omicron");
+      put(960, "pi");
+      put(961, "rho");
+      put(962, "sigmaf");
+      put(963, "sigma");
+      put(964, "tau");
+      put(965, "upsilon");
+      put(966, "phi");
+      put(967, "chi");
+      put(968, "psi");
+      put(969, "omega");
+      put(977, "thetasym");
+      put(978, "upsih");
+      put(982, "piv");
+      put(8226, "bull");
+      put(8230, "hellip");
+      put(8242, "prime");
+      put(8243, "Prime");
+      put(8254, "oline");
+      put(8260, "frasl");
+      put(8472, "weierp");
+      put(8465, "image");
+      put(8476, "real");
+      put(8482, "trade");
+      put(8501, "alefsym");
+      put(8592, "larr");
+      put(8593, "uarr");
+      put(8594, "rarr");
+      put(8595, "darr");
+      put(8596, "harr");
+      put(8629, "crarr");
+      put(8656, "lArr");
+      put(8657, "uArr");
+      put(8658, "rArr");
+      put(8659, "dArr");
+      put(8660, "hArr");
+      put(8704, "forall");
+      put(8706, "part");
+      put(8707, "exist");
+      put(8709, "empty");
+      put(8711, "nabla");
+      put(8712, "isin");
+      put(8713, "notin");
+      put(8715, "ni");
+      put(8719, "prod");
+      put(8721, "sum");
+      put(8722, "minus");
+      put(8727, "lowast");
+      put(8730, "radic");
+      put(8733, "prop");
+      put(8734, "infin");
+      put(8736, "ang");
+      put(8743, "and");
+      put(8744, "or");
+      put(8745, "cap");
+      put(8746, "cup");
+      put(8747, "int");
+      put(8756, "there4");
+      put(8764, "sim");
+      put(8773, "cong");
+      put(8776, "asymp");
+      put(8800, "ne");
+      put(8801, "equiv");
+      put(8804, "le");
+      put(8805, "ge");
+      put(8834, "sub");
+      put(8835, "sup");
+      put(8836, "nsub");
+      put(8838, "sube");
+      put(8839, "supe");
+      put(8853, "oplus");
+      put(8855, "otimes");
+      put(8869, "perp");
+      put(8901, "sdot");
+      put(8968, "lceil");
+      put(8969, "rceil");
+      put(8970, "lfloor");
+      put(8971, "rfloor");
+      put(9001, "lang");
+      put(9002, "rang");
+      put(9674, "loz");
+      put(9824, "spades");
+      put(9827, "clubs");
+      put(9829, "hearts");
+      put(9830, "diams");
+      put(34, "quot");
+      put(38, "amp");
+      put(60, "lt");
+      put(62, "gt");
+      put(338, "OElig");
+      put(339, "oelig");
+      put(352, "Scaron");
+      put(353, "scaron");
+      put(376, "Yuml");
+      put(710, "circ");
+      put(732, "tilde");
+      put(8194, "ensp");
+      put(8195, "emsp");
+      put(8201, "thinsp");
+      put(8204, "zwnj");
+      put(8205, "zwj");
+      put(8206, "lrm");
+      put(8207, "rlm");
+      put(8211, "ndash");
+      put(8212, "mdash");
+      put(8216, "lsquo");
+      put(8217, "rsquo");
+      put(8218, "sbquo");
+      put(8220, "ldquo");
+      put(8221, "rdquo");
+      put(8222, "bdquo");
+      put(8224, "dagger");
+      put(8225, "Dagger");
+      put(8240, "permil");
+      put(8249, "lsaquo");
+      put(8250, "rsaquo");
+      put(8364, "euro");
+   }
+
+   protected final void put(int c, String entity)
+   {
+      charToEntity[c] = entity;
+   }
+
+   protected final void remove(int c)
+   {
+      charToEntity[c] = null;
+   }
+
+   /** Returns null if no entity is found or return the converted entity. */
+   public final String lookup(char c)
+   {
+      return charToEntity[c];
+   }
+
+   public final String convertEntities(String txt)
+   {
+      // Get the chars it's faster
+      char[] chars = txt.toCharArray();
+
+      // The new result if any
+      StringBuffer result = null;
+
+      // The index of the last copied char
+      int previous = 0;
+
+      // Perform lookup char by char
+      for (int current = 0; current < chars.length; current++)
+      {
+         // Lookup
+         String replacement = lookup(chars[current]);
+
+         // Do we have a replacement
+         if (replacement != null)
+         {
+            // We lazy create the result
+            if (result == null)
+            {
+               // Allocate 1/2 more than the current txt size
+               result = new StringBuffer(txt.length() * 3 / 2);
+            }
+            // Append the previous chars if any
+            result.append(chars, previous, current - previous);
+            // Append the replaced entity
+            result.append('&').append(replacement).append(';');
+            // Update the previous pointer
+            previous = current + 1;
+         }
+      }
+
+      // If we have a result we need to complete it
+      if (result != null)
+      {
+         result.append(chars, previous, chars.length - previous);
+         return result.toString();
+      }
+      else
+      {
+         return txt;
+      }
+   }
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/Loader.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/util/Loader.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/Loader.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,41 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.util;
-
-import java.io.InputStream;
-
-/**
- * A generic interface which define loading capabilities. The name format must follow the regular expression :
- * ^(/[-a-zA-Z0-9_\.]+)+$
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public interface Loader
-{
-
-   String NAME_VALIDATOR = "^(/[-a-zA-Z0-9_\\.]+)+$";
-
-   /** Returns an InputStream or null if not found. */
-   InputStream load(String path);
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/Loader.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/util/Loader.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/Loader.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/Loader.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,41 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.util;
+
+import java.io.InputStream;
+
+/**
+ * A generic interface which define loading capabilities. The name format must follow the regular expression :
+ * ^(/[-a-zA-Z0-9_\.]+)+$
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public interface Loader
+{
+
+   String NAME_VALIDATOR = "^(/[-a-zA-Z0-9_\\.]+)+$";
+
+   /** Returns an InputStream or null if not found. */
+   InputStream load(String path);
+}

Deleted: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/Stack.java
===================================================================
--- labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/util/Stack.java	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/Stack.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,161 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat                                               *
- * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
- * contributors as indicated by the @authors tag. See the                     *
- * copyright.txt in the distribution for a full listing of                    *
- * individual contributors.                                                   *
- *                                                                            *
- * This is free software; you can redistribute it and/or modify it            *
- * under the terms of the GNU Lesser General Public License as                *
- * published by the Free Software Foundation; either version 2.1 of           *
- * the License, or (at your option) any later version.                        *
- *                                                                            *
- * This software is distributed in the hope that it will be useful,           *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
- * Lesser General Public License for more details.                            *
- *                                                                            *
- * You should have received a copy of the GNU Lesser General Public           *
- * License along with this software; if not, write to the Free                *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
- ******************************************************************************/
-package org.jboss.portlet.forums.format.util;
-
-import java.util.Collections;
-import java.util.Iterator;
-
-/**
- * The goal of this class is to ensure that any event with open/close well formdness semantics are respected.
- * <p/>
- * This class maintain a stack of keys.
- * <p/>
- * To be operational this class must be subclassed to provide semantics that the user wants to give to the key
- * identities.
- *
- * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 5448 $
- */
-public abstract class Stack
-{
-
-   /** The stack pointer which always points the first available element. */
-   protected int ptr = 0;
-
-   /** The stack holder. */
-   protected Key[] stack;
-
-   /** The reusable iterator. */
-   private KeyIterator iterator = new KeyIterator();
-
-   /** Create a new stack with a specified depth. */
-   public Stack(int initalCapacity)
-   {
-      this.stack = new Key[initalCapacity];
-      for (int i = 0; i < stack.length; i++)
-      {
-         this.stack[i] = createKey();
-      }
-   }
-
-   /** Reset the stack state. */
-   public final void reset()
-   {
-      ptr = 0;
-   }
-
-   /** Push a key on the stack. */
-   public final Key push()
-   {
-      if (ptr == stack.length)
-      {
-         enlarge();
-      }
-      return stack[ptr++];
-   }
-
-   /** Peek a key on the stack. */
-   public Key peek(int level)
-   {
-      level = ptr - 1 - level;
-      return level >= 0 ? stack[level] : null;
-   }
-
-   /** Pop keys until it finds the good one. */
-   public final Iterator pop(Key candidate)
-   {
-      if (ptr > 0)
-      {
-         iterator.from = ptr - 1;
-         for (Key key = stack[--ptr]; !equals(candidate, key) && ptr >= 1; key = stack[--ptr])
-         {
-            ;
-         }
-         iterator.to = ptr - 1;
-         return iterator;
-      }
-      else
-      {
-         // This is a warn because it is not possible to pop with empty stack
-         return Collections.EMPTY_LIST.iterator();
-      }
-   }
-
-   /** The implementation must provide a reusable key. */
-   protected abstract Key createKey();
-
-   /** The implementation must test keys equality. */
-   protected abstract boolean equals(Key key1, Key key2);
-
-   /** Enlarge the key stack. For now it simply add 3 keys to the actual length */
-   protected void enlarge()
-   {
-      Key[] tmp = new Key[stack.length + 3];
-      System.arraycopy(stack, 0, tmp, 0, stack.length);
-      for (int i = stack.length; i < tmp.length; i++)
-      {
-         tmp[i] = createKey();
-      }
-      stack = tmp;
-   }
-
-   /** Iterates over the poped keys. */
-   public class KeyIterator implements Iterator
-   {
-      private int from;
-      private int to;
-
-      public boolean hasNext()
-      {
-         return from > to;
-      }
-
-      public Object next()
-      {
-         return stack[from--];
-      }
-
-      public void remove()
-      {
-         throw new UnsupportedOperationException();
-      }
-   }
-
-   /** A key for the stack. */
-   public interface Key
-   {
-   }
-
-   public String toString()
-   {
-      StringBuffer buffer = new StringBuffer();
-      buffer.append("[stack[");
-      for (int i = 0; i < ptr; i++)
-      {
-         Stack.Key key = stack[i];
-         buffer.append(i == 0 ? "" : ",").append(key);
-      }
-      buffer.append("]]");
-      return buffer.toString();
-   }
-}

Copied: labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/Stack.java (from rev 16781, labs/jbossforums/branches/forums101P26/forums/src/main/org/jboss/portlet/forums/format/util/Stack.java)
===================================================================
--- labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/Stack.java	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/forums/src/main/org/jboss/portlet/forums/format/util/Stack.java	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,161 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat                                               *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual                    *
+ * contributors as indicated by the @authors tag. See the                     *
+ * copyright.txt in the distribution for a full listing of                    *
+ * individual contributors.                                                   *
+ *                                                                            *
+ * This is free software; you can redistribute it and/or modify it            *
+ * under the terms of the GNU Lesser General Public License as                *
+ * published by the Free Software Foundation; either version 2.1 of           *
+ * the License, or (at your option) any later version.                        *
+ *                                                                            *
+ * This software is distributed in the hope that it will be useful,           *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU           *
+ * Lesser General Public License for more details.                            *
+ *                                                                            *
+ * You should have received a copy of the GNU Lesser General Public           *
+ * License along with this software; if not, write to the Free                *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA         *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.                   *
+ ******************************************************************************/
+package org.jboss.portlet.forums.format.util;
+
+import java.util.Collections;
+import java.util.Iterator;
+
+/**
+ * The goal of this class is to ensure that any event with open/close well formdness semantics are respected.
+ * <p/>
+ * This class maintain a stack of keys.
+ * <p/>
+ * To be operational this class must be subclassed to provide semantics that the user wants to give to the key
+ * identities.
+ *
+ * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
+ * @version $Revision: 5448 $
+ */
+public abstract class Stack
+{
+
+   /** The stack pointer which always points the first available element. */
+   protected int ptr = 0;
+
+   /** The stack holder. */
+   protected Key[] stack;
+
+   /** The reusable iterator. */
+   private KeyIterator iterator = new KeyIterator();
+
+   /** Create a new stack with a specified depth. */
+   public Stack(int initalCapacity)
+   {
+      this.stack = new Key[initalCapacity];
+      for (int i = 0; i < stack.length; i++)
+      {
+         this.stack[i] = createKey();
+      }
+   }
+
+   /** Reset the stack state. */
+   public final void reset()
+   {
+      ptr = 0;
+   }
+
+   /** Push a key on the stack. */
+   public final Key push()
+   {
+      if (ptr == stack.length)
+      {
+         enlarge();
+      }
+      return stack[ptr++];
+   }
+
+   /** Peek a key on the stack. */
+   public Key peek(int level)
+   {
+      level = ptr - 1 - level;
+      return level >= 0 ? stack[level] : null;
+   }
+
+   /** Pop keys until it finds the good one. */
+   public final Iterator pop(Key candidate)
+   {
+      if (ptr > 0)
+      {
+         iterator.from = ptr - 1;
+         for (Key key = stack[--ptr]; !equals(candidate, key) && ptr >= 1; key = stack[--ptr])
+         {
+            ;
+         }
+         iterator.to = ptr - 1;
+         return iterator;
+      }
+      else
+      {
+         // This is a warn because it is not possible to pop with empty stack
+         return Collections.EMPTY_LIST.iterator();
+      }
+   }
+
+   /** The implementation must provide a reusable key. */
+   protected abstract Key createKey();
+
+   /** The implementation must test keys equality. */
+   protected abstract boolean equals(Key key1, Key key2);
+
+   /** Enlarge the key stack. For now it simply add 3 keys to the actual length */
+   protected void enlarge()
+   {
+      Key[] tmp = new Key[stack.length + 3];
+      System.arraycopy(stack, 0, tmp, 0, stack.length);
+      for (int i = stack.length; i < tmp.length; i++)
+      {
+         tmp[i] = createKey();
+      }
+      stack = tmp;
+   }
+
+   /** Iterates over the poped keys. */
+   public class KeyIterator implements Iterator
+   {
+      private int from;
+      private int to;
+
+      public boolean hasNext()
+      {
+         return from > to;
+      }
+
+      public Object next()
+      {
+         return stack[from--];
+      }
+
+      public void remove()
+      {
+         throw new UnsupportedOperationException();
+      }
+   }
+
+   /** A key for the stack. */
+   public interface Key
+   {
+   }
+
+   public String toString()
+   {
+      StringBuffer buffer = new StringBuffer();
+      buffer.append("[stack[");
+      for (int i = 0; i < ptr; i++)
+      {
+         Stack.Key key = stack[i];
+         buffer.append(i == 0 ? "" : ",").append(key);
+      }
+      buffer.append("]]");
+      return buffer.toString();
+   }
+}

Copied: labs/jbossforums/branches/forums101P24/thirdparty/dom4j (from rev 16781, labs/jbossforums/branches/forums101P26/thirdparty/dom4j)

Deleted: labs/jbossforums/branches/forums101P24/thirdparty/dom4j/component-info.xml
===================================================================
--- labs/jbossforums/branches/forums101P26/thirdparty/dom4j/component-info.xml	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/thirdparty/dom4j/component-info.xml	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,19 +0,0 @@
-<project name="dom4j-component-info">
-
-   <!-- ============================================================ -->
-   <!-- DOM4J                                                        -->
-   <!-- ============================================================ -->
-
-   <component id="dom4j"
-              licenseType="dom4j"
-              version="1.6.1jboss"
-              projectHome="http://dom4j.org/"
-              description="Library for XML, XPath and XSLT on the Java platform">
-      <artifact id="dom4j.jar"/>
-      <export>
-         <include input="dom4j.jar"/>
-      </export>
-   </component>
-
-
-</project>

Copied: labs/jbossforums/branches/forums101P24/thirdparty/dom4j/component-info.xml (from rev 16781, labs/jbossforums/branches/forums101P26/thirdparty/dom4j/component-info.xml)
===================================================================
--- labs/jbossforums/branches/forums101P24/thirdparty/dom4j/component-info.xml	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/thirdparty/dom4j/component-info.xml	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,19 @@
+<project name="dom4j-component-info">
+
+   <!-- ============================================================ -->
+   <!-- DOM4J                                                        -->
+   <!-- ============================================================ -->
+
+   <component id="dom4j"
+              licenseType="dom4j"
+              version="1.6.1jboss"
+              projectHome="http://dom4j.org/"
+              description="Library for XML, XPath and XSLT on the Java platform">
+      <artifact id="dom4j.jar"/>
+      <export>
+         <include input="dom4j.jar"/>
+      </export>
+   </component>
+
+
+</project>

Copied: labs/jbossforums/branches/forums101P24/thirdparty/dom4j/lib (from rev 16781, labs/jbossforums/branches/forums101P26/thirdparty/dom4j/lib)

Deleted: labs/jbossforums/branches/forums101P24/thirdparty/dom4j/lib/dom4j.jar
===================================================================
(Binary files differ)

Copied: labs/jbossforums/branches/forums101P24/thirdparty/dom4j/lib/dom4j.jar (from rev 16781, labs/jbossforums/branches/forums101P26/thirdparty/dom4j/lib/dom4j.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossforums/branches/forums101P24/thirdparty/javassist (from rev 16781, labs/jbossforums/branches/forums101P26/thirdparty/javassist)

Deleted: labs/jbossforums/branches/forums101P24/thirdparty/javassist/component-info.xml
===================================================================
--- labs/jbossforums/branches/forums101P26/thirdparty/javassist/component-info.xml	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/thirdparty/javassist/component-info.xml	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,18 +0,0 @@
-<project name="javassist-component-info">
-   <!-- ============================================================ -->
-   <!-- Javassist                                                    -->
-   <!-- ============================================================ -->
-
-   <component id="javassist"
-              licenseType="lgpl"
-              version="3.3.0.GA"
-              projectHome="http://sourceforge.net/projects/jboss"
-              description="Simple Java bytecode manipulation (cvstag Javassist_3_3_GA)">
-      <artifact id="javassist.jar"/>
-      <export>
-         <include input="javassist.jar"/>
-      </export>
-   </component>
-
-
-</project>

Copied: labs/jbossforums/branches/forums101P24/thirdparty/javassist/component-info.xml (from rev 16781, labs/jbossforums/branches/forums101P26/thirdparty/javassist/component-info.xml)
===================================================================
--- labs/jbossforums/branches/forums101P24/thirdparty/javassist/component-info.xml	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/thirdparty/javassist/component-info.xml	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,18 @@
+<project name="javassist-component-info">
+   <!-- ============================================================ -->
+   <!-- Javassist                                                    -->
+   <!-- ============================================================ -->
+
+   <component id="javassist"
+              licenseType="lgpl"
+              version="3.3.0.GA"
+              projectHome="http://sourceforge.net/projects/jboss"
+              description="Simple Java bytecode manipulation (cvstag Javassist_3_3_GA)">
+      <artifact id="javassist.jar"/>
+      <export>
+         <include input="javassist.jar"/>
+      </export>
+   </component>
+
+
+</project>

Copied: labs/jbossforums/branches/forums101P24/thirdparty/javassist/lib (from rev 16781, labs/jbossforums/branches/forums101P26/thirdparty/javassist/lib)

Deleted: labs/jbossforums/branches/forums101P24/thirdparty/javassist/lib/javassist.jar
===================================================================
(Binary files differ)

Copied: labs/jbossforums/branches/forums101P24/thirdparty/javassist/lib/javassist.jar (from rev 16781, labs/jbossforums/branches/forums101P26/thirdparty/javassist/lib/javassist.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossforums/branches/forums101P24/thirdparty/jflex (from rev 16781, labs/jbossforums/branches/forums101P26/thirdparty/jflex)

Deleted: labs/jbossforums/branches/forums101P24/thirdparty/jflex/component-info.xml
===================================================================
--- labs/jbossforums/branches/forums101P26/thirdparty/jflex/component-info.xml	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/thirdparty/jflex/component-info.xml	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,14 +0,0 @@
-<project name="jflex-component-info">
-   <component id="jflex"
-              licenseType="gpl"
-              version="1.4.0"
-              projectHome="http://jflex.de/"
-              description="lexical analyzer generator">
-      <artifact id="jflex.jar"/>
-      
-      <export>
-         <include input="jflex.jar"/>         
-      </export>
-   </component>
-
-</project>
\ No newline at end of file

Copied: labs/jbossforums/branches/forums101P24/thirdparty/jflex/component-info.xml (from rev 16781, labs/jbossforums/branches/forums101P26/thirdparty/jflex/component-info.xml)
===================================================================
--- labs/jbossforums/branches/forums101P24/thirdparty/jflex/component-info.xml	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/thirdparty/jflex/component-info.xml	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,14 @@
+<project name="jflex-component-info">
+   <component id="jflex"
+              licenseType="gpl"
+              version="1.4.0"
+              projectHome="http://jflex.de/"
+              description="lexical analyzer generator">
+      <artifact id="jflex.jar"/>
+      
+      <export>
+         <include input="jflex.jar"/>         
+      </export>
+   </component>
+
+</project>
\ No newline at end of file

Copied: labs/jbossforums/branches/forums101P24/thirdparty/jflex/lib (from rev 16781, labs/jbossforums/branches/forums101P26/thirdparty/jflex/lib)

Deleted: labs/jbossforums/branches/forums101P24/thirdparty/jflex/lib/jflex.jar
===================================================================
(Binary files differ)

Copied: labs/jbossforums/branches/forums101P24/thirdparty/jflex/lib/jflex.jar (from rev 16781, labs/jbossforums/branches/forums101P26/thirdparty/jflex/lib/jflex.jar)
===================================================================
(Binary files differ)

Copied: labs/jbossforums/branches/forums101P24/thirdparty/sun-javacc (from rev 16781, labs/jbossforums/branches/forums101P26/thirdparty/sun-javacc)

Deleted: labs/jbossforums/branches/forums101P24/thirdparty/sun-javacc/component-info.xml
===================================================================
--- labs/jbossforums/branches/forums101P26/thirdparty/sun-javacc/component-info.xml	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/thirdparty/sun-javacc/component-info.xml	2007-11-24 23:20:48 UTC (rev 16782)
@@ -1,16 +0,0 @@
-<project name="sun-javacc-component-info">
-
-   <component id="sun-javacc"
-              version="3.2-portal"
-              licenseType="bsd"
-              projectHome="https://javacc.dev.java.net/"
-              description="JavaCC is a parser/scanner generator for java"
-   >
-      <artifact id="JavaCC.zip"/>
-      <export>
-         <include input="JavaCC.zip"/>
-      </export>
-   </component>
-
-</project>
-

Copied: labs/jbossforums/branches/forums101P24/thirdparty/sun-javacc/component-info.xml (from rev 16781, labs/jbossforums/branches/forums101P26/thirdparty/sun-javacc/component-info.xml)
===================================================================
--- labs/jbossforums/branches/forums101P24/thirdparty/sun-javacc/component-info.xml	                        (rev 0)
+++ labs/jbossforums/branches/forums101P24/thirdparty/sun-javacc/component-info.xml	2007-11-24 23:20:48 UTC (rev 16782)
@@ -0,0 +1,16 @@
+<project name="sun-javacc-component-info">
+
+   <component id="sun-javacc"
+              version="3.2-portal"
+              licenseType="bsd"
+              projectHome="https://javacc.dev.java.net/"
+              description="JavaCC is a parser/scanner generator for java"
+   >
+      <artifact id="JavaCC.zip"/>
+      <export>
+         <include input="JavaCC.zip"/>
+      </export>
+   </component>
+
+</project>
+

Copied: labs/jbossforums/branches/forums101P24/thirdparty/sun-javacc/lib (from rev 16781, labs/jbossforums/branches/forums101P26/thirdparty/sun-javacc/lib)

Deleted: labs/jbossforums/branches/forums101P24/thirdparty/sun-javacc/lib/JavaCC.zip
===================================================================
(Binary files differ)

Copied: labs/jbossforums/branches/forums101P24/thirdparty/sun-javacc/lib/JavaCC.zip (from rev 16781, labs/jbossforums/branches/forums101P26/thirdparty/sun-javacc/lib/JavaCC.zip)
===================================================================
(Binary files differ)

Modified: labs/jbossforums/branches/forums101P24/tools/etc/buildfragments/libraries.ent
===================================================================
--- labs/jbossforums/branches/forums101P24/tools/etc/buildfragments/libraries.ent	2007-11-24 23:17:38 UTC (rev 16781)
+++ labs/jbossforums/branches/forums101P24/tools/etc/buildfragments/libraries.ent	2007-11-24 23:20:48 UTC (rev 16782)
@@ -183,4 +183,29 @@
   <path id="jdom.classpath">
     <filelist dir="${jdom.lib}" files="jdom.jar"/>
   </path>
+  <!-- JFlex -->
+  <property name="jflex.jflex.root" value="${project.thirdparty}/jflex"/>
+  <property name="jflex.jflex.lib" value="${jflex.jflex.root}/lib"/>
+  <path id="jflex.jflex.classpath">
+    <pathelement path="${jflex.jflex.lib}/jflex.jar"/>
+  </path>
+
+  <!-- JavaCC -->
+  <property name="sun.javacc.root" value="${project.thirdparty}/sun-javacc"/>
+  <property name="sun.javacc.lib" value="${sun.javacc.root}/lib"/>
+
+  <!-- Javassist -->
+  <property name="jboss.javassist.root" value="${project.thirdparty}/javassist"/>
+  <property name="jboss.javassist.lib" value="${jboss.javassist.root}/lib"/>
+  <path id="jboss.javassist.classpath">
+    <pathelement path="${jboss.javassist.lib}/javassist.jar"/>
+  </path>
+
+  <!-- Dom4j -->
+  <property name="dom4j.dom4j.root" value="${project.thirdparty}/dom4j"/>
+  <property name="dom4j.dom4j.lib" value="${dom4j.dom4j.root}/lib"/>
+  <path id="dom4j.dom4j.classpath">
+    <pathelement path="${dom4j.dom4j.lib}/dom4j.jar"/>
+  </path>
+
 </target>




More information about the jboss-svn-commits mailing list