/* Parser.java
*  Homework #1
*  Problem #5
*  Author: Dan Rocco
*  Date Compiled: 01/11/02
*  A scripting event loop parser that accepts the
*  following protocol:
*  "exit"  : exit the program
*  "list"  : prints "list in protocol"
*  "chdir" : prints "chdir in the protocol"
*  "rename": prints "rename in protocol" 
*  anything will print an error message. */



class Parser{
    public static void main(String[] args){
	String input = " ";
	String tokens;
        String string1 = "list";
        String string2 = "chdir";
        String string3 = "rename";
     
        //check to see if user entered "exit" if so exit.
	while (!input.equalsIgnoreCase("exit")){
	    System.out.print("PROMPT >> ");
	    input = ParserUtils.getKeyInput();
	    tokens = ParserUtils.getTokens(input);

            //check what protocol was entered
            //I deleated the for loop, user can only enter one
            //protocol at a time.
            if ( input.equals(string1))
            {
                System.out.println("list in protocol");
            }

            else
             
             if ( input.equals(string2))
            {
                System.out.println("chdir in protocol");
            }
	    
            else
            
            if ( input.equals(string3))
            {
                System.out.println("rename in protocol");
            }
            
            else
            
             if (!input.equalsIgnoreCase("exit"))
             {
             System.out.println("error: command not in protocol");
	     }
	}
    }
}


