Author: ebourg
Date: Mon Jun 22 12:59:47 2009
New Revision: 787228

URL: http://svn.apache.org/viewvc?rev=787228&view=rev
Log:
Updated the plist parser with JavaCC 4.1

Modified:
    
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/ParseException.java
    
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java
    
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListParser.java
    
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListParserConstants.java
    
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListParserTokenManager.java
    
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/SimpleCharStream.java
    
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/Token.java
    
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/TokenMgrError.java

Modified: 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/ParseException.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/ParseException.java?rev=787228&r1=787227&r2=787228&view=diff
==============================================================================
--- 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/ParseException.java
 (original)
+++ 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/ParseException.java
 Mon Jun 22 12:59:47 2009
@@ -1,4 +1,5 @@
-/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 
*/
+/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 4.1 
*/
+/* JavaCCOptions:KEEP_LINE_COL=null */
 package org.apache.commons.configuration2.plist;
 
 /**
@@ -51,6 +52,7 @@
     specialConstructor = false;
   }
 
+  /** Constructor with message. */
   public ParseException(String message) {
     super(message);
     specialConstructor = false;
@@ -105,7 +107,7 @@
         maxSize = expectedTokenSequences[i].length;
       }
       for (int j = 0; j < expectedTokenSequences[i].length; j++) {
-        expected.append(tokenImage[expectedTokenSequences[i][j]]).append(" ");
+        expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' ');
       }
       if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 
0) {
         expected.append("...");
@@ -120,8 +122,11 @@
         retval += tokenImage[0];
         break;
       }
+      retval += " " + tokenImage[tok.kind];
+      retval += " \"";
       retval += add_escapes(tok.image);
-      tok = tok.next; 
+      retval += " \"";
+      tok = tok.next;
     }
     retval += "\" at line " + currentToken.next.beginLine + ", column " + 
currentToken.next.beginColumn;
     retval += "." + eol;
@@ -190,3 +195,4 @@
    }
 
 }
+/* JavaCC - OriginalChecksum=00038c13799d342a07e557a91aa7b71a (do not edit 
this line) */

Modified: 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java?rev=787228&r1=787227&r2=787228&view=diff
==============================================================================
--- 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java
 (original)
+++ 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListConfiguration.java
 Mon Jun 22 12:59:47 2009
@@ -48,7 +48,7 @@
  * References:
  * <ul>
  *   <li><a
- * 
href="http://developer.apple.com/documentation/Cocoa/Conceptual/PropertyLists/OldStylePlists/OldStylePLists.html#//apple_ref/doc/uid/20001012-BBCBDBJE";>
+ * 
href="http://developer.apple.com/documentation/Cocoa/Conceptual/PropertyLists/OldStylePlists/OldStylePLists.html";>
  * Apple Documentation - Old-Style ASCII Property Lists</a></li>
  *   <li><a
  * 
href="http://www.gnustep.org/resources/documentation/Developer/Base/Reference/NSPropertyList.html";>

Modified: 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListParser.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListParser.java?rev=787228&r1=787227&r2=787228&view=diff
==============================================================================
--- 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListParser.java
 (original)
+++ 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListParser.java
 Mon Jun 22 12:59:47 2009
@@ -261,74 +261,34 @@
     throw new Error("Missing return statement in function");
   }
 
-  final private boolean jj_2_1(int xla) {
+  private boolean jj_2_1(int xla) {
     jj_la = xla; jj_lastpos = jj_scanpos = token;
     try { return !jj_3_1(); }
     catch(LookaheadSuccess ls) { return true; }
     finally { jj_save(0, xla); }
   }
 
-  final private boolean jj_3R_14() {
-    if (jj_scan_token(QUOTED_STRING)) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_11() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_14()) {
-    jj_scanpos = xsp;
-    if (jj_3R_15()) return true;
-    }
-    return false;
-  }
-
-  final private boolean jj_3R_13() {
-    if (jj_scan_token(DATE)) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_10() {
-    if (jj_scan_token(DICT_BEGIN)) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_9() {
-    if (jj_3R_13()) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_8() {
-    if (jj_3R_12()) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_12() {
-    if (jj_scan_token(DATA)) return true;
-    return false;
-  }
-
-  final private boolean jj_3R_7() {
+  private boolean jj_3R_7() {
     if (jj_3R_11()) return true;
     return false;
   }
 
-  final private boolean jj_3R_4() {
+  private boolean jj_3R_4() {
     if (jj_3R_5()) return true;
     return false;
   }
 
-  final private boolean jj_3R_6() {
+  private boolean jj_3R_6() {
     if (jj_3R_10()) return true;
     return false;
   }
 
-  final private boolean jj_3R_15() {
+  private boolean jj_3R_15() {
     if (jj_scan_token(STRING)) return true;
     return false;
   }
 
-  final private boolean jj_3R_3() {
+  private boolean jj_3R_3() {
     if (jj_scan_token(ARRAY_BEGIN)) return true;
     Token xsp;
     xsp = jj_scanpos;
@@ -337,12 +297,11 @@
     return false;
   }
 
-  final private boolean jj_3_1() {
-    if (jj_3R_3()) return true;
-    return false;
+  private boolean jj_3_1() {
+    return jj_3R_3();
   }
 
-  final private boolean jj_3R_5() {
+  private boolean jj_3R_5() {
     Token xsp;
     xsp = jj_scanpos;
     if (jj_3_1()) {
@@ -361,47 +320,64 @@
     return false;
   }
 
+  private boolean jj_3R_14() {
+    return jj_scan_token(QUOTED_STRING);
+  }
+
+  private boolean jj_3R_11() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_14()) {
+    jj_scanpos = xsp;
+    if (jj_3R_15()) return true;
+    }
+    return false;
+  }
+
+  private boolean jj_3R_13() {
+    return jj_scan_token(DATE);
+  }
+
+  private boolean jj_3R_10() {
+    return jj_scan_token(DICT_BEGIN);
+  }
+
+  private boolean jj_3R_9() {
+    return jj_3R_13();
+  }
+
+  private boolean jj_3R_8() {
+    return jj_3R_12();
+  }
+
+  private boolean jj_3R_12() {
+    return jj_scan_token(DATA);
+  }
+
+  /** Generated Token Manager. */
   public PropertyListParserTokenManager token_source;
   SimpleCharStream jj_input_stream;
-  public Token token, jj_nt;
+  /** Current token. */
+  public Token token;
+  /** Next token. */
+  public Token jj_nt;
   private int jj_ntk;
   private Token jj_scanpos, jj_lastpos;
   private int jj_la;
-  public boolean lookingAhead = false;
-  private boolean jj_semLA;
   private int jj_gen;
   final private int[] jj_la1 = new int[6];
   static private int[] jj_la1_0;
   static {
-      jj_la1_0();
+      jj_la1_init_0();
    }
-   private static void jj_la1_0() {
+   private static void jj_la1_init_0() {
       jj_la1_0 = new int[] {0x600000,0x400,0x780100,0x80,0x780120,0x600000,};
    }
   final private JJCalls[] jj_2_rtns = new JJCalls[1];
   private boolean jj_rescan = false;
   private int jj_gc = 0;
 
-    public PropertyListParser(java.io.InputStream stream, String encoding) {
-    try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } 
catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
-    token_source = new PropertyListParserTokenManager(jj_input_stream);
-    token = new Token();
-    jj_ntk = -1;
-    jj_gen = 0;
-    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
-    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
-  }
-
-    public void ReInit(java.io.InputStream stream, String encoding) {
-    try { jj_input_stream.ReInit(stream, encoding, 1, 1); } 
catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
-    token_source.ReInit(jj_input_stream);
-    token = new Token();
-    jj_ntk = -1;
-    jj_gen = 0;
-    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
-    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
-  }
-
+    /** Constructor. */
   public PropertyListParser(java.io.Reader stream) {
     jj_input_stream = new SimpleCharStream(stream, 1, 1);
     token_source = new PropertyListParserTokenManager(jj_input_stream);
@@ -412,35 +388,7 @@
     for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
   }
 
-  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 < 6; i++) jj_la1[i] = -1;
-    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
-  }
-
-  public PropertyListParser(PropertyListParserTokenManager tm) {
-    token_source = tm;
-    token = new Token();
-    jj_ntk = -1;
-    jj_gen = 0;
-    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
-    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
-  }
-
-  public void ReInit(PropertyListParserTokenManager tm) {
-    token_source = tm;
-    token = new Token();
-    jj_ntk = -1;
-    jj_gen = 0;
-    for (int i = 0; i < 6; i++) jj_la1[i] = -1;
-    for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
-  }
-
-  final private Token jj_consume_token(int kind) throws ParseException {
+    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();
@@ -466,7 +414,7 @@
 
   static private final class LookaheadSuccess extends java.lang.Error { }
   final private LookaheadSuccess jj_ls = new LookaheadSuccess();
-  final private boolean jj_scan_token(int kind) {
+  private boolean jj_scan_token(int kind) {
     if (jj_scanpos == jj_lastpos) {
       jj_la--;
       if (jj_scanpos.next == null) {
@@ -487,31 +435,14 @@
     return false;
   }
 
-  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 = lookingAhead ? jj_scanpos : 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() {
+    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 java.util.List jj_expentries = new java.util.ArrayList();
   private int[] jj_expentry;
   private int jj_kind = -1;
   private int[] jj_lasttokens = new int[100];
@@ -526,31 +457,26 @@
       for (int i = 0; i < jj_endpos; i++) {
         jj_expentry[i] = jj_lasttokens[i];
       }
-      boolean exists = false;
-      for (java.util.Enumeration e = jj_expentries.elements(); 
e.hasMoreElements();) {
-        int[] oldentry = (int[])(e.nextElement());
+      jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); 
it.hasNext();) {
+        int[] oldentry = (int[])(it.next());
         if (oldentry.length == jj_expentry.length) {
-          exists = true;
           for (int i = 0; i < jj_expentry.length; i++) {
             if (oldentry[i] != jj_expentry[i]) {
-              exists = false;
-              break;
+              continue jj_entries_loop;
             }
           }
-          if (exists) break;
+          jj_expentries.add(jj_expentry);
+          break jj_entries_loop;
         }
       }
-      if (!exists) jj_expentries.addElement(jj_expentry);
       if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
     }
   }
 
+  /** Generate ParseException. */
   public ParseException generateParseException() {
-    jj_expentries.removeAllElements();
+    jj_expentries.clear();
     boolean[] la1tokens = new boolean[24];
-    for (int i = 0; i < 24; i++) {
-      la1tokens[i] = false;
-    }
     if (jj_kind >= 0) {
       la1tokens[jj_kind] = true;
       jj_kind = -1;
@@ -568,7 +494,7 @@
       if (la1tokens[i]) {
         jj_expentry = new int[1];
         jj_expentry[0] = i;
-        jj_expentries.addElement(jj_expentry);
+        jj_expentries.add(jj_expentry);
       }
     }
     jj_endpos = 0;
@@ -576,18 +502,12 @@
     jj_add_error_token(0, 0);
     int[][] exptokseq = new int[jj_expentries.size()][];
     for (int i = 0; i < jj_expentries.size(); i++) {
-      exptokseq[i] = (int[])jj_expentries.elementAt(i);
+      exptokseq[i] = (int[])jj_expentries.get(i);
     }
     return new ParseException(token, exptokseq, tokenImage);
   }
 
-  final public void enable_tracing() {
-  }
-
-  final public void disable_tracing() {
-  }
-
-  final private void jj_rescan_token() {
+  private void jj_rescan_token() {
     jj_rescan = true;
     for (int i = 0; i < 1; i++) {
     try {
@@ -606,7 +526,7 @@
     jj_rescan = false;
   }
 
-  final private void jj_save(int index, int xla) {
+  private void jj_save(int index, int xla) {
     JJCalls p = jj_2_rtns[index];
     while (p.gen > jj_gen) {
       if (p.next == null) { p = p.next = new JJCalls(); break; }

Modified: 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListParserConstants.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListParserConstants.java?rev=787228&r1=787227&r2=787228&view=diff
==============================================================================
--- 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListParserConstants.java
 (original)
+++ 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListParserConstants.java
 Mon Jun 22 12:59:47 2009
@@ -1,6 +1,10 @@
 /* Generated By:JavaCC: Do not edit this line. 
PropertyListParserConstants.java */
 package org.apache.commons.configuration2.plist;
 
+/**
+ * Token literal values and constants.
+ * Generated by org.javacc.parser.OtherFilesGen#start()
+ */
 interface PropertyListParserConstants
 {
     int EOF = 0;
@@ -24,8 +28,10 @@
     int QUOTED_STRING = 22;
     int ESCAPED_QUOTE = 23;
 
+    /** Lexical state. */
     int DEFAULT = 0;
 
+    /** Literal token values. */
     String[] tokenImage = {
         "<EOF>",
         "\" \"",

Modified: 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListParserTokenManager.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListParserTokenManager.java?rev=787228&r1=787227&r2=787228&view=diff
==============================================================================
--- 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListParserTokenManager.java
 (original)
+++ 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/PropertyListParserTokenManager.java
 Mon Jun 22 12:59:47 2009
@@ -1,10 +1,15 @@
 /* Generated By:JavaCC: Do not edit this line. 
PropertyListParserTokenManager.java */
 package org.apache.commons.configuration2.plist;
 
+/**
+ * Token Manager.
+ */
 class PropertyListParserTokenManager implements PropertyListParserConstants
 {
+    /** Debug output. */
     public java.io.PrintStream debugStream = System.out;
 
+    /** Set debug output.*/
     public void setDebugStream(java.io.PrintStream ds)
     {
         debugStream = ds;
@@ -41,7 +46,7 @@
                     return 3;
                 }
                 return -1;
-            default :
+            default:
                 return -1;
         }
     }
@@ -51,29 +56,14 @@
         return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
     }
 
-    private final int jjStopAtPos(int pos, int kind)
+    private 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()
+    private int jjMoveStringLiteralDfa0_0()
     {
         switch (curChar)
         {
@@ -100,12 +90,12 @@
                 return jjStopAtPos(0, 8);
             case 125:
                 return jjStopAtPos(0, 9);
-            default :
+            default:
                 return jjMoveNfa_0(0, 0);
         }
     }
 
-    private final int jjMoveStringLiteralDfa1_0(long active0)
+    private int jjMoveStringLiteralDfa1_0(long active0)
     {
         try
         {
@@ -126,13 +116,13 @@
                 break;
             case 42:
                 return jjMoveStringLiteralDfa2_0(active0, 0x4000L);
-            default :
+            default:
                 break;
         }
         return jjStartNfa_0(0, active0);
     }
 
-    private final int jjMoveStringLiteralDfa2_0(long old0, long active0)
+    private int jjMoveStringLiteralDfa2_0(long old0, long active0)
     {
         if (((active0 &= old0)) == 0L)
         {
@@ -155,63 +145,38 @@
                     return jjStartNfaWithStates_0(2, 14, 15);
                 }
                 break;
-            default :
+            default:
                 break;
         }
         return jjStartNfa_0(1, active0);
     }
 
-    private final void jjCheckNAdd(int state)
-    {
-        if (jjrounds[state] != jjround)
-        {
-            jjstateSet[jjnewStateCnt++] = state;
-            jjrounds[state] = jjround;
-        }
-    }
-
-    private final void jjAddStates(int start, int end)
+    private int jjStartNfaWithStates_0(int pos, int kind, int state)
     {
-        do
+        jjmatchedKind = kind;
+        jjmatchedPos = pos;
+        try
         {
-            jjstateSet[jjnewStateCnt++] = jjnextStates[start];
+            curChar = input_stream.readChar();
         }
-        while (start++ != end);
-    }
-
-    private final void jjCheckNAddTwoStates(int state1, int state2)
-    {
-        jjCheckNAdd(state1);
-        jjCheckNAdd(state2);
-    }
-
-    private final void jjCheckNAddStates(int start, int end)
-    {
-        do
+        catch (java.io.IOException e)
         {
-            jjCheckNAdd(jjnextStates[start]);
+            return pos + 1;
         }
-        while (start++ != end);
-    }
-
-    private final void jjCheckNAddStates(int start)
-    {
-        jjCheckNAdd(jjnextStates[start]);
-        jjCheckNAdd(jjnextStates[start + 1]);
+        return jjMoveNfa_0(state, pos + 1);
     }
 
     static final long[] jjbitVec0 = {
             0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
     };
 
-    private final int jjMoveNfa_0(int startState, int curPos)
+    private int jjMoveNfa_0(int startState, int curPos)
     {
-        int[] nextStates;
         int startsAt = 0;
         jjnewStateCnt = 14;
         int i = 1;
         jjstateSet[0] = startState;
-        int j, kind = 0x7fffffff;
+        int kind = 0x7fffffff;
         for (; ;)
         {
             if (++jjround == 0x7fffffff)
@@ -221,7 +186,6 @@
             if (curChar < 64)
             {
                 long l = 1L << curChar;
-                MatchLoop:
                 do
                 {
                     switch (jjstateSet[--i])
@@ -368,7 +332,7 @@
                                 kind = 22;
                             }
                             break;
-                        default :
+                        default:
                             break;
                     }
                 }
@@ -377,7 +341,6 @@
             else if (curChar < 128)
             {
                 long l = 1L << (curChar & 077);
-                MatchLoop:
                 do
                 {
                     switch (jjstateSet[--i])
@@ -464,7 +427,7 @@
                                 jjstateSet[jjnewStateCnt++] = 11;
                             }
                             break;
-                        default :
+                        default:
                             break;
                     }
                 }
@@ -474,7 +437,6 @@
             {
                 int i2 = (curChar & 0xff) >> 6;
                 long l2 = 1L << (curChar & 077);
-                MatchLoop:
                 do
                 {
                     switch (jjstateSet[--i])
@@ -531,7 +493,7 @@
                             }
                             jjCheckNAdd(8);
                             break;
-                        default :
+                        default:
                             break;
                     }
                 }
@@ -562,10 +524,14 @@
     static final int[] jjnextStates = {
             10, 12, 13,
     };
+
+    /** Token literal values. */
     public static final String[] jjstrLiteralImages = {
             "", null, null, null, null, "\50", "\51", "\54", "\173", "\175", 
"\73", "\75",
             "\74", "\76", "\74\52\104", "\42", null, null, null, null, null, 
null, null,
             "\134\42",};
+
+    /** Lexer state names. */
     public static final String[] lexStateNames = {
             "DEFAULT",
     };
@@ -580,6 +546,9 @@
     private final int[] jjstateSet = new int[28];
     protected char curChar;
 
+    /**
+     * Constructor.
+     */
     public PropertyListParserTokenManager(SimpleCharStream stream)
     {
         if (SimpleCharStream.staticFlag)
@@ -589,12 +558,9 @@
         input_stream = stream;
     }
 
-    public PropertyListParserTokenManager(SimpleCharStream stream, int 
lexState)
-    {
-        this(stream);
-        SwitchTo(lexState);
-    }
-
+    /**
+     * Reinitialise parser.
+     */
     public void ReInit(SimpleCharStream stream)
     {
         jjmatchedPos = jjnewStateCnt = 0;
@@ -603,7 +569,7 @@
         ReInitRounds();
     }
 
-    private final void ReInitRounds()
+    private void ReInitRounds()
     {
         int i;
         jjround = 0x80000001;
@@ -613,12 +579,9 @@
         }
     }
 
-    public void ReInit(SimpleCharStream stream, int lexState)
-    {
-        ReInit(stream);
-        SwitchTo(lexState);
-    }
-
+    /**
+     * Switch to specified lex state.
+     */
     public void SwitchTo(int lexState)
     {
         if (lexState >= 1 || lexState < 0)
@@ -633,14 +596,25 @@
 
     protected Token jjFillToken()
     {
-        Token t = Token.newToken(jjmatchedKind);
-        t.kind = jjmatchedKind;
+        final Token t;
+        final String curTokenImage;
+        final int beginLine;
+        final int endLine;
+        final int beginColumn;
+        final int endColumn;
         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();
+        curTokenImage = (im == null) ? input_stream.GetImage() : im;
+        beginLine = input_stream.getBeginLine();
+        beginColumn = input_stream.getBeginColumn();
+        endLine = input_stream.getEndLine();
+        endColumn = input_stream.getEndColumn();
+        t = Token.newToken(jjmatchedKind, curTokenImage);
+
+        t.beginLine = beginLine;
+        t.endLine = endLine;
+        t.beginColumn = beginColumn;
+        t.endColumn = endColumn;
+
         return t;
     }
 
@@ -651,14 +625,15 @@
     int jjmatchedPos;
     int jjmatchedKind;
 
+    /**
+     * Get the next Token.
+     */
     public Token getNextToken()
     {
-        int kind;
-        Token specialToken = null;
         Token matchedToken;
         int curPos = 0;
 
-        EOFLoop :
+        EOFLoop:
         for (; ;)
         {
             try
@@ -735,4 +710,28 @@
         }
     }
 
+    private void jjCheckNAdd(int state)
+    {
+        if (jjrounds[state] != jjround)
+        {
+            jjstateSet[jjnewStateCnt++] = state;
+            jjrounds[state] = jjround;
+        }
+    }
+
+    private void jjCheckNAddTwoStates(int state1, int state2)
+    {
+        jjCheckNAdd(state1);
+        jjCheckNAdd(state2);
+    }
+
+    private void jjCheckNAddStates(int start, int end)
+    {
+        do
+        {
+            jjCheckNAdd(jjnextStates[start]);
+        }
+        while (start++ != end);
+    }
+
 }

Modified: 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/SimpleCharStream.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/SimpleCharStream.java?rev=787228&r1=787227&r2=787228&view=diff
==============================================================================
--- 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/SimpleCharStream.java
 (original)
+++ 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/SimpleCharStream.java
 Mon Jun 22 12:59:47 2009
@@ -1,17 +1,20 @@
-/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 
4.0 */
+/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 
4.1 */
+/* JavaCCOptions:STATIC=false */
+
 package org.apache.commons.configuration2.plist;
 
 /**
  * An implementation of interface CharStream, where the stream is assumed to
  * contain only ASCII characters (without unicode processing).
  */
-
 class SimpleCharStream
 {
+  /** Whether parser is static. */
   public static final boolean staticFlag = false;
   int bufsize;
   int available;
   int tokenBegin;
+  /** Position in buffer. */
   public int bufpos = -1;
   protected int bufline[];
   protected int bufcolumn[];
@@ -27,6 +30,10 @@
   protected char[] buffer;
   protected int maxNextCharInd = 0;
   protected int inBuf = 0;
+  protected int tabSize = 8;
+
+  protected void setTabSize(int i) { tabSize = i; }
+  protected int getTabSize(int i) { return tabSize; }
 
   protected void ExpandBuff(boolean wrapAround)
   {
@@ -123,6 +130,7 @@
      }
   }
 
+  /** Start. */
   public char BeginToken() throws java.io.IOException
   {
      tokenBegin = -1;
@@ -162,7 +170,7 @@
            break;
         case '\t' :
            column--;
-           column += (8 - (column & 07));
+           column += (tabSize - (column % tabSize));
            break;
         default :
            break;
@@ -172,6 +180,7 @@
      bufcolumn[bufpos] = column;
   }
 
+  /** Read a character. */
   public char readChar() throws java.io.IOException
   {
      if (inBuf > 0)
@@ -190,43 +199,30 @@
      char c = buffer[bufpos];
 
      UpdateLineColumn(c);
-     return (c);
-  }
-
-  /**
-   * @deprecated 
-   * @see #getEndColumn
-   */
-
-  public int getColumn() {
-     return bufcolumn[bufpos];
-  }
-
-  /**
-   * @deprecated 
-   * @see #getEndLine
-   */
-
-  public int getLine() {
-     return bufline[bufpos];
+     return c;
   }
 
+  /** Get token end column number. */
   public int getEndColumn() {
      return bufcolumn[bufpos];
   }
 
+  /** Get token end line number. */
   public int getEndLine() {
      return bufline[bufpos];
   }
 
+  /** Get token beginning column number. */
   public int getBeginColumn() {
      return bufcolumn[tokenBegin];
   }
 
+  /** Get token beginning line number. */
   public int getBeginLine() {
      return bufline[tokenBegin];
   }
 
+  /** Backup a number of characters. */
   public void backup(int amount) {
 
     inBuf += amount;
@@ -234,6 +230,7 @@
        bufpos += bufsize;
   }
 
+  /** Constructor. */
   public SimpleCharStream(java.io.Reader dstream, int startline,
   int startcolumn, int buffersize)
   {
@@ -247,16 +244,20 @@
     bufcolumn = new int[buffersize];
   }
 
+  /** Constructor. */
   public SimpleCharStream(java.io.Reader dstream, int startline,
-                                                           int startcolumn)
+                          int startcolumn)
   {
      this(dstream, startline, startcolumn, 4096);
   }
 
+  /** Constructor. */
   public SimpleCharStream(java.io.Reader dstream)
   {
      this(dstream, 1, 1, 4096);
   }
+
+  /** Reinitialise. */
   public void ReInit(java.io.Reader dstream, int startline,
   int startcolumn, int buffersize)
   {
@@ -276,63 +277,73 @@
     bufpos = -1;
   }
 
+  /** Reinitialise. */
   public void ReInit(java.io.Reader dstream, int startline,
-                                                           int startcolumn)
+                     int startcolumn)
   {
      ReInit(dstream, startline, startcolumn, 4096);
   }
 
+  /** Reinitialise. */
   public void ReInit(java.io.Reader dstream)
   {
      ReInit(dstream, 1, 1, 4096);
   }
+  /** Constructor. */
   public SimpleCharStream(java.io.InputStream dstream, String encoding, int 
startline,
   int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
   {
      this(encoding == null ? new java.io.InputStreamReader(dstream) : new 
java.io.InputStreamReader(dstream, encoding), startline, startcolumn, 
buffersize);
   }
 
+  /** Constructor. */
   public SimpleCharStream(java.io.InputStream dstream, int startline,
   int startcolumn, int buffersize)
   {
      this(new java.io.InputStreamReader(dstream), startline, startcolumn, 
buffersize);
   }
 
+  /** Constructor. */
   public SimpleCharStream(java.io.InputStream dstream, String encoding, int 
startline,
                           int startcolumn) throws 
java.io.UnsupportedEncodingException
   {
      this(dstream, encoding, startline, startcolumn, 4096);
   }
 
-  public SimpleCharStream(java.io.InputStream dstream, int startline,
-                                                           int startcolumn)
+  /** Constructor. */
+  public SimpleCharStream(java.io.InputStream dstream, int startline, int 
startcolumn)
   {
      this(dstream, startline, startcolumn, 4096);
   }
 
+  /** Constructor. */
   public SimpleCharStream(java.io.InputStream dstream)
   {
      this(dstream, 1, 1, 4096);
   }
 
+  /** Reinitialise. */
   public void ReInit(java.io.InputStream dstream, String encoding, int 
startline,
                           int startcolumn, int buffersize) throws 
java.io.UnsupportedEncodingException
   {
      ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new 
java.io.InputStreamReader(dstream, encoding), startline, startcolumn, 
buffersize);
   }
 
+  /** Reinitialise. */
   public void ReInit(java.io.InputStream dstream, int startline,
                           int startcolumn, int buffersize)
   {
      ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 
buffersize);
   }
 
+  /** Reinitialise. */
   public void ReInit(java.io.InputStream dstream, String encoding, int 
startline,
                      int startcolumn) throws 
java.io.UnsupportedEncodingException
   {
      ReInit(dstream, encoding, startline, startcolumn, 4096);
   }
 
+  /** Get token literal value. */
   public String GetImage()
   {
      if (bufpos >= tokenBegin)
@@ -343,3 +354,4 @@
   }
 
 }
+/* JavaCC - OriginalChecksum=6f79303ad1956d9a3a792fa4dd2787ce (do not edit 
this line) */

Modified: 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/Token.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/Token.java?rev=787228&r1=787227&r2=787228&view=diff
==============================================================================
--- 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/Token.java
 (original)
+++ 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/Token.java
 Mon Jun 22 12:59:47 2009
@@ -1,10 +1,10 @@
-/* Generated By:JavaCC: Do not edit this line. Token.java Version 3.0 */
+/* Generated By:JavaCC: Do not edit this line. Token.java Version 4.1 */
+/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null */
 package org.apache.commons.configuration2.plist;
 
 /**
  * Describes the input token stream.
  */
-
 class Token {
 
   /**
@@ -14,12 +14,14 @@
    */
   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 line number of the first character of this Token. */
+  public int beginLine;
+  /** The column number of the first character of this Token. */
+  public int beginColumn;
+  /** The line number of the last character of this Token. */
+  public int endLine;
+  /** The column number of the last character of this Token. */
+  public int endColumn;
 
   /**
    * The string image of the token.
@@ -50,6 +52,20 @@
    */
   public Token specialToken;
 
+    /**
+   * No-argument constructor
+   */
+  public Token() {}
+
+    /**
+   * Constructs a new token for the specified Image and Kind.
+   */
+  public Token(int kind, String image)
+  {
+     this.kind = kind;
+     this.image = image;
+  }
+
   /**
    * Returns the image.
    */
@@ -63,19 +79,20 @@
    * 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 :
+   * you want to create if ofKind is ID, simply add something like :
    *
-   *    case MyParserConstants.ID : return new IDToken();
+   *    case MyParserConstants.ID : return new IDToken(ofKind, image);
    *
    * to the following switch statement. Then you can cast matchedToken
-   * variable to the appropriate type and use it in your lexical actions.
+   * variable to the appropriate type and use sit in your lexical actions.
    */
-  public static final Token newToken(int ofKind)
+  public static Token newToken(int ofKind, String image)
   {
      switch(ofKind)
      {
-       default : return new Token();
+       default : return new Token(ofKind, image);
      }
   }
 
 }
+/* JavaCC - OriginalChecksum=454014fcfc45d3afac7bf340fbcc27a4 (do not edit 
this line) */

Modified: 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/TokenMgrError.java
URL: 
http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/TokenMgrError.java?rev=787228&r1=787227&r2=787228&view=diff
==============================================================================
--- 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/TokenMgrError.java
 (original)
+++ 
commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/plist/TokenMgrError.java
 Mon Jun 22 12:59:47 2009
@@ -1,30 +1,24 @@
-/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 
*/
+/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 4.1 
*/
+/* JavaCCOptions: */
 package org.apache.commons.configuration2.plist;
 
+/** Token Manager Error. */
 class TokenMgrError extends Error
 {
    /*
     * Ordinals for various reasons why an Error of this type can be thrown.
     */
 
-   /**
-    * Lexical error occured.
-    */
+   /** Lexical error occurred. */
    static final int LEXICAL_ERROR = 0;
 
-   /**
-    * An attempt wass made to create a second instance of a static token 
manager.
-    */
+   /** An attempt was 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.
-    */
+   /** 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.
-    */
+   /** Detected (and bailed out of) an infinite loop in the token manager. */
    static final int LOOP_DETECTED = 3;
 
    /**
@@ -34,7 +28,7 @@
    int errorCode;
 
    /**
-    * Replaces unprintable characters by their espaced (or unicode escaped)
+    * Replaces unprintable characters by their escaped (or unicode escaped)
     * equivalents in the given string
     */
    protected static final String addEscapes(String str) {
@@ -85,12 +79,12 @@
    /**
     * 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
+    * Parameters :
+    *    EOFSeen     : indicates if EOF caused the lexical error
+    *    curLexState : lexical state in which this error occurred
+    *    errorLine   : line number when the error occurred
+    *    errorColumn : column number when the error occurred
+    *    errorAfter  : prefix that was seen before this error occurred
     *    curchar     : the offending character
     * Note: You can customize the lexical error message by modifying this 
method.
     */
@@ -105,7 +99,7 @@
    /**
     * 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 : 
+    * of end-users concern, so you can return something like :
     *
     *     "Internal Error : Please file a bug report .... "
     *
@@ -119,15 +113,19 @@
     * Constructors of various flavors follow.
     */
 
+   /** No arg constructor. */
    public TokenMgrError() {
    }
 
+   /** Constructor with message and reason. */
    public TokenMgrError(String message, int reason) {
       super(message);
       errorCode = reason;
    }
 
+   /** Full Constructor. */
    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);
    }
 }
+/* JavaCC - OriginalChecksum=2b06084d557b26cdf69e88ad142eb1b6 (do not edit 
this line) */


Reply via email to