Class Parser

java.lang.Object
  extended by Parser

public class Parser
extends Object

This class is part of the "World of Zuul" application. "World of Zuul" is a very simple, text based adventure game. 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. 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:
28/1/2015
Author:
Michael Kölling, David J. Barnes and Olaf Chitil

Constructor Summary
Parser()
          Create a parser to read from the terminal window.
 
Method Summary
 String commands()
          Returns a list of valid commands.
 Command getCommand()
           
 String help()
          Returns name of help command.
 
Methods inherited from class
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parser

public Parser()
Create a parser to read from the terminal window.

Method Detail

commands

public String commands()
Returns a list of valid commands.


getCommand

public Command getCommand()
Returns:
The next command from the user.

help

public String help()
Returns name of help command.