Example #1
0
 def enterClassDeclaration(self, ctx: JavaParserLabeled.ClassDeclarationContext):
     if ctx.IDENTIFIER().getText() == self.class_name:
         self.implement_token_index = ctx.IDENTIFIER().symbol.tokenIndex
         if ctx.EXTENDS() is not None:
             self.implement_state.append(ctx.EXTENDS().getText())
             self.implement_token_index = ctx.typeType().stop.tokenIndex
         if ctx.IMPLEMENTS() is not None:
             self.implement_state.append(ctx.IMPLEMENTS().getText())
             self.implement_token_index = ctx.typeList().typeType()[-1].stop.tokenIndex
Example #2
0
    def enterClassDeclaration(self, ctx: JavaParserLabeled.ClassDeclarationContext):
        if ctx.IDENTIFIER().getText() == self.SuperClass_identifier:
            self.InSuperClass = True
        elif ctx.IDENTIFIER().getText() in self.SubClass_identifier:
            self.InSubClass = True
        elif ctx.IDENTIFIER().getText() == "Main":
            self.InMainClass = True

        if ctx.EXTENDS().__str__() == "extends":
            # SubClass Headers Rename
            self.token_stream_rewriter.insertAfter(ctx.start.tokenIndex + 4, "implements")
            self.token_stream_rewriter.deleteIndex(ctx.start.tokenIndex + 4)