c-next 0.1.0
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.
- package/README.md +726 -0
- package/bin/cnext.js +5 -0
- package/grammar/C.g4 +1112 -0
- package/grammar/CNext.g4 +817 -0
- package/grammar/CPP14Lexer.g4 +282 -0
- package/grammar/CPP14Parser.g4 +1072 -0
- package/package.json +85 -0
- package/src/analysis/DivisionByZeroAnalyzer.ts +378 -0
- package/src/analysis/FunctionCallAnalyzer.ts +526 -0
- package/src/analysis/InitializationAnalyzer.ts +725 -0
- package/src/analysis/NullCheckAnalyzer.ts +427 -0
- package/src/analysis/types/IDivisionByZeroError.ts +25 -0
- package/src/analysis/types/IFunctionCallError.ts +17 -0
- package/src/analysis/types/IInitializationError.ts +55 -0
- package/src/analysis/types/INullCheckError.ts +25 -0
- package/src/codegen/CodeGenerator.ts +7945 -0
- package/src/codegen/CommentExtractor.ts +240 -0
- package/src/codegen/CommentFormatter.ts +155 -0
- package/src/codegen/HeaderGenerator.ts +265 -0
- package/src/codegen/TypeResolver.ts +365 -0
- package/src/codegen/types/ECommentType.ts +10 -0
- package/src/codegen/types/IComment.ts +21 -0
- package/src/codegen/types/ICommentError.ts +15 -0
- package/src/codegen/types/TOverflowBehavior.ts +6 -0
- package/src/codegen/types/TParameterInfo.ts +13 -0
- package/src/codegen/types/TTypeConstants.ts +94 -0
- package/src/codegen/types/TTypeInfo.ts +22 -0
- package/src/index.ts +518 -0
- package/src/lib/IncludeDiscovery.ts +131 -0
- package/src/lib/InputExpansion.ts +121 -0
- package/src/lib/PlatformIODetector.ts +162 -0
- package/src/lib/transpiler.ts +439 -0
- package/src/lib/types/ITranspileResult.ts +80 -0
- package/src/parser/c/grammar/C.interp +338 -0
- package/src/parser/c/grammar/C.tokens +229 -0
- package/src/parser/c/grammar/CLexer.interp +415 -0
- package/src/parser/c/grammar/CLexer.tokens +229 -0
- package/src/parser/c/grammar/CLexer.ts +750 -0
- package/src/parser/c/grammar/CListener.ts +976 -0
- package/src/parser/c/grammar/CParser.ts +9663 -0
- package/src/parser/c/grammar/CVisitor.ts +626 -0
- package/src/parser/cpp/grammar/CPP14Lexer.interp +478 -0
- package/src/parser/cpp/grammar/CPP14Lexer.tokens +264 -0
- package/src/parser/cpp/grammar/CPP14Lexer.ts +848 -0
- package/src/parser/cpp/grammar/CPP14Parser.interp +492 -0
- package/src/parser/cpp/grammar/CPP14Parser.tokens +264 -0
- package/src/parser/cpp/grammar/CPP14Parser.ts +19961 -0
- package/src/parser/cpp/grammar/CPP14ParserListener.ts +2120 -0
- package/src/parser/cpp/grammar/CPP14ParserVisitor.ts +1354 -0
- package/src/parser/grammar/CNext.interp +340 -0
- package/src/parser/grammar/CNext.tokens +214 -0
- package/src/parser/grammar/CNextLexer.interp +374 -0
- package/src/parser/grammar/CNextLexer.tokens +214 -0
- package/src/parser/grammar/CNextLexer.ts +668 -0
- package/src/parser/grammar/CNextListener.ts +1020 -0
- package/src/parser/grammar/CNextParser.ts +9239 -0
- package/src/parser/grammar/CNextVisitor.ts +654 -0
- package/src/preprocessor/Preprocessor.ts +301 -0
- package/src/preprocessor/ToolchainDetector.ts +225 -0
- package/src/preprocessor/types/IPreprocessResult.ts +39 -0
- package/src/preprocessor/types/IToolchain.ts +27 -0
- package/src/project/FileDiscovery.ts +236 -0
- package/src/project/Project.ts +425 -0
- package/src/project/types/IProjectConfig.ts +64 -0
- package/src/symbols/CNextSymbolCollector.ts +326 -0
- package/src/symbols/CSymbolCollector.ts +457 -0
- package/src/symbols/CppSymbolCollector.ts +362 -0
- package/src/symbols/SymbolTable.ts +312 -0
- package/src/symbols/types/IConflict.ts +20 -0
- package/src/types/ESourceLanguage.ts +10 -0
- package/src/types/ESymbolKind.ts +20 -0
- package/src/types/ISymbol.ts +45 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types of symbols that can be collected from source files
|
|
3
|
+
*/
|
|
4
|
+
enum ESymbolKind {
|
|
5
|
+
Function = "function",
|
|
6
|
+
Variable = "variable",
|
|
7
|
+
Type = "type",
|
|
8
|
+
Macro = "macro",
|
|
9
|
+
Namespace = "namespace",
|
|
10
|
+
Class = "class",
|
|
11
|
+
Struct = "struct",
|
|
12
|
+
Enum = "enum",
|
|
13
|
+
EnumMember = "enum_member",
|
|
14
|
+
Bitmap = "bitmap",
|
|
15
|
+
BitmapField = "bitmap_field",
|
|
16
|
+
Register = "register",
|
|
17
|
+
RegisterMember = "register_member",
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default ESymbolKind;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import ESymbolKind from "./ESymbolKind";
|
|
2
|
+
import ESourceLanguage from "./ESourceLanguage";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents a symbol collected from a source file
|
|
6
|
+
*/
|
|
7
|
+
interface ISymbol {
|
|
8
|
+
/** Symbol name (e.g., "LED_toggle", "GPIO7", "uint32_t") */
|
|
9
|
+
name: string;
|
|
10
|
+
|
|
11
|
+
/** Kind of symbol */
|
|
12
|
+
kind: ESymbolKind;
|
|
13
|
+
|
|
14
|
+
/** Type of the symbol (e.g., "void", "u32", "int*") */
|
|
15
|
+
type?: string;
|
|
16
|
+
|
|
17
|
+
/** Source file where the symbol is defined */
|
|
18
|
+
sourceFile: string;
|
|
19
|
+
|
|
20
|
+
/** Line number in the source file */
|
|
21
|
+
sourceLine: number;
|
|
22
|
+
|
|
23
|
+
/** Source language */
|
|
24
|
+
sourceLanguage: ESourceLanguage;
|
|
25
|
+
|
|
26
|
+
/** Whether this symbol is exported/public */
|
|
27
|
+
isExported: boolean;
|
|
28
|
+
|
|
29
|
+
/** Whether this is a declaration (not definition) */
|
|
30
|
+
isDeclaration?: boolean;
|
|
31
|
+
|
|
32
|
+
/** Function signature for overload detection (e.g., "void foo(int, float)") */
|
|
33
|
+
signature?: string;
|
|
34
|
+
|
|
35
|
+
/** Parent namespace or class name */
|
|
36
|
+
parent?: string;
|
|
37
|
+
|
|
38
|
+
/** Access modifier for register members (rw, ro, wo, w1c, w1s) */
|
|
39
|
+
accessModifier?: string;
|
|
40
|
+
|
|
41
|
+
/** For arrays: element count. For integers: bit width */
|
|
42
|
+
size?: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default ISymbol;
|