add Serializable to util classes
[sbp.git] / src / edu / berkeley / sbp / Parser.java
index a3730b6..8af8005 100644 (file)
@@ -106,7 +106,7 @@ public abstract class Parser<Token, NodeType> {
     // Table //////////////////////////////////////////////////////////////////////////////
 
     /** an SLR(1) parse table which may contain conflicts */
-    class Table extends Grammar<Token> {
+    class Table extends Grammar<Token> implements Serializable {
 
         /** the start state */
         final State<Token>   start;
@@ -118,13 +118,13 @@ public abstract class Parser<Token, NodeType> {
         private int master_state_idx = 0;
 
         /** all the states for this table */
-        HashSet<State<Token>>                     all_states       = new HashSet<State<Token>>();
+        private transient HashSet<State<Token>>                     all_states       = new HashSet<State<Token>>();
 
         /** all the doomed states in this table */
-        HashMap<HashSet<Position>,State<Token>>   doomed_states    = new HashMap<HashSet<Position>,State<Token>>();
+        private transient HashMap<HashSet<Position>,State<Token>>   doomed_states    = new HashMap<HashSet<Position>,State<Token>>();
 
         /** all the non-doomed states in this table */
-        HashMap<HashSet<Position>,State<Token>>   normal_states    = new HashMap<HashSet<Position>,State<Token>>();
+        private transient HashMap<HashSet<Position>,State<Token>>   normal_states    = new HashMap<HashSet<Position>,State<Token>>();
 
         Topology<Token> emptyTopology() { return Parser.this.emptyTopology(); }
     
@@ -263,10 +263,10 @@ public abstract class Parser<Token, NodeType> {
          *  space+time complexity in otherwise simple grammars.  There
          *  is an example of this in the regression suite.
          */
-        class State<Token> implements IntegerMappable, Iterable<Position> {
+        class State<Token> implements IntegerMappable, Serializable {
         
             public  final     int               idx    = master_state_idx++;
-            private final     HashSet<Position> hs;
+            private final  transient   HashSet<Position> hs;
             public HashSet<State<Token>> conjunctStates = new HashSet<State<Token>>();
 
             HashMap<Sequence,State<Token>>      gotoSetNonTerminals = new HashMap<Sequence,State<Token>>();