vcode-analysis 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- analyzers/__init__.py +24 -0
- analyzers/architecture.py +510 -0
- analyzers/code_review.py +150 -0
- analyzers/directory.py +867 -0
- analyzers/documentation.py +209 -0
- analyzers/security.py +671 -0
- core/__init__.py +17 -0
- core/analyzer.py +207 -0
- core/config.py +166 -0
- core/git_handler.py +718 -0
- core/llm_client.py +186 -0
- parsers/__init__.py +209 -0
- parsers/c/__init__.py +57 -0
- parsers/c/ast_parser.py +424 -0
- parsers/c/models.py +211 -0
- parsers/c/patterns.py +143 -0
- parsers/c/regex_parser.py +594 -0
- parsers/c_parser.py +275 -0
- parsers/java_parser.py +430 -0
- parsers/javascript_parser.py +587 -0
- parsers/kotlin/__init__.py +61 -0
- parsers/kotlin/ast_parser.py +591 -0
- parsers/kotlin/models.py +274 -0
- parsers/kotlin/patterns.py +146 -0
- parsers/kotlin/regex_parser.py +906 -0
- parsers/kotlin_parser.py +279 -0
- parsers/python_parser.py +429 -0
- parsers/typescript_parser.py +381 -0
- vcode_analysis-0.1.0.dist-info/METADATA +246 -0
- vcode_analysis-0.1.0.dist-info/RECORD +34 -0
- vcode_analysis-0.1.0.dist-info/WHEEL +5 -0
- vcode_analysis-0.1.0.dist-info/entry_points.txt +2 -0
- vcode_analysis-0.1.0.dist-info/licenses/LICENSE +21 -0
- vcode_analysis-0.1.0.dist-info/top_level.txt +3 -0
parsers/c/patterns.py
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"""C 语言正则表达式模式定义
|
|
2
|
+
|
|
3
|
+
定义用于快速解析 C 代码的正则表达式模式。
|
|
4
|
+
支持 C89/C90 标准。
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
# 基础模式
|
|
8
|
+
C_PATTERNS = {
|
|
9
|
+
# ==================== 预处理器指令 ====================
|
|
10
|
+
|
|
11
|
+
# #include 指令
|
|
12
|
+
"include_angle": r'#include\s*<([^>]+)>', # #include <stdio.h>
|
|
13
|
+
"include_quote": r'#include\s*"([^"]+)"', # #include "myheader.h"
|
|
14
|
+
|
|
15
|
+
# #define 宏定义
|
|
16
|
+
"define_object": r'#define\s+(\w+)(?:\s+(.+?))?$', # #define PI 3.14
|
|
17
|
+
"define_function": r'#define\s+(\w+)\s*\(([^)]*)\)\s*(.*)$', # #define MAX(a,b) ((a)>(b)?(a):(b))
|
|
18
|
+
|
|
19
|
+
# 条件编译
|
|
20
|
+
"ifdef": r'#ifdef\s+(\w+)',
|
|
21
|
+
"ifndef": r'#ifndef\s+(\w+)',
|
|
22
|
+
"if_defined": r'#if\s+(?:defined\s*\(\s*(\w+)\s*\)|defined\s+(\w+))',
|
|
23
|
+
"endif": r'#endif',
|
|
24
|
+
"else": r'#else',
|
|
25
|
+
"elif": r'#elif',
|
|
26
|
+
|
|
27
|
+
# #pragma
|
|
28
|
+
"pragma": r'#pragma\s+(.+)$',
|
|
29
|
+
|
|
30
|
+
# #undef
|
|
31
|
+
"undef": r'#undef\s+(\w+)',
|
|
32
|
+
|
|
33
|
+
# ==================== 函数定义 ====================
|
|
34
|
+
|
|
35
|
+
# 函数声明/定义
|
|
36
|
+
"function_declaration": r'(?:^|\n)\s*(?:(static|inline|extern)\s+)?'
|
|
37
|
+
r'(\w+(?:\s*\*)*)\s+' # 返回类型
|
|
38
|
+
r'(\w+)\s*' # 函数名
|
|
39
|
+
r'\(([^)]*)\)\s*' # 参数
|
|
40
|
+
r'(?:;|\{)', # 声明结束或定义开始
|
|
41
|
+
|
|
42
|
+
# 函数原型
|
|
43
|
+
"function_prototype": r'(?:^|\n)\s*(?:(static|inline|extern)\s+)?'
|
|
44
|
+
r'(\w+(?:\s*\*)*)\s+'
|
|
45
|
+
r'(\w+)\s*'
|
|
46
|
+
r'\(([^)]*)\)\s*;',
|
|
47
|
+
|
|
48
|
+
# ==================== 变量声明 ====================
|
|
49
|
+
|
|
50
|
+
# 全局变量
|
|
51
|
+
"global_variable": r'(?:^|\n)\s*(?:(extern|static|const|volatile)\s+)*'
|
|
52
|
+
r'(\w+(?:\s*\*)*)\s+' # 类型
|
|
53
|
+
r'(\w+)' # 变量名
|
|
54
|
+
r'(?:\s*\[([^\]]*)\])?' # 可选数组大小
|
|
55
|
+
r'(?:\s*=\s*([^;]+))?\s*;', # 可选初始化
|
|
56
|
+
|
|
57
|
+
# ==================== 结构体/联合体 ====================
|
|
58
|
+
|
|
59
|
+
# 结构体定义
|
|
60
|
+
"struct_definition": r'struct\s+(\w*)\s*\{([^}]*?)\}\s*(?:\w+\s*)?;',
|
|
61
|
+
|
|
62
|
+
# 结构体声明
|
|
63
|
+
"struct_declaration": r'struct\s+(\w+)\s*(\w+)\s*;',
|
|
64
|
+
|
|
65
|
+
# 联合体定义
|
|
66
|
+
"union_definition": r'union\s+(\w*)\s*\{([^}]*?)\}\s*(?:\w+\s*)?;',
|
|
67
|
+
|
|
68
|
+
# ==================== 枚举 ====================
|
|
69
|
+
|
|
70
|
+
# 枚举定义
|
|
71
|
+
"enum_definition": r'enum\s+(\w*)\s*\{([^}]*?)\}\s*(?:\w+\s*)?;',
|
|
72
|
+
|
|
73
|
+
# 枚举成员
|
|
74
|
+
"enum_member": r'(\w+)(?:\s*=\s*([^,]+))?',
|
|
75
|
+
|
|
76
|
+
# ==================== typedef ====================
|
|
77
|
+
|
|
78
|
+
# typedef 基本类型
|
|
79
|
+
"typedef_basic": r'typedef\s+(?:const\s+)?(\w+(?:\s*\*)*)\s+(\w+)\s*;',
|
|
80
|
+
|
|
81
|
+
# typedef 结构体
|
|
82
|
+
"typedef_struct": r'typedef\s+struct\s+(\w*)\s*\{([^}]*?)\}\s*(\w+)\s*;',
|
|
83
|
+
|
|
84
|
+
# typedef 联合体
|
|
85
|
+
"typedef_union": r'typedef\s+union\s+(\w*)\s*\{([^}]*?)\}\s*(\w+)\s*;',
|
|
86
|
+
|
|
87
|
+
# typedef 枚举
|
|
88
|
+
"typedef_enum": r'typedef\s+enum\s+(\w*)\s*\{([^}]*?)\}\s*(\w+)\s*;',
|
|
89
|
+
|
|
90
|
+
# typedef 函数指针
|
|
91
|
+
"typedef_function_pointer": r'typedef\s+(\w+(?:\s*\*)*)\s*\(\s*\*\s*(\w+)\s*\)\s*\(([^)]*)\)\s*;',
|
|
92
|
+
|
|
93
|
+
# ==================== 函数指针 ====================
|
|
94
|
+
|
|
95
|
+
# 函数指针变量
|
|
96
|
+
"function_pointer": r'(\w+(?:\s*\*)*)\s*\(\s*\*\s*(\w+)\s*\)\s*\(([^)]*)\)',
|
|
97
|
+
|
|
98
|
+
# ==================== 注释 ====================
|
|
99
|
+
|
|
100
|
+
# 单行注释
|
|
101
|
+
"single_line_comment": r'//.*$',
|
|
102
|
+
|
|
103
|
+
# 多行注释
|
|
104
|
+
"multi_line_comment": r'/\*[\s\S]*?\*/',
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
# C 关键字列表
|
|
108
|
+
C_KEYWORDS = {
|
|
109
|
+
# 存储类说明符
|
|
110
|
+
'auto', 'register', 'static', 'extern', 'typedef',
|
|
111
|
+
|
|
112
|
+
# 类型说明符
|
|
113
|
+
'void', 'char', 'short', 'int', 'long', 'float', 'double',
|
|
114
|
+
'signed', 'unsigned', 'struct', 'union', 'enum',
|
|
115
|
+
|
|
116
|
+
# 类型限定符
|
|
117
|
+
'const', 'volatile',
|
|
118
|
+
|
|
119
|
+
# 控制语句
|
|
120
|
+
'if', 'else', 'switch', 'case', 'default',
|
|
121
|
+
'for', 'while', 'do', 'break', 'continue', 'goto', 'return',
|
|
122
|
+
|
|
123
|
+
# 其他
|
|
124
|
+
'sizeof', 'typedef',
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
# 基本类型
|
|
128
|
+
C_BASIC_TYPES = {
|
|
129
|
+
'void', 'char', 'short', 'int', 'long', 'float', 'double',
|
|
130
|
+
'unsigned char', 'unsigned short', 'unsigned int', 'unsigned long',
|
|
131
|
+
'signed char', 'signed short', 'signed int', 'signed long',
|
|
132
|
+
'long long', 'unsigned long long', 'long double',
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
# 存储类说明符
|
|
136
|
+
C_STORAGE_CLASSES = {
|
|
137
|
+
'auto', 'register', 'static', 'extern', 'typedef',
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
# 类型限定符
|
|
141
|
+
C_TYPE_QUALIFIERS = {
|
|
142
|
+
'const', 'volatile',
|
|
143
|
+
}
|