/* Generated by Nim Compiler v1.6.14 */
#define NIM_INTBITS 64

#include "nimbase.h"
#include <string.h>
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
#define nimfr_(x, y)
#define nimln_(x, y)
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA;
typedef struct RootObj RootObj;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg;
typedef struct tyObject_HSlice__dyNB5o2GYLzoO6FJ2RhiZw tyObject_HSlice__dyNB5o2GYLzoO6FJ2RhiZw;
typedef NU8 tyEnum_TNimKind__pspQAsqJLrw3jEKBD9bxmyQ;
typedef NU8 tySet_tyEnum_TNimTypeFlag__Yt5hq6z2IoHhKZrzIVrc1w;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
NI align;
tyEnum_TNimKind__pspQAsqJLrw3jEKBD9bxmyQ kind;
tySet_tyEnum_TNimTypeFlag__Yt5hq6z2IoHhKZrzIVrc1w flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind__rrp49bl1h9aEkXfXp9bNg0yZw;
struct TNimNode {
tyEnum_TNimNodeKind__rrp49bl1h9aEkXfXp9bNg0yZw kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct RootObj {
TNimType* m_type;
};
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NU8 tySet_tyChar__nmiMWKVIe46vacnhAFrQvw[32];
struct tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA {
  RootObj Sup;
NI bufpos;
NimStringDesc* buf;
tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* input;
NI lineNumber;
NI sentinel;
NI lineStart;
NI offsetBase;
tySet_tyChar__nmiMWKVIe46vacnhAFrQvw refillChars;
};
typedef N_NIMCALL_PTR(void, tyProc__u1QtPTYUJu1ozpzb9a8xchw) (tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s);
typedef N_NIMCALL_PTR(NIM_BOOL, tyProc__VytW5cBLp1DOuwAj9cjoj3Q) (tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s);
typedef N_NIMCALL_PTR(void, tyProc__nAUmmvz53fMDhkU9aQ4i60Q) (tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s, NI pos);
typedef N_NIMCALL_PTR(NI, tyProc__rvgAWCz6iG9cntloh2xzZmQ) (tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s);
typedef N_NIMCALL_PTR(NI, tyProc__sAr4e3JGOuIBVEZ29aGGKUQ) (tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s, NimStringDesc** buffer, tyObject_HSlice__dyNB5o2GYLzoO6FJ2RhiZw slice);
typedef N_NIMCALL_PTR(NIM_BOOL, tyProc__7SoiV5lfjKUldz1ENKXq1w) (tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s, NimStringDesc** line);
typedef N_NIMCALL_PTR(NI, tyProc__mPF9ae7sAGGCOezlsIuH6Yg) (tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s, void* buffer, NI bufLen);
typedef N_NIMCALL_PTR(void, tyProc__1nrRaSRiXjiE9bnEpZhmOsA) (tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s, void* buffer, NI bufLen);
struct tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg {
  RootObj Sup;
tyProc__u1QtPTYUJu1ozpzb9a8xchw closeImpl;
tyProc__VytW5cBLp1DOuwAj9cjoj3Q atEndImpl;
tyProc__nAUmmvz53fMDhkU9aQ4i60Q setPositionImpl;
tyProc__rvgAWCz6iG9cntloh2xzZmQ getPositionImpl;
tyProc__sAr4e3JGOuIBVEZ29aGGKUQ readDataStrImpl;
tyProc__7SoiV5lfjKUldz1ENKXq1w readLineImpl;
tyProc__mPF9ae7sAGGCOezlsIuH6Yg readDataImpl;
tyProc__mPF9ae7sAGGCOezlsIuH6Yg peekDataImpl;
tyProc__1nrRaSRiXjiE9bnEpZhmOsA writeDataImpl;
tyProc__u1QtPTYUJu1ozpzb9a8xchw flushImpl;
};
struct tyObject_HSlice__dyNB5o2GYLzoO6FJ2RhiZw {
NI a;
NI b;
};
N_LIB_PRIVATE N_NIMCALL(void, unsureAsgnRef)(void** dest, void* src);
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size);
N_NIMCALL(NimStringDesc*, mnewString)(NI len);
N_LIB_PRIVATE N_NIMCALL(void, fillBuffer__pureZlexbase_16)(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA* L);
static N_INLINE(void, moveMem__system_1737)(void* dest, void* source, NI size);
N_LIB_PRIVATE N_NIMCALL(NI, readDataStr__pureZstreams_81)(tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s, NimStringDesc** buffer, tyObject_HSlice__dyNB5o2GYLzoO6FJ2RhiZw slice);
static N_INLINE(tyObject_HSlice__dyNB5o2GYLzoO6FJ2RhiZw, dotdot___pureZunicode_840)(NI a, NI b);
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, setLengthStr)(NimStringDesc* s, NI newLen);
N_LIB_PRIVATE N_NIMCALL(void, skipUtf8Bom__pureZlexbase_112)(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA* L);
N_LIB_PRIVATE N_NIMCALL(NI, fillBaseLexer__pureZlexbase_68)(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA* L, NI pos);
N_LIB_PRIVATE N_NIMCALL(void, close__pureZstreams_57)(tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* s);
extern TNimType NTIrootobj__ytyiCJqK439aF9cIibuRVpAg_;
N_LIB_PRIVATE TNimType NTIbaselexer__1ErHTvYSm67JCofXisRUnA_;
extern TNimType NTIint__rR5Bzr1D5krxoo1NcNyeMA_;
extern TNimType NTIstring__77mFvmsOLKik79ci2hXkHEg_;
extern TNimType NTIstream__aYUZBpFIj29a9ckz9chwQ9buAQ_;
extern TNimType NTIsetLcharT__HDqWPvEAxZK51ZcfaeQEdg_;
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memcpy(dest, source, ((size_t) (size)));
}
static N_INLINE(void, moveMem__system_1737)(void* dest, void* source, NI size) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memmove(dest, source, ((size_t) (size)));
}
static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memset(a, v, ((size_t) (size)));
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {
	nimSetMem__systemZmemory_7(p, ((int) 0), size);
}
static N_INLINE(tyObject_HSlice__dyNB5o2GYLzoO6FJ2RhiZw, dotdot___pureZunicode_840)(NI a, NI b) {
	tyObject_HSlice__dyNB5o2GYLzoO6FJ2RhiZw result;
	nimZeroMem((void*)(&result), sizeof(tyObject_HSlice__dyNB5o2GYLzoO6FJ2RhiZw));
	nimZeroMem((void*)(&result), sizeof(tyObject_HSlice__dyNB5o2GYLzoO6FJ2RhiZw));
	result.a = a;
	result.b = b;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, fillBuffer__pureZlexbase_16)(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA* L) {
	NI charsRead;
	NI toCopy;
	NI s;
	NI oldBufLen;
	tyObject_HSlice__dyNB5o2GYLzoO6FJ2RhiZw T5_;
	charsRead = (NI)0;
	toCopy = (NI)0;
	s = (NI)0;
	oldBufLen = (NI)0;
	toCopy = (NI)(((*L).buf ? (*L).buf->Sup.len : 0) - (NI)((*L).sentinel + ((NI) 1)));
	{
		if (!(((NI) 0) < toCopy)) goto LA3_;
		moveMem__system_1737(((void*) ((&(*L).buf->data[((NI) 0)]))), ((void*) ((&(*L).buf->data[(NI)((*L).sentinel + ((NI) 1))]))), ((NI) (toCopy)));
	}
	LA3_: ;
	T5_ = dotdot___pureZunicode_840(toCopy, (NI)((NI)((NI)(toCopy + (*L).sentinel) + ((NI) 1)) - ((NI) 1)));
	charsRead = readDataStr__pureZstreams_81((*L).input, (&(*L).buf), T5_);
	s = (NI)(toCopy + charsRead);
	{
		if (!(charsRead < (NI)((*L).sentinel + ((NI) 1)))) goto LA8_;
		(*L).buf->data[s] = 0;
		(*L).sentinel = s;
	}
	goto LA6_;
	LA8_: ;
	{
		s -= ((NI) 1);
		{
			while (1) {
				{
					while (1) {
						NIM_BOOL T15_;
						T15_ = (NIM_BOOL)0;
						T15_ = (((NI) 0) <= s);
						if (!(T15_)) goto LA16_;
						T15_ = !((((*L).refillChars[(NU)(((NU8)((*L).buf->data[s])))>>3] &(1U<<((NU)(((NU8)((*L).buf->data[s])))&7U)))!=0));
						LA16_: ;
						if (!T15_) goto LA14;
						s -= ((NI) 1);
					} LA14: ;
				}
				{
					if (!(((NI) 0) <= s)) goto LA19_;
					(*L).sentinel = s;
					goto LA11;
				}
				goto LA17_;
				LA19_: ;
				{
					tyObject_HSlice__dyNB5o2GYLzoO6FJ2RhiZw T22_;
					oldBufLen = ((*L).buf ? (*L).buf->Sup.len : 0);
					unsureAsgnRef((void**) (&(*L).buf), setLengthStr((*L).buf, ((NI) ((NI)(((*L).buf ? (*L).buf->Sup.len : 0) * ((NI) 2))))));
					T22_ = dotdot___pureZunicode_840(oldBufLen, (NI)(((*L).buf ? (*L).buf->Sup.len : 0) - ((NI) 1)));
					charsRead = readDataStr__pureZstreams_81((*L).input, (&(*L).buf), T22_);
					{
						if (!(charsRead < oldBufLen)) goto LA25_;
						(*L).buf->data[(NI)(oldBufLen + charsRead)] = 0;
						(*L).sentinel = (NI)(oldBufLen + charsRead);
						goto LA11;
					}
					LA25_: ;
					s = (NI)(((*L).buf ? (*L).buf->Sup.len : 0) - ((NI) 1));
				}
				LA17_: ;
			}
		} LA11: ;
	}
	LA6_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, skipUtf8Bom__pureZlexbase_112)(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA* L) {
	{
		NIM_BOOL T3_;
		NIM_BOOL T4_;
		T3_ = (NIM_BOOL)0;
		T4_ = (NIM_BOOL)0;
		T4_ = ((NU8)((*L).buf->data[((NI) 0)]) == (NU8)(239));
		if (!(T4_)) goto LA5_;
		T4_ = ((NU8)((*L).buf->data[((NI) 1)]) == (NU8)(187));
		LA5_: ;
		T3_ = T4_;
		if (!(T3_)) goto LA6_;
		T3_ = ((NU8)((*L).buf->data[((NI) 2)]) == (NU8)(191));
		LA6_: ;
		if (!T3_) goto LA7_;
		(*L).bufpos += ((NI) 3);
		(*L).lineStart += ((NI) 3);
	}
	LA7_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, open__pureZlexbase_122)(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA* L, tyObject_StreamObj__QJOHa8TkfjsZVXTbMulWFg* input, NI bufLen, tySet_tyChar__nmiMWKVIe46vacnhAFrQvw refillChars) {
	unsureAsgnRef((void**) (&(*L).input), input);
	(*L).bufpos = ((NI) 0);
	(*L).offsetBase = ((NI) 0);
	nimCopyMem((void*)(*L).refillChars, (NIM_CONST void*)refillChars, 32);
	unsureAsgnRef((void**) (&(*L).buf), mnewString(((NI) (bufLen))));
	(*L).sentinel = (NI)(bufLen - ((NI) 1));
	(*L).lineStart = ((NI) 0);
	(*L).lineNumber = ((NI) 1);
	fillBuffer__pureZlexbase_16(L);
	skipUtf8Bom__pureZlexbase_112(L);
}
N_LIB_PRIVATE N_NIMCALL(NI, fillBaseLexer__pureZlexbase_68)(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA* L, NI pos) {
	NI result;
	result = (NI)0;
	{
		if (!(pos < (*L).sentinel)) goto LA3_;
		result = (NI)(pos + ((NI) 1));
	}
	goto LA1_;
	LA3_: ;
	{
		fillBuffer__pureZlexbase_16(L);
		(*L).offsetBase += pos;
		(*L).bufpos = ((NI) 0);
		result = ((NI) 0);
	}
	LA1_: ;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, handleCR__pureZlexbase_79)(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA* L, NI pos) {
	NI result;
	result = (NI)0;
	(*L).lineNumber += ((NI) 1);
	result = fillBaseLexer__pureZlexbase_68(L, pos);
	{
		if (!((NU8)((*L).buf->data[result]) == (NU8)(10))) goto LA3_;
		result = fillBaseLexer__pureZlexbase_68(L, result);
	}
	LA3_: ;
	(*L).lineStart = result;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, handleLF__pureZlexbase_90)(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA* L, NI pos) {
	NI result;
	result = (NI)0;
	(*L).lineNumber += ((NI) 1);
	result = fillBaseLexer__pureZlexbase_68(L, pos);
	(*L).lineStart = result;
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, getColNumber__pureZlexbase_137)(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA* L, NI pos) {
	NI result;
	result = (NI)0;
	result = ((NI)(pos - (*L).lineStart) > 0? ((NI)(pos - (*L).lineStart)) : -((NI)(pos - (*L).lineStart)));
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, close__pureZlexbase_14)(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA* L) {
	close__pureZstreams_57((*L).input);
}
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatslibatspureatslexbasedotnim_DatInit000)(void) {
static TNimNode* TM__k6p5NxDJat9aTyZxfZjCDJQ_2_8[8];
static TNimNode TM__k6p5NxDJat9aTyZxfZjCDJQ_0[9];
NTIbaselexer__1ErHTvYSm67JCofXisRUnA_.size = sizeof(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA);
NTIbaselexer__1ErHTvYSm67JCofXisRUnA_.align = NIM_ALIGNOF(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA);
NTIbaselexer__1ErHTvYSm67JCofXisRUnA_.kind = 17;
NTIbaselexer__1ErHTvYSm67JCofXisRUnA_.base = (&NTIrootobj__ytyiCJqK439aF9cIibuRVpAg_);
TM__k6p5NxDJat9aTyZxfZjCDJQ_2_8[0] = &TM__k6p5NxDJat9aTyZxfZjCDJQ_0[1];
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[1].kind = 1;
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[1].offset = offsetof(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA, bufpos);
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[1].typ = (&NTIint__rR5Bzr1D5krxoo1NcNyeMA_);
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[1].name = "bufpos";
TM__k6p5NxDJat9aTyZxfZjCDJQ_2_8[1] = &TM__k6p5NxDJat9aTyZxfZjCDJQ_0[2];
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[2].kind = 1;
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[2].offset = offsetof(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA, buf);
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[2].typ = (&NTIstring__77mFvmsOLKik79ci2hXkHEg_);
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[2].name = "buf";
TM__k6p5NxDJat9aTyZxfZjCDJQ_2_8[2] = &TM__k6p5NxDJat9aTyZxfZjCDJQ_0[3];
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[3].kind = 1;
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[3].offset = offsetof(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA, input);
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[3].typ = (&NTIstream__aYUZBpFIj29a9ckz9chwQ9buAQ_);
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[3].name = "input";
TM__k6p5NxDJat9aTyZxfZjCDJQ_2_8[3] = &TM__k6p5NxDJat9aTyZxfZjCDJQ_0[4];
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[4].kind = 1;
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[4].offset = offsetof(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA, lineNumber);
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[4].typ = (&NTIint__rR5Bzr1D5krxoo1NcNyeMA_);
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[4].name = "lineNumber";
TM__k6p5NxDJat9aTyZxfZjCDJQ_2_8[4] = &TM__k6p5NxDJat9aTyZxfZjCDJQ_0[5];
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[5].kind = 1;
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[5].offset = offsetof(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA, sentinel);
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[5].typ = (&NTIint__rR5Bzr1D5krxoo1NcNyeMA_);
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[5].name = "sentinel";
TM__k6p5NxDJat9aTyZxfZjCDJQ_2_8[5] = &TM__k6p5NxDJat9aTyZxfZjCDJQ_0[6];
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[6].kind = 1;
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[6].offset = offsetof(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA, lineStart);
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[6].typ = (&NTIint__rR5Bzr1D5krxoo1NcNyeMA_);
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[6].name = "lineStart";
TM__k6p5NxDJat9aTyZxfZjCDJQ_2_8[6] = &TM__k6p5NxDJat9aTyZxfZjCDJQ_0[7];
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[7].kind = 1;
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[7].offset = offsetof(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA, offsetBase);
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[7].typ = (&NTIint__rR5Bzr1D5krxoo1NcNyeMA_);
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[7].name = "offsetBase";
TM__k6p5NxDJat9aTyZxfZjCDJQ_2_8[7] = &TM__k6p5NxDJat9aTyZxfZjCDJQ_0[8];
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[8].kind = 1;
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[8].offset = offsetof(tyObject_BaseLexer__1ErHTvYSm67JCofXisRUnA, refillChars);
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[8].typ = (&NTIsetLcharT__HDqWPvEAxZK51ZcfaeQEdg_);
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[8].name = "refillChars";
TM__k6p5NxDJat9aTyZxfZjCDJQ_0[0].len = 8; TM__k6p5NxDJat9aTyZxfZjCDJQ_0[0].kind = 2; TM__k6p5NxDJat9aTyZxfZjCDJQ_0[0].sons = &TM__k6p5NxDJat9aTyZxfZjCDJQ_2_8[0];
NTIbaselexer__1ErHTvYSm67JCofXisRUnA_.node = &TM__k6p5NxDJat9aTyZxfZjCDJQ_0[0];
}

