/* Generated by Nim Compiler v0.10.2 */
/*   (c) 2014 Andreas Rumpf */
/* The generated code is subject to the original license. */
#define NIM_INTBITS 64
#include "nimbase.h"

#include <string.h>

#include <stdio.h>
typedef struct tnode225816 tnode225816;
typedef struct tparsers260035 tparsers260035;
typedef struct tparser244205 tparser244205;
typedef struct tlexer215190 tlexer215190;
typedef struct tbaselexer213024 tbaselexer213024;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tllstream211204 tllstream211204;
typedef struct tlineinfo195539 tlineinfo195539;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct ttoken215186 ttoken215186;
typedef struct tident200021 tident200021;
typedef struct ttype225852 ttype225852;
typedef struct tsym225846 tsym225846;
typedef struct tnodeseq225810 tnodeseq225810;
typedef struct tidobj200015 tidobj200015;
typedef struct ttypeseq225848 ttypeseq225848;
typedef struct tloc225830 tloc225830;
typedef struct trope177009 trope177009;
typedef struct tscope225840 tscope225840;
typedef struct TY225947 TY225947;
typedef struct tinstantiation225836 tinstantiation225836;
typedef struct tstrtable225820 tstrtable225820;
typedef struct tsymseq225818 tsymseq225818;
typedef struct tlib225834 tlib225834;
typedef struct TY225936 TY225936;
typedef struct tlistentry127022 tlistentry127022;
typedef N_NIMCALL_PTR(void, TY3089) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3094) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3089 marker;
TY3094 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  tbaselexer213024  {
  TNimObject Sup;
NI Bufpos;
NCSTRING Buf;
NI Buflen;
tllstream211204* Stream;
NI Linenumber;
NI Sentinel;
NI Linestart;
};
struct  tlineinfo195539  {
NI16 Line;
NI16 Col;
NI32 Fileindex;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (tlineinfo195539 info, NU16 msg, NimStringDesc* arg, void* ClEnv);
void* ClEnv;
} terrorhandler215188;
struct  tlexer215190  {
  tbaselexer213024 Sup;
NI32 Fileidx;
NI Indentahead;
NI Currlineindent;
NIM_BOOL Strongspaces;
terrorhandler215188 Errorhandler;
};
struct  ttoken215186  {
NU8 Toktype;
NI Indent;
tident200021* Ident;
NI64 Inumber;
NF Fnumber;
NU8 Base;
NI8 Strongspacea;
NI8 Strongspaceb;
NimStringDesc* Literal;
NI Line;
NI Col;
};
struct  tparser244205  {
NI Currind;
NIM_BOOL Firsttok;
NIM_BOOL Strongspaces;
tlexer215190 Lex;
ttoken215186 Tok;
NI Inpragma;
NI Insemistmtlist;
};
struct  tparsers260035  {
NU8 Skin;
tparser244205 Parser;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  tnode225816  {
ttype225852* Typ;
tlineinfo195539 Info;
NU16 Flags;
NU8 Kind;
union {
struct {NI64 Intval;
} S1;
struct {NF Floatval;
} S2;
struct {NimStringDesc* Strval;
} S3;
struct {tsym225846* Sym;
} S4;
struct {tident200021* Ident;
} S5;
struct {tnodeseq225810* Sons;
} S6;
} kindU;
NimStringDesc* Comment;
};
typedef NimStringDesc* TY260026[4];
typedef NimStringDesc* TY260020[4];
struct  tidobj200015  {
  TNimObject Sup;
NI Id;
};
struct  tident200021  {
  tidobj200015 Sup;
NimStringDesc* S;
tident200021* Next;
NI H;
};
typedef NimStringDesc* TY260532[1];
struct  tllstream211204  {
  TNimObject Sup;
NU8 Kind;
FILE* F;
NimStringDesc* S;
NI Rd;
NI Wr;
NI Lineoffset;
};
struct  tloc225830  {
NU8 K;
NU8 S;
NU8 Flags;
ttype225852* T;
trope177009* R;
trope177009* Heaproot;
};
struct  ttype225852  {
  tidobj200015 Sup;
NU8 Kind;
NU8 Callconv;
NU32 Flags;
ttypeseq225848* Sons;
tnode225816* N;
tsym225846* Owner;
tsym225846* Sym;
tsym225846* Destructor;
tsym225846* Deepcopy;
NI64 Size;
NI16 Align;
NI16 Locklevel;
tloc225830 Loc;
};
struct  tstrtable225820  {
NI Counter;
tsymseq225818* Data;
};
struct  tsym225846  {
  tidobj200015 Sup;
NU8 Kind;
union {
struct {ttypeseq225848* Typeinstcache;
tscope225840* Typscope;
} S1;
struct {TY225947* Procinstcache;
tscope225840* Scope;
} S2;
struct {TY225947* Usedgenerics;
tstrtable225820 Tab;
} S3;
struct {tsym225846* Guard;
} S4;
} kindU;
NU16 Magic;
ttype225852* Typ;
tident200021* Name;
tlineinfo195539 Info;
tsym225846* Owner;
NU32 Flags;
tnode225816* Ast;
NU32 Options;
NI Position;
NI Offset;
tloc225830 Loc;
tlib225834* Annex;
tnode225816* Constraint;
};
struct  trope177009  {
  TNimObject Sup;
trope177009* Left;
trope177009* Right;
NI Length;
NimStringDesc* Data;
};
struct  tscope225840  {
NI Depthlevel;
tstrtable225820 Symbols;
tnodeseq225810* Usingsyms;
tscope225840* Parent;
};
struct  tinstantiation225836  {
tsym225846* Sym;
ttypeseq225848* Concretetypes;
TY225936* Usedby;
};
struct  tlistentry127022  {
  TNimObject Sup;
tlistentry127022* Prev;
tlistentry127022* Next;
};
struct  tlib225834  {
  tlistentry127022 Sup;
NU8 Kind;
NIM_BOOL Generated;
NIM_BOOL Isoverriden;
trope177009* Name;
tnode225816* Path;
};
struct tnodeseq225810 {
  TGenericSeq Sup;
  tnode225816* data[SEQ_DECL_SIZE];
};
struct ttypeseq225848 {
  TGenericSeq Sup;
  ttype225852* data[SEQ_DECL_SIZE];
};
struct TY225947 {
  TGenericSeq Sup;
  tinstantiation225836* data[SEQ_DECL_SIZE];
};
struct tsymseq225818 {
  TGenericSeq Sup;
  tsym225846* data[SEQ_DECL_SIZE];
};
struct TY225936 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
N_NIMCALL(void, objectInit)(void* dest, TNimType* typ);
N_NIMCALL(NimStringDesc*, tofullpath_197037)(NI32 fileidx);
N_NIMCALL(NIM_BOOL, open_12803)(FILE** f, NimStringDesc* filename, NU8 mode, NI bufsize);
N_NIMCALL(void, rawmessage_197733)(NU16 msg, NimStringDesc* arg);
N_NIMCALL(void, openparsers_260047)(tparsers260035* p, NI32 fileidx, tllstream211204* inputstream);
N_NIMCALL(tnode225816*, parsepipe_260177)(NimStringDesc* filename, tllstream211204* inputstream);
N_NIMCALL(tllstream211204*, llstreamopen_211233)(NimStringDesc* filename, NU8 mode);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
N_NIMCALL(NIM_BOOL, llstreamreadline_211264)(tllstream211204* s, NimStringDesc** line);
N_NIMCALL(NI, utf8bom_260123)(NimStringDesc* s);
N_NIMCALL(NIM_BOOL, containsshebang_260133)(NimStringDesc* s, NI i);
N_NIMCALL(void, openparser_244417)(tparser244205* p, NimStringDesc* filename, tllstream211204* inputstream, NIM_BOOL strongspaces);
N_NIMCALL(tllstream211204*, llstreamopen_211220)(NimStringDesc* data);
N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s, NI start);
N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s, NI first);
N_NIMCALL(tnode225816*, parseall_244216)(tparser244205* p);
N_NIMCALL(void, closeparser_244223)(tparser244205* p);
N_NIMCALL(void, llstreamclose_211250)(tllstream211204* s);
N_NIMCALL(tllstream211204*, evalpipe_260546)(tparsers260035* p, tnode225816* n, NimStringDesc* filename, tllstream211204* start);
N_NIMCALL(NIM_BOOL, identeq_200493)(tident200021* id, NimStringDesc* name);
N_NIMCALL(tllstream211204*, applyfilter_260507)(tparsers260035* p, tnode225816* n, NimStringDesc* filename, tllstream211204* stdin_260513);
N_NIMCALL(tident200021*, getcallee_260410)(tnode225816* n);
N_NIMCALL(NimStringDesc*, rendertree_250058)(tnode225816* n, NU8 renderflags);
N_NIMCALL(NU8, getfilter_260260)(tident200021* ident);
N_NIMCALL(NU8, getparser_260335)(tident200021* ident);
N_NIMCALL(tllstream211204*, filtertmpl_259009)(tllstream211204* stdin_259011, NimStringDesc* filename, tnode225816* call);
N_NIMCALL(tllstream211204*, filterstrip_258012)(tllstream211204* stdin_258014, NimStringDesc* filename, tnode225816* call);
N_NIMCALL(tllstream211204*, filterreplace_258004)(tllstream211204* stdin_258006, NimStringDesc* filename, tnode225816* call);
N_NIMCALL(void, rawmessage_197643)(NU16 msg, NimStringDesc** args, NI argsLen0);
N_NIMCALL(void, msgwriteln_197236)(NimStringDesc* s);
N_NIMCALL(void, openparser_244402)(tparser244205* p, NI32 fileidx, tllstream211204* inputstream, NIM_BOOL strongspaces);
N_NIMCALL(tllstream211204*, llstreamopen_211226)(FILE** f);
N_NIMCALL(tnode225816*, parseall_260063)(tparsers260035* p);
N_NIMCALL(tnode225816*, parseall_249009)(tparser244205* p);
N_NIMCALL(void, internalerror_198006)(NimStringDesc* errmsg);
N_NIMCALL(void, closeparsers_260056)(tparsers260035* p);
N_NIMCALL(tnode225816*, parsetoplevelstmt_244230)(tparser244205* p);
N_NIMCALL(tnode225816*, parsetoplevelstmt_249020)(tparser244205* p);
STRING_LITERAL(TMP1205, "|", 1);
STRING_LITERAL(TMP1315, "none", 4);
STRING_LITERAL(TMP1316, "stdtmpl", 7);
STRING_LITERAL(TMP1317, "replace", 7);
STRING_LITERAL(TMP1318, "strip", 5);
NIM_CONST TY260026 filternames_260025 = {((NimStringDesc*) &TMP1315),
((NimStringDesc*) &TMP1316),
((NimStringDesc*) &TMP1317),
((NimStringDesc*) &TMP1318)}
;
STRING_LITERAL(TMP1319, "standard", 8);
STRING_LITERAL(TMP1320, "strongspaces", 12);
STRING_LITERAL(TMP1321, "braces", 6);
STRING_LITERAL(TMP1322, "endx", 4);
NIM_CONST TY260020 parsernames_260019 = {((NimStringDesc*) &TMP1319),
((NimStringDesc*) &TMP1320),
((NimStringDesc*) &TMP1321),
((NimStringDesc*) &TMP1322)}
;
STRING_LITERAL(TMP1353, "parser to implement", 19);
TNimType NTI260035; /* TParsers */
TNimType NTI260007; /* TParserKind */
extern TNimType NTI244205; /* TParser */
extern tnode225816* emptynode_226738;
extern NI gverbosity_169127;

N_NIMCALL(NI, utf8bom_260123)(NimStringDesc* s) {
	NI result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NIM_BOOL LOC4;
		LOC3 = 0;
		LOC4 = 0;
		LOC4 = ((NU8)(s->data[0]) == (NU8)(239));
		if (!(LOC4)) goto LA5;
		LOC4 = ((NU8)(s->data[1]) == (NU8)(187));
		LA5: ;
		LOC3 = LOC4;
		if (!(LOC3)) goto LA6;
		LOC3 = ((NU8)(s->data[2]) == (NU8)(191));
		LA6: ;
		if (!LOC3) goto LA7;
		result = 3;
	}
	goto LA1;
	LA7: ;
	{
		result = 0;
	}
	LA1: ;
	return result;
}

N_NIMCALL(NIM_BOOL, containsshebang_260133)(NimStringDesc* s, NI i) {
	NIM_BOOL result;
	result = 0;
	{
		NIM_BOOL LOC3;
		NI j;
		LOC3 = 0;
		LOC3 = ((NU8)(s->data[i]) == (NU8)(35));
		if (!(LOC3)) goto LA4;
		LOC3 = ((NU8)(s->data[(NI64)(i + 1)]) == (NU8)(33));
		LA4: ;
		if (!LOC3) goto LA5;
		j = (NI64)(i + 2);
		{
			while (1) {
				if (!(((NU8)(s->data[j])) == ((NU8)(32)) || ((NU8)(s->data[j])) == ((NU8)(9)) || ((NU8)(s->data[j])) == ((NU8)(11)) || ((NU8)(s->data[j])) == ((NU8)(13)) || ((NU8)(s->data[j])) == ((NU8)(10)) || ((NU8)(s->data[j])) == ((NU8)(12)))) goto LA8;
				j += 1;
			} LA8: ;
		}
		result = ((NU8)(s->data[j]) == (NU8)(47));
	}
	LA5: ;
	return result;
}

N_NIMCALL(tnode225816*, parsepipe_260177)(NimStringDesc* filename, tllstream211204* inputstream) {
	tnode225816* result;
	tllstream211204* s;
	result = 0;
	result = emptynode_226738;
	s = llstreamopen_211233(filename, ((NU8) 0));
	{
		NimStringDesc* line;
		NIM_BOOL LOC5;
		NI i;
		if (!!((s == NIM_NIL))) goto LA3;
		line = rawNewString(80);
		LOC5 = 0;
		LOC5 = llstreamreadline_211264(s, (&line));
		i = utf8bom_260123(line);
		{
			NIM_BOOL LOC8;
			NIM_BOOL LOC11;
			LOC8 = 0;
			LOC8 = containsshebang_260133(line, i);
			if (!LOC8) goto LA9;
			LOC11 = 0;
			LOC11 = llstreamreadline_211264(s, (&line));
			i = 0;
		}
		LA9: ;
		{
			NIM_BOOL LOC14;
			tparser244205 q;
			NimStringDesc* LOC20;
			tllstream211204* LOC21;
			LOC14 = 0;
			LOC14 = ((NU8)(line->data[i]) == (NU8)(35));
			if (!(LOC14)) goto LA15;
			LOC14 = ((NU8)(line->data[(NI64)(i + 1)]) == (NU8)(33));
			LA15: ;
			if (!LOC14) goto LA16;
			i += 2;
			{
				while (1) {
					if (!(((NU8)(line->data[i])) == ((NU8)(32)) || ((NU8)(line->data[i])) == ((NU8)(9)) || ((NU8)(line->data[i])) == ((NU8)(11)) || ((NU8)(line->data[i])) == ((NU8)(13)) || ((NU8)(line->data[i])) == ((NU8)(10)) || ((NU8)(line->data[i])) == ((NU8)(12)))) goto LA19;
					i += 1;
				} LA19: ;
			}
			memset((void*)(&q), 0, sizeof(q));
			objectInit((&q), (&NTI244205));
			LOC20 = 0;
			LOC20 = copyStr(line, i);
			LOC21 = 0;
			LOC21 = llstreamopen_211220(LOC20);
			openparser_244417((&q), filename, LOC21, NIM_FALSE);
			result = parseall_244216((&q));
			closeparser_244223((&q));
		}
		LA16: ;
		llstreamclose_211250(s);
	}
	LA3: ;
	return result;
}

N_NIMCALL(tident200021*, getcallee_260410)(tnode225816* n) {
	tident200021* result;
	result = 0;
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = ((*n).Kind == ((NU8) 27) || (*n).Kind == ((NU8) 29) || (*n).Kind == ((NU8) 30) || (*n).Kind == ((NU8) 31) || (*n).Kind == ((NU8) 26) || (*n).Kind == ((NU8) 28) || (*n).Kind == ((NU8) 32));
		if (!(LOC3)) goto LA4;
		LOC3 = ((*(*n).kindU.S6.Sons->data[0]).Kind == ((NU8) 2));
		LA4: ;
		if (!LOC3) goto LA5;
		result = (*(*n).kindU.S6.Sons->data[0]).kindU.S5.Ident;
	}
	goto LA1;
	LA5: ;
	{
		if (!((*n).Kind == ((NU8) 2))) goto LA8;
		result = (*n).kindU.S5.Ident;
	}
	goto LA1;
	LA8: ;
	{
		NimStringDesc* LOC11;
		LOC11 = 0;
		LOC11 = rendertree_250058(n, 0);
		rawmessage_197733(((NU16) 163), LOC11);
	}
	LA1: ;
	return result;
}

N_NIMCALL(NU8, getfilter_260260)(tident200021* ident) {
	NU8 result;
	result = 0;
	{
		NU8 i_260312;
		NU8 res_260318;
		i_260312 = 0;
		res_260318 = ((NU8) 0);
		{
			while (1) {
				if (!(res_260318 <= ((NU8) 3))) goto LA3;
				i_260312 = res_260318;
				{
					NIM_BOOL LOC6;
					LOC6 = 0;
					LOC6 = identeq_200493(ident, filternames_260025[(i_260312)- 0]);
					if (!LOC6) goto LA7;
					result = i_260312;
					goto BeforeRet;
				}
				LA7: ;
				res_260318 += 1;
			} LA3: ;
		}
	}
	result = ((NU8) 0);
	BeforeRet: ;
	return result;
}

N_NIMCALL(NU8, getparser_260335)(tident200021* ident) {
	NU8 result;
	result = 0;
	{
		NU8 i_260387;
		NU8 res_260393;
		i_260387 = 0;
		res_260393 = ((NU8) 0);
		{
			while (1) {
				if (!(res_260393 <= ((NU8) 3))) goto LA3;
				i_260387 = res_260393;
				{
					NIM_BOOL LOC6;
					LOC6 = 0;
					LOC6 = identeq_200493(ident, parsernames_260019[(i_260387)- 0]);
					if (!LOC6) goto LA7;
					result = i_260387;
					goto BeforeRet;
				}
				LA7: ;
				res_260393 += 1;
			} LA3: ;
		}
	}
	rawmessage_197733(((NU16) 30), (*ident).S);
	BeforeRet: ;
	return result;
}

N_NIMCALL(tllstream211204*, applyfilter_260507)(tparsers260035* p, tnode225816* n, NimStringDesc* filename, tllstream211204* stdin_260513) {
	tllstream211204* result;
	tident200021* ident;
	NU8 f;
	result = 0;
	ident = getcallee_260410(n);
	f = getfilter_260260(ident);
	switch (f) {
	case ((NU8) 0):
	{
		(*p).Skin = getparser_260335(ident);
		result = stdin_260513;
	}
	break;
	case ((NU8) 1):
	{
		result = filtertmpl_259009(stdin_260513, filename, n);
	}
	break;
	case ((NU8) 3):
	{
		result = filterstrip_258012(stdin_260513, filename, n);
	}
	break;
	case ((NU8) 2):
	{
		result = filterreplace_258004(stdin_260513, filename, n);
	}
	break;
	}
	{
		if (!!((f == ((NU8) 0)))) goto LA7;
		{
			TY260532 LOC13;
			TY260532 LOC14;
			if (!(2 <= gverbosity_169127)) goto LA11;
			memset((void*)LOC13, 0, sizeof(LOC13));
			rawmessage_197643(((NU16) 268), LOC13, 0);
			msgwriteln_197236((*result).S);
			memset((void*)LOC14, 0, sizeof(LOC14));
			rawmessage_197643(((NU16) 269), LOC14, 0);
		}
		LA11: ;
	}
	LA7: ;
	return result;
}

N_NIMCALL(tllstream211204*, evalpipe_260546)(tparsers260035* p, tnode225816* n, NimStringDesc* filename, tllstream211204* start) {
	tllstream211204* result;
	result = 0;
	result = start;
	{
		if (!((*n).Kind == ((NU8) 1))) goto LA3;
		goto BeforeRet;
	}
	LA3: ;
	{
		NIM_BOOL LOC7;
		NIM_BOOL LOC8;
		LOC7 = 0;
		LOC8 = 0;
		LOC8 = ((*n).Kind == ((NU8) 29));
		if (!(LOC8)) goto LA9;
		LOC8 = ((*(*n).kindU.S6.Sons->data[0]).Kind == ((NU8) 2));
		LA9: ;
		LOC7 = LOC8;
		if (!(LOC7)) goto LA10;
		LOC7 = identeq_200493((*(*n).kindU.S6.Sons->data[0]).kindU.S5.Ident, ((NimStringDesc*) &TMP1205));
		LA10: ;
		if (!LOC7) goto LA11;
		{
			NI i_260635;
			NI res_260713;
			i_260635 = 0;
			res_260713 = 1;
			{
				while (1) {
					if (!(res_260713 <= 2)) goto LA15;
					i_260635 = res_260713;
					{
						if (!((*(*n).kindU.S6.Sons->data[i_260635]).Kind == ((NU8) 29))) goto LA18;
						result = evalpipe_260546(p, (*n).kindU.S6.Sons->data[i_260635], filename, result);
					}
					goto LA16;
					LA18: ;
					{
						result = applyfilter_260507(p, (*n).kindU.S6.Sons->data[i_260635], filename, result);
					}
					LA16: ;
					res_260713 += 1;
				} LA15: ;
			}
		}
	}
	goto LA5;
	LA11: ;
	{
		if (!((*n).Kind == ((NU8) 115))) goto LA22;
		result = evalpipe_260546(p, (*n).kindU.S6.Sons->data[0], filename, result);
	}
	goto LA5;
	LA22: ;
	{
		result = applyfilter_260507(p, n, filename, result);
	}
	LA5: ;
	BeforeRet: ;
	return result;
}

N_NIMCALL(void, openparsers_260047)(tparsers260035* p, NI32 fileidx, tllstream211204* inputstream) {
	tllstream211204* s;
	NimStringDesc* filename;
	tnode225816* pipe;
	s = 0;
	(*p).Skin = ((NU8) 0);
	filename = tofullpath_197037(fileidx);
	pipe = parsepipe_260177(filename, inputstream);
	{
		if (!!((pipe == NIM_NIL))) goto LA3;
		s = evalpipe_260546(p, pipe, filename, inputstream);
	}
	goto LA1;
	LA3: ;
	{
		s = inputstream;
	}
	LA1: ;
	switch ((*p).Skin) {
	case ((NU8) 0):
	case ((NU8) 2):
	case ((NU8) 3):
	{
		openparser_244402((&(*p).Parser), fileidx, s, NIM_FALSE);
	}
	break;
	case ((NU8) 1):
	{
		openparser_244402((&(*p).Parser), fileidx, s, NIM_TRUE);
	}
	break;
	}
}

N_NIMCALL(tnode225816*, parseall_260063)(tparsers260035* p) {
	tnode225816* result;
	result = 0;
	switch ((*p).Skin) {
	case ((NU8) 0):
	case ((NU8) 1):
	{
		result = parseall_244216((&(*p).Parser));
	}
	break;
	case ((NU8) 2):
	{
		result = parseall_249009((&(*p).Parser));
	}
	break;
	case ((NU8) 3):
	{
		internalerror_198006(((NimStringDesc*) &TMP1353));
		result = emptynode_226738;
	}
	break;
	}
	return result;
}

N_NIMCALL(void, closeparsers_260056)(tparsers260035* p) {
	closeparser_244223((&(*p).Parser));
}

N_NIMCALL(tnode225816*, parsefile_260041)(NI32 fileidx) {
	tnode225816* result;
	tparsers260035 p;
	FILE* f;
	NimStringDesc* filename;
	tllstream211204* LOC6;
	result = 0;
	memset((void*)(&p), 0, sizeof(p));
	objectInit((&p), (&NTI260035));
	f = 0;
	filename = tofullpath_197037(fileidx);
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = open_12803(&f, filename, ((NU8) 0), -1);
		if (!!(LOC3)) goto LA4;
		rawmessage_197733(((NU16) 3), filename);
		goto BeforeRet;
	}
	LA4: ;
	LOC6 = 0;
	LOC6 = llstreamopen_211226(&f);
	openparsers_260047((&p), fileidx, LOC6);
	result = parseall_260063((&p));
	closeparsers_260056((&p));
	BeforeRet: ;
	return result;
}

N_NIMCALL(tnode225816*, parsetoplevelstmt_260070)(tparsers260035* p) {
	tnode225816* result;
	result = 0;
	switch ((*p).Skin) {
	case ((NU8) 0):
	case ((NU8) 1):
	{
		result = parsetoplevelstmt_244230((&(*p).Parser));
	}
	break;
	case ((NU8) 2):
	{
		result = parsetoplevelstmt_249020((&(*p).Parser));
	}
	break;
	case ((NU8) 3):
	{
		internalerror_198006(((NimStringDesc*) &TMP1353));
		result = emptynode_226738;
	}
	break;
	}
	return result;
}
NIM_EXTERNC N_NOINLINE(void, HEX00_syntaxesInit)(void) {
}

NIM_EXTERNC N_NOINLINE(void, HEX00_syntaxesDatInit)(void) {
static TNimNode* TMP1002[2];
static TNimNode* TMP1003[4];
NI TMP1005;
static char* NIM_CONST TMP1004[4] = {
"skinStandard", 
"skinStrongSpaces", 
"skinBraces", 
"skinEndX"};
static TNimNode TMP795[8];
NTI260035.size = sizeof(tparsers260035);
NTI260035.kind = 18;
NTI260035.base = 0;
TMP1002[0] = &TMP795[1];
NTI260007.size = sizeof(NU8);
NTI260007.kind = 14;
NTI260007.base = 0;
NTI260007.flags = 3;
for (TMP1005 = 0; TMP1005 < 4; TMP1005++) {
TMP795[TMP1005+2].kind = 1;
TMP795[TMP1005+2].offset = TMP1005;
TMP795[TMP1005+2].name = TMP1004[TMP1005];
TMP1003[TMP1005] = &TMP795[TMP1005+2];
}
TMP795[6].len = 4; TMP795[6].kind = 2; TMP795[6].sons = &TMP1003[0];
NTI260007.node = &TMP795[6];
TMP795[1].kind = 1;
TMP795[1].offset = offsetof(tparsers260035, Skin);
TMP795[1].typ = (&NTI260007);
TMP795[1].name = "skin";
TMP1002[1] = &TMP795[7];
TMP795[7].kind = 1;
TMP795[7].offset = offsetof(tparsers260035, Parser);
TMP795[7].typ = (&NTI244205);
TMP795[7].name = "parser";
TMP795[0].len = 2; TMP795[0].kind = 2; TMP795[0].sons = &TMP1002[0];
NTI260035.node = &TMP795[0];
}

