Class BasicCommandFactory

java.lang.Object
com.scriptbasic.syntax.commands.BasicCommandFactory
All Implemented Interfaces:
CommandFactory

public final class BasicCommandFactory
extends java.lang.Object
implements CommandFactory
  • Constructor Summary

    Constructors 
    Constructor Description
    BasicCommandFactory​(Context ctx)
    This implementation of the interface (btw: the only one in ScriptBasic) creates a command from a list of symbols.
  • Method Summary

    Modifier and Type Method Description
    Command create​(java.lang.String commandKeyword)
    Create a Command that starts with the keyword.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BasicCommandFactory

      public BasicCommandFactory​(Context ctx)
      This implementation of the interface (btw: the only one in ScriptBasic) creates a command from a list of symbols. First it checks if the first symbol of the command is a keyword and appears in the classMap as a key. If yes, for example the
      Parameters:
      ctx - the context of the interpreter
  • Method Details

    • create

      public Command create​(java.lang.String commandKeyword) throws AnalysisException
      Description copied from interface: CommandFactory
      Create a Command that starts with the keyword.
      Specified by:
      create in interface CommandFactory
      Parameters:
      commandKeyword - the command keyword lexeme or null in case the command does not start with a keyword (e.g. procedure call or assignment or a DSL sentence)
      Returns:
      the created command
      Throws:
      AnalysisException - is there is a lexical or syntax exception if there is some error with the command factory itself and it can not analyze the line and does not know what the error is. (probably the syntax of the line is totally wrong)