Beispiel #1
0
N_NIMCALL(Tllstream178204*, filterreplace_217004)(Tllstream178204* stdin_217006, NimStringDesc* filename, Tnode191813* call) {
	Tllstream178204* result;
	NimStringDesc* sub;
	NimStringDesc* by;
	NimStringDesc* line;
	result = 0;
	sub = strarg_217029(call, ((NimStringDesc*) &TMP1424), ((NI) 1), ((NimStringDesc*) &TMP1419));
	{
		if (!((sub ? sub->Sup.len : 0) == ((NI) 0))) goto LA3;
		invalidpragma_217047(call);
	}
	LA3: ;
	by = strarg_217029(call, ((NimStringDesc*) &TMP1425), ((NI) 2), ((NimStringDesc*) &TMP1419));
	result = llstreamopen_178220(((NimStringDesc*) &TMP1419));
	line = rawNewString(((NI) 80));
	{
		while (1) {
			NIM_BOOL LOC7;
			NimStringDesc* LOC8;
			LOC7 = 0;
			LOC7 = llstreamreadline_178610(stdin_217006, (&line));
			if (!LOC7) goto LA6;
			LOC8 = 0;
			LOC8 = nsuReplaceStr(line, sub, by);
			llstreamwriteln_178686(result, LOC8);
		} LA6: ;
	}
	llstreamclose_178310(stdin_217006);
	return result;
}
Beispiel #2
0
N_NIMCALL(Tllstream178204*, filtertmpl_218009)(Tllstream178204* stdin_218011, NimStringDesc* filename, Tnode191813* call) {
	Tllstream178204* result;
	Ttmplparser218020 p;
	result = 0;
	memset((void*)(&p), 0, sizeof(p));
	p.info = newlineinfo_163883(filename, ((NI) 0), ((NI) 0));
	p.outp = llstreamopen_178220(((NimStringDesc*) &TMP1401));
	p.inp = stdin_218011;
	p.subschar = chararg_217020(call, ((NimStringDesc*) &TMP1402), ((NI) 1), 36);
	p.nimdirective = chararg_217020(call, ((NimStringDesc*) &TMP1403), ((NI) 2), 35);
	p.emit = strarg_217029(call, ((NimStringDesc*) &TMP1404), ((NI) 3), ((NimStringDesc*) &TMP1405));
	p.conc = strarg_217029(call, ((NimStringDesc*) &TMP1406), ((NI) 4), ((NimStringDesc*) &TMP1407));
	p.tostr = strarg_217029(call, ((NimStringDesc*) &TMP1408), ((NI) 5), ((NimStringDesc*) &TMP1409));
	p.x = rawNewString(((NI) 120));
	{
		while (1) {
			NIM_BOOL LOC3;
			LOC3 = 0;
			LOC3 = llstreamreadline_178610(p.inp, (&p.x));
			if (!LOC3) goto LA2;
			p.info.line = (NI16)(p.info.line + ((NI16) 1));
			parseline_218149((&p));
		} LA2: ;
	}
	newline_218047((&p));
	result = p.outp;
	llstreamclose_178310(p.inp);
	return result;
}
N_NIMCALL(void, closebaselexer_179045)(Tbaselexer179024* L) {
	nimfr("closeBaseLexer", "nimlexbase.nim")
	nimln(71, "nimlexbase.nim");
	dealloc_6048(((void*) ((*L).buf)));
	nimln(72, "nimlexbase.nim");
	llstreamclose_178310((*L).stream);
	popFrame();
}
N_NIMCALL(Tllstream178204*, filtertmpl_218009)(Tllstream178204* stdin_218011, NimStringDesc* filename, Tnode191813* call) {
	Tllstream178204* result;
	Ttmplparser218020 p;
	nimfr("filterTmpl", "filter_tmpl.nim")
	result = 0;
	memset((void*)(&p), 0, sizeof(p));
	nimln(207, "filter_tmpl.nim");
	p.info = newlineinfo_163879(filename, ((NI) 0), ((NI) 0));
	nimln(208, "filter_tmpl.nim");
	p.outp = llstreamopen_178220(((NimStringDesc*) &TMP3362));
	nimln(209, "filter_tmpl.nim");
	p.inp = stdin_218011;
	nimln(210, "filter_tmpl.nim");
	p.subschar = chararg_217020(call, ((NimStringDesc*) &TMP3396), ((NI) 1), 36);
	nimln(211, "filter_tmpl.nim");
	p.nimdirective = chararg_217020(call, ((NimStringDesc*) &TMP3397), ((NI) 2), 35);
	nimln(212, "filter_tmpl.nim");
	p.emit = strarg_217029(call, ((NimStringDesc*) &TMP3398), ((NI) 3), ((NimStringDesc*) &TMP3399));
	nimln(213, "filter_tmpl.nim");
	p.conc = strarg_217029(call, ((NimStringDesc*) &TMP3400), ((NI) 4), ((NimStringDesc*) &TMP3401));
	nimln(214, "filter_tmpl.nim");
	p.tostr = strarg_217029(call, ((NimStringDesc*) &TMP3402), ((NI) 5), ((NimStringDesc*) &TMP3393));
	nimln(215, "filter_tmpl.nim");
	p.x = rawNewString(((NI) 120));
	{
		nimln(216, "filter_tmpl.nim");
		while (1) {
			NIM_BOOL LOC3;
			NI TMP3403;
			LOC3 = 0;
			LOC3 = llstreamreadline_178610(p.inp, (&p.x));
			if (!LOC3) goto LA2;
			nimln(217, "filter_tmpl.nim");
			TMP3403 = addInt(p.info.line, ((NI16) 1));
			if (TMP3403 < -32768 || TMP3403 > 32767) raiseOverflow();
			p.info.line = (NI16)(TMP3403);
			nimln(218, "filter_tmpl.nim");
			parseline_218149((&p));
		} LA2: ;
	}
	nimln(219, "filter_tmpl.nim");
	newline_218047((&p));
	nimln(220, "filter_tmpl.nim");
	result = p.outp;
	nimln(221, "filter_tmpl.nim");
	llstreamclose_178310(p.inp);
	popFrame();
	return result;
}
Beispiel #5
0
N_NIMCALL(Tllstream178204*, filterstrip_217012)(Tllstream178204* stdin_217014, NimStringDesc* filename, Tnode191813* call) {
	Tllstream178204* result;
	NimStringDesc* pattern;
	NIM_BOOL leading;
	NIM_BOOL trailing;
	NimStringDesc* line;
	result = 0;
	pattern = strarg_217029(call, ((NimStringDesc*) &TMP1418), ((NI) 1), ((NimStringDesc*) &TMP1419));
	leading = boolarg_217038(call, ((NimStringDesc*) &TMP1422), ((NI) 2), NIM_TRUE);
	trailing = boolarg_217038(call, ((NimStringDesc*) &TMP1423), ((NI) 3), NIM_TRUE);
	result = llstreamopen_178220(((NimStringDesc*) &TMP1419));
	line = rawNewString(((NI) 80));
	{
		while (1) {
			NIM_BOOL LOC3;
			NimStringDesc* stripped;
			LOC3 = 0;
			LOC3 = llstreamreadline_178610(stdin_217014, (&line));
			if (!LOC3) goto LA2;
			stripped = nsuStrip(line, leading, trailing);
			{
				NIM_BOOL LOC6;
				LOC6 = 0;
				LOC6 = ((pattern ? pattern->Sup.len : 0) == ((NI) 0));
				if (LOC6) goto LA7;
				LOC6 = nsuStartsWith(stripped, pattern);
				LA7: ;
				if (!LOC6) goto LA8;
				llstreamwriteln_178686(result, stripped);
			}
			goto LA4;
			LA8: ;
			{
				llstreamwriteln_178686(result, line);
			}
			LA4: ;
		} LA2: ;
	}
	llstreamclose_178310(stdin_217014);
	return result;
}
Beispiel #6
0
N_NIMCALL(void, closebaselexer_179045)(Tbaselexer179024* L) {
	dealloc_6048(((void*) ((*L).buf)));
	llstreamclose_178310((*L).stream);
}