feat: rename codefile to codecontainer for c#

上级 d06f9ee5
......@@ -66,7 +66,7 @@ func AnalysisGo() []core_domain.CodeDataStruct {
}
func CommentAnalysis(path string, app app_concept.AbstractAnalysisApp, filter func(path string) bool, isFunctionBase bool) []core_domain.CodeDataStruct {
var results []core_domain.CodeFile
var results []core_domain.CodeContainer
files := cocafile.GetFilesWithFilter(path, filter)
var codeMembers []core_domain.CodeMember
......@@ -103,7 +103,7 @@ func CommentAnalysis(path string, app app_concept.AbstractAnalysisApp, filter fu
return ds
}
func BuildMethodDs(result core_domain.CodeFile) []core_domain.CodeDataStruct {
func BuildMethodDs(result core_domain.CodeContainer) []core_domain.CodeDataStruct {
var methodsDs []core_domain.CodeDataStruct
for _, member := range result.Members {
for _, node := range member.FunctionNodes {
......
此差异已折叠。
此差异已折叠。
BREAK=1
DEFAULT=2
FUNC=3
INTERFACE=4
SELECT=5
CASE=6
DEFER=7
GO=8
MAP=9
STRUCT=10
CHAN=11
ELSE=12
GOTO=13
PACKAGE=14
SWITCH=15
CONST=16
FALLTHROUGH=17
IF=18
RANGE=19
TYPE=20
CONTINUE=21
FOR=22
IMPORT=23
RETURN=24
VAR=25
NIL_LIT=26
IDENTIFIER=27
L_PAREN=28
R_PAREN=29
L_CURLY=30
R_CURLY=31
L_BRACKET=32
R_BRACKET=33
ASSIGN=34
COMMA=35
SEMI=36
COLON=37
DOT=38
PLUS_PLUS=39
MINUS_MINUS=40
DECLARE_ASSIGN=41
ELLIPSIS=42
LOGICAL_OR=43
LOGICAL_AND=44
EQUALS=45
NOT_EQUALS=46
LESS=47
LESS_OR_EQUALS=48
GREATER=49
GREATER_OR_EQUALS=50
OR=51
DIV=52
MOD=53
LSHIFT=54
RSHIFT=55
BIT_CLEAR=56
EXCLAMATION=57
PLUS=58
MINUS=59
CARET=60
STAR=61
AMPERSAND=62
RECEIVE=63
DECIMAL_LIT=64
OCTAL_LIT=65
HEX_LIT=66
FLOAT_LIT=67
IMAGINARY_LIT=68
RUNE_LIT=69
RAW_STRING_LIT=70
INTERPRETED_STRING_LIT=71
WS=72
COMMENT=73
TERMINATOR=74
LINE_COMMENT=75
'break'=1
'default'=2
'func'=3
'interface'=4
'select'=5
'case'=6
'defer'=7
'go'=8
'map'=9
'struct'=10
'chan'=11
'else'=12
'goto'=13
'package'=14
'switch'=15
'const'=16
'fallthrough'=17
'if'=18
'range'=19
'type'=20
'continue'=21
'for'=22
'import'=23
'return'=24
'var'=25
'nil'=26
'('=28
')'=29
'{'=30
'}'=31
'['=32
']'=33
'='=34
','=35
';'=36
':'=37
'.'=38
'++'=39
'--'=40
':='=41
'...'=42
'||'=43
'&&'=44
'=='=45
'!='=46
'<'=47
'<='=48
'>'=49
'>='=50
'|'=51
'/'=52
'%'=53
'<<'=54
'>>'=55
'&^'=56
'!'=57
'+'=58
'-'=59
'^'=60
'*'=61
'&'=62
'<-'=63
......@@ -3,7 +3,7 @@ package app_concept
import "github.com/phodal/coca/pkg/domain/core_domain"
type AbstractAnalysisApp interface {
Analysis(code string, path string) core_domain.CodeFile
Analysis(code string, path string) core_domain.CodeContainer
IdentAnalysis(s string, file string) []core_domain.CodeMember
SetExtensions(extension interface{})
AnalysisPackageManager(path string) core_domain.CodePackageManagerInfo
......
......@@ -29,7 +29,7 @@ func (g *GoIdentApp) AnalysisPackageManager(path string) core_domain.CodePackage
return *pmInfo
}
func (g *GoIdentApp) Analysis(code string, fileName string) core_domain.CodeFile {
func (g *GoIdentApp) Analysis(code string, fileName string) core_domain.CodeContainer {
parser := ast_go.NewCocagoParser()
var codeMembers []core_domain.CodeMember
if g.Extensions != nil {
......
......@@ -26,7 +26,7 @@ func (p *PythonIdentApp) AnalysisPackageManager(path string) core_domain.CodePac
return core_domain.CodePackageManagerInfo{}
}
func (p *PythonIdentApp) Analysis(code string, fileName string) core_domain.CodeFile {
func (p *PythonIdentApp) Analysis(code string, fileName string) core_domain.CodeContainer {
scriptParser := ProcessPythonString(code)
context := scriptParser.Root()
......
......@@ -26,7 +26,7 @@ func (t *TypeScriptIdentApp) AnalysisPackageManager(path string) core_domain.Cod
return core_domain.CodePackageManagerInfo{}
}
func (t *TypeScriptIdentApp) Analysis(code string, fileName string) core_domain.CodeFile {
func (t *TypeScriptIdentApp) Analysis(code string, fileName string) core_domain.CodeContainer {
scriptParser := ProcessTsString(code)
context := scriptParser.Program()
......
package core_domain
type CodeFile struct {
type CodeContainer struct {
FullName string
PackageName string
Imports []CodeImport
Members []CodeMember
DataStructures []CodeDataStruct
Fields []CodeField
Containers []CodeContainer
}
......@@ -3,7 +3,7 @@ package core_domain
type CodePackage struct {
Name string
ID string
CodeFiles []CodeFile
CodeFiles []CodeContainer
Extension interface{}
}
......
......@@ -75,7 +75,7 @@ func getStarExprName(starExpr ast.StarExpr) string {
}
}
func BuildFunction(x *ast.FuncDecl, file *CodeFile) *CodeFunction {
func BuildFunction(x *ast.FuncDecl, file *CodeContainer) *CodeFunction {
codeFunc := &CodeFunction{
Name: x.Name.String(),
}
......
......@@ -41,7 +41,7 @@ func (n *CocagoParser) SetOutput(out io.Writer) io.Writer {
return output
}
func (n *CocagoParser) ProcessFile(fileName string) core_domain.CodeFile {
func (n *CocagoParser) ProcessFile(fileName string) core_domain.CodeContainer {
absPath, _ := filepath.Abs(fileName)
content, _ := ioutil.ReadFile(absPath)
......@@ -53,7 +53,7 @@ func (n *CocagoParser) ProcessFile(fileName string) core_domain.CodeFile {
return *codeFile
}
func (n *CocagoParser) ProcessString(code string, fileName string, codeMembers []core_domain.CodeMember) *core_domain.CodeFile {
func (n *CocagoParser) ProcessString(code string, fileName string, codeMembers []core_domain.CodeMember) *core_domain.CodeContainer {
identCodeMembers = codeMembers
n.CodeMembers = codeMembers
fset := token.NewFileSet()
......@@ -67,7 +67,7 @@ func (n *CocagoParser) ProcessString(code string, fileName string, codeMembers [
return codeFile
}
func (n *CocagoParser) IdentAnalysis(code string, fileName string) *core_domain.CodeFile {
func (n *CocagoParser) IdentAnalysis(code string, fileName string) *core_domain.CodeContainer {
fset := token.NewFileSet()
f, err := parser.ParseFile(fset, fileName, code, 0)
if err != nil {
......@@ -78,9 +78,9 @@ func (n *CocagoParser) IdentAnalysis(code string, fileName string) *core_domain.
return codeFile
}
func (n *CocagoParser) Visitor(f *ast.File, fset *token.FileSet, fileName string) *core_domain.CodeFile {
func (n *CocagoParser) Visitor(f *ast.File, fset *token.FileSet, fileName string) *core_domain.CodeContainer {
var currentStruct core_domain.CodeDataStruct
var currentFile core_domain.CodeFile
var currentFile core_domain.CodeContainer
var currentFunc *core_domain.CodeFunction
var dsMap = make(map[string]*core_domain.CodeDataStruct)
......@@ -213,7 +213,7 @@ func BuildImportName(fileName string) string {
return importName
}
func AddInterface(x *ast.InterfaceType, ident string, codeFile *core_domain.CodeFile) core_domain.CodeDataStruct {
func AddInterface(x *ast.InterfaceType, ident string, codeFile *core_domain.CodeContainer) core_domain.CodeDataStruct {
properties := BuildFieldToProperty(x.Methods.List)
dataStruct := core_domain.CodeDataStruct{
......@@ -231,7 +231,7 @@ func AddInterface(x *ast.InterfaceType, ident string, codeFile *core_domain.Code
return dataStruct
}
func setMemberPackageInfo(member *core_domain.CodeMember, codeFile *core_domain.CodeFile) {
func setMemberPackageInfo(member *core_domain.CodeMember, codeFile *core_domain.CodeContainer) {
member.AliasPackage = codeFile.PackageName
member.FileID = codeFile.FullName
member.BuildMemberId()
......@@ -241,7 +241,7 @@ func AddNestedFunction(currentFunc *core_domain.CodeFunction, x *ast.FuncType) {
}
func AddFunctionDecl(x *ast.FuncDecl, currentFile *core_domain.CodeFile) (*core_domain.CodeFunction, string) {
func AddFunctionDecl(x *ast.FuncDecl, currentFile *core_domain.CodeContainer) (*core_domain.CodeFunction, string) {
recv := ""
if x.Recv != nil {
recv = BuildReceiver(x, recv)
......@@ -329,7 +329,7 @@ func getFieldName(field *ast.Field) string {
return field.Names[0].Name
}
func AddStructType(currentNodeName string, x *ast.StructType, currentFile *core_domain.CodeFile, dsMap map[string]*core_domain.CodeDataStruct) {
func AddStructType(currentNodeName string, x *ast.StructType, currentFile *core_domain.CodeContainer, dsMap map[string]*core_domain.CodeDataStruct) {
member := core_domain.NewCodeMember()
member.DataStructID = currentNodeName
member.Type = "struct"
......
{
"Containers": null,
"DataStructures": null,
"Fields": null,
"FullName": "testdata.method_call",
......
{
"Containers": null,
"DataStructures": null,
"Fields": null,
"FullName": "testdata.method_call",
......
{
"Containers": null,
"DataStructures": [
{
"Annotations": null,
......
{
"Containers": null,
"DataStructures": [
{
"Annotations": null,
......
{
"Containers": null,
"DataStructures": null,
"Fields": null,
"FullName": "testdata.node_infos",
......
{
"Containers": null,
"DataStructures": null,
"Fields": null,
"FullName": "testdata.node_infos",
......
{
"Containers": null,
"DataStructures": null,
"Fields": null,
"FullName": "testdata.node_infos",
......
{
"Containers": null,
"DataStructures": [
{
"Annotations": null,
......
{
"Containers": null,
"DataStructures": [
{
"Annotations": null,
......
{
"Containers": null,
"DataStructures": [
{
"Annotations": null,
......
......@@ -15,14 +15,14 @@ type PythonIdentListener struct {
parser.BasePythonParserListener
}
var currentCodeFile *core_domain.CodeFile
var currentCodeFile *core_domain.CodeContainer
var currentDataStruct *core_domain.CodeDataStruct
var debug = false
var output io.Writer
var hasEnterMember = false
func NewPythonIdentListener(fileName string) *PythonIdentListener {
currentCodeFile = &core_domain.CodeFile{}
currentCodeFile = &core_domain.CodeContainer{}
currentCodeFile.FullName = fileName
output = os.Stdout
......@@ -165,6 +165,6 @@ func BuildArgList(context *parser.ArglistContext) []core_domain.AnnotationKeyVal
return arguments
}
func (s *PythonIdentListener) GetCodeFileInfo() core_domain.CodeFile {
func (s *PythonIdentListener) GetCodeFileInfo() core_domain.CodeContainer {
return *currentCodeFile
}
......@@ -15,7 +15,7 @@ type TypeScriptIdentListener struct {
dataStructures []core_domain.CodeDataStruct
dataStructQueue []core_domain.CodeDataStruct
filePath string
codeFile core_domain.CodeFile
codeFile core_domain.CodeContainer
parser.BaseTypeScriptParserListener
}
......@@ -26,7 +26,7 @@ func NewTypeScriptIdentListener(fileName string) *TypeScriptIdentListener {
return listener
}
func (s *TypeScriptIdentListener) GetNodeInfo() core_domain.CodeFile {
func (s *TypeScriptIdentListener) GetNodeInfo() core_domain.CodeContainer {
isScriptCalls := s.currentDataStruct != nil && s.currentDataStruct.IsNotEmpty()
if isScriptCalls {
if len(s.currentDataStruct.Functions) < 1 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册