Commit 66f9f58
committed
feat(make): Refactor macro engine and parser for enhanced capabilities
This commit significantly refactors the macro processing and parsing
mechanisms within the utility. The primary goal is to enhance
macro functionality and improve the robustness of Makefile parsing.
Major changes include:
- **Enhanced Macro Preprocessor:**
- Macro substitution is now more context-aware (receives target,
files, prerequisites).
- Added support for built-in macro functions like ,
, , , and .
- Macro table generation is now more sophisticated.
- **Centralized Macro Management:**
- Macros are now stored and managed within the struct,
making them globally accessible.
- struct no longer directly holds macro definitions.
- Initialized and special macros.
- **Improved Parser & Lexer:**
- Parser now correctly handles macro definitions (e.g., ).
- Added support for pattern rules (e.g., ).
- Lexer now skips leading whitespace, simplifying token stream.
- More flexible parsing of newlines in recipes and rules.
- **Testing Adjustments:**
- Updated integration and parser tests to align with the new
macro and parsing behaviors.
- Introduced a test helper that avoids strict comparison.1 parent bd6aafa commit 66f9f58
File tree
12 files changed
+404
-182
lines changed- make
- src
- parser
- tests
- plib/src
- process
12 files changed
+404
-182
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
| 117 | + | |
116 | 118 | | |
117 | 119 | | |
118 | 120 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| |||
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
114 | | - | |
| 113 | + | |
115 | 114 | | |
116 | 115 | | |
117 | 116 | | |
| |||
183 | 182 | | |
184 | 183 | | |
185 | 184 | | |
186 | | - | |
| 185 | + | |
187 | 186 | | |
188 | 187 | | |
189 | 188 | | |
190 | 189 | | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
191 | 196 | | |
192 | 197 | | |
193 | 198 | | |
| |||
205 | 210 | | |
206 | 211 | | |
207 | 212 | | |
208 | | - | |
209 | 213 | | |
210 | 214 | | |
211 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
182 | 186 | | |
183 | 187 | | |
184 | 188 | | |
| |||
199 | 203 | | |
200 | 204 | | |
201 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
202 | 210 | | |
203 | 211 | | |
204 | 212 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | 30 | | |
35 | 31 | | |
36 | 32 | | |
| |||
64 | 60 | | |
65 | 61 | | |
66 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
67 | 66 | | |
68 | 67 | | |
69 | 68 | | |
| |||
96 | 95 | | |
97 | 96 | | |
98 | 97 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | 98 | | |
103 | 99 | | |
104 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
74 | 75 | | |
75 | 76 | | |
76 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | 78 | | |
80 | 79 | | |
81 | 80 | | |
| |||
144 | 143 | | |
145 | 144 | | |
146 | 145 | | |
147 | | - | |
| 146 | + | |
148 | 147 | | |
149 | 148 | | |
150 | 149 | | |
| |||
156 | 155 | | |
157 | 156 | | |
158 | 157 | | |
159 | | - | |
| 158 | + | |
160 | 159 | | |
161 | 160 | | |
162 | 161 | | |
163 | 162 | | |
164 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
165 | 173 | | |
166 | 174 | | |
167 | 175 | | |
168 | 176 | | |
169 | 177 | | |
170 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
171 | 182 | | |
172 | 183 | | |
173 | 184 | | |
| |||
176 | 187 | | |
177 | 188 | | |
178 | 189 | | |
179 | | - | |
| 190 | + | |
180 | 191 | | |
181 | 192 | | |
182 | 193 | | |
| |||
197 | 208 | | |
198 | 209 | | |
199 | 210 | | |
200 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
201 | 215 | | |
202 | 216 | | |
203 | 217 | | |
| |||
347 | 361 | | |
348 | 362 | | |
349 | 363 | | |
| 364 | + | |
| 365 | + | |
350 | 366 | | |
351 | 367 | | |
352 | 368 | | |
353 | | - | |
354 | 369 | | |
355 | | - | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
356 | 374 | | |
357 | 375 | | |
358 | 376 | | |
| |||
403 | 421 | | |
404 | 422 | | |
405 | 423 | | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
406 | 428 | | |
407 | 429 | | |
408 | 430 | | |
409 | 431 | | |
410 | 432 | | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | | - | |
| 433 | + | |
| 434 | + | |
415 | 435 | | |
416 | 436 | | |
417 | 437 | | |
| |||
530 | 550 | | |
531 | 551 | | |
532 | 552 | | |
533 | | - | |
534 | | - | |
| 553 | + | |
535 | 554 | | |
536 | 555 | | |
0 commit comments