Update of /var/cvs/src/org/mmbase/util/transformers
In directory james.mmbase.org:/tmp/cvs-serv4007
Modified Files:
Tag: MMBase-1_8
ListParser.jj
Log Message:
ported from HEAD to suppport nested different list
See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/util/transformers
Index: ListParser.jj
===================================================================
RCS file: /var/cvs/src/org/mmbase/util/transformers/ListParser.jj,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -b -r1.2.2.1 -r1.2.2.2
--- ListParser.jj 17 Jun 2008 10:18:58 -0000 1.2.2.1
+++ ListParser.jj 24 Jul 2008 16:17:48 -0000 1.2.2.2
@@ -13,7 +13,7 @@
*
* @author Michiel Meeuwisssen
* @since MMBase-1.8.6
- * @version $Id: ListParser.jj,v 1.2.2.1 2008/06/17 10:18:58 michiel Exp $
+ * @version $Id: ListParser.jj,v 1.2.2.2 2008/07/24 16:17:48 michiel Exp $
*/
options {
@@ -51,8 +51,8 @@
int getDepth(Token t) {
return t.image.length() - (begin ? 1 : 2);
}
- char getType(Token t) {
- return t.image.charAt(begin ? 0 : 1) == '*' ? 'o' : 'u';
+ char getType(Token t, int depth) {
+ return t.image.charAt(depth - 1 + (begin ? 0 : 1)) == '*' ? 'o' : 'u';
}
void open(StringBuffer buf, char type) {
curDepth++;
@@ -68,7 +68,7 @@
}
void handleList(StringBuffer buf, Token t) {
int depth = getDepth(t);
- char type = getType(t);
+ char type = getType(t, depth);
if (depth == curDepth + 1) {
open(buf, type);
} else if (depth == curDepth - 1) {
@@ -93,13 +93,15 @@
PARSER_END(ListParser)
-TOKEN : { <BOL: "*" ("*")* (" ")> }
-TOKEN : { <BUL: "-" ("-")* (" ")> }
-TOKEN : { <OL: "\n*" ("*")* (" ")> }
-TOKEN : { <UL: "\n-" ("-")* (" ")> }
+
+TOKEN : { <BOL: "*" (["*","-"])* (" ")> }
+TOKEN : { <BUL: "-" (["*", "-"])* (" ")> }
+TOKEN : { <OL: "\n*" (["*", "-"])* (" ")> }
+TOKEN : { <UL: "\n-" (["*", "-"])* (" ")> }
TOKEN : { <END: ("\n")> }
TOKEN : { <OTHER : ~[] > }
+
void start(StringBuffer buf) :
{
Token t ;
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs