import java.util.*;
import java.io.*;

public class Parser
{
    public static final char DELIMITER = ',';
    public static final String PRODUCES = "=>";
    public static final char SPACE = ' ';

    public Parser (boolean debug)
    {
        _debug = debug;
    }

    public void loadData (String fileName)
    {
        /*
         * Open the data file and read it in.
         */

        BufferedReader reader = null;
        String[] values = null;

        try
        {
            reader = new BufferedReader(new FileReader(fileName));
            String line = null;

            while ((line = reader.readLine()) != null)
            {
                /*
                 * Line format:
                 * 
                 * - ALWAYS start with a number
                 * - ALWAYS follow with a String
                 * - Then EITHER a comma if more than one chemical OR => to denote end of reactants
                 * - ALWAYS end in a number and a String
                 */

                 int quantitySpace = line.indexOf(SPACE);
                 int quantity = Integer.parseInt(line.substring(0, quantitySpace));
                 
                 
            }
        }
        catch (Throwable ex)
        {
            ex.printStackTrace();
        }
        finally
        {
            try
            {
                reader.close();
            }
            catch (Throwable ex)
            {
            }
        }
    }

    private boolean _debug;
}
@@ -981,32 +981,291 @@
             */%0A%0A
+                 Vector%3CInteger%3E quantities = new Vector%3CInteger%3E();%0A                 Vector%3CChemical%3E chemicals = new Vector%3CChemical%3E();%0A                 boolean allReactants = false;%0A                 int ptr = 0;%0A%0A                 do%0A                 %7B%0A   
                 
@@ -1302,16 +1302,21 @@
 xOf(
+ptr, 
 SPACE);%0A
     
@@ -1311,16 +1311,91 @@
 SPACE);%0A
+%0A                    if (quantitySpace != -1)%0A                    %7B%0A       
         
@@ -1450,17 +1450,19 @@
 bstring(
-0
+ptr
 , quanti
@@ -1489,34 +1489,599 @@
         
-%0A                 
+       int chemDelim = line.indexOf(DELIMITER, quantitySpace);%0A                        String chem = null;%0A%0A                        if (chemDelim == -1)  // no more chemicals, but we do have a rogue quantity!%0A                            allReactants = true;%0A                        else%0A                        %7B%0A                            chem = line.substring(quantitySpace, chemDelim-1);%0A                        %7D%0A%0A                        ptr = %0A                    %7D%0A                    else%0A                        allReactants = true;%0A%0A                %7D while (!allReactants);
 %0A       

Update Parser.java