Author: michiel
Date: 2010-02-16 01:13:35 +0100 (Tue, 16 Feb 2010)
New Revision: 41058

Removed:
   mmbase/trunk/utils/src/main/java/org/mmbase/util/transformers/ListParser.jj
Log:
was already moved to src/main/javacc

Deleted: 
mmbase/trunk/utils/src/main/java/org/mmbase/util/transformers/ListParser.jj
===================================================================
--- mmbase/trunk/utils/src/main/java/org/mmbase/util/transformers/ListParser.jj 
2010-02-16 00:12:33 UTC (rev 41057)
+++ mmbase/trunk/utils/src/main/java/org/mmbase/util/transformers/ListParser.jj 
2010-02-16 00:13:35 UTC (rev 41058)
@@ -1,120 +0,0 @@
-/* -*- java -*-
-
-This software is OSI Certified Open Source Software.
-OSI Certified is a certification mark of the Open Source Initiative.
-
-The license (Mozilla version 1.0) can be read at the MMBase site.
-See http://www.MMBase.org/license
-
-*/
-/**
- * ListParser
- * This file is parsed by <a href="https://javacc.dev.java.net/";>javacc</a>.
- *
- * @author Michiel Meeuwisssen
- * @since MMBase-1.8.6
- * @version $Id: ListParser.jj,v 1.4 2008-07-08 15:54:46 michiel Exp $
- */
-
-options {
-    STATIC = false;
-    IGNORE_CASE = false;
-}
-
-PARSER_BEGIN(ListParser)
-
-package org.mmbase.util.transformers;
-import java.io.Reader ;
-import java.io.StringReader ;
-import java.util.*;
-import java.io.*;
-
-
-public class ListParser {
-    int curDepth = 0;
-    boolean begin = true;
-    LinkedList<Character> stack = new LinkedList<Character>();
-
-    static String transform( String inString ) {
-        Reader reader = new StringReader(inString) ;
-        ListParser parser = new ListParser(reader) ;
-        StringBuilder buffer = new StringBuilder() ;
-        try {
-            parser.start(buffer) ; }
-        catch( TokenMgrError e ) {
-            throw new IllegalStateException() ; }
-        catch( ParseException e ) {
-            throw new IllegalStateException() ; }
-        return buffer.toString() ;
-    }
-
-    int getDepth(Token t) {
-        return t.image.length() - (begin ? 1 : 2);
-    }
-    char getType(Token t, int depth) {
-        return t.image.charAt(depth - 1 +  (begin ? 0 : 1)) == '*' ? 'o' : 'u';
-    }
-    void open(StringBuilder buf, char type) {
-        curDepth++;
-        stack.addFirst(type);
-        if (! begin && curDepth == 1) buf.append('\n');
-        buf.append('<').append(type).append("l>");
-    }
-    void close(StringBuilder buf) {
-        curDepth--;
-        char t = stack.removeFirst();
-        buf.append("</li></").append(t).append("l>");
-        if (curDepth > 0) buf.append("</li>");
-    }
-    void handleList(StringBuilder buf, Token t) {
-        int depth = getDepth(t);
-        char type = getType(t, depth);
-        if (depth == curDepth + 1) {
-            open(buf, type);
-        } else if (depth == curDepth - 1) {
-            close(buf);
-        } else if (depth == curDepth) {
-            buf.append("</li>");
-        }
-        buf.append("<li>");
-    }
-    void endLists(StringBuilder buf) {
-        while (stack.size() > 0) {
-            close(buf);
-        }
-    }
-
-    public static void main(String argv[]) throws ParseException, 
InterruptedException {
-        System.out.println(ListParser.transform((argv[0])));
-    }
-
-
-}
-
-PARSER_END(ListParser)
-
-TOKEN : { <BOL: "*" (["*","-"])* (" ")> }
-TOKEN : { <BUL: "-" (["*", "-"])* (" ")> }
-TOKEN : { <OL: "\n*" (["*", "-"])* (" ")> }
-TOKEN : { <UL: "\n-" (["*", "-"])* (" ")> }
-TOKEN : { <END: ("\n")> }
-TOKEN : { <OTHER : ~[] > }
-
-void start(StringBuilder buf) :
-{
-  Token t ;
-}
-{
-
-   (
-    t = <OL>  {   begin = false; handleList(buf, t); }
-    | t = <UL>  { begin = false;  handleList(buf, t);   }
-    | t = <BOL> { if (begin) { handleList(buf, t); begin = false; } else { 
buf.append(t.image); }}
-    | t = <BUL> { if (begin) { handleList(buf, t); begin = false; } else { 
buf.append(t.image); }}
-    | <END> { if (begin) { buf.append("\n"); } else { endLists(buf); 
buf.append("\n"); } }
-    | (t = <OTHER>) { begin = false; buf.append(t.image); }
-   )*
-   <EOF> { endLists(buf); }
-}
-
-

_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to