return;
}
- // first $$ marks beginning of exports
- p0 = strstr(data, "$$");
+ // first \n$$ marks beginning of exports - skip rest of line
+ p0 = strstr(data, "\n$$");
if(p0 == nil)
return;
- p0 += 2;
+ p0 += 3;
while(*p0 != '\n' && *p0 != '\0')
p0++;
- p1 = strstr(p0, "$$");
+
+ // second marks end of exports / beginning of local data
+ p1 = strstr(p0, "\n$$");
if(p1 == nil) {
fprint(2, "6l: cannot find end of exports in %s\n", filename);
return;
loadpkgdata(filename, p0, p1 - p0);
// local types begin where exports end.
- p0 = p1;
+ // skip rest of line after $$ we found above
+ p0 = p1 + 3;
while(*p0 != '\n' && *p0 != '\0')
p0++;
- p1 = strstr(p0, "$$");
+
+ // local types end at next \n$$.
+ p1 = strstr(p0, "\n$$");
if(p1 == nil) {
fprint(2, "6l: cannot find end of local types in %s\n", filename);
return;
first = 0;
continue;
}
- if (strstrn(line, Blinelen(b), "$$"))
+ if(line[0] == '$' && line[1] == '$')
goto foundend;
end = Boffset(b); // before closing $$
}
lno = lineno;
Bprint(bout, " import\n");
- Bprint(bout, " $$ // exports\n");
+ Bprint(bout, "\n$$ // exports\n");
Bprint(bout, " package %s\n", package);