Class AbstractCommandAnalyzer

    • Field Detail

    • Constructor Detail

      • AbstractCommandAnalyzer

        protected AbstractCommandAnalyzer​(Context ctx)
    • Method Detail

      • equal

        protected static boolean equal​(LeftValue a,
                                       LeftValue b)
        Check that the left values are simple (no modifiers, a.k.a. simply variables) and are the same variables (have the same name).
        Parameters:
        a - variable one
        b - variable two
        Returns:
        true if the variables have the same name and none of them has modifiers (array access or field access)
      • getName

        protected java.lang.String getName()
      • assertKeyWord

        protected void assertKeyWord​(java.lang.String keyword)
                              throws AnalysisException
        Ensures that the appropriate keyword is on the line. Also it eats up that keyword.
        Parameters:
        keyword - the keyword that has to be present on the line
        Throws:
        AnalysisException - when the next lexeme is NOT the expected keyword.
      • consumeEndOfLine

        protected void consumeEndOfLine()
                                 throws AnalysisException
        Checks that there are no extra characters on a program line when the line analyzer thinks that it has finished analyzing the line. If there are some extra characters on the line then throws syntax error exception. Otherwise it simply steps the lexical analyzer iterator over the EOL symbol.
        Throws:
        AnalysisException - when there are extra character on the actual line