/* Generated by Nim Compiler v0.13.0 */
/*   (c) 2015 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 Tnode214790 Tnode214790;
typedef struct Tparsers238026 Tparsers238026;
typedef struct Tparser228202 Tparser228202;
typedef struct Tlexer205173 Tlexer205173;
typedef struct Tbaselexer203015 Tbaselexer203015;
typedef struct TNimObject TNimObject;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct Tllstream202204 Tllstream202204;
typedef struct Tlineinfo182337 Tlineinfo182337;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct Ttoken205169 Ttoken205169;
typedef struct Tident189012 Tident189012;
typedef struct Ttype214828 Ttype214828;
typedef struct Tsym214822 Tsym214822;
typedef struct Tnodeseq214784 Tnodeseq214784;
typedef struct Tidobj189006 Tidobj189006;
typedef struct Ttypeseq214824 Ttypeseq214824;
typedef struct Tloc214804 Tloc214804;
typedef struct Ropeobj169006 Ropeobj169006;
typedef struct Tscope214816 Tscope214816;
typedef struct TY214925 TY214925;
typedef struct Tstrtable214794 Tstrtable214794;
typedef struct Tsymseq214792 Tsymseq214792;
typedef struct Tlib214808 Tlib214808;
typedef struct Tinstantiation214812 Tinstantiation214812;
typedef struct Tlistentry135010 Tlistentry135010;
typedef struct TY214913 TY214913;
typedef N_NIMCALL_PTR(void, TY3489) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, TY3494) (void* p);
struct  TNimType  {
NI size;
NU8 kind;
NU8 flags;
TNimType* base;
TNimNode* node;
void* finalizer;
TY3489 marker;
TY3494 deepcopy;
};
struct  TNimObject  {
TNimType* m_type;
};
struct  Tbaselexer203015  {
  TNimObject Sup;
NI bufpos;
NCSTRING buf;
NI buflen;
Tllstream202204* stream;
NI linenumber;
NI sentinel;
NI linestart;
};
struct  TGenericSeq  {
NI len;
NI reserved;
};
struct  NimStringDesc  {
  TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef struct {
N_NIMCALL_PTR(void, ClPrc) (Tlineinfo182337 info, NU16 msg, NimStringDesc* arg, void* ClEnv);
void* ClEnv;
} Terrorhandler205171;
struct  Tlexer205173  {
  Tbaselexer203015 Sup;
NI32 fileidx;
NI indentahead;
NI currlineindent;
NIM_BOOL strongspaces;
Terrorhandler205171 errorhandler;
};
struct  Ttoken205169  {
NU8 toktype;
NI indent;
Tident189012* ident;
NI64 inumber;
NF fnumber;
NU8 base;
NI8 strongspacea;
NI8 strongspaceb;
NimStringDesc* literal;
NI line;
NI col;
};
struct  Tparser228202  {
NI currind;
NIM_BOOL firsttok;
NIM_BOOL strongspaces;
Tlexer205173 lex;
Ttoken205169 tok;
NI inpragma;
NI insemistmtlist;
};
struct  Tparsers238026  {
NU8 skin;
Tparser228202 parser;
};
struct  TNimNode  {
NU8 kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
struct  Tlineinfo182337  {
NI16 line;
NI16 col;
NI32 fileindex;
};
struct  Tnode214790  {
Ttype214828* typ;
Tlineinfo182337 info;
NU16 flags;
NU8 kind;
union{
struct {NI64 intval;
} S1;
struct {NF floatval;
} S2;
struct {NimStringDesc* strval;
} S3;
struct {Tsym214822* sym;
} S4;
struct {Tident189012* ident;
} S5;
struct {Tnodeseq214784* sons;
} S6;
} kindU;
NimStringDesc* comment;
};
typedef NimStringDesc* TY238022[4];
typedef NimStringDesc* TY238016[4];
struct  Tidobj189006  {
  TNimObject Sup;
NI id;
};
struct  Tident189012  {
  Tidobj189006 Sup;
NimStringDesc* s;
Tident189012* next;
NI h;
};
typedef NimStringDesc* TY238694[1];
struct  Tllstream202204  {
  TNimObject Sup;
NU8 kind;
FILE* f;
NimStringDesc* s;
NI rd;
NI wr;
NI lineoffset;
};
struct  Tloc214804  {
NU8 k;
NU8 s;
NU16 flags;
Ttype214828* t;
Ropeobj169006* r;
Ropeobj169006* heaproot;
};
struct  Ttype214828  {
  Tidobj189006 Sup;
NU8 kind;
NU8 callconv;
NU32 flags;
Ttypeseq214824* sons;
Tnode214790* n;
Tsym214822* owner;
Tsym214822* sym;
Tsym214822* destructor;
Tsym214822* deepcopy;
Tsym214822* assignment;
NI64 size;
NI16 align;
NI16 locklevel;
Tloc214804 loc;
};
struct  Tstrtable214794  {
NI counter;
Tsymseq214792* data;
};
struct  Tsym214822  {
  Tidobj189006 Sup;
NU8 kind;
union{
struct {Ttypeseq214824* typeinstcache;
Tscope214816* typscope;
} S1;
struct {TY214925* procinstcache;
Tsym214822* gcunsafetyreason;
} S2;
struct {TY214925* usedgenerics;
Tstrtable214794 tab;
} S3;
struct {Tsym214822* guard;
NI bitsize;
} S4;
} kindU;
NU8 magic;
Ttype214828* typ;
Tident189012* name;
Tlineinfo182337 info;
Tsym214822* owner;
NU32 flags;
Tnode214790* ast;
NU32 options;
NI position;
NI offset;
Tloc214804 loc;
Tlib214808* annex;
Tnode214790* constraint;
};
struct  Ropeobj169006  {
  TNimObject Sup;
Ropeobj169006* left;
Ropeobj169006* right;
NI length;
NimStringDesc* data;
};
struct  Tscope214816  {
NI depthlevel;
Tstrtable214794 symbols;
Tnodeseq214784* usingsyms;
Tscope214816* parent;
};
struct  Tlistentry135010  {
  TNimObject Sup;
Tlistentry135010* prev;
Tlistentry135010* next;
};
struct  Tlib214808  {
  Tlistentry135010 Sup;
NU8 kind;
NIM_BOOL generated;
NIM_BOOL isoverriden;
Ropeobj169006* name;
Tnode214790* path;
};
struct  Tinstantiation214812  {
Tsym214822* sym;
Ttypeseq214824* concretetypes;
TY214913* usedby;
NI compilesid;
};
struct Tnodeseq214784 {
  TGenericSeq Sup;
  Tnode214790* data[SEQ_DECL_SIZE];
};
struct Ttypeseq214824 {
  TGenericSeq Sup;
  Ttype214828* data[SEQ_DECL_SIZE];
};
struct TY214925 {
  TGenericSeq Sup;
  Tinstantiation214812* data[SEQ_DECL_SIZE];
};
struct Tsymseq214792 {
  TGenericSeq Sup;
  Tsym214822* data[SEQ_DECL_SIZE];
};
struct TY214913 {
  TGenericSeq Sup;
  NI32 data[SEQ_DECL_SIZE];
};
N_NIMCALL(void, objectInit)(void* dest, TNimType* typ);
N_NIMCALL(NimStringDesc*, tofullpathconsiderdirty_183401)(NI32 fileidx);
N_NIMCALL(NIM_BOOL, open_15403)(FILE** f, NimStringDesc* filename, NU8 mode, NI bufsize);
N_NIMCALL(void, rawmessage_185612)(NU16 msg, NimStringDesc* arg);
N_NIMCALL(void, openparsers_238032)(Tparsers238026* p, NI32 fileidx, Tllstream202204* inputstream);
N_NIMCALL(Tnode214790*, parsepipe_238107)(NimStringDesc* filename, Tllstream202204* inputstream);
N_NIMCALL(Tllstream202204*, llstreamopen_202241)(NimStringDesc* filename, NU8 mode);
N_NIMCALL(NimStringDesc*, rawNewString)(NI space);
N_NIMCALL(NimStringDesc*, rawNewString)(NI cap);
N_NIMCALL(NIM_BOOL, llstreamreadline_202550)(Tllstream202204* s, NimStringDesc** line);
N_NIMCALL(NI, utf8bom_238077)(NimStringDesc* s);
N_NIMCALL(NIM_BOOL, containsshebang_238081)(NimStringDesc* s, NI i);
N_NIMCALL(void, message_187095)(Tlineinfo182337 info, NU16 msg, NimStringDesc* arg);
static N_INLINE(Tlineinfo182337, newlineinfo_183030)(NimStringDesc* filename, NI line, NI col);
N_NIMCALL(Tlineinfo182337, newlineinfo_183024)(NI32 fileinfoidx, NI line, NI col);
N_NIMCALL(NI32, fileinfoidx_183017)(NimStringDesc* filename);
N_NIMCALL(void, openparser_228331)(Tparser228202* p, NimStringDesc* filename, Tllstream202204* inputstream, NIM_BOOL strongspaces);
N_NIMCALL(Tllstream202204*, llstreamopen_202217)(NimStringDesc* data);
N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s, NI start);
N_NIMCALL(NimStringDesc*, copyStr)(NimStringDesc* s, NI first);
N_NIMCALL(Tnode214790*, parseall_228210)(Tparser228202* p);
N_NIMCALL(void, closeparser_228214)(Tparser228202* p);
N_NIMCALL(void, llstreamclose_202277)(Tllstream202204* s);
N_NIMCALL(Tllstream202204*, evalpipe_238696)(Tparsers238026* p, Tnode214790* n, NimStringDesc* filename, Tllstream202204* start);
N_NIMCALL(NIM_BOOL, identeq_189450)(Tident189012* id, NimStringDesc* name);
N_NIMCALL(Tllstream202204*, applyfilter_238659)(Tparsers238026* p, Tnode214790* n, NimStringDesc* filename, Tllstream202204* stdin_238665);
N_NIMCALL(Tident189012*, getcallee_238623)(Tnode214790* n);
N_NIMCALL(NimStringDesc*, rendertree_233044)(Tnode214790* n, NU8 renderflags);
N_NIMCALL(NU8, getfilter_238185)(Tident189012* ident);
N_NIMCALL(NU8, getparser_238423)(Tident189012* ident);
N_NIMCALL(Tllstream202204*, filtertmpl_237003)(Tllstream202204* stdin_237005, NimStringDesc* filename, Tnode214790* call);
N_NIMCALL(Tllstream202204*, filterstrip_236006)(Tllstream202204* stdin_236008, NimStringDesc* filename, Tnode214790* call);
N_NIMCALL(Tllstream202204*, filterreplace_236001)(Tllstream202204* stdin_236003, NimStringDesc* filename, Tnode214790* call);
N_NIMCALL(void, rawmessage_184645)(NU16 msg, NimStringDesc** args, NI argsLen0);
N_NIMCALL(void, msgwriteln_183449)(NimStringDesc* s, NU8 flags);
N_NIMCALL(void, openparser_228322)(Tparser228202* p, NI32 fileidx, Tllstream202204* inputstream, NIM_BOOL strongspaces);
N_NIMCALL(Tllstream202204*, llstreamopen_202229)(FILE* f);
N_NIMCALL(Tnode214790*, parseall_238042)(Tparsers238026* p);
N_NIMCALL(Tnode214790*, parseall_232003)(Tparser228202* p);
N_NIMCALL(void, internalerror_187113)(NimStringDesc* errmsg);
N_NIMCALL(void, closeparsers_238038)(Tparsers238026* p);
N_NIMCALL(Tnode214790*, parsetoplevelstmt_228218)(Tparser228202* p);
N_NIMCALL(Tnode214790*, parsetoplevelstmt_232008)(Tparser228202* p);
STRING_LITERAL(TMP1236, "use \'#?\' instead; \'#!\'", 22);
STRING_LITERAL(TMP1402, "|", 1);
STRING_LITERAL(TMP1513, "none", 4);
STRING_LITERAL(TMP1514, "stdtmpl", 7);
STRING_LITERAL(TMP1515, "replace", 7);
STRING_LITERAL(TMP1516, "strip", 5);
NIM_CONST TY238022 filternames_238019 = {((NimStringDesc*) &TMP1513),
((NimStringDesc*) &TMP1514),
((NimStringDesc*) &TMP1515),
((NimStringDesc*) &TMP1516)}
;
STRING_LITERAL(TMP1517, "standard", 8);
STRING_LITERAL(TMP1518, "strongspaces", 12);
STRING_LITERAL(TMP1519, "braces", 6);
STRING_LITERAL(TMP1520, "endx", 4);
NIM_CONST TY238016 parsernames_238013 = {((NimStringDesc*) &TMP1517),
((NimStringDesc*) &TMP1518),
((NimStringDesc*) &TMP1519),
((NimStringDesc*) &TMP1520)}
;
STRING_LITERAL(TMP1552, "parser to implement", 19);
TNimType NTI238026; /* TParsers */
TNimType NTI238004; /* TParserKind */
extern TNimType NTI228202; /* TParser */
extern Tnode214790* emptynode_215801;
extern NU64 gnotes_183080;

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

N_NIMCALL(NIM_BOOL, containsshebang_238081)(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[(NI)(i + ((NI) 1))]) == (NU8)(33));
		LA4: ;
		if (!LOC3) goto LA5;
		j = (NI)(i + ((NI) 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 += ((NI) 1);
			} LA8: ;
		}
		result = ((NU8)(s->data[j]) == (NU8)(47));
	}
	LA5: ;
	return result;
}

static N_INLINE(Tlineinfo182337, newlineinfo_183030)(NimStringDesc* filename, NI line, NI col) {
	Tlineinfo182337 result;
	NI32 LOC1;
	memset((void*)(&result), 0, sizeof(result));
	LOC1 = 0;
	LOC1 = fileinfoidx_183017(filename);
	result = newlineinfo_183024(LOC1, line, col);
	return result;
}

N_NIMCALL(Tnode214790*, parsepipe_238107)(NimStringDesc* filename, Tllstream202204* inputstream) {
	Tnode214790* result;
	Tllstream202204* s;
	result = 0;
	result = emptynode_215801;
	s = llstreamopen_202241(filename, ((NU8) 0));
	{
		NimStringDesc* line;
		NIM_BOOL LOC5;
		NI i;
		NI linenumber;
		if (!!((s == NIM_NIL))) goto LA3;
		line = rawNewString(((NI) 80));
		LOC5 = 0;
		LOC5 = llstreamreadline_202550(s, (&line));
		i = utf8bom_238077(line);
		linenumber = ((NI) 1);
		{
			NIM_BOOL LOC8;
			NIM_BOOL LOC11;
			LOC8 = 0;
			LOC8 = containsshebang_238081(line, i);
			if (!LOC8) goto LA9;
			LOC11 = 0;
			LOC11 = llstreamreadline_202550(s, (&line));
			i = ((NI) 0);
			linenumber += ((NI) 1);
		}
		LA9: ;
		{
			NIM_BOOL LOC14;
			Tparser228202 q;
			NimStringDesc* LOC25;
			Tllstream202204* LOC26;
			LOC14 = 0;
			LOC14 = ((NU8)(line->data[i]) == (NU8)(35));
			if (!(LOC14)) goto LA15;
			LOC14 = (((NU8)(line->data[(NI)(i + ((NI) 1))])) == ((NU8)(63)) || ((NU8)(line->data[(NI)(i + ((NI) 1))])) == ((NU8)(33)));
			LA15: ;
			if (!LOC14) goto LA16;
			{
				Tlineinfo182337 LOC22;
				if (!((NU8)(line->data[(NI)(i + ((NI) 1))]) == (NU8)(33))) goto LA20;
				LOC22 = newlineinfo_183030(filename, linenumber, ((NI) 1));
				message_187095(LOC22, ((NU16) 241), ((NimStringDesc*) &TMP1236));
			}
			LA20: ;
			i += ((NI) 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 LA24;
					i += ((NI) 1);
				} LA24: ;
			}
			memset((void*)(&q), 0, sizeof(q));
			objectInit((&q), (&NTI228202));
			LOC25 = 0;
			LOC25 = copyStr(line, i);
			LOC26 = 0;
			LOC26 = llstreamopen_202217(LOC25);
			openparser_228331((&q), filename, LOC26, NIM_FALSE);
			result = parseall_228210((&q));
			closeparser_228214((&q));
		}
		LA16: ;
		llstreamclose_202277(s);
	}
	LA3: ;
	return result;
}

N_NIMCALL(Tident189012*, getcallee_238623)(Tnode214790* n) {
	Tident189012* 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[((NI) 0)]).kind == ((NU8) 2));
		LA4: ;
		if (!LOC3) goto LA5;
		result = (*(*n).kindU.S6.sons->data[((NI) 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_233044(n, 0);
		rawmessage_185612(((NU16) 167), LOC11);
	}
	LA1: ;
	return result;
}

N_NIMCALL(NU8, getfilter_238185)(Tident189012* ident) {
	NU8 result;
{	result = 0;
	{
		NU8 i_238414;
		NI res_238420;
		i_238414 = 0;
		res_238420 = ((NI) 0);
		{
			while (1) {
				if (!(res_238420 <= ((NI) 3))) goto LA3;
				i_238414 = ((NU8) (res_238420));
				{
					NIM_BOOL LOC6;
					LOC6 = 0;
					LOC6 = identeq_189450(ident, filternames_238019[(i_238414)- 0]);
					if (!LOC6) goto LA7;
					result = i_238414;
					goto BeforeRet;
				}
				LA7: ;
				res_238420 += ((NI) 1);
			} LA3: ;
		}
	}
	result = ((NU8) 0);
	}BeforeRet: ;
	return result;
}

N_NIMCALL(NU8, getparser_238423)(Tident189012* ident) {
	NU8 result;
{	result = 0;
	{
		NU8 i_238614;
		NI res_238620;
		i_238614 = 0;
		res_238620 = ((NI) 0);
		{
			while (1) {
				if (!(res_238620 <= ((NI) 3))) goto LA3;
				i_238614 = ((NU8) (res_238620));
				{
					NIM_BOOL LOC6;
					LOC6 = 0;
					LOC6 = identeq_189450(ident, parsernames_238013[(i_238614)- 0]);
					if (!LOC6) goto LA7;
					result = i_238614;
					goto BeforeRet;
				}
				LA7: ;
				res_238620 += ((NI) 1);
			} LA3: ;
		}
	}
	rawmessage_185612(((NU16) 31), (*ident).s);
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tllstream202204*, applyfilter_238659)(Tparsers238026* p, Tnode214790* n, NimStringDesc* filename, Tllstream202204* stdin_238665) {
	Tllstream202204* result;
	Tident189012* ident;
	NU8 f;
	result = 0;
	ident = getcallee_238623(n);
	f = getfilter_238185(ident);
	switch (f) {
	case ((NU8) 0):
	{
		(*p).skin = getparser_238423(ident);
		result = stdin_238665;
	}
	break;
	case ((NU8) 1):
	{
		result = filtertmpl_237003(stdin_238665, filename, n);
	}
	break;
	case ((NU8) 3):
	{
		result = filterstrip_236006(stdin_238665, filename, n);
	}
	break;
	case ((NU8) 2):
	{
		result = filterreplace_236001(stdin_238665, filename, n);
	}
	break;
	}
	{
		if (!!((f == ((NU8) 0)))) goto LA7;
		{
			TY238694 LOC13;
			TY238694 LOC14;
			if (!((gnotes_183080 &((NU64)1<<((NU)((((NU16) 277)- 237))&63U)))!=0)) goto LA11;
			memset((void*)LOC13, 0, sizeof(LOC13));
			rawmessage_184645(((NU16) 277), LOC13, 0);
			msgwriteln_183449((*result).s, 0);
			memset((void*)LOC14, 0, sizeof(LOC14));
			rawmessage_184645(((NU16) 278), LOC14, 0);
		}
		LA11: ;
	}
	LA7: ;
	return result;
}

N_NIMCALL(Tllstream202204*, evalpipe_238696)(Tparsers238026* p, Tnode214790* n, NimStringDesc* filename, Tllstream202204* start) {
	Tllstream202204* 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[((NI) 0)]).kind == ((NU8) 2));
		LA9: ;
		LOC7 = LOC8;
		if (!(LOC7)) goto LA10;
		LOC7 = identeq_189450((*(*n).kindU.S6.sons->data[((NI) 0)]).kindU.S5.ident, ((NimStringDesc*) &TMP1402));
		LA10: ;
		if (!LOC7) goto LA11;
		{
			NI i_238745;
			NI res_238771;
			i_238745 = 0;
			res_238771 = ((NI) 1);
			{
				while (1) {
					if (!(res_238771 <= ((NI) 2))) goto LA15;
					i_238745 = res_238771;
					{
						if (!((*(*n).kindU.S6.sons->data[i_238745]).kind == ((NU8) 29))) goto LA18;
						result = evalpipe_238696(p, (*n).kindU.S6.sons->data[i_238745], filename, result);
					}
					goto LA16;
					LA18: ;
					{
						result = applyfilter_238659(p, (*n).kindU.S6.sons->data[i_238745], filename, result);
					}
					LA16: ;
					res_238771 += ((NI) 1);
				} LA15: ;
			}
		}
	}
	goto LA5;
	LA11: ;
	{
		if (!((*n).kind == ((NU8) 115))) goto LA22;
		result = evalpipe_238696(p, (*n).kindU.S6.sons->data[((NI) 0)], filename, result);
	}
	goto LA5;
	LA22: ;
	{
		result = applyfilter_238659(p, n, filename, result);
	}
	LA5: ;
	}BeforeRet: ;
	return result;
}

N_NIMCALL(void, openparsers_238032)(Tparsers238026* p, NI32 fileidx, Tllstream202204* inputstream) {
	Tllstream202204* s;
	NimStringDesc* filename;
	Tnode214790* pipe;
	s = 0;
	(*p).skin = ((NU8) 0);
	filename = tofullpathconsiderdirty_183401(fileidx);
	pipe = parsepipe_238107(filename, inputstream);
	{
		if (!!((pipe == NIM_NIL))) goto LA3;
		s = evalpipe_238696(p, pipe, filename, inputstream);
	}
	goto LA1;
	LA3: ;
	{
		s = inputstream;
	}
	LA1: ;
	switch ((*p).skin) {
	case ((NU8) 0):
	case ((NU8) 2):
	case ((NU8) 3):
	{
		openparser_228322((&(*p).parser), fileidx, s, NIM_FALSE);
	}
	break;
	case ((NU8) 1):
	{
		openparser_228322((&(*p).parser), fileidx, s, NIM_TRUE);
	}
	break;
	}
}

N_NIMCALL(Tnode214790*, parseall_238042)(Tparsers238026* p) {
	Tnode214790* result;
	result = 0;
	switch ((*p).skin) {
	case ((NU8) 0):
	case ((NU8) 1):
	{
		result = parseall_228210((&(*p).parser));
	}
	break;
	case ((NU8) 2):
	{
		result = parseall_232003((&(*p).parser));
	}
	break;
	case ((NU8) 3):
	{
		internalerror_187113(((NimStringDesc*) &TMP1552));
		result = emptynode_215801;
	}
	break;
	}
	return result;
}

N_NIMCALL(void, closeparsers_238038)(Tparsers238026* p) {
	closeparser_228214((&(*p).parser));
}

N_NIMCALL(Tnode214790*, parsefile_238029)(NI32 fileidx) {
	Tnode214790* result;
	Tparsers238026 p;
	FILE* f;
	NimStringDesc* filename;
	Tllstream202204* LOC6;
{	result = 0;
	memset((void*)(&p), 0, sizeof(p));
	objectInit((&p), (&NTI238026));
	f = 0;
	filename = tofullpathconsiderdirty_183401(fileidx);
	{
		NIM_BOOL LOC3;
		LOC3 = 0;
		LOC3 = open_15403(&f, filename, ((NU8) 0), ((NI) -1));
		if (!!(LOC3)) goto LA4;
		rawmessage_185612(((NU16) 3), filename);
		goto BeforeRet;
	}
	LA4: ;
	LOC6 = 0;
	LOC6 = llstreamopen_202229(f);
	openparsers_238032((&p), fileidx, LOC6);
	result = parseall_238042((&p));
	closeparsers_238038((&p));
	}BeforeRet: ;
	return result;
}

N_NIMCALL(Tnode214790*, parsetoplevelstmt_238046)(Tparsers238026* p) {
	Tnode214790* result;
	result = 0;
	switch ((*p).skin) {
	case ((NU8) 0):
	case ((NU8) 1):
	{
		result = parsetoplevelstmt_228218((&(*p).parser));
	}
	break;
	case ((NU8) 2):
	{
		result = parsetoplevelstmt_232008((&(*p).parser));
	}
	break;
	case ((NU8) 3):
	{
		internalerror_187113(((NimStringDesc*) &TMP1552));
		result = emptynode_215801;
	}
	break;
	}
	return result;
}
NIM_EXTERNC N_NOINLINE(void, compiler_syntaxesInit000)(void) {
}

NIM_EXTERNC N_NOINLINE(void, compiler_syntaxesDatInit000)(void) {
static TNimNode* TMP1204[2];
static TNimNode* TMP1205[4];
NI TMP1207;
static char* NIM_CONST TMP1206[4] = {
"skinStandard", 
"skinStrongSpaces", 
"skinBraces", 
"skinEndX"};
static TNimNode TMP880[8];
NTI238026.size = sizeof(Tparsers238026);
NTI238026.kind = 18;
NTI238026.base = 0;
TMP1204[0] = &TMP880[1];
NTI238004.size = sizeof(NU8);
NTI238004.kind = 14;
NTI238004.base = 0;
NTI238004.flags = 3;
for (TMP1207 = 0; TMP1207 < 4; TMP1207++) {
TMP880[TMP1207+2].kind = 1;
TMP880[TMP1207+2].offset = TMP1207;
TMP880[TMP1207+2].name = TMP1206[TMP1207];
TMP1205[TMP1207] = &TMP880[TMP1207+2];
}
TMP880[6].len = 4; TMP880[6].kind = 2; TMP880[6].sons = &TMP1205[0];
NTI238004.node = &TMP880[6];
TMP880[1].kind = 1;
TMP880[1].offset = offsetof(Tparsers238026, skin);
TMP880[1].typ = (&NTI238004);
TMP880[1].name = "skin";
TMP1204[1] = &TMP880[7];
TMP880[7].kind = 1;
TMP880[7].offset = offsetof(Tparsers238026, parser);
TMP880[7].typ = (&NTI228202);
TMP880[7].name = "parser";
TMP880[0].len = 2; TMP880[0].kind = 2; TMP880[0].sons = &TMP1204[0];
NTI238026.node = &TMP880[0];
}

