title: JFlex: Unexpected end of file macros
body: <p>This is my first JFlex program so I don't understand why I am getting these errors. When I run my code, it give me the message "Unexpected end of file macros" and doesn't specify which line the error is on. Also, after commenting out the <code>%eof</code> code (i.e. line 18 to 24) it gives me an error "unexpected symbol" and it points to the beginning of my first regular expression. Can someone please tell me why I am getting these problems?</p>
  
  <pre><code>import java.io.*;
  import java.util.*;
  
  %%
  %class test
  %line
  %column
  
  
  %{
      PrintWriter pw = new PrintWriter(new File(args[0]));
      int ids = 0;
      int nums = 0;
      int comments = 0;
      int literals = 0;
  %}
  
  %eof{
      pw.println("number of identifiers = " + ids);
      pw.println("number of numbers = " + nums);
      pw.println("number of comments = " + comments);
      pw.println("number of string literals = " + literals);
      pw.close();
  eof%}
  
  [A-Za-z_][A-Z-a-z_0-9]*     {ids++;
                               System.out.print(ids);}
  
  (\n|\s|\t)[0-9](\n|\s|\t)   {nums++;
                               System.out.print(nums);}
  
  \/*.*/\                     {comments++;
                               System.out.print(comments);}
  
  \p{Punct}                   {literals++;
                               System.out.print(literals);}
  
  
                               System.out.println(literals);}
  </code></pre>