Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Commit

Permalink
更新 Analysis API(4/?) 包含错误...
Browse files Browse the repository at this point in the history
  • Loading branch information
weg2022 committed Jul 18, 2023
1 parent a12c8c3 commit 5f50fa3
Show file tree
Hide file tree
Showing 68 changed files with 18,533 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
package com.apkide.analysis.api.cle;

import com.apkide.analysis.api.clm.SyntaxTree;
import com.apkide.analysis.api.clm.Type;
import com.apkide.analysis.api.clm.excpetions.UnknownEntityException;
import com.apkide.common.collections.SetOfInt;

public interface CodeAnalyzer {
Type analyzeTypeName(SyntaxTree ast, int var2, int var3, String name) throws UnknownEntityException;

void analyzeImports(SyntaxTree ast);

void analyzeEveryIdentifiers(SyntaxTree ast, SetOfInt identifiers);

void analyzeEveryIdentifier(SyntaxTree ast, int identifier);

void analyzeNode(SyntaxTree ast, int node);

void analyzeNodeWithValues(SyntaxTree ast, int node);

void analyzeNamesAndTypes(SyntaxTree ast);

void analyzeErrors(SyntaxTree ast);
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.apkide.analysis.api.cle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import java.io.IOException;
import java.io.Reader;
Expand All @@ -18,14 +19,19 @@ public interface CodeModel {

void update();


boolean isArchiveReader();
boolean isSupportsFileArchives();

long getArchiveVersion(String filePath);

Reader getArchiveEntryReader(String filePath,String entryName,String encoding)throws IOException;

String[] getArchiveEntries(String filePath);
String[] getArchiveEntries(String filePath)throws IOException;

void close();

@Nullable
Compiler getCompiler();

@Nullable
Preprocessor getPreprocessor();
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,42 @@
package com.apkide.analysis.api.cle;

import com.apkide.analysis.api.clm.ClassType;
import com.apkide.analysis.api.clm.Entity;
import com.apkide.analysis.api.clm.Namespace;
import com.apkide.analysis.api.clm.SyntaxTree;
import com.apkide.analysis.api.clm.Type;
import com.apkide.analysis.api.clm.Variable;
import com.apkide.analysis.api.clm.collections.MapOf;
import com.apkide.analysis.api.clm.collections.SetOf;

public interface CodeRenderer {
String renderParameter(String typeName, String identifier);

String renderTypeName(SyntaxTree ast, int line, int column, Type type);

String renderDefaultValueString(Type type);

String renderStaticImports(SyntaxTree ast, MapOf<ClassType, Entity> imports);

String renderFileNamespace(Namespace namespace);

String renderClassNamespaceStart(Namespace namespace);

String renderClassNamespaceEnd(Namespace namespace);

String renderImports(SyntaxTree ast, MapOf<ClassType, Entity> imports);

String renderImports(SyntaxTree ast, int line, int column, SetOf<? extends Type> imports);

String renderImports(SyntaxTree ast, int line, int column, SetOf<? extends Type> imports, SetOf<Entity> set);

String getModifierString(int modifier);

String getHTMLString(Variable variable);

String getNameString(Entity entity);

String getFullyQualifiedNameString(Entity entity);

String getHTMLString(Entity entity);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
package com.apkide.analysis.api.cle;

import com.apkide.analysis.api.clm.SyntaxTree;

public interface Compiler {
void compile(SyntaxTree ast, boolean createDebugMetadata);
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public interface Language {
TypeSystem getTypeSystem();

@Nullable
CodeRenderer getCodeRenderer();
CodeRenderer getRenderer();

@Nullable
CodeAnalyzer getCodeAnalyzer();
CodeAnalyzer getAnalyzer();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.apkide.analysis.api.cle;

import com.apkide.analysis.api.clm.FileEntry;
import com.apkide.analysis.api.clm.SyntaxTree;

import java.io.Reader;

public interface Preprocessor {
char POS_ESCAPE_CHAR = '\uFFEE';

void processVersion(FileEntry fileEntry);

Reader process(FileEntry fileEntry, Reader reader, SyntaxTree ast);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
package com.apkide.analysis.api.cle;

import com.apkide.analysis.api.clm.ClassType;
import com.apkide.analysis.api.clm.FileEntry;
import com.apkide.analysis.api.clm.Member;
import com.apkide.analysis.api.clm.SyntaxTree;

public interface SignatureAnalyzer {
long getDeclarationDigest(SyntaxTree ast);

long getPublicDeclarationDigest(SyntaxTree ast);

long getClassDeclarationDigest(SyntaxTree ast);

void doLoadNamespaces(FileEntry fileEntry);

void doLoadPositions(FileEntry fileEntry);

void doLoadTypes(FileEntry fileEntry);

void doLoadSyntax(FileEntry fileEntry);

void doLoadSuperClassTypes(FileEntry fileEntry, ClassType classtype);

void doLoadDefaultSuperClassTypes(FileEntry fileEntry, ClassType classtype);

void doLoadBoundTypes(FileEntry fileEntry, ClassType classtype);

void doLoadSuperTypes(FileEntry fileEntry, ClassType classtype);

void doLoadConstantValueOfField(FileEntry fileEntry, Member member);
}
99 changes: 99 additions & 0 deletions analysis-api/src/main/java/com/apkide/analysis/api/cle/Syntax.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,103 @@
package com.apkide.analysis.api.cle;

import com.apkide.analysis.api.clm.SyntaxTree;
import com.apkide.common.collections.ListOfInt;

public interface Syntax {

boolean isParameters(int syntaxTag);

boolean isMethodDeclaration(int syntaxTag);

boolean isFieldDeclaration(int syntaxTag);

boolean isArguments(int syntaxTag);

boolean isClassBody(int syntaxTag);

boolean isBlock(int syntaxTag);

boolean isIdentifier(int syntaxTag);

boolean isExpression(int syntaxTag);

boolean isStatement(int syntaxTag);

boolean isMemberDeclaration(int syntaxTag);

boolean isClassDeclaration(int syntaxTag);

boolean isLiteral(int syntaxTag);

boolean isToken(int syntaxTag);

int getOperator(int syntaxTag);

int getOperatorPriority(int syntaxTag);

String getString(int syntaxTag);

int getTokenLength(int syntaxTag);

int getIdentifierForKeyword(int syntaxTag);

boolean hasAttrVariableSlot(int syntaxTag);

boolean hasAttrDAIndex(int syntaxTag);

boolean hasAttrTarget(int syntaxTag);

boolean hasAttrType(int syntaxTag);

boolean hasAttrValue(int syntaxTag);

boolean isDeclarationIdentifierNode(SyntaxTree ast, int node);

boolean isPublicSignatureIdentifierNode(SyntaxTree ast, int node);

boolean isNonQualifiedTypeIdentifierNode(SyntaxTree ast, int node);

boolean isQualifiedTypeIdentifierNode(SyntaxTree ast, int node);

int getQualifiedTypeIdentifierNode(SyntaxTree ast, int node);

int getTypeIdentifierNodeArgumentCount(SyntaxTree ast, int node);

boolean isFieldIdentifierNode(SyntaxTree ast, int node);

boolean isAssignedExpressionNode(SyntaxTree ast, int node);

boolean isChangedExpressionNode(SyntaxTree ast, int node);

int getParameterNodeOfParametersNode(SyntaxTree ast, int node, int i);

int getLeftParenNodeOfParametersNode(SyntaxTree ast, int node);

int getRightParenNodeOfParametersNode(SyntaxTree ast, int node);

int getArgumentNodeOfArgumentsNode(SyntaxTree ast, int node, int i);

int getArgumentCountOfArgumentsNode(SyntaxTree ast, int node);

int getLeftParenNodeOfArgumentsNode(SyntaxTree ast, int node);

int getRightParenNodeOfArgumentsNode(SyntaxTree ast, int node);

ListOfInt getNamespaceNodePairs(SyntaxTree ast);

ListOfInt getImportNodePairs(SyntaxTree ast);

int getImportStartLine(SyntaxTree ast);

int getImportStartColumn(SyntaxTree ast);

int getImportEndLine(SyntaxTree ast);

int getImportEndColumn(SyntaxTree ast);

String getHTMLDocCommentString(SyntaxTree ast, int node);

boolean hasHTMLDocCommentString(SyntaxTree ast, int node);

String getRawDocCommentString(SyntaxTree ast, int node);
}
45 changes: 45 additions & 0 deletions analysis-api/src/main/java/com/apkide/analysis/api/cle/Tools.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,49 @@
package com.apkide.analysis.api.cle;

import com.apkide.analysis.api.clm.Entity;
import com.apkide.analysis.api.clm.FileEntry;
import com.apkide.analysis.api.clm.Member;
import com.apkide.analysis.api.clm.Type;

public interface Tools {
boolean isHighlighted();

void requestParameterList(FileEntry fileEntry, int line, int column);

void requestCompletionList(FileEntry fileEntry, int line, int column);

void requestClassesCompletionList(FileEntry fileEntry);

void requestSuperMethodsCompletionList(FileEntry fileEntry, int line, int column);

void documentize(FileEntry fileEntry, int line, int column);

void documentize(FileEntry fileEntry);

void surroundWithTryCatch(FileEntry fileEntry, int startLine, int startColumn, int endLine, int endColumn);

void addThrows(FileEntry fileEntry, int line, int column);

void safeDelete(Entity entity);

void createVariable(FileEntry fileEntry, int line, int column, int identifier, Type type);

void createField(FileEntry fileEntry, int line, int column, int modifiers, int identifier, Type type);

void createMethod(FileEntry fileEntry, int line, int column, int modifiers, int identifier, Type type, int[] argModifiers, Type[] argTypes, int[] argNames);

void inlineVariable(FileEntry fileEntry,int line, int column);

void createSettersAndGetters(FileEntry fileEntry, int startLine, int startColumn, int endLine, int endColumn);

void createConstructor(FileEntry fileEntry, int startLine, int startColumn, int endLine, int endColumn);

void extractMethod(FileEntry fileEntry, int startLine, int startColumn, int endLine, int endColumn);

void implementMembers(FileEntry fileEntry, int line, int column);

void overrideMember(FileEntry fileEntry, int line, int column, Member member);

void introduceVariable(FileEntry fileEntry, int startLine, int startColumn, int endLine, int endColumn);

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,33 @@
package com.apkide.analysis.api.cle;

import com.apkide.analysis.api.clm.ClassType;
import com.apkide.analysis.api.clm.FileEntry;
import com.apkide.analysis.api.clm.Namespace;
import com.apkide.analysis.api.clm.Type;
import com.apkide.analysis.api.clm.excpetions.UnknownEntityException;

public interface TypeSystem {
boolean hasTypeparametersOfEnclosingClasstype();

boolean inheritsBoundTypes();

boolean supportsGenericTypeNameResolving();

boolean supportsMethodParametertypeVariables();

Type getConditionalOperationType(FileEntry fileEntry, Type type1, Type type2) throws UnknownEntityException;

Type getBinaryNumericOperationType(FileEntry fileEntry, int operator, Type type1, Type type2) throws UnknownEntityException;

boolean isImplicitConversion(FileEntry fileEntry, Type type1, Type type2);

boolean isExplicitConversion(FileEntry fileEntry, Type type1, Type type2);

int getTypeSemanticForClasstype(Namespace namespace, int identifier);

int getTypeSemanticForPrimitivetype(int number);

ClassType getRootClasstype(FileEntry fileEntry) throws UnknownEntityException;

ClassType getArraySuperClasstype(FileEntry fileEntry) throws UnknownEntityException;
}
Loading

0 comments on commit 5f50fa3

Please sign in to comment.