Class BlockParentHandler

    • Field Detail

      • CHECKED_CHILDREN

        private static final int[] CHECKED_CHILDREN
        Children checked by parent handlers.
    • Constructor Detail

      • BlockParentHandler

        public BlockParentHandler​(IndentationCheck indentCheck,
                                  String name,
                                  DetailAST ast,
                                  AbstractExpressionHandler parent)
        Construct an instance of this handler with the given indentation check, name, abstract syntax tree, and parent handler.
        Parameters:
        indentCheck - the indentation check
        name - the name of the handler
        ast - the abstract syntax tree
        parent - the parent handler
    • Method Detail

      • getCheckedChildren

        protected int[] getCheckedChildren()
        Returns array of token types which should be checked among children.
        Returns:
        array of token types to check.
      • getTopLevelAst

        protected DetailAST getTopLevelAst()
        Get the top level expression being managed by this handler.
        Returns:
        the top level expression
      • checkTopLevelToken

        protected void checkTopLevelToken()
        Check the indent of the top level token.
      • hasCurlies

        private boolean hasCurlies()
        Determines if this block expression has curly braces.
        Returns:
        true if curly braces are present, false otherwise
      • getLeftCurly

        protected DetailAST getLeftCurly()
        Get the left curly brace portion of the expression we are handling.
        Returns:
        the left curly brace expression
      • getRightCurly

        protected DetailAST getRightCurly()
        Get the right curly brace portion of the expression we are handling.
        Returns:
        the right curly brace expression
      • checkLeftCurly

        private void checkLeftCurly()
        Check the indentation of the left curly brace.
      • curlyIndent

        protected IndentLevel curlyIndent()
        Get the expected indentation level for the curly braces.
        Returns:
        the curly brace indentation level
      • canChildrenBeNested

        protected boolean canChildrenBeNested()
        Determines if child elements within the expression may be nested.
        Returns:
        false
      • checkRightCurly

        private void checkRightCurly()
        Check the indentation of the right curly brace.
      • getNonListChild

        protected DetailAST getNonListChild()
        Get the child element that is not a list of statements.
        Returns:
        the non-list child element
      • checkNonListChild

        private void checkNonListChild()
        Check the indentation level of a child that is not a list of statements.
      • getListChild

        protected DetailAST getListChild()
        Get the child element representing the list of statements.
        Returns:
        the statement list child
      • getRightParen

        private DetailAST getRightParen()
        Get the right parenthesis portion of the expression we are handling.
        Returns:
        the right parenthesis expression
      • getLeftParen

        private DetailAST getLeftParen()
        Get the left parenthesis portion of the expression we are handling.
        Returns:
        the left parenthesis expression
      • getLineWrappingIndent

        private int getLineWrappingIndent()
        A shortcut for IndentationCheck property.
        Returns:
        value of lineWrappingIndentation property of IndentationCheck