Hey Everyone,

I'm doing an assignment for my computer science course and I got stuck on an error and just thought you might make it clearer for me, i'm not asking that you do anything more than make it clearer, although i appreciate any extra help,

this is my code:

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
 
public class Parser
{
  private boolean success;
  private Parser.Scanner scanner;
 
  private Parser()
  {
  }
 
  public Parser(String paramString)
  {
    this.success = false;
    try
    {
      this.scanner = new Parser.Scanner(paramString);
    }
    catch (FileNotFoundException localFileNotFoundException)
    {
      System.out.println("Unable to find file " + paramString);
      return;
    }
 
    while ((localLexeme = this.scanner.getNextLexeme()) != null)
    {
      Lexeme localLexeme;
      System.out.print("The scanner found a lexeme with source code \"" + localLexeme.getSource() + "\" at line ");
      System.out.println(localLexeme.getLineNumber() + " and assigned token " + localLexeme.getToken().name());
    }
 
    this.success = true;
  }
 
  public boolean isSuccessful()
  {
    return this.success;
  }
 
  private static class Scanner
  {
    private Scanner javaScanner;
    private Pattern pattern;
    private Matcher matcher;
    private String sourceLine;
    private int lineNumber;
 
    private Scanner()
    {
    }
 
    public Scanner(String paramString)
      throws FileNotFoundException
    {
      this.sourceLine = "";
      this.lineNumber = 0;
      this.javaScanner = new Scanner(new File(paramString));
    }
 
    public Lexeme getNextLexeme()
    {
      if (this.sourceLine.length() == 0)
      {
        if (!this.javaScanner.hasNextLine())
        {
          return null;
        }
        this.sourceLine = this.javaScanner.nextLine();
        this.lineNumber += 1;
      }
 
      this.pattern = Pattern.compile("\\s+");
      this.matcher = this.pattern.matcher(this.sourceLine);
 
      if (this.matcher.lookingAt())
      {
        this.sourceLine = this.sourceLine.substring(this.matcher.group().length());
      }
 
      for (Lexeme.Token localToken : Lexeme.Token.values())
      {
        this.pattern = Pattern.compile(localToken.getRegex());
        this.matcher = this.pattern.matcher(this.sourceLine);
 
        if (!this.matcher.lookingAt())
          continue;
        this.sourceLine = this.sourceLine.substring(this.matcher.group().length());
        return new Lexeme(this.matcher.group(), this.lineNumber, localToken);
      }
 
      return null;
    }
  }
}

and these are the errors I get:

Parser.java:30: cannot find symbol
symbol    :   variable localLexeme
location:  class Parser
            while   ((localLexeme  =  this.scanner.getNextLexeme()) !=null)
 
Parser.java:62: cannot find symbol
symbol    :    constructor Scanner(java.io.File)
location: class Parser.Scanner
               this.javaScanner = new Scanner(new File(paramString));
 
Parser.java:69: cannot find symbol
 
 
symbol    :    method hasNextLine()
location: class Parser.Scanner
                    this.sourceLine = this.javaScanner.hasNextLine();

I belive this is very easy, but i don't know why i'm not getting it!


thanx to who ever helps