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

#include <string.h>

#include <stdio.h>
typedef struct tnode224816 tnode224816;
typedef struct tparsers259035 tparsers259035;
typedef struct tparser243205 tparser243205;
typedef struct tlexer214190 tlexer214190;
typedef struct tbaselexer212024 tbaselexer212024;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tllstream210204 tllstream210204;
typedef struct tlineinfo194539 tlineinfo194539;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct ttoken214186 ttoken214186;
typedef struct tident199021 tident199021;
typedef struct ttype224852 ttype224852;
typedef struct tsym224846 tsym224846;
typedef struct tnodeseq224810 tnodeseq224810;
typedef struct tidobj199015 tidobj199015;
typedef struct ttypeseq224848 ttypeseq224848;
typedef struct tloc224830 tloc224830;
typedef struct trope176009 trope176009;
typedef struct tscope224840 tscope224840;
typedef struct TY224947 TY224947;
typedef struct tinstantiation224836 tinstantiation224836;
typedef struct tstrtable224820 tstrtable224820;
typedef struct tsymseq224818 tsymseq224818;
typedef struct tlib224834 tlib224834;
typedef struct TY224936 TY224936;
typedef struct tlistentry126022 tlistentry126022;
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  tbaselexer212024  {
  TNimObject Sup;
NI Bufpos;
NCSTRING Buf;
NI Buflen;
tllstream210204* Stream;
NI Linenumber;
NI Sentinel;
NI Linestart;
};
struct  tlineinfo194539  {
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) (tlineinfo194539 info, NU16 msg, NimStringDesc* arg, void* ClEnv);
void* ClEnv;
} terrorhandler214188;
struct  tlexer214190  {
  tbaselexer212024 Sup;
NI32 Fileidx;
NI Indentahead;
NI Currlineindent;
NIM_BOOL Strongspaces;
terrorhandler214188 Errorhandler;
};
struct  ttoken214186  {
NU8 Toktype;
NI Indent;
tident199021* Ident;
NI64 Inumber;
NF Fnumber;
NU8 Base;
NI8 Strongspacea;
NI8 Strongspaceb;
NimStringDesc* Literal;
NI Line;
NI Col;
};
struct  tparser243205  {
NI Currind;
NIM_BOOL Firsttok;
NIM_BOOL Strongspaces;
tlexer214190 Lex;
ttoken214186 Tok;
NI Inpragma;
NI Insemistmtlist;
};
struct  tparsers259035  {
NU8 Skin;
tparser243205 Parser;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  tnode224816  {
ttype224852* Typ;
tlineinfo194539 Info;
NU16 Flags;
NU8 Kind;
union {
struct {NI64 Intval;
} S1;
struct {NF Floatval;
} S2;
struct {NimStringDesc* Strval;
} S3;
struct {tsym224846* Sym;
} S4;
struct {tident199021* Ident;
} S5;
struct {tnodeseq224810* Sons;
} S6;
} kindU;
NimStringDesc* Comment;
};
typedef NimStringDesc* TY259026[4];
typedef NimStringDesc* TY259020[4];
struct  tidobj199015  {
  TNimObject Sup;
NI Id;
};
struct  tident199021  {
  tidobj199015 Sup;
NimStringDesc* S;
tident199021* Next;
NI H;
};
typedef NimStringDesc* TY259532[1];
struct  tllstream210204  {
  TNimObject Sup;
NU8 Kind;
FILE* F;
NimStringDesc* S;
NI Rd;
NI Wr;
NI Lineoffset;
};
struct  tloc224830  {
NU8 K;
NU8 S;
NU8 Flags;
ttype224852* T;
trope176009* R;
trope176009* Heaproot;
};
struct  ttype224852  {
  tidobj199015 Sup;
NU8 Kind;
NU8 Callconv;
NU32 Flags;
ttypeseq224848* Sons;
tnode224816* N;
tsym224846* Owner;
tsym224846* Sym;
tsym224846* Destructor;
tsym224846* Deepcopy;
NI64 Size;
NI16 Align;
NI16 Locklevel;
tloc224830 Loc;
};
struct  tstrtable224820  {
NI Counter;
tsymseq224818* Data;
};
struct  tsym224846  {
  tidobj199015 Sup;
NU8 Kind;
union {
struct {ttypeseq224848* Typeinstcache;
tscope224840* Typscope;
} S1;
struct {TY224947* Procinstcache;
tscope224840* Scope;
} S2;
struct {TY224947* Usedgenerics;
tstrtable224820 Tab;
} S3;
struct {tsym224846* Guard;
} S4;
} kindU;
NU16 Magic;
ttype224852* Typ;
tident199021* Name;
tlineinfo194539 Info;
tsym224846* Owner;
NU32 Flags;
tnode224816* Ast;
NU32 Options;
NI Position;
NI Offset;
tloc224830 Loc;
tlib224834* Annex;
tnode224816* Constraint;
};
struct  trope176009  {
  TNimObject Sup;
trope176009* Left;
trope176009* Right;
NI Length;
NimStringDesc* Data;
};
struct  tscope224840  {
NI Depthlevel;
tstrtable224820 Symbols;
tnodeseq224810* Usingsyms;
tscope224840* Parent;
};
struct  tinstantiation224836  {
tsym224846* Sym;
ttypeseq224848* Concretetypes;
TY224936* Usedby;
};
struct  tlistentry126022  {
  TNimObject Sup;
tlistentry126022* Prev;
tlistentry126022* Next;
};
struct  tlib224834  {
  tlistentry126022 Sup;
NU8 Kind;
NIM_BOOL Generated;
NIM_BOOL Isoverriden;
trope176009* Name;
tnode224816* Path;
};
struct tnodeseq224810 {
  TGenericSeq Sup;
  tnode224816* data[SEQ_DECL_SIZE];
};
struct ttypeseq224848 {
  TGenericSeq Sup;
  ttype224852* data[SEQ_DECL_SIZE];
};
struct TY224947 {
  TGenericSeq Sup;
  tinstantiation224836* data[SEQ_DECL_SIZE];
};
struct tsymseq224818 {
  TGenericSeq Sup;
  tsym224846* data[SEQ_DECL_SIZE];
};
struct TY224936 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
N_NIMCALL(void, objectInit)(void* dest, TNimType* typ);
N_NIMCALL(NimStringDesc*, tofullpath_196037)(NI32 fileidx);
N_NIMCALL(NIM_BOOL, open_12603)(FILE** f, NimStringDesc* filename, NU8 mode, NI bufsize);
N_NIMCALL(void, rawmessage_196733)(NU16 msg, NimStringDesc* arg);
N_NIMCALL(void, openparsers_259047)(tparsers259035* p, NI32 fileidx, tllstream210204* inputstream);
N_NIMCALL(tnode224816*, parsepipe_259177)(NimStringDesc* filename, tllstream210204* inputstream);
N_NIMCALL(tllstream210204*, llstreamopen_210233)(NimStringDesc* filename, NU8 mode);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
N_NIMCALL(NIM_BOOL, llstreamreadline_210264)(tllstream210204* s, NimStringDesc** line);
N_NIMCALL(NI, utf8bom_259123)(NimStringDesc* s);
N_NIMCALL(NIM_BOOL, containsshebang_259133)(NimStringDesc* s, NI i);
N_NIMCALL(void, openparser_243417)(tparser243205* p, NimStringDesc* filename, tllstream210204* inputstream, NIM_BOOL strongspaces);
N_NIMCALL(tllstream210204*, llstreamopen_210220)(NimStringDesc* data);
N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s, NI start);
N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s, NI first);
N_NIMCALL(tnode224816*, parseall_243216)(tparser243205* p);
N_NIMCALL(void, closeparser_243223)(tparser243205* p);
N_NIMCALL(void, llstreamclose_210250)(tllstream210204* s);
N_NIMCALL(tllstream210204*, evalpipe_259546)(tparsers259035* p, tnode224816* n, NimStringDesc* filename, tllstream210204* start);
N_NIMCALL(NIM_BOOL, identeq_199493)(tident199021* id, NimStringDesc* name);
N_NIMCALL(tllstream210204*, applyfilter_259507)(tparsers259035* p, tnode224816* n, NimStringDesc* filename, tllstream210204* stdin_259513);
N_NIMCALL(tident199021*, getcallee_259410)(tnode224816* n);
N_NIMCALL(NimStringDesc*, rendertree_249058)(tnode224816* n, NU8 renderflags);
N_NIMCALL(NU8, getfilter_259260)(tident199021* ident);
N_NIMCALL(NU8, getparser_259335)(tident199021* ident);
N_NIMCALL(tllstream210204*, filtertmpl_258009)(tllstream210204* stdin_258011, NimStringDesc* filename, tnode224816* call);
N_NIMCALL(tllstream210204*, filterstrip_257012)(tllstream210204* stdin_257014, NimStringDesc* filename, tnode224816* call);
N_NIMCALL(tllstream210204*, filterreplace_257004)(tllstream210204* stdin_257006, NimStringDesc* filename, tnode224816* call);
N_NIMCALL(void, rawmessage_196643)(NU16 msg, NimStringDesc** args, NI argsLen0);
N_NIMCALL(void, msgwriteln_196236)(NimStringDesc* s);
N_NIMCALL(void, openparser_243402)(tparser243205* p, NI32 fileidx, tllstream210204* inputstream, NIM_BOOL strongspaces);
N_NIMCALL(tllstream210204*, llstreamopen_210226)(FILE** f);
N_NIMCALL(tnode224816*, parseall_259063)(tparsers259035* p);
N_NIMCALL(tnode224816*, parseall_248009)(tparser243205* p);
N_NIMCALL(void, internalerror_197006)(NimStringDesc* errmsg);
N_NIMCALL(void, closeparsers_259056)(tparsers259035* p);
N_NIMCALL(tnode224816*, parsetoplevelstmt_243230)(tparser243205* p);
N_NIMCALL(tnode224816*, parsetoplevelstmt_248020)(tparser243205* p);
STRING_LITERAL(TMP1209, "|", 1);
STRING_LITERAL(TMP1319, "none", 4);
STRING_LITERAL(TMP1320, "stdtmpl", 7);
STRING_LITERAL(TMP1321, "replace", 7);
STRING_LITERAL(TMP1322, "strip", 5);
NIM_CONST TY259026 filternames_259025 = {((NimStringDesc*) &TMP1319),
((NimStringDesc*) &TMP1320),
((NimStringDesc*) &TMP1321),
((NimStringDesc*) &TMP1322)}
;
STRING_LITERAL(TMP1323, "standard", 8);
STRING_LITERAL(TMP1324, "strongspaces", 12);
STRING_LITERAL(TMP1325, "braces", 6);
STRING_LITERAL(TMP1326, "endx", 4);
NIM_CONST TY259020 parsernames_259019 = {((NimStringDesc*) &TMP1323),
((NimStringDesc*) &TMP1324),
((NimStringDesc*) &TMP1325),
((NimStringDesc*) &TMP1326)}
;
STRING_LITERAL(TMP1357, "parser to implement", 19);
TNimType NTI259035; /* TParsers */
TNimType NTI259007; /* TParserKind */
extern TNimType NTI243205; /* TParser */
extern tnode224816* emptynode_225738;
extern NI gverbosity_168127;

N_NIMCALL(NI, utf8bom_259123)(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_259133)(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[(NI32)(i + 1)]) == (NU8)(33));
		LA4: ;
		if (!LOC3) goto LA5;
		j = (NI32)(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(tnode224816*, parsepipe_259177)(NimStringDesc* filename, tllstream210204* inputstream) {
	tnode224816* result;
	tllstream210204* s;
	result = 0;
	result = emptynode_225738;
	s = llstreamopen_210233(filename, ((NU8) 0));
	{
		NimStringDesc* line;
		NIM_BOOL LOC5;
		NI i;
		if (!!((s == NIM_NIL))) goto LA3;
		line = rawNewString(80);
		LOC5 = 0;
		LOC5 = llstreamreadline_210264(s, (&line));
		i = utf8bom_259123(line);
		{
			NIM_BOOL LOC8;
			NIM_BOOL LOC11;
			LOC8 = 0;
			LOC8 = containsshebang_259133(line, i);
			if (!LOC8) goto LA9;
			LOC11 = 0;
			LOC11 = llstreamreadline_210264(s, (&line));
			i = 0;
		}
		LA9: ;
		{
			NIM_BOOL LOC14;
			tparser243205 q;
			NimStringDesc* LOC20;
			tllstream210204* LOC21;
			LOC14 = 0;
			LOC14 = ((NU8)(line->data[i]) == (NU8)(35));
			if (!(LOC14)) goto LA15;
			LOC14 = ((NU8)(line->data[(NI32)(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), (&NTI243205));
			LOC20 = 0;
			LOC20 = copyStr(line, i);
			LOC21 = 0;
			LOC21 = llstreamopen_210220(LOC20);
			openparser_243417((&q), filename, LOC21, NIM_FALSE);
			result = parseall_243216((&q));
			closeparser_243223((&q));
		}
		LA16: ;
		llstreamclose_210250(s);
	}
	LA3: ;
	return result;
}

N_NIMCALL(tident199021*, getcallee_259410)(tnode224816* n) {
	tident199021* 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_249058(n, 0);
		rawmessage_196733(((NU16) 163), LOC11);
	}
	LA1: ;
	return result;
}

N_NIMCALL(NU8, getfilter_259260)(tident199021* ident) {
	NU8 result;
	result = 0;
	{
		NU8 i_259312;
		NU8 res_259318;
		i_259312 = 0;
		res_259318 = ((NU8) 0);
		{
			while (1) {
				if (!(res_259318 <= ((NU8) 3))) goto LA3;
				i_259312 = res_259318;
				{
					NIM_BOOL LOC6;
					LOC6 = 0;
					LOC6 = identeq_199493(ident, filternames_259025[(i_259312)- 0]);
					if (!LOC6) goto LA7;
					result = i_259312;
					goto BeforeRet;
				}
				LA7: ;
				res_259318 += 1;
			} LA3: ;
		}
	}
	result = ((NU8) 0);
	BeforeRet: ;
	return result;
}

N_NIMCALL(NU8, getparser_259335)(tident199021* ident) {
	NU8 result;
	result = 0;
	{
		NU8 i_259387;
		NU8 res_259393;
		i_259387 = 0;
		res_259393 = ((NU8) 0);
		{
			while (1) {
				if (!(res_259393 <= ((NU8) 3))) goto LA3;
				i_259387 = res_259393;
				{
					NIM_BOOL LOC6;
					LOC6 = 0;
					LOC6 = identeq_199493(ident, parsernames_259019[(i_259387)- 0]);
					if (!LOC6) goto LA7;
					result = i_259387;
					goto BeforeRet;
				}
				LA7: ;
				res_259393 += 1;
			} LA3: ;
		}
	}
	rawmessage_196733(((NU16) 30), (*ident).S);
	BeforeRet: ;
	return result;
}

N_NIMCALL(tllstream210204*, applyfilter_259507)(tparsers259035* p, tnode224816* n, NimStringDesc* filename, tllstream210204* stdin_259513) {
	tllstream210204* result;
	tident199021* ident;
	NU8 f;
	result = 0;
	ident = getcallee_259410(n);
	f = getfilter_259260(ident);
	switch (f) {
	case ((NU8) 0):
	{
		(*p).Skin = getparser_259335(ident);
		result = stdin_259513;
	}
	break;
	case ((NU8) 1):
	{
		result = filtertmpl_258009(stdin_259513, filename, n);
	}
	break;
	case ((NU8) 3):
	{
		result = filterstrip_257012(stdin_259513, filename, n);
	}
	break;
	case ((NU8) 2):
	{
		result = filterreplace_257004(stdin_259513, filename, n);
	}
	break;
	}
	{
		if (!!((f == ((NU8) 0)))) goto LA7;
		{
			TY259532 LOC13;
			TY259532 LOC14;
			if (!(2 <= gverbosity_168127)) goto LA11;
			memset((void*)LOC13, 0, sizeof(LOC13));
			rawmessage_196643(((NU16) 268), LOC13, 0);
			msgwriteln_196236((*result).S);
			memset((void*)LOC14, 0, sizeof(LOC14));
			rawmessage_196643(((NU16) 269), LOC14, 0);
		}
		LA11: ;
	}
	LA7: ;
	return result;
}

N_NIMCALL(tllstream210204*, evalpipe_259546)(tparsers259035* p, tnode224816* n, NimStringDesc* filename, tllstream210204* start) {
	tllstream210204* 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_199493((*(*n).kindU.S6.Sons->data[0]).kindU.S5.Ident, ((NimStringDesc*) &TMP1209));
		LA10: ;
		if (!LOC7) goto LA11;
		{
			NI i_259635;
			NI res_259713;
			i_259635 = 0;
			res_259713 = 1;
			{
				while (1) {
					if (!(res_259713 <= 2)) goto LA15;
					i_259635 = res_259713;
					{
						if (!((*(*n).kindU.S6.Sons->data[i_259635]).Kind == ((NU8) 29))) goto LA18;
						result = evalpipe_259546(p, (*n).kindU.S6.Sons->data[i_259635], filename, result);
					}
					goto LA16;
					LA18: ;
					{
						result = applyfilter_259507(p, (*n).kindU.S6.Sons->data[i_259635], filename, result);
					}
					LA16: ;
					res_259713 += 1;
				} LA15: ;
			}
		}
	}
	goto LA5;
	LA11: ;
	{
		if (!((*n).Kind == ((NU8) 115))) goto LA22;
		result = evalpipe_259546(p, (*n).kindU.S6.Sons->data[0], filename, result);
	}
	goto LA5;
	LA22: ;
	{
		result = applyfilter_259507(p, n, filename, result);
	}
	LA5: ;
	BeforeRet: ;
	return result;
}

N_NIMCALL(void, openparsers_259047)(tparsers259035* p, NI32 fileidx, tllstream210204* inputstream) {
	tllstream210204* s;
	NimStringDesc* filename;
	tnode224816* pipe;
	s = 0;
	(*p).Skin = ((NU8) 0);
	filename = tofullpath_196037(fileidx);
	pipe = parsepipe_259177(filename, inputstream);
	{
		if (!!((pipe == NIM_NIL))) goto LA3;
		s = evalpipe_259546(p, pipe, filename, inputstream);
	}
	goto LA1;
	LA3: ;
	{
		s = inputstream;
	}
	LA1: ;
	switch ((*p).Skin) {
	case ((NU8) 0):
	case ((NU8) 2):
	case ((NU8) 3):
	{
		openparser_243402((&(*p).Parser), fileidx, s, NIM_FALSE);
	}
	break;
	case ((NU8) 1):
	{
		openparser_243402((&(*p).Parser), fileidx, s, NIM_TRUE);
	}
	break;
	}
}

N_NIMCALL(tnode224816*, parseall_259063)(tparsers259035* p) {
	tnode224816* result;
	result = 0;
	switch ((*p).Skin) {
	case ((NU8) 0):
	case ((NU8) 1):
	{
		result = parseall_243216((&(*p).Parser));
	}
	break;
	case ((NU8) 2):
	{
		result = parseall_248009((&(*p).Parser));
	}
	break;
	case ((NU8) 3):
	{
		internalerror_197006(((NimStringDesc*) &TMP1357));
		result = emptynode_225738;
	}
	break;
	}
	return result;
}

N_NIMCALL(void, closeparsers_259056)(tparsers259035* p) {
	closeparser_243223((&(*p).Parser));
}

N_NIMCALL(tnode224816*, parsefile_259041)(NI32 fileidx) {
	tnode224816* result;
	tparsers259035 p;
	FILE* f;
	NimStringDesc* filename;
	tllstream210204* LOC6;
	result = 0;
	memset((void*)(&p), 0, sizeof(p));
	objectInit((&p), (&NTI259035));
	f = 0;
	filename = tofullpath_196037(fileidx);
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = open_12603(&f, filename, ((NU8) 0), -1);
		if (!!(LOC3)) goto LA4;
		rawmessage_196733(((NU16) 3), filename);
		goto BeforeRet;
	}
	LA4: ;
	LOC6 = 0;
	LOC6 = llstreamopen_210226(&f);
	openparsers_259047((&p), fileidx, LOC6);
	result = parseall_259063((&p));
	closeparsers_259056((&p));
	BeforeRet: ;
	return result;
}

N_NIMCALL(tnode224816*, parsetoplevelstmt_259070)(tparsers259035* p) {
	tnode224816* result;
	result = 0;
	switch ((*p).Skin) {
	case ((NU8) 0):
	case ((NU8) 1):
	{
		result = parsetoplevelstmt_243230((&(*p).Parser));
	}
	break;
	case ((NU8) 2):
	{
		result = parsetoplevelstmt_248020((&(*p).Parser));
	}
	break;
	case ((NU8) 3):
	{
		internalerror_197006(((NimStringDesc*) &TMP1357));
		result = emptynode_225738;
	}
	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];
NTI259035.size = sizeof(tparsers259035);
NTI259035.kind = 18;
NTI259035.base = 0;
TMP1002[0] = &TMP795[1];
NTI259007.size = sizeof(NU8);
NTI259007.kind = 14;
NTI259007.base = 0;
NTI259007.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];
NTI259007.node = &TMP795[6];
TMP795[1].kind = 1;
TMP795[1].offset = offsetof(tparsers259035, Skin);
TMP795[1].typ = (&NTI259007);
TMP795[1].name = "skin";
TMP1002[1] = &TMP795[7];
TMP795[7].kind = 1;
TMP795[7].offset = offsetof(tparsers259035, Parser);
TMP795[7].typ = (&NTI243205);
TMP795[7].name = "parser";
TMP795[0].len = 2; TMP795[0].kind = 2; TMP795[0].sons = &TMP1002[0];
NTI259035.node = &TMP795[0];
}

