Exemple #1
0
 def enterPackageDeclaration(
         self, ctx: JavaParserLabeled.PackageDeclarationContext):
     if ctx.qualifiedName().IDENTIFIER()[-1].getText() not in packages:
         packages.append(ctx.qualifiedName().IDENTIFIER()[-1].getText())
         print("package",
               ctx.qualifiedName().IDENTIFIER()[-1].getText(),
               "added to list")
Exemple #2
0
 def enterPackageDeclaration(self, ctx: JavaParserLabeled.PackageDeclarationContext):
     if self.package_identifier == ctx.qualifiedName().IDENTIFIER()[-1].getText():
         if self.package_new_name not in self.packages_name:
             self.token_stream_rewriter.replaceIndex(
                 index=ctx.qualifiedName().start.tokenIndex + (2 * len(ctx.qualifiedName().IDENTIFIER()) - 2),
                 text=self.package_new_name)
             print("package changed")
Exemple #3
0
 def enterPackageDeclaration(
         self, ctx: JavaParserLabeled.PackageDeclarationContext):
     self.in_some_package = True
     if self.package_identifier is not None:
         print(ctx.qualifiedName())
         print(ctx.getText())
         if self.package_identifier == ctx.qualifiedName().getText():
             self.in_selected_package = True
             print("Package Found")
Exemple #4
0
 def enterPackageDeclaration(
         self, ctx: JavaParserLabeled.PackageDeclarationContext):
     package_name = ctx.getText()[7:-1]
     print(package_name)
     if package_name != self.source_package:
         raise ValueError(
             f"The package {package_name} in the file isn't equal to the source package!"
         )
Exemple #5
0
 def enterPackageDeclaration(
         self, ctx: JavaParserLabeled.PackageDeclarationContext):
     self.current_package = ctx.qualifiedName().getText()
Exemple #6
0
 def enterPackageDeclaration(
         self, ctx: JavaParserLabeled.PackageDeclarationContext):
     if self.package_name == ctx.qualifiedName().getText():
         self.in_selected_package = True
     else:
         self.in_selected_package = False
Exemple #7
0
 def enterPackageDeclaration(
         self, ctx: JavaParserLabeled.PackageDeclarationContext):
     if self.package_name == ctx.qualifiedName().getText():
         self.has_access_to_class = True
Exemple #8
0
 def enterPackageDeclaration(
         self, ctx: JavaParserLabeled.PackageDeclarationContext):
     if self.target_package in ctx.getText():
         self.detected_package = True
     self.import_end = ctx.stop
Exemple #9
0
 def enterPackageDeclaration(
         self, ctx: JavaParserLabeled.PackageDeclarationContext):
     if self.package_identifier == ctx.qualifiedName().getText():
         self.in_selected_package = True
         print("Package " + self.package_identifier + " Found")
Exemple #10
0
 def enterPackageDeclaration(
         self, ctx: JavaParserLabeled.PackageDeclarationContext):
     if ctx.qualifiedName() and not self.package_name:
         self.package_name = ctx.qualifiedName().getText()
         self.code += f"package {self.package_name};{self.NEW_LINE}"
Exemple #11
0
 def enterPackageDeclaration(
         self, ctx: JavaParserLabeled.PackageDeclarationContext):
     self.interface_info['package'] = ctx.qualifiedName().getText()
Exemple #12
0
 def enterPackageDeclaration(
         self, ctx: JavaParserLabeled.PackageDeclarationContext):
     if self.target_package is None or is_equivalent(
             ctx.qualifiedName().getText(), self.target_package):
         self.is_in_target_package = True