Class Parser


  • public class Parser
    extends Object
    This class is part of "World of Zuul". "World of Zuul" is a simple, text based adventure game. This parser takes user input and tries to interpret it as a "Zuul" command. Every time it is called it takes a line as a String 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:
    2.0 (Jan 2003) DB edited (2019)
    Author:
    Michael Kolling and David J. Barnes
    • Constructor Detail

      • Parser

        public Parser()
        Create a new Parser.
    • Method Detail

      • getCommand

        public Command getCommand​(String pInputLine)
        Get a new command from the user. The command is read by parsing the 'inputLine'.
      • getCommandString

        public String getCommandString()
        Returns a String with valid command words.