title: expecting EOF, found '<something>'
body: <p>My 1st post here so I'll try to keep it simple. I'm trying to create a plot of some mass spectrometry data using Processing. I wanted to write a sketch to parse data from pseudo-XML into tables and then to plot this data as points on 2 axes (time, mz) with the third axis, the signal, as the colour of the point.</p>
  
  <p>At this stage I want the plot to be the dimensions of the data. In my test data this is 38 time points on the x axis, 51 mz points on the Y and signal ranging from 0 to 12,000. The bounds of a real data set will be a hundred times bigger in every dimension. </p>
  
  <p>My issue is that the width and height of the plot is dependent on the data and establishing these limits involves a bit of code. In Processing you can only call <em>size()</em> immediately after <em>void setup()</em> so I put all the calculation code first. This threw the title error. I couldn't work around it so I output the data to three csv files and started on a 2nd sketch to import that data and plot it. I've run into the same error. </p>
  
  <p>The exact error is <em>expecting EOF, found ''</em>, where  can be the first word on a line. It has been <em>for</em>, <em>mzTable</em> and <em>if</em>, depending on the code I've tried.</p>
  
  <p>Here's the second sketch in full:</p>
  
  <pre><code>import java.io.*;
  
  int debug = 1;
  
  String target = "M1A crop.txt";  // test data
  
  
  File file = new File(target);
  
  // ~  ~  ~  
  
  String folderPath = file.getParent(); // target folder path
  String name = file.getName(); 
  
  String mzData = folderPath + "\\" + name + " - mz data.csv" ;    // CSV file to open
  String signalData = folderPath + "\\" + name + " - signal data.csv" ;    // CSV file to open
  String summaryData = folderPath + "\\" + name + " - summary data.csv" ;    // CSV file to open
  
  Table mzTable = new Table();
  Table signalTable = new Table();
  Table summaryTable = new Table();
  
  mzTable = loadTable(mzData, "header");
  signalTable = loadTable(signalData, "header");
  summaryTable = loadTable(summaryData, "header");
  
  int timeMin = summaryTable.getInt(0, "timeMin");
  int timeMax = summaryTable.getInt(0, "timeMax");
  int mzMin = summaryTable.getInt(0, "mzMin");
  int mzMax = summaryTable.getInt(0, "mzMax");
  int signalMin = summaryTable.getInt(0, "signalMin");
  int signalMax = summaryTable.getInt(0, "signalMax");
  
  width = mzTable.getColumnCount();  // this is the number of time points on the X axis
  height = mzMax - mzMin;  // this is the number of mz points on the Y axis
  
  println("time Min: " + timeMin + ", Max: " + timeMax);
  println("mz Min: " + mzMin + ", Max: " + mzMax);
  println("signal Min: " + signalMin + ", Max: " + signalMax);
  
  
  void setup() {
    size(width, height);
  
  }    // end of void setup()
  
  
  void draw() {
    for(int x = 0; x &lt; height; x++) {
      for(int y = 0; y &lt; width; y++) {
        stroke(map(signalTable.getInt(x, y), signalMin, signalMax, 0, 255));
        point(x, y);
      }
    }  
  }
  </code></pre>
  
  <p>The source of the error is identified as coming from line 19: </p>
  
  <pre><code>mzTable = loadTable(mzData, "header");
  </code></pre>
  
  <p>I'm no hacker but I can see there's nothing wrong with that code. If I comment out everything from <em>void setup()</em> onwards the code runs so its something to do with having the import and summary code outside of that function. If I put bad code in front of it, such as just <em>for(</em> then I get expecting EOF, found 'for'. Can anyone tell me why? </p>
  
  <p>Many thanks in advance, </p>
  
  <p>Chris</p>
  
  <p>edited for derp 20:20 1-5-15</p>
  
  <p>edit 22:00 1-5-15
  I've just tried the sketch in Processing 3.0a7, which has much better error reporting. It has identified a different error with line 19: <em>Syntax error on tokens, delete these tokens</em>. Searching for this error lead me to this questions with suggestions of a diagnosis. 
  <a href="https://stackoverflow.com/questions/17537185/syntax-error-on-tokens-delete-these-tokens">Syntax error on tokens, delete these tokens</a></p>