N_NIMCALL(void, openbaselexer_179035)(Tbaselexer179024* L, Tllstream178204* inputstream, NI buflen) {
	NI TMP2155;
	void* LOC5;
	NI TMP2156;
	nimfr("openBaseLexer", "nimlexbase.nim")
	nimln(147, "nimlexbase.nim");
	{
		if (!!((((NI) 0) < buflen))) goto LA3;
		failedassertimpl_87217(((NimStringDesc*) &TMP2154));
	}
	LA3: ;
	nimln(148, "nimlexbase.nim");
	(*L).bufpos = ((NI) 0);
	nimln(149, "nimlexbase.nim");
	(*L).buflen = buflen;
	nimln(150, "nimlexbase.nim");
	TMP2155 = mulInt(buflen, ((NI) 1));
	LOC5 = 0;
	LOC5 = alloc_6001(((NI)chckRange((NI)(TMP2155), ((NI) 0), ((NI) 2147483647))));
	(*L).buf = ((NCSTRING) (LOC5));
	nimln(151, "nimlexbase.nim");
	TMP2156 = subInt(buflen, ((NI) 1));
	(*L).sentinel = (NI)(TMP2156);
	nimln(152, "nimlexbase.nim");
	(*L).linestart = ((NI) 0);
	nimln(153, "nimlexbase.nim");
	(*L).linenumber = ((NI) 1);
	nimln(154, "nimlexbase.nim");
	unsureAsgnRef((void**) (&(*L).stream), inputstream);
	nimln(155, "nimlexbase.nim");
	fillbuffer_179097(L);
	nimln(156, "nimlexbase.nim");
	skiputf8bom_180416(L);
	popFrame();
}
N_NIMCALL(NI, fillbaselexer_179827)(Tbaselexer179024* L, NI pos) {
	NI result;
	nimfr("fillBaseLexer", "nimlexbase.nim")
	result = 0;
	nimln(120, "nimlexbase.nim");
	{
		if (!!((pos <= (*L).sentinel))) goto LA3;
		failedassertimpl_87217(((NimStringDesc*) &TMP2146));
	}
	LA3: ;
	nimln(121, "nimlexbase.nim");
	{
		NI TMP2147;
		if (!(pos < (*L).sentinel)) goto LA7;
		nimln(122, "nimlexbase.nim");
		TMP2147 = addInt(pos, ((NI) 1));
		result = (NI)(TMP2147);
	}
	goto LA5;
	LA7: ;
	{
		nimln(124, "nimlexbase.nim");
		fillbuffer_179097(L);
		nimln(125, "nimlexbase.nim");
		(*L).bufpos = ((NI) 0);
		nimln(126, "nimlexbase.nim");
		result = ((NI) 0);
	}
	LA5: ;
	nimln(127, "nimlexbase.nim");
	(*L).linestart = result;
	popFrame();
	return result;
}
N_NIMCALL(void, openbaselexer_179035)(Tbaselexer179024* L, Tllstream178204* inputstream, NI buflen) {
	void* LOC1;
	(*L).bufpos = ((NI) 0);
	(*L).buflen = buflen;
	LOC1 = 0;
	LOC1 = alloc_6001(((NI) ((NI)(buflen * ((NI) 1)))));
	(*L).buf = ((NCSTRING) (LOC1));
	(*L).sentinel = (NI)(buflen - ((NI) 1));
	(*L).linestart = ((NI) 0);
	(*L).linenumber = ((NI) 1);
	unsureAsgnRef((void**) (&(*L).stream), inputstream);
	fillbuffer_179097(L);
	skiputf8bom_180416(L);
}
N_NIMCALL(NI, fillbaselexer_179827)(Tbaselexer179024* L, NI pos) {
	NI result;
	result = 0;
	{
		if (!(pos < (*L).sentinel)) goto LA3;
		result = (NI)(pos + ((NI) 1));
	}
	goto LA1;
	LA3: ;
	{
		fillbuffer_179097(L);
		(*L).bufpos = ((NI) 0);
		result = ((NI) 0);
	}
	LA1: ;
	(*L).linestart = result;
	return result;
}