c-next 0.2.12 → 0.2.13

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 (66) hide show
  1. package/README.md +80 -649
  2. package/dist/index.js +7387 -6211
  3. package/dist/index.js.map +4 -4
  4. package/grammar/C.g4 +9 -3
  5. package/package.json +1 -2
  6. package/src/__tests__/index.test.ts +1 -1
  7. package/src/cli/CleanCommand.ts +8 -12
  8. package/src/cli/Cli.ts +29 -6
  9. package/src/cli/Runner.ts +42 -62
  10. package/src/cli/__tests__/CleanCommand.test.ts +10 -10
  11. package/src/cli/__tests__/Cli.test.ts +59 -7
  12. package/src/cli/__tests__/ConfigPrinter.test.ts +12 -12
  13. package/src/cli/__tests__/PathNormalizer.test.ts +5 -5
  14. package/src/cli/__tests__/Runner.test.ts +108 -82
  15. package/src/cli/serve/ServeCommand.ts +1 -1
  16. package/src/cli/types/ICliConfig.ts +2 -2
  17. package/src/lib/parseWithSymbols.ts +21 -21
  18. package/src/transpiler/Transpiler.ts +88 -43
  19. package/src/transpiler/__tests__/DualCodePaths.test.ts +29 -29
  20. package/src/transpiler/__tests__/Transpiler.coverage.test.ts +244 -72
  21. package/src/transpiler/__tests__/Transpiler.test.ts +32 -72
  22. package/src/transpiler/__tests__/determineProjectRoot.test.ts +30 -28
  23. package/src/transpiler/__tests__/needsConditionalPreprocessing.test.ts +1 -1
  24. package/src/transpiler/data/CNextMarkerDetector.ts +34 -0
  25. package/src/transpiler/data/CppEntryPointScanner.ts +174 -0
  26. package/src/transpiler/data/FileDiscovery.ts +2 -105
  27. package/src/transpiler/data/InputExpansion.ts +37 -81
  28. package/src/transpiler/data/__tests__/CNextMarkerDetector.test.ts +62 -0
  29. package/src/transpiler/data/__tests__/CppEntryPointScanner.test.ts +239 -0
  30. package/src/transpiler/data/__tests__/FileDiscovery.test.ts +45 -191
  31. package/src/transpiler/data/__tests__/InputExpansion.test.ts +36 -204
  32. package/src/transpiler/logic/analysis/InitializationAnalyzer.ts +2 -2
  33. package/src/transpiler/logic/analysis/PassByValueAnalyzer.ts +4 -5
  34. package/src/transpiler/logic/parser/c/grammar/C.interp +19 -1
  35. package/src/transpiler/logic/parser/c/grammar/C.tokens +231 -213
  36. package/src/transpiler/logic/parser/c/grammar/CLexer.interp +28 -1
  37. package/src/transpiler/logic/parser/c/grammar/CLexer.tokens +231 -213
  38. package/src/transpiler/logic/parser/c/grammar/CLexer.ts +654 -600
  39. package/src/transpiler/logic/parser/c/grammar/CParser.ts +1175 -1099
  40. package/src/transpiler/logic/symbols/SymbolTable.ts +19 -7
  41. package/src/transpiler/logic/symbols/__tests__/SymbolTable.test.ts +78 -0
  42. package/src/transpiler/logic/symbols/cnext/__tests__/TSymbolInfoAdapter.test.ts +6 -6
  43. package/src/transpiler/logic/symbols/cnext/adapters/TSymbolInfoAdapter.ts +28 -27
  44. package/src/transpiler/logic/symbols/cnext/index.ts +4 -4
  45. package/src/transpiler/logic/symbols/cnext/utils/SymbolNameUtils.ts +5 -5
  46. package/src/transpiler/output/codegen/CodeGenerator.ts +7 -1
  47. package/src/transpiler/output/codegen/__tests__/CodeGenerator.test.ts +15 -0
  48. package/src/transpiler/output/codegen/__tests__/ExpressionWalker.test.ts +3 -3
  49. package/src/transpiler/output/codegen/__tests__/RequireInclude.test.ts +14 -14
  50. package/src/transpiler/output/codegen/__tests__/TrackVariableTypeHelpers.test.ts +2 -2
  51. package/src/transpiler/output/codegen/utils/QualifiedNameGenerator.ts +7 -7
  52. package/src/transpiler/output/codegen/utils/__tests__/QualifiedNameGenerator.test.ts +3 -3
  53. package/src/transpiler/output/headers/BaseHeaderGenerator.ts +10 -1
  54. package/src/transpiler/output/headers/HeaderGenerator.ts +3 -0
  55. package/src/transpiler/output/headers/HeaderGeneratorUtils.ts +6 -2
  56. package/src/transpiler/output/headers/__tests__/HeaderGeneratorUtils.test.ts +16 -0
  57. package/src/transpiler/output/headers/adapters/HeaderSymbolAdapter.ts +19 -19
  58. package/src/transpiler/output/headers/adapters/__tests__/HeaderSymbolAdapter.test.ts +5 -5
  59. package/src/transpiler/state/SymbolRegistry.ts +10 -12
  60. package/src/transpiler/state/__tests__/SymbolRegistry.test.ts +11 -13
  61. package/src/transpiler/types/IPipelineFile.ts +3 -0
  62. package/src/transpiler/types/ITranspilerConfig.ts +2 -2
  63. package/src/transpiler/types/symbols/IScopeSymbol.ts +1 -1
  64. package/src/utils/FunctionUtils.ts +3 -3
  65. package/src/utils/__tests__/FunctionUtils.test.ts +6 -4
  66. package/src/transpiler/data/types/IDiscoveryOptions.ts +0 -15
@@ -23,219 +23,237 @@ T__21=22
23
23
  T__22=23
24
24
  T__23=24
25
25
  T__24=25
26
- Auto=26
27
- Break=27
28
- Case=28
29
- Char=29
30
- Const=30
31
- Continue=31
32
- Default=32
33
- Do=33
34
- Double=34
35
- Else=35
36
- Enum=36
37
- Extern=37
38
- Float=38
39
- For=39
40
- Goto=40
41
- If=41
42
- Inline=42
43
- Int=43
44
- Long=44
45
- Register=45
46
- Restrict=46
47
- Return=47
48
- Short=48
49
- Signed=49
50
- Sizeof=50
51
- Static=51
52
- Struct=52
53
- Switch=53
54
- Typedef=54
55
- Union=55
56
- Unsigned=56
57
- Void=57
58
- Volatile=58
59
- While=59
60
- Alignas=60
61
- Alignof=61
62
- Atomic=62
63
- Bool=63
64
- Complex=64
65
- Generic=65
66
- Imaginary=66
67
- Noreturn=67
68
- StaticAssert=68
69
- ThreadLocal=69
70
- LeftParen=70
71
- RightParen=71
72
- LeftBracket=72
73
- RightBracket=73
74
- LeftBrace=74
75
- RightBrace=75
76
- Less=76
77
- LessEqual=77
78
- Greater=78
79
- GreaterEqual=79
80
- LeftShift=80
81
- RightShift=81
82
- Plus=82
83
- PlusPlus=83
84
- Minus=84
85
- MinusMinus=85
86
- Star=86
87
- Div=87
88
- Mod=88
89
- And=89
90
- Or=90
91
- AndAnd=91
92
- OrOr=92
93
- Caret=93
94
- Not=94
95
- Tilde=95
96
- Question=96
97
- Colon=97
98
- Semi=98
99
- Comma=99
100
- Assign=100
101
- StarAssign=101
102
- DivAssign=102
103
- ModAssign=103
104
- PlusAssign=104
105
- MinusAssign=105
106
- LeftShiftAssign=106
107
- RightShiftAssign=107
108
- AndAssign=108
109
- XorAssign=109
110
- OrAssign=110
111
- Equal=111
112
- NotEqual=112
113
- Arrow=113
114
- Dot=114
115
- Ellipsis=115
116
- Identifier=116
117
- Constant=117
118
- DigitSequence=118
119
- StringLiteral=119
120
- MultiLineMacro=120
121
- Directive=121
122
- AsmBlock=122
123
- Whitespace=123
124
- Newline=124
125
- BlockComment=125
126
- LineComment=126
26
+ T__25=26
27
+ T__26=27
28
+ T__27=28
29
+ T__28=29
30
+ T__29=30
31
+ T__30=31
32
+ T__31=32
33
+ T__32=33
34
+ T__33=34
35
+ Auto=35
36
+ Break=36
37
+ Case=37
38
+ Char=38
39
+ Const=39
40
+ Continue=40
41
+ Default=41
42
+ Do=42
43
+ Double=43
44
+ Else=44
45
+ Enum=45
46
+ Extern=46
47
+ Float=47
48
+ For=48
49
+ Goto=49
50
+ If=50
51
+ Inline=51
52
+ Int=52
53
+ Long=53
54
+ Register=54
55
+ Restrict=55
56
+ Return=56
57
+ Short=57
58
+ Signed=58
59
+ Sizeof=59
60
+ Static=60
61
+ Struct=61
62
+ Switch=62
63
+ Typedef=63
64
+ Union=64
65
+ Unsigned=65
66
+ Void=66
67
+ Volatile=67
68
+ While=68
69
+ Alignas=69
70
+ Alignof=70
71
+ Atomic=71
72
+ Bool=72
73
+ Complex=73
74
+ Generic=74
75
+ Imaginary=75
76
+ Noreturn=76
77
+ StaticAssert=77
78
+ ThreadLocal=78
79
+ LeftParen=79
80
+ RightParen=80
81
+ LeftBracket=81
82
+ RightBracket=82
83
+ LeftBrace=83
84
+ RightBrace=84
85
+ Less=85
86
+ LessEqual=86
87
+ Greater=87
88
+ GreaterEqual=88
89
+ LeftShift=89
90
+ RightShift=90
91
+ Plus=91
92
+ PlusPlus=92
93
+ Minus=93
94
+ MinusMinus=94
95
+ Star=95
96
+ Div=96
97
+ Mod=97
98
+ And=98
99
+ Or=99
100
+ AndAnd=100
101
+ OrOr=101
102
+ Caret=102
103
+ Not=103
104
+ Tilde=104
105
+ Question=105
106
+ Colon=106
107
+ Semi=107
108
+ Comma=108
109
+ Assign=109
110
+ StarAssign=110
111
+ DivAssign=111
112
+ ModAssign=112
113
+ PlusAssign=113
114
+ MinusAssign=114
115
+ LeftShiftAssign=115
116
+ RightShiftAssign=116
117
+ AndAssign=117
118
+ XorAssign=118
119
+ OrAssign=119
120
+ Equal=120
121
+ NotEqual=121
122
+ Arrow=122
123
+ Dot=123
124
+ Ellipsis=124
125
+ Identifier=125
126
+ Constant=126
127
+ DigitSequence=127
128
+ StringLiteral=128
129
+ MultiLineMacro=129
130
+ Directive=130
131
+ AsmBlock=131
132
+ Whitespace=132
133
+ Newline=133
134
+ BlockComment=134
135
+ LineComment=135
127
136
  '__extension__'=1
128
137
  '__builtin_va_arg'=2
129
138
  '__builtin_offsetof'=3
130
- '__signed__'=4
131
- '__m128'=5
132
- '__m128d'=6
133
- '__m128i'=7
134
- '__typeof__'=8
135
- '__const'=9
136
- '__const__'=10
137
- '__restrict'=11
138
- '__restrict__'=12
139
- '__volatile'=13
140
- '__volatile__'=14
141
- '__inline__'=15
142
- '__stdcall'=16
143
- '__declspec'=17
144
- '__cdecl'=18
145
- '__clrcall'=19
146
- '__fastcall'=20
147
- '__thiscall'=21
148
- '__vectorcall'=22
149
- '__asm'=23
150
- '__asm__'=24
151
- '__attribute__'=25
152
- 'auto'=26
153
- 'break'=27
154
- 'case'=28
155
- 'char'=29
156
- 'const'=30
157
- 'continue'=31
158
- 'default'=32
159
- 'do'=33
160
- 'double'=34
161
- 'else'=35
162
- 'enum'=36
163
- 'extern'=37
164
- 'float'=38
165
- 'for'=39
166
- 'goto'=40
167
- 'if'=41
168
- 'inline'=42
169
- 'int'=43
170
- 'long'=44
171
- 'register'=45
172
- 'restrict'=46
173
- 'return'=47
174
- 'short'=48
175
- 'signed'=49
176
- 'sizeof'=50
177
- 'static'=51
178
- 'struct'=52
179
- 'switch'=53
180
- 'typedef'=54
181
- 'union'=55
182
- 'unsigned'=56
183
- 'void'=57
184
- 'volatile'=58
185
- 'while'=59
186
- '_Alignas'=60
187
- '_Alignof'=61
188
- '_Atomic'=62
189
- '_Bool'=63
190
- '_Complex'=64
191
- '_Generic'=65
192
- '_Imaginary'=66
193
- '_Noreturn'=67
194
- '_Static_assert'=68
195
- '_Thread_local'=69
196
- '('=70
197
- ')'=71
198
- '['=72
199
- ']'=73
200
- '{'=74
201
- '}'=75
202
- '<'=76
203
- '<='=77
204
- '>'=78
205
- '>='=79
206
- '<<'=80
207
- '>>'=81
208
- '+'=82
209
- '++'=83
210
- '-'=84
211
- '--'=85
212
- '*'=86
213
- '/'=87
214
- '%'=88
215
- '&'=89
216
- '|'=90
217
- '&&'=91
218
- '||'=92
219
- '^'=93
220
- '!'=94
221
- '~'=95
222
- '?'=96
223
- ':'=97
224
- ';'=98
225
- ','=99
226
- '='=100
227
- '*='=101
228
- '/='=102
229
- '%='=103
230
- '+='=104
231
- '-='=105
232
- '<<='=106
233
- '>>='=107
234
- '&='=108
235
- '^='=109
236
- '|='=110
237
- '=='=111
238
- '!='=112
239
- '->'=113
240
- '.'=114
241
- '...'=115
139
+ '__alignof__'=4
140
+ '__alignof'=5
141
+ '__thread'=6
142
+ '__signed'=7
143
+ '__signed__'=8
144
+ '__m128'=9
145
+ '__m128d'=10
146
+ '__m128i'=11
147
+ '__int128'=12
148
+ '__int128_t'=13
149
+ '__uint128_t'=14
150
+ '__typeof__'=15
151
+ '__typeof'=16
152
+ '__const'=17
153
+ '__const__'=18
154
+ '__restrict'=19
155
+ '__restrict__'=20
156
+ '__volatile'=21
157
+ '__volatile__'=22
158
+ '__inline'=23
159
+ '__inline__'=24
160
+ '__stdcall'=25
161
+ '__declspec'=26
162
+ '__cdecl'=27
163
+ '__clrcall'=28
164
+ '__fastcall'=29
165
+ '__thiscall'=30
166
+ '__vectorcall'=31
167
+ '__asm'=32
168
+ '__asm__'=33
169
+ '__attribute__'=34
170
+ 'auto'=35
171
+ 'break'=36
172
+ 'case'=37
173
+ 'char'=38
174
+ 'const'=39
175
+ 'continue'=40
176
+ 'default'=41
177
+ 'do'=42
178
+ 'double'=43
179
+ 'else'=44
180
+ 'enum'=45
181
+ 'extern'=46
182
+ 'float'=47
183
+ 'for'=48
184
+ 'goto'=49
185
+ 'if'=50
186
+ 'inline'=51
187
+ 'int'=52
188
+ 'long'=53
189
+ 'register'=54
190
+ 'restrict'=55
191
+ 'return'=56
192
+ 'short'=57
193
+ 'signed'=58
194
+ 'sizeof'=59
195
+ 'static'=60
196
+ 'struct'=61
197
+ 'switch'=62
198
+ 'typedef'=63
199
+ 'union'=64
200
+ 'unsigned'=65
201
+ 'void'=66
202
+ 'volatile'=67
203
+ 'while'=68
204
+ '_Alignas'=69
205
+ '_Alignof'=70
206
+ '_Atomic'=71
207
+ '_Bool'=72
208
+ '_Complex'=73
209
+ '_Generic'=74
210
+ '_Imaginary'=75
211
+ '_Noreturn'=76
212
+ '_Static_assert'=77
213
+ '_Thread_local'=78
214
+ '('=79
215
+ ')'=80
216
+ '['=81
217
+ ']'=82
218
+ '{'=83
219
+ '}'=84
220
+ '<'=85
221
+ '<='=86
222
+ '>'=87
223
+ '>='=88
224
+ '<<'=89
225
+ '>>'=90
226
+ '+'=91
227
+ '++'=92
228
+ '-'=93
229
+ '--'=94
230
+ '*'=95
231
+ '/'=96
232
+ '%'=97
233
+ '&'=98
234
+ '|'=99
235
+ '&&'=100
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
+ '^='=118
254
+ '|='=119
255
+ '=='=120
256
+ '!='=121
257
+ '->'=122
258
+ '.'=123
259
+ '...'=124