@@ -0,0 +1,2487 @@
+ %0A%0Aimport java.io.BufferedReader;%0Aimport java.io.InputStreamReader;%0Aimport java.util.Scanner;%0Aimport java.util.StringTokenizer;%0A%0A/**%0A * This class is part of the %22World of Zuul%22 application. %22World of Zuul%22 is a%0A * very simple, text based adventure game.%0A * %0A * This parser reads user input and tries to interpret it as an %22Adventure%22%0A * command. Every time it is called it reads a line from the terminal and tries%0A * to interpret the line as a two-word command. It returns the command as an%0A * object of class Command.%0A * %0A * The parser has a set of known command words. It checks user input against the%0A * known commands, and if the input is not one of the known commands, it returns%0A * a command object that is marked as an unknown command.%0A * %0A * @author Michael Kolling and David J. Barnes%0A * @version 2008.03.30%0A */%0Apublic class Parser %7B%0A    private CommandWords commands; // holds all valid command words%0A    @SuppressWarnings(%22unused%22)%0A    private Scanner reader; // source of command input%0A%0A    /**%0A     * Create a parser to read from the terminal window.%0A     */%0A    public Parser() %7B%0A        commands = new CommandWords();%0A        reader = new Scanner(System.in);%0A    %7D%0A%0A    /**%0A     * @return The next command from the user.%0A     */%0A    public Command getCommand() %7B%0A        String inputLine = %22%22;   // will hold the full input line%0A        String word1;%0A        String word2;%0A%0A        System.out.print(%22%3E %22);     // print prompt%0A%0A        BufferedReader reader = %0A                new BufferedReader(new InputStreamReader(System.in));%0A        try %7B%0A            inputLine = reader.readLine();%0A        %7D%0A        catch(java.io.IOException exc) %7B%0A            System.out.println (%22There was an error during reading: %22%0A                    + exc.getMessage());%0A        %7D%0A%0A        StringTokenizer tokenizer = new StringTokenizer(inputLine);%0A%0A        if(tokenizer.hasMoreTokens())%0A            word1 = tokenizer.nextToken();      // get first word%0A        else%0A            word1 = null;%0A        if(tokenizer.hasMoreTokens())%0A            word2 = tokenizer.nextToken();      // get second word%0A        else%0A            word2 = null;%0A%0A        // note: we just ignore the rest of the input line.%0A%0A        Command command = commands.get(word1);%0A        if(command != null) %7B%0A            command.setSecondWord(word2);%0A        %7D%0A        return command;%0A    %7D%0A%0A    /**%0A     * Print out a list of valid command words.%0A     */%0A    public void showCommands() %7B%0A        commands.showAll();%0A    %7D%0A%7D%0A

Create Parser.java