// ScanTest: Test a scanner for C-style comments
import java.io.*;
public class ScanTest {
   public static void main(String[] args) throws IOException {
      Scan scanner; // the scanner
      String s;
      // pass an input file name if present on command line
      if (args.length > 0)
         scanner = new Scan(args[0]);
      else
         scanner = new Scan();
      while (true) {
         // fetch and print the next comment
         // end-of-file is detected inside Scan.java
         s = scanner.getComment();
         System.out.println("Next comment: " + "\"" + s + "\"");
      }
   }
}

