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.
Files changed (72) hide show
  1. package/README.md +726 -0
  2. package/bin/cnext.js +5 -0
  3. package/grammar/C.g4 +1112 -0
  4. package/grammar/CNext.g4 +817 -0
  5. package/grammar/CPP14Lexer.g4 +282 -0
  6. package/grammar/CPP14Parser.g4 +1072 -0
  7. package/package.json +85 -0
  8. package/src/analysis/DivisionByZeroAnalyzer.ts +378 -0
  9. package/src/analysis/FunctionCallAnalyzer.ts +526 -0
  10. package/src/analysis/InitializationAnalyzer.ts +725 -0
  11. package/src/analysis/NullCheckAnalyzer.ts +427 -0
  12. package/src/analysis/types/IDivisionByZeroError.ts +25 -0
  13. package/src/analysis/types/IFunctionCallError.ts +17 -0
  14. package/src/analysis/types/IInitializationError.ts +55 -0
  15. package/src/analysis/types/INullCheckError.ts +25 -0
  16. package/src/codegen/CodeGenerator.ts +7945 -0
  17. package/src/codegen/CommentExtractor.ts +240 -0
  18. package/src/codegen/CommentFormatter.ts +155 -0
  19. package/src/codegen/HeaderGenerator.ts +265 -0
  20. package/src/codegen/TypeResolver.ts +365 -0
  21. package/src/codegen/types/ECommentType.ts +10 -0
  22. package/src/codegen/types/IComment.ts +21 -0
  23. package/src/codegen/types/ICommentError.ts +15 -0
  24. package/src/codegen/types/TOverflowBehavior.ts +6 -0
  25. package/src/codegen/types/TParameterInfo.ts +13 -0
  26. package/src/codegen/types/TTypeConstants.ts +94 -0
  27. package/src/codegen/types/TTypeInfo.ts +22 -0
  28. package/src/index.ts +518 -0
  29. package/src/lib/IncludeDiscovery.ts +131 -0
  30. package/src/lib/InputExpansion.ts +121 -0
  31. package/src/lib/PlatformIODetector.ts +162 -0
  32. package/src/lib/transpiler.ts +439 -0
  33. package/src/lib/types/ITranspileResult.ts +80 -0
  34. package/src/parser/c/grammar/C.interp +338 -0
  35. package/src/parser/c/grammar/C.tokens +229 -0
  36. package/src/parser/c/grammar/CLexer.interp +415 -0
  37. package/src/parser/c/grammar/CLexer.tokens +229 -0
  38. package/src/parser/c/grammar/CLexer.ts +750 -0
  39. package/src/parser/c/grammar/CListener.ts +976 -0
  40. package/src/parser/c/grammar/CParser.ts +9663 -0
  41. package/src/parser/c/grammar/CVisitor.ts +626 -0
  42. package/src/parser/cpp/grammar/CPP14Lexer.interp +478 -0
  43. package/src/parser/cpp/grammar/CPP14Lexer.tokens +264 -0
  44. package/src/parser/cpp/grammar/CPP14Lexer.ts +848 -0
  45. package/src/parser/cpp/grammar/CPP14Parser.interp +492 -0
  46. package/src/parser/cpp/grammar/CPP14Parser.tokens +264 -0
  47. package/src/parser/cpp/grammar/CPP14Parser.ts +19961 -0
  48. package/src/parser/cpp/grammar/CPP14ParserListener.ts +2120 -0
  49. package/src/parser/cpp/grammar/CPP14ParserVisitor.ts +1354 -0
  50. package/src/parser/grammar/CNext.interp +340 -0
  51. package/src/parser/grammar/CNext.tokens +214 -0
  52. package/src/parser/grammar/CNextLexer.interp +374 -0
  53. package/src/parser/grammar/CNextLexer.tokens +214 -0
  54. package/src/parser/grammar/CNextLexer.ts +668 -0
  55. package/src/parser/grammar/CNextListener.ts +1020 -0
  56. package/src/parser/grammar/CNextParser.ts +9239 -0
  57. package/src/parser/grammar/CNextVisitor.ts +654 -0
  58. package/src/preprocessor/Preprocessor.ts +301 -0
  59. package/src/preprocessor/ToolchainDetector.ts +225 -0
  60. package/src/preprocessor/types/IPreprocessResult.ts +39 -0
  61. package/src/preprocessor/types/IToolchain.ts +27 -0
  62. package/src/project/FileDiscovery.ts +236 -0
  63. package/src/project/Project.ts +425 -0
  64. package/src/project/types/IProjectConfig.ts +64 -0
  65. package/src/symbols/CNextSymbolCollector.ts +326 -0
  66. package/src/symbols/CSymbolCollector.ts +457 -0
  67. package/src/symbols/CppSymbolCollector.ts +362 -0
  68. package/src/symbols/SymbolTable.ts +312 -0
  69. package/src/symbols/types/IConflict.ts +20 -0
  70. package/src/types/ESourceLanguage.ts +10 -0
  71. package/src/types/ESymbolKind.ts +20 -0
  72. package/src/types/ISymbol.ts +45 -0
@@ -0,0 +1,264 @@
1
+ IntegerLiteral=1
2
+ CharacterLiteral=2
3
+ FloatingLiteral=3
4
+ StringLiteral=4
5
+ BooleanLiteral=5
6
+ PointerLiteral=6
7
+ UserDefinedLiteral=7
8
+ MultiLineMacro=8
9
+ Directive=9
10
+ Alignas=10
11
+ Alignof=11
12
+ Asm=12
13
+ Auto=13
14
+ Bool=14
15
+ Break=15
16
+ Case=16
17
+ Catch=17
18
+ Char=18
19
+ Char16=19
20
+ Char32=20
21
+ Class=21
22
+ Const=22
23
+ Constexpr=23
24
+ Const_cast=24
25
+ Continue=25
26
+ Decltype=26
27
+ Default=27
28
+ Delete=28
29
+ Do=29
30
+ Double=30
31
+ Dynamic_cast=31
32
+ Else=32
33
+ Enum=33
34
+ Explicit=34
35
+ Export=35
36
+ Extern=36
37
+ False_=37
38
+ Final=38
39
+ Float=39
40
+ For=40
41
+ Friend=41
42
+ Goto=42
43
+ If=43
44
+ Inline=44
45
+ Int=45
46
+ Long=46
47
+ Mutable=47
48
+ Namespace=48
49
+ New=49
50
+ Noexcept=50
51
+ Nullptr=51
52
+ Operator=52
53
+ Override=53
54
+ Private=54
55
+ Protected=55
56
+ Public=56
57
+ Register=57
58
+ Reinterpret_cast=58
59
+ Return=59
60
+ Short=60
61
+ Signed=61
62
+ Sizeof=62
63
+ Static=63
64
+ Static_assert=64
65
+ Static_cast=65
66
+ Struct=66
67
+ Switch=67
68
+ Template=68
69
+ This=69
70
+ Thread_local=70
71
+ Throw=71
72
+ True_=72
73
+ Try=73
74
+ Typedef=74
75
+ Typeid_=75
76
+ Typename_=76
77
+ Union=77
78
+ Unsigned=78
79
+ Using=79
80
+ Virtual=80
81
+ Void=81
82
+ Volatile=82
83
+ Wchar=83
84
+ While=84
85
+ LeftParen=85
86
+ RightParen=86
87
+ LeftBracket=87
88
+ RightBracket=88
89
+ LeftBrace=89
90
+ RightBrace=90
91
+ Plus=91
92
+ Minus=92
93
+ Star=93
94
+ Div=94
95
+ Mod=95
96
+ Caret=96
97
+ And=97
98
+ Or=98
99
+ Tilde=99
100
+ Not=100
101
+ Assign=101
102
+ Less=102
103
+ Greater=103
104
+ PlusAssign=104
105
+ MinusAssign=105
106
+ StarAssign=106
107
+ DivAssign=107
108
+ ModAssign=108
109
+ XorAssign=109
110
+ AndAssign=110
111
+ OrAssign=111
112
+ LeftShiftAssign=112
113
+ RightShiftAssign=113
114
+ Equal=114
115
+ NotEqual=115
116
+ LessEqual=116
117
+ GreaterEqual=117
118
+ AndAnd=118
119
+ OrOr=119
120
+ PlusPlus=120
121
+ MinusMinus=121
122
+ Comma=122
123
+ ArrowStar=123
124
+ Arrow=124
125
+ Question=125
126
+ Colon=126
127
+ Doublecolon=127
128
+ Semi=128
129
+ Dot=129
130
+ DotStar=130
131
+ Ellipsis=131
132
+ Identifier=132
133
+ DecimalLiteral=133
134
+ OctalLiteral=134
135
+ HexadecimalLiteral=135
136
+ BinaryLiteral=136
137
+ Integersuffix=137
138
+ UserDefinedIntegerLiteral=138
139
+ UserDefinedFloatingLiteral=139
140
+ UserDefinedStringLiteral=140
141
+ UserDefinedCharacterLiteral=141
142
+ Whitespace=142
143
+ Newline=143
144
+ BlockComment=144
145
+ LineComment=145
146
+ 'alignas'=10
147
+ 'alignof'=11
148
+ 'asm'=12
149
+ 'auto'=13
150
+ 'bool'=14
151
+ 'break'=15
152
+ 'case'=16
153
+ 'catch'=17
154
+ 'char'=18
155
+ 'char16_t'=19
156
+ 'char32_t'=20
157
+ 'class'=21
158
+ 'const'=22
159
+ 'constexpr'=23
160
+ 'const_cast'=24
161
+ 'continue'=25
162
+ 'decltype'=26
163
+ 'default'=27
164
+ 'delete'=28
165
+ 'do'=29
166
+ 'double'=30
167
+ 'dynamic_cast'=31
168
+ 'else'=32
169
+ 'enum'=33
170
+ 'explicit'=34
171
+ 'export'=35
172
+ 'extern'=36
173
+ 'false'=37
174
+ 'final'=38
175
+ 'float'=39
176
+ 'for'=40
177
+ 'friend'=41
178
+ 'goto'=42
179
+ 'if'=43
180
+ 'inline'=44
181
+ 'int'=45
182
+ 'long'=46
183
+ 'mutable'=47
184
+ 'namespace'=48
185
+ 'new'=49
186
+ 'noexcept'=50
187
+ 'nullptr'=51
188
+ 'operator'=52
189
+ 'override'=53
190
+ 'private'=54
191
+ 'protected'=55
192
+ 'public'=56
193
+ 'register'=57
194
+ 'reinterpret_cast'=58
195
+ 'return'=59
196
+ 'short'=60
197
+ 'signed'=61
198
+ 'sizeof'=62
199
+ 'static'=63
200
+ 'static_assert'=64
201
+ 'static_cast'=65
202
+ 'struct'=66
203
+ 'switch'=67
204
+ 'template'=68
205
+ 'this'=69
206
+ 'thread_local'=70
207
+ 'throw'=71
208
+ 'true'=72
209
+ 'try'=73
210
+ 'typedef'=74
211
+ 'typeid'=75
212
+ 'typename'=76
213
+ 'union'=77
214
+ 'unsigned'=78
215
+ 'using'=79
216
+ 'virtual'=80
217
+ 'void'=81
218
+ 'volatile'=82
219
+ 'wchar_t'=83
220
+ 'while'=84
221
+ '('=85
222
+ ')'=86
223
+ '['=87
224
+ ']'=88
225
+ '{'=89
226
+ '}'=90
227
+ '+'=91
228
+ '-'=92
229
+ '*'=93
230
+ '/'=94
231
+ '%'=95
232
+ '^'=96
233
+ '&'=97
234
+ '|'=98
235
+ '~'=99
236
+ '='=101
237
+ '<'=102
238
+ '>'=103
239
+ '+='=104
240
+ '-='=105
241
+ '*='=106
242
+ '/='=107
243
+ '%='=108
244
+ '^='=109
245
+ '&='=110
246
+ '|='=111
247
+ '<<='=112
248
+ '>>='=113
249
+ '=='=114
250
+ '!='=115
251
+ '<='=116
252
+ '>='=117
253
+ '++'=120
254
+ '--'=121
255
+ ','=122
256
+ '->*'=123
257
+ '->'=124
258
+ '?'=125
259
+ ':'=126
260
+ '::'=127
261
+ ';'=128
262
+ '.'=129
263
+ '.*'=130
264
+ '...'=131