authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-07-27 23:26:12-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-07-27 23:26:12-07:00
log1fa0cabf9dd0c2016a60c23bb616f0f39daf1dfd
treeed50dd2790c0e12cad2b20071766089b18f386cc
parent8552d7fd19836f3350b7303f9bd897708b966805

remove multiline comments

closes #161

7 files changed, 106 insertions(+), 193 deletions(-)

doc/vim/syntax/zig.vim+5-12
...@@ -1,28 +1,27 @@...@@ -1,28 +1,27 @@
1" Vim syntax file1" Vim syntax file
2" Language: Zig2" Language: Zig
3" Maintainer: Andrew Kelley3" Maintainer: Andrew Kelley
4" Latest Revision: 02 December 20154" Latest Revision: 28 July 2016
55
6if exists("b:current_syntax")6if exists("b:current_syntax")
7 finish7 finish
8endif8endif
99
10syn keyword zigStorage const var extern volatile export pub noalias inline10syn keyword zigStorage const var extern export pub noalias inline noinline
11syn keyword zigStructure struct enum union11syn keyword zigStructure struct enum union
12syn keyword zigStatement goto break return continue asm defer12syn keyword zigStatement goto break return continue asm defer
13syn keyword zigConditional if else switch13syn keyword zigConditional if else switch
14syn keyword zigRepeat while for14syn keyword zigRepeat while for
1515
16syn keyword zigConstant null undefined16syn keyword zigConstant null undefined zeroes
17syn keyword zigKeyword fn use17syn keyword zigKeyword fn use
18syn keyword zigType bool f32 f64 void unreachable type error18syn keyword zigType bool f32 f64 void unreachable type error
19syn keyword zigType i8 u8 i16 u16 i32 u32 i64 u64 isize usize19syn keyword zigType i8 u8 i16 u16 i32 u32 i64 u64 isize usize
20syn keyword zigType c_short c_ushort c_int c_uint c_long c_ulong c_longlong c_ulonglong20syn keyword zigType c_short c_ushort c_int c_uint c_long c_ulong c_longlong c_ulonglong c_long_double
2121
22syn keyword zigBoolean true false22syn keyword zigBoolean true false
2323
24syn match zigOperator display "\%(+\|-\|/\|*\|=\|\^\|&\|?\||\|!\|>\|<\|%\)=\?"24syn match zigOperator display "\%(+%\?\|-%\?\|/\|*%\?\|=\|\^\|&\|?\||\|!\|>\|<\|%\|<<%\?\|>>\|&&\|||\)=\?"
25syn match zigOperator display "&&\|||"
26syn match zigArrowCharacter display "->"25syn match zigArrowCharacter display "->"
2726
28syn match zigDecNumber display "\<[0-9][0-9_]*\%([iu]\%(size\|8\|16\|32\|64\)\)\="27syn match zigDecNumber display "\<[0-9][0-9_]*\%([iu]\%(size\|8\|16\|32\|64\)\)\="
...@@ -40,10 +39,6 @@ syn match zigShebang /\%^#![^[].*/...@@ -40,10 +39,6 @@ syn match zigShebang /\%^#![^[].*/
4039
41syn region zigCommentLine start="//" end="$" contains=zigTodo,@Spell40syn region zigCommentLine start="//" end="$" contains=zigTodo,@Spell
42syn region zigCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=zigTodo,@Spell41syn region zigCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=zigTodo,@Spell
43syn region zigCommentBlock matchgroup=zigCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=zigTodo,zigCommentBlockNest,@Spell
44syn region zigCommentBlockDoc matchgroup=zigCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=zigTodo,zigCommentBlockDocNest,@Spell
45syn region zigCommentBlockNest matchgroup=zigCommentBlock start="/\*" end="\*/" contains=zigTodo,zigCommentBlockNest,@Spell contained transparent
46syn region zigCommentBlockDocNest matchgroup=zigCommentBlockDoc start="/\*" end="\*/" contains=zigTodo,zigCommentBlockDocNest,@Spell contained transparent
4742
48syn keyword zigTodo contained TODO XXX43syn keyword zigTodo contained TODO XXX
4944
...@@ -67,8 +62,6 @@ hi def link zigType Type...@@ -67,8 +62,6 @@ hi def link zigType Type
67hi def link zigShebang Comment62hi def link zigShebang Comment
68hi def link zigCommentLine Comment63hi def link zigCommentLine Comment
69hi def link zigCommentLineDoc SpecialComment64hi def link zigCommentLineDoc SpecialComment
70hi def link zigCommentBlock zigCommentLine
71hi def link zigCommentBlockDoc zigCommentLineDoc
72hi def link zigTodo Todo65hi def link zigTodo Todo
73hi def link zigStringContinuation Special66hi def link zigStringContinuation Special
74hi def link zigString String67hi def link zigString String
src/tokenizer.cpp-57
...@@ -167,9 +167,6 @@ enum TokenizeState {...@@ -167,9 +167,6 @@ enum TokenizeState {
167 TokenizeStateSawPipe,167 TokenizeStateSawPipe,
168 TokenizeStateSawPipePipe,168 TokenizeStateSawPipePipe,
169 TokenizeStateLineComment,169 TokenizeStateLineComment,
170 TokenizeStateMultiLineComment,
171 TokenizeStateMultiLineCommentSlash,
172 TokenizeStateMultiLineCommentStar,
173 TokenizeStateSawEq,170 TokenizeStateSawEq,
174 TokenizeStateSawBang,171 TokenizeStateSawBang,
175 TokenizeStateSawLessThan,172 TokenizeStateSawLessThan,
...@@ -194,7 +191,6 @@ struct Tokenize {...@@ -194,7 +191,6 @@ struct Tokenize {
194 int line;191 int line;
195 int column;192 int column;
196 Token *cur_tok;193 Token *cur_tok;
197 int multi_line_comment_count;
198 Tokenization *out;194 Tokenization *out;
199 int raw_string_id_start;195 int raw_string_id_start;
200 int raw_string_id_end;196 int raw_string_id_end;
...@@ -840,11 +836,6 @@ void tokenize(Buf *buf, Tokenization *out) {...@@ -840,11 +836,6 @@ void tokenize(Buf *buf, Tokenization *out) {
840 cancel_token(&t);836 cancel_token(&t);
841 t.state = TokenizeStateLineComment;837 t.state = TokenizeStateLineComment;
842 break;838 break;
843 case '*':
844 cancel_token(&t);
845 t.state = TokenizeStateMultiLineComment;
846 t.multi_line_comment_count = 1;
847 break;
848 case '=':839 case '=':
849 t.cur_tok->id = TokenIdDivEq;840 t.cur_tok->id = TokenIdDivEq;
850 end_token(&t);841 end_token(&t);
...@@ -867,49 +858,6 @@ void tokenize(Buf *buf, Tokenization *out) {...@@ -867,49 +858,6 @@ void tokenize(Buf *buf, Tokenization *out) {
867 break;858 break;
868 }859 }
869 break;860 break;
870 case TokenizeStateMultiLineComment:
871 switch (c) {
872 case '*':
873 t.state = TokenizeStateMultiLineCommentStar;
874 break;
875 case '/':
876 t.state = TokenizeStateMultiLineCommentSlash;
877 break;
878 default:
879 // do nothing
880 break;
881 }
882 break;
883 case TokenizeStateMultiLineCommentSlash:
884 switch (c) {
885 case '*':
886 t.state = TokenizeStateMultiLineComment;
887 t.multi_line_comment_count += 1;
888 break;
889 case '/':
890 break;
891 default:
892 t.state = TokenizeStateMultiLineComment;
893 break;
894 }
895 break;
896 case TokenizeStateMultiLineCommentStar:
897 switch (c) {
898 case '/':
899 t.multi_line_comment_count -= 1;
900 if (t.multi_line_comment_count == 0) {
901 t.state = TokenizeStateStart;
902 } else {
903 t.state = TokenizeStateMultiLineComment;
904 }
905 break;
906 case '*':
907 break;
908 default:
909 t.state = TokenizeStateMultiLineComment;
910 break;
911 }
912 break;
913 case TokenizeStateSymbolFirst:861 case TokenizeStateSymbolFirst:
914 switch (c) {862 switch (c) {
915 case '"':863 case '"':
...@@ -1339,11 +1287,6 @@ void tokenize(Buf *buf, Tokenization *out) {...@@ -1339,11 +1287,6 @@ void tokenize(Buf *buf, Tokenization *out) {
1339 break;1287 break;
1340 case TokenizeStateLineComment:1288 case TokenizeStateLineComment:
1341 break;1289 break;
1342 case TokenizeStateMultiLineComment:
1343 case TokenizeStateMultiLineCommentSlash:
1344 case TokenizeStateMultiLineCommentStar:
1345 tokenize_error(&t, "unterminated multi-line comment");
1346 break;
1347 }1290 }
1348 if (t.state != TokenizeStateError) {1291 if (t.state != TokenizeStateError) {
1349 if (t.tokens->length > 0) {1292 if (t.tokens->length > 0) {
std/compiler_rt.zig+54-66
...@@ -27,45 +27,41 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int {...@@ -27,45 +27,41 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int {
27 var q: udwords = undefined;27 var q: udwords = undefined;
28 var r: udwords = undefined;28 var r: udwords = undefined;
29 var sr: c_uint = undefined;29 var sr: c_uint = undefined;
30 /* special cases, X is unknown, K != 0 */30 // special cases, X is unknown, K != 0
31 if (n[high] == 0) {31 if (n[high] == 0) {
32 if (d[high] == 0) {32 if (d[high] == 0) {
33 /* 0 X33 // 0 X
34 * ---34 // ---
35 * 0 X35 // 0 X
36 */
37 if (const rem ?= maybe_rem) {36 if (const rem ?= maybe_rem) {
38 *rem = n[low] % d[low];37 *rem = n[low] % d[low];
39 }38 }
40 return n[low] / d[low];39 return n[low] / d[low];
41 }40 }
42 /* 0 X41 // 0 X
43 * ---42 // ---
44 * K X43 // K X
45 */
46 if (const rem ?= maybe_rem) {44 if (const rem ?= maybe_rem) {
47 *rem = n[low];45 *rem = n[low];
48 }46 }
49 return 0;47 return 0;
50 }48 }
51 /* n[high] != 0 */49 // n[high] != 0
52 if (d[low] == 0) {50 if (d[low] == 0) {
53 if (d[high] == 0) {51 if (d[high] == 0) {
54 /* K X52 // K X
55 * ---53 // ---
56 * 0 054 // 0 0
57 */
58 if (var rem ?= maybe_rem) {55 if (var rem ?= maybe_rem) {
59 *rem = n[high] % d[low];56 *rem = n[high] % d[low];
60 }57 }
61 return n[high] / d[low];58 return n[high] / d[low];
62 }59 }
63 /* d[high] != 0 */60 // d[high] != 0
64 if (n[low] == 0) {61 if (n[low] == 0) {
65 /* K 062 // K 0
66 * ---63 // ---
67 * K 064 // K 0
68 */
69 if (var rem ?= maybe_rem) {65 if (var rem ?= maybe_rem) {
70 r[high] = n[high] % d[high];66 r[high] = n[high] % d[high];
71 r[low] = 0;67 r[low] = 0;
...@@ -73,10 +69,9 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int {...@@ -73,10 +69,9 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int {
73 }69 }
74 return n[high] / d[high];70 return n[high] / d[high];
75 }71 }
76 /* K K72 // K K
77 * ---73 // ---
78 * K 074 // K 0
79 */
80 // if d is a power of 275 // if d is a power of 2
81 if ((d[high] & (d[high] - 1)) == 0) {76 if ((d[high] & (d[high] - 1)) == 0) {
82 if (var rem ?= maybe_rem) {77 if (var rem ?= maybe_rem) {
...@@ -86,12 +81,11 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int {...@@ -86,12 +81,11 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int {
86 }81 }
87 return n[high] >> @ctz(@typeof(d[high]), d[high]);82 return n[high] >> @ctz(@typeof(d[high]), d[high]);
88 }83 }
89 /* K K84 // K K
90 * ---85 // ---
91 * K 086 // K 0
92 */
93 sr = @clz(su_int, d[high]) - @clz(su_int, n[high]);87 sr = @clz(su_int, d[high]) - @clz(su_int, n[high]);
94 /* 0 <= sr <= n_uword_bits - 2 or sr large */88 // 0 <= sr <= n_uword_bits - 2 or sr large
95 if (sr > n_uword_bits - 2) {89 if (sr > n_uword_bits - 2) {
96 if (var rem ?= maybe_rem) {90 if (var rem ?= maybe_rem) {
97 *rem = *(&du_int)(&n[0]);91 *rem = *(&du_int)(&n[0]);
...@@ -99,21 +93,20 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int {...@@ -99,21 +93,20 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int {
99 return 0;93 return 0;
100 }94 }
101 sr += 1;95 sr += 1;
102 /* 1 <= sr <= n_uword_bits - 1 */96 // 1 <= sr <= n_uword_bits - 1
103 /* q.all = n.all << (n_udword_bits - sr); */97 // q.all = n.all << (n_udword_bits - sr);
104 q[low] = 0;98 q[low] = 0;
105 q[high] = n[low] << (n_uword_bits - sr);99 q[high] = n[low] << (n_uword_bits - sr);
106 /* r.all = n.all >> sr; */100 // r.all = n.all >> sr;
107 r[high] = n[high] >> sr;101 r[high] = n[high] >> sr;
108 r[low] = (n[high] << (n_uword_bits - sr)) | (n[low] >> sr);102 r[low] = (n[high] << (n_uword_bits - sr)) | (n[low] >> sr);
109 } else {103 } else {
110 /* d[low] != 0 */104 // d[low] != 0
111 if (d[high] == 0) {105 if (d[high] == 0) {
112 /* K X106 // K X
113 * ---107 // ---
114 * 0 K108 // 0 K
115 */109 // if d is a power of 2
116 /* if d is a power of 2 */
117 if ((d[low] & (d[low] - 1)) == 0) {110 if ((d[low] & (d[low] - 1)) == 0) {
118 if (var rem ?= maybe_rem) {111 if (var rem ?= maybe_rem) {
119 *rem = n[low] & (d[low] - 1);112 *rem = n[low] & (d[low] - 1);
...@@ -126,15 +119,13 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int {...@@ -126,15 +119,13 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int {
126 q[low] = (n[high] << (n_uword_bits - sr)) | (n[low] >> sr);119 q[low] = (n[high] << (n_uword_bits - sr)) | (n[low] >> sr);
127 return *(&du_int)(&q[0]);120 return *(&du_int)(&q[0]);
128 }121 }
129 /* K X122 // K X
130 * ---123 // ---
131 * 0 K124 // 0 K
132 */
133 sr = 1 + n_uword_bits + @clz(su_int, d[low]) - @clz(su_int, n[high]);125 sr = 1 + n_uword_bits + @clz(su_int, d[low]) - @clz(su_int, n[high]);
134 /* 2 <= sr <= n_udword_bits - 1126 // 2 <= sr <= n_udword_bits - 1
135 * q.all = n.all << (n_udword_bits - sr);127 // q.all = n.all << (n_udword_bits - sr);
136 * r.all = n.all >> sr;128 // r.all = n.all >> sr;
137 */
138 if (sr == n_uword_bits) {129 if (sr == n_uword_bits) {
139 q[low] = 0;130 q[low] = 0;
140 q[high] = n[low];131 q[high] = n[low];
...@@ -155,12 +146,11 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int {...@@ -155,12 +146,11 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int {
155 r[low] = n[high] >> (sr - n_uword_bits);146 r[low] = n[high] >> (sr - n_uword_bits);
156 }147 }
157 } else {148 } else {
158 /* K X149 // K X
159 * ---150 // ---
160 * K K151 // K K
161 */
162 sr = @clz(su_int, d[high]) - @clz(su_int, n[high]);152 sr = @clz(su_int, d[high]) - @clz(su_int, n[high]);
163 /* 0 <= sr <= n_uword_bits - 1 or sr large */153 // 0 <= sr <= n_uword_bits - 1 or sr large
164 if (sr > n_uword_bits - 1) {154 if (sr > n_uword_bits - 1) {
165 if (var rem ?= maybe_rem) {155 if (var rem ?= maybe_rem) {
166 *rem = *(&du_int)(&n[0]);156 *rem = *(&du_int)(&n[0]);
...@@ -168,8 +158,8 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int {...@@ -168,8 +158,8 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int {
168 return 0;158 return 0;
169 }159 }
170 sr += 1;160 sr += 1;
171 /* 1 <= sr <= n_uword_bits */161 // 1 <= sr <= n_uword_bits
172 /* q.all = n.all << (n_udword_bits - sr); */162 // q.all = n.all << (n_udword_bits - sr);
173 q[low] = 0;163 q[low] = 0;
174 if (sr == n_uword_bits) {164 if (sr == n_uword_bits) {
175 q[high] = n[low];165 q[high] = n[low];
...@@ -182,26 +172,24 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int {...@@ -182,26 +172,24 @@ export fn __udivmoddi4(a: du_int, b: du_int, maybe_rem: ?&du_int) -> du_int {
182 }172 }
183 }173 }
184 }174 }
185 /* Not a special case175 // Not a special case
186 * q and r are initialized with:176 // q and r are initialized with:
187 * q.all = n.all << (n_udword_bits - sr);177 // q.all = n.all << (n_udword_bits - sr);
188 * r.all = n.all >> sr;178 // r.all = n.all >> sr;
189 * 1 <= sr <= n_udword_bits - 1179 // 1 <= sr <= n_udword_bits - 1
190 */
191 var carry: su_int = 0;180 var carry: su_int = 0;
192 while (sr > 0) {181 while (sr > 0) {
193 /* r:q = ((r:q) << 1) | carry */182 // r:q = ((r:q) << 1) | carry
194 r[high] = (r[high] << 1) | (r[low] >> (n_uword_bits - 1));183 r[high] = (r[high] << 1) | (r[low] >> (n_uword_bits - 1));
195 r[low] = (r[low] << 1) | (q[high] >> (n_uword_bits - 1));184 r[low] = (r[low] << 1) | (q[high] >> (n_uword_bits - 1));
196 q[high] = (q[high] << 1) | (q[low] >> (n_uword_bits - 1));185 q[high] = (q[high] << 1) | (q[low] >> (n_uword_bits - 1));
197 q[low] = (q[low] << 1) | carry;186 q[low] = (q[low] << 1) | carry;
198 /* carry = 0;187 // carry = 0;
199 * if (r.all >= d.all)188 // if (r.all >= d.all)
200 * {189 // {
201 * r.all -= d.all;190 // r.all -= d.all;
202 * carry = 1;191 // carry = 1;
203 * }192 // }
204 */
205 const s: di_int = (di_int)(*(&du_int)(&d[0]) - *(&du_int)(&r[0]) - 1) >> (n_udword_bits - 1);193 const s: di_int = (di_int)(*(&du_int)(&d[0]) - *(&du_int)(&r[0]) - 1) >> (n_udword_bits - 1);
206 carry = su_int(s & 1);194 carry = su_int(s & 1);
207 *(&du_int)(&r[0]) -= *(&du_int)(&d[0]) & u64(s);195 *(&du_int)(&r[0]) -= *(&du_int)(&d[0]) & u64(s);
std/hash_map.zig+4-4
...@@ -6,11 +6,11 @@ const Allocator = mem.Allocator;...@@ -6,11 +6,11 @@ const Allocator = mem.Allocator;
6const want_modification_safety = !@compile_var("is_release");6const want_modification_safety = !@compile_var("is_release");
7const debug_u32 = if (want_modification_safety) u32 else void;7const debug_u32 = if (want_modification_safety) u32 else void;
88
9/*9pub inline fn HashMap(inline K: type, inline V: type,
10pub inline fn HashMap(inline K: type, inline V: type, inline hash: fn(key: K)->u32, inline eql: fn(a: K, b: K)->bool) {10 inline hash: fn(key: K)->u32, inline eql: fn(a: K, b: K)->bool)
11 SmallHashMap(K, V, hash, eql, 8);11{
12 SmallHashMap(K, V, hash, eql, 8)
12}13}
13*/
1414
15pub struct SmallHashMap(K: type, V: type, hash: fn(key: K)->u32, eql: fn(a: K, b: K)->bool, STATIC_SIZE: usize) {15pub struct SmallHashMap(K: type, V: type, hash: fn(key: K)->u32, eql: fn(a: K, b: K)->bool, STATIC_SIZE: usize) {
16 entries: []Entry,16 entries: []Entry,
std/linux.zig+21-21
...@@ -342,27 +342,27 @@ export struct iovec {...@@ -342,27 +342,27 @@ export struct iovec {
342 iov_len: usize,342 iov_len: usize,
343}343}
344344
345/*345//
346const IF_NAMESIZE = 16;346//const IF_NAMESIZE = 16;
347347//
348export struct ifreq {348//export struct ifreq {
349 ifrn_name: [IF_NAMESIZE]u8,349// ifrn_name: [IF_NAMESIZE]u8,
350 union {350// union {
351 ifru_addr: sockaddr,351// ifru_addr: sockaddr,
352 ifru_dstaddr: sockaddr,352// ifru_dstaddr: sockaddr,
353 ifru_broadaddr: sockaddr,353// ifru_broadaddr: sockaddr,
354 ifru_netmask: sockaddr,354// ifru_netmask: sockaddr,
355 ifru_hwaddr: sockaddr,355// ifru_hwaddr: sockaddr,
356 ifru_flags: i16,356// ifru_flags: i16,
357 ifru_ivalue: i32,357// ifru_ivalue: i32,
358 ifru_mtu: i32,358// ifru_mtu: i32,
359 ifru_map: ifmap,359// ifru_map: ifmap,
360 ifru_slave: [IF_NAMESIZE]u8,360// ifru_slave: [IF_NAMESIZE]u8,
361 ifru_newname: [IF_NAMESIZE]u8,361// ifru_newname: [IF_NAMESIZE]u8,
362 ifru_data: &u8,362// ifru_data: &u8,
363 } ifr_ifru;363// } ifr_ifru;
364}364//}
365*/365//
366366
367pub fn getsockname(fd: i32, noalias addr: &sockaddr, noalias len: &socklen_t) -> usize {367pub fn getsockname(fd: i32, noalias addr: &sockaddr, noalias len: &socklen_t) -> usize {
368 arch.syscall3(arch.SYS_getsockname, usize(fd), usize(addr), usize(len))368 arch.syscall3(arch.SYS_getsockname, usize(fd), usize(addr), usize(len))
std/net.zig+20-20
...@@ -67,12 +67,12 @@ struct Address {...@@ -67,12 +67,12 @@ struct Address {
67pub fn lookup(hostname: []const u8, out_addrs: []Address) -> %[]Address {67pub fn lookup(hostname: []const u8, out_addrs: []Address) -> %[]Address {
68 if (hostname.len == 0) {68 if (hostname.len == 0) {
6969
70/*70//
71 if (family != AF_INET6)71// if (family != AF_INET6)
72 buf[cnt++] = (struct address){ .family = AF_INET, .addr = { 127,0,0,1 } };72// buf[cnt++] = (struct address){ .family = AF_INET, .addr = { 127,0,0,1 } };
73 if (family != AF_INET)73// if (family != AF_INET)
74 buf[cnt++] = (struct address){ .family = AF_INET6, .addr = { [15] = 1 } };74// buf[cnt++] = (struct address){ .family = AF_INET6, .addr = { [15] = 1 } };
75 */75//
76 unreachable{} // TODO76 unreachable{} // TODO
77 }77 }
7878
...@@ -248,20 +248,20 @@ fn parse_ip6(buf: []const u8) -> %Address {...@@ -248,20 +248,20 @@ fn parse_ip6(buf: []const u8) -> %Address {
248 return error.Incomplete;248 return error.Incomplete;
249 }249 }
250250
251 /*251//
252 if (p) {252// if (p) {
253 if (isdigit(*++p)) scopeid = strtoull(p, &z, 10);253// if (isdigit(*++p)) scopeid = strtoull(p, &z, 10);
254 else z = p-1;254// else z = p-1;
255 if (*z) {255// if (*z) {
256 if (!IN6_IS_ADDR_LINKLOCAL(&a6) &&256// if (!IN6_IS_ADDR_LINKLOCAL(&a6) &&
257 !IN6_IS_ADDR_MC_LINKLOCAL(&a6))257// !IN6_IS_ADDR_MC_LINKLOCAL(&a6))
258 return EAI_NONAME;258// return EAI_NONAME;
259 scopeid = if_nametoindex(p);259// scopeid = if_nametoindex(p);
260 if (!scopeid) return EAI_NONAME;260// if (!scopeid) return EAI_NONAME;
261 }261// }
262 if (scopeid > UINT_MAX) return EAI_NONAME;262// if (scopeid > UINT_MAX) return EAI_NONAME;
263 }263// }
264 */264//
265265
266 if (scope_id) {266 if (scope_id) {
267 return result;267 return result;
test/self_hosted.zig+2-13
...@@ -4,22 +4,11 @@ const str = std.str;...@@ -4,22 +4,11 @@ const str = std.str;
4const cstr = std.cstr;4const cstr = std.cstr;
5const other = @import("other.zig");5const other = @import("other.zig");
66
7#attribute("test")7// normal comment
8fn empty_function() {}
9
10
11
12/**
13 * multi line doc comment
14 */
15/// this is a documentation comment8/// this is a documentation comment
16/// doc comment line 29/// doc comment line 2
17#attribute("test")10#attribute("test")
18fn comments() {11fn empty_function_with_comments() {}
19 comments_f1(/* mid-line comment /* nested */ */ "OK\n");
20}
21
22fn comments_f1(s: []u8) {}
2312
2413
25#attribute("test")14#attribute("test")