cs1705.adventure
Class Parser

java.lang.Object
  extended bycs1705.adventure.Parser

public class Parser
extends Object

This parser reads user input and tries to interpret it as an "Adventure" command. Every time it is called it reads a line from the terminal and tries to interpret the line as a two word command. It returns the command as an object of class Command. This class is part of the "World of Zuul" framework for writing very simple text-based adventure games. The parser has a set of known command words. It checks user input against the known commands, and if the input is not one of the known commands, it returns a command object that is marked as an unknown command.

Version:
1.1 (December 2002)
Author:
Michael Kolling and David J. Barnes

Constructor Summary
Parser()
           
 
Method Summary
 CommandWords commandWords()
          Access the set of valid command words.
 Command getCommand()
           
 String promptString()
          Get the prompt string printed before reading each command.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parser

public Parser()
Method Detail

commandWords

public CommandWords commandWords()
Access the set of valid command words.


getCommand

public Command getCommand()

promptString

public String promptString()
Get the prompt string printed before reading each command. A subclass can override this method to change the prompt.

Returns:
the prompt used for user input