This repository was archived by the owner on Nov 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ pub fn main() !void {
109109 defer file .close ();
110110 var contents = try file .reader ().readAllAlloc (arena , 100 * 1024 * 1024 );
111111
112- // filter out comments
112+ // filter out comments (both /**/ and // styles)
113113 var i : usize = 0 ;
114114 var k : usize = 0 ;
115115 var in_comment = false ;
@@ -126,6 +126,14 @@ pub fn main() !void {
126126 i += 2 ;
127127 continue ;
128128 }
129+
130+ if (! in_comment and std .mem .eql (u8 , contents [i .. ][0.. 2], "//" )) {
131+ // skip until we get to a newline
132+ while (contents [i ] != '\n ' ) {
133+ i += 1 ;
134+ }
135+ continue ;
136+ }
129137 }
130138
131139 if (! in_comment ) {
Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ pub fn main() !void {
134134 break ;
135135 } else {
136136 const vline = versionstack .pop ();
137- try outwriter .print ("#endif /*{s}*/\n " , .{vline });
137+ try outwriter .print ("#endif /*_ZIG_UH_| {s}*/\n " , .{vline });
138138 }
139139 }
140140
@@ -158,7 +158,7 @@ pub fn main() !void {
158158 first_v = false ;
159159 try outwriter .print ("defined {s}" , .{version });
160160 }
161- try outwriter .print (" OR _ZIG_UH_TEST \n " , .{});
161+ try outwriter .print (" OR _ZIG_UH_ \n " , .{});
162162
163163 try versionstack .append (versionline );
164164
@@ -173,7 +173,7 @@ pub fn main() !void {
173173
174174 while (versionstack .items .len > 0 ) {
175175 const versionline = versionstack .pop ();
176- try outwriter .print ("#endif /*{s}*/\n " , .{versionline });
176+ try outwriter .print ("#endif /*_ZIG_UH_| {s}*/\n " , .{versionline });
177177 }
178178 }
179179 }
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ pub fn main() !void {
9292 if (debug ) std .debug .print ("trimmed {s}\n " , .{trimmed });
9393 if (std .mem .startsWith (u8 , trimmed , "if" )) {
9494 if (debug ) std .debug .print ("- if\n " , .{});
95- if (std .mem .indexOf (u8 , trimmed , "_ZIG_UH_TEST " ) != null ) {
95+ if (std .mem .indexOf (u8 , trimmed , "_ZIG_UH_ " ) != null ) {
9696 if (std .mem .indexOf (u8 , trimmed , versionStr ) != null ) {
9797 try outputing .append (3 );
9898 } else {
You can’t perform that action at this time.
0 commit comments