Class RightCurlyCheck.Details

  • Enclosing class:
    RightCurlyCheck

    private static final class RightCurlyCheck.Details
    extends java.lang.Object
    Structure that contains all details for validation.
    • Field Detail

      • TOKENS_WITH_NO_CHILD_SLIST

        private static final int[] TOKENS_WITH_NO_CHILD_SLIST
        Token types that identify tokens that will never have SLIST in their AST.
      • rcurly

        private final DetailAST rcurly
        Right curly.
      • lcurly

        private final DetailAST lcurly
        Left curly.
      • nextToken

        private final DetailAST nextToken
        Next token.
      • shouldCheckLastRcurly

        private final boolean shouldCheckLastRcurly
        Should check last right curly.
    • Constructor Detail

      • Details

        private Details​(DetailAST lcurly,
                        DetailAST rcurly,
                        DetailAST nextToken,
                        boolean shouldCheckLastRcurly)
        Constructor.
        Parameters:
        lcurly - the lcurly of the token whose details are being collected
        rcurly - the rcurly of the token whose details are being collected
        nextToken - the token after the token whose details are being collected
        shouldCheckLastRcurly - boolean value to determine if to check last rcurly
    • Method Detail

      • getDetails

        private static RightCurlyCheck.Details getDetails​(DetailAST ast)
        Collects validation Details.
        Parameters:
        ast - a DetailAST value
        Returns:
        object containing all details to make a validation
      • getDetailsForTryCatchFinally

        private static RightCurlyCheck.Details getDetailsForTryCatchFinally​(DetailAST ast)
        Collects validation details for LITERAL_TRY, LITERAL_CATCH, and LITERAL_FINALLY.
        Parameters:
        ast - a DetailAST value
        Returns:
        object containing all details to make a validation
      • getDetailsForIfElse

        private static RightCurlyCheck.Details getDetailsForIfElse​(DetailAST ast)
        Collects validation details for LITERAL_IF and LITERAL_ELSE.
        Parameters:
        ast - a DetailAST value
        Returns:
        object containing all details to make a validation
      • getDetailsForOthers

        private static RightCurlyCheck.Details getDetailsForOthers​(DetailAST ast)
        Collects validation details for CLASS_DEF, RECORD_DEF, METHOD DEF, CTOR_DEF, STATIC_INIT, INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF, and COMPACT_CTOR_DEF.
        Parameters:
        ast - a DetailAST value
        Returns:
        an object containing all details to make a validation
      • isTokenWithNoChildSlist

        private static boolean isTokenWithNoChildSlist​(int tokenType)
        Tests whether the provided tokenType will never have a SLIST as child in its AST. Like CLASS_DEF, ANNOTATION_DEF etc.
        Parameters:
        tokenType - the tokenType to test against.
        Returns:
        weather provided tokenType is definition token.
      • getDetailsForLoops

        private static RightCurlyCheck.Details getDetailsForLoops​(DetailAST ast)
        Collects validation details for loops' tokens.
        Parameters:
        ast - a DetailAST value
        Returns:
        an object containing all details to make a validation
      • getNextToken

        private static DetailAST getNextToken​(DetailAST ast)
        Finds next token after the given one.
        Parameters:
        ast - the given node.
        Returns:
        the token which represents next lexical item.