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,229 @@
1
+ T__0=1
2
+ T__1=2
3
+ T__2=3
4
+ T__3=4
5
+ T__4=5
6
+ T__5=6
7
+ T__6=7
8
+ T__7=8
9
+ T__8=9
10
+ T__9=10
11
+ T__10=11
12
+ T__11=12
13
+ T__12=13
14
+ T__13=14
15
+ T__14=15
16
+ T__15=16
17
+ T__16=17
18
+ T__17=18
19
+ T__18=19
20
+ Auto=20
21
+ Break=21
22
+ Case=22
23
+ Char=23
24
+ Const=24
25
+ Continue=25
26
+ Default=26
27
+ Do=27
28
+ Double=28
29
+ Else=29
30
+ Enum=30
31
+ Extern=31
32
+ Float=32
33
+ For=33
34
+ Goto=34
35
+ If=35
36
+ Inline=36
37
+ Int=37
38
+ Long=38
39
+ Register=39
40
+ Restrict=40
41
+ Return=41
42
+ Short=42
43
+ Signed=43
44
+ Sizeof=44
45
+ Static=45
46
+ Struct=46
47
+ Switch=47
48
+ Typedef=48
49
+ Union=49
50
+ Unsigned=50
51
+ Void=51
52
+ Volatile=52
53
+ While=53
54
+ Alignas=54
55
+ Alignof=55
56
+ Atomic=56
57
+ Bool=57
58
+ Complex=58
59
+ Generic=59
60
+ Imaginary=60
61
+ Noreturn=61
62
+ StaticAssert=62
63
+ ThreadLocal=63
64
+ LeftParen=64
65
+ RightParen=65
66
+ LeftBracket=66
67
+ RightBracket=67
68
+ LeftBrace=68
69
+ RightBrace=69
70
+ Less=70
71
+ LessEqual=71
72
+ Greater=72
73
+ GreaterEqual=73
74
+ LeftShift=74
75
+ RightShift=75
76
+ Plus=76
77
+ PlusPlus=77
78
+ Minus=78
79
+ MinusMinus=79
80
+ Star=80
81
+ Div=81
82
+ Mod=82
83
+ And=83
84
+ Or=84
85
+ AndAnd=85
86
+ OrOr=86
87
+ Caret=87
88
+ Not=88
89
+ Tilde=89
90
+ Question=90
91
+ Colon=91
92
+ Semi=92
93
+ Comma=93
94
+ Assign=94
95
+ StarAssign=95
96
+ DivAssign=96
97
+ ModAssign=97
98
+ PlusAssign=98
99
+ MinusAssign=99
100
+ LeftShiftAssign=100
101
+ RightShiftAssign=101
102
+ AndAssign=102
103
+ XorAssign=103
104
+ OrAssign=104
105
+ Equal=105
106
+ NotEqual=106
107
+ Arrow=107
108
+ Dot=108
109
+ Ellipsis=109
110
+ Identifier=110
111
+ Constant=111
112
+ DigitSequence=112
113
+ StringLiteral=113
114
+ MultiLineMacro=114
115
+ Directive=115
116
+ AsmBlock=116
117
+ Whitespace=117
118
+ Newline=118
119
+ BlockComment=119
120
+ LineComment=120
121
+ '__extension__'=1
122
+ '__builtin_va_arg'=2
123
+ '__builtin_offsetof'=3
124
+ '__m128'=4
125
+ '__m128d'=5
126
+ '__m128i'=6
127
+ '__typeof__'=7
128
+ '__inline__'=8
129
+ '__stdcall'=9
130
+ '__declspec'=10
131
+ '__cdecl'=11
132
+ '__clrcall'=12
133
+ '__fastcall'=13
134
+ '__thiscall'=14
135
+ '__vectorcall'=15
136
+ '__asm'=16
137
+ '__attribute__'=17
138
+ '__asm__'=18
139
+ '__volatile__'=19
140
+ 'auto'=20
141
+ 'break'=21
142
+ 'case'=22
143
+ 'char'=23
144
+ 'const'=24
145
+ 'continue'=25
146
+ 'default'=26
147
+ 'do'=27
148
+ 'double'=28
149
+ 'else'=29
150
+ 'enum'=30
151
+ 'extern'=31
152
+ 'float'=32
153
+ 'for'=33
154
+ 'goto'=34
155
+ 'if'=35
156
+ 'inline'=36
157
+ 'int'=37
158
+ 'long'=38
159
+ 'register'=39
160
+ 'restrict'=40
161
+ 'return'=41
162
+ 'short'=42
163
+ 'signed'=43
164
+ 'sizeof'=44
165
+ 'static'=45
166
+ 'struct'=46
167
+ 'switch'=47
168
+ 'typedef'=48
169
+ 'union'=49
170
+ 'unsigned'=50
171
+ 'void'=51
172
+ 'volatile'=52
173
+ 'while'=53
174
+ '_Alignas'=54
175
+ '_Alignof'=55
176
+ '_Atomic'=56
177
+ '_Bool'=57
178
+ '_Complex'=58
179
+ '_Generic'=59
180
+ '_Imaginary'=60
181
+ '_Noreturn'=61
182
+ '_Static_assert'=62
183
+ '_Thread_local'=63
184
+ '('=64
185
+ ')'=65
186
+ '['=66
187
+ ']'=67
188
+ '{'=68
189
+ '}'=69
190
+ '<'=70
191
+ '<='=71
192
+ '>'=72
193
+ '>='=73
194
+ '<<'=74
195
+ '>>'=75
196
+ '+'=76
197
+ '++'=77
198
+ '-'=78
199
+ '--'=79
200
+ '*'=80
201
+ '/'=81
202
+ '%'=82
203
+ '&'=83
204
+ '|'=84
205
+ '&&'=85
206
+ '||'=86
207
+ '^'=87
208
+ '!'=88
209
+ '~'=89
210
+ '?'=90
211
+ ':'=91
212
+ ';'=92
213
+ ','=93
214
+ '='=94
215
+ '*='=95
216
+ '/='=96
217
+ '%='=97
218
+ '+='=98
219
+ '-='=99
220
+ '<<='=100
221
+ '>>='=101
222
+ '&='=102
223
+ '^='=103
224
+ '|='=104
225
+ '=='=105
226
+ '!='=106
227
+ '->'=107
228
+ '.'=108
229
+ '...'=109