1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
|
/* Generated by Nim Compiler v2.2.0 */
#define NIM_INTBITS 32
#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
typedef struct tyObject_BaseLexer__ZspOFmN5MjfhmGOKIrGMRg tyObject_BaseLexer__ZspOFmN5MjfhmGOKIrGMRg;
typedef struct tyObject_StreamObj__nX3kZRlh8Dq3gQ2cC6DE8w tyObject_StreamObj__nX3kZRlh8Dq3gQ2cC6DE8w;
typedef struct RootObj RootObj;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_HSlice__OAVyDXS0QPw7LdXClfU2hA tyObject_HSlice__OAVyDXS0QPw7LdXClfU2hA;
typedef NU8 tySet_tyChar__nmiMWKVIe46vacnhAFrQvw[32];
struct TNimTypeV2 {
void* destructor;
NI size;
NI16 align;
NI16 depth;
NU32* display;
void* traceImpl;
void* typeInfoV1;
NI flags;
void* vTable[SEQ_DECL_SIZE];
};
struct RootObj {
TNimTypeV2* m_type;
};
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
struct tyObject_BaseLexer__ZspOFmN5MjfhmGOKIrGMRg {
RootObj Sup;
NI bufpos;
NimStringV2 buf;
tyObject_StreamObj__nX3kZRlh8Dq3gQ2cC6DE8w* input;
NI lineNumber;
NI sentinel;
NI lineStart;
NI offsetBase;
tySet_tyChar__nmiMWKVIe46vacnhAFrQvw refillChars;
};
struct tyObject_HSlice__OAVyDXS0QPw7LdXClfU2hA {
NI a;
NI b;
};
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___pureZstreams_u676)(tyObject_StreamObj__nX3kZRlh8Dq3gQ2cC6DE8w** dest_p0, tyObject_StreamObj__nX3kZRlh8Dq3gQ2cC6DE8w* src_p1, NIM_BOOL cyclic_p2);
static N_INLINE(void, nimCopyMem)(void* dest_p0, void* source_p1, NI size_p2);
N_LIB_PRIVATE N_NIMCALL(void, eqsink___system_u2606)(NimStringV2* dest_p0, NimStringV2 src_p1);
N_NIMCALL(NimStringV2, mnewString)(NI len_p0);
N_LIB_PRIVATE N_NIMCALL(void, fillBuffer__pureZlexbase_u17)(tyObject_BaseLexer__ZspOFmN5MjfhmGOKIrGMRg* L_p0);
static N_INLINE(void, moveMem__system_u1717)(void* dest_p0, void* source_p1, NI size_p2);
N_LIB_PRIVATE N_NIMCALL(NI, readDataStr__pureZstreams_u85)(tyObject_StreamObj__nX3kZRlh8Dq3gQ2cC6DE8w* s_p0, NimStringV2* buffer_p1, tyObject_HSlice__OAVyDXS0QPw7LdXClfU2hA slice_p2);
static N_INLINE(tyObject_HSlice__OAVyDXS0QPw7LdXClfU2hA, dotdot___stdZstrbasics_u49)(NI a_p0, NI b_p1);
static N_INLINE(void, nimPrepareStrMutationV2)(NimStringV2* s_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimPrepareStrMutationImpl__system_u2348)(NimStringV2* s_p0);
N_LIB_PRIVATE N_NIMCALL(void, setLengthStrV2)(NimStringV2* s_p0, NI newLen_p1);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, skipUtf8Bom__pureZlexbase_u119)(tyObject_BaseLexer__ZspOFmN5MjfhmGOKIrGMRg* L_p0);
N_LIB_PRIVATE N_NIMCALL(NI, fillBaseLexer__pureZlexbase_u73)(tyObject_BaseLexer__ZspOFmN5MjfhmGOKIrGMRg* L_p0, NI pos_p1);
N_LIB_PRIVATE N_NIMCALL(void, close__pureZstreams_u58)(tyObject_StreamObj__nX3kZRlh8Dq3gQ2cC6DE8w* s_p0);
extern NIM_BOOL nimInErrorMode__system_u4272;
static N_INLINE(void, nimCopyMem)(void* dest_p0, void* source_p1, NI size_p2) {
void* T1_;
T1_ = (void*)0;
T1_ = memcpy(dest_p0, source_p1, ((size_t) (size_p2)));
}
static N_INLINE(void, moveMem__system_u1717)(void* dest_p0, void* source_p1, NI size_p2) {
void* T1_;
T1_ = (void*)0;
T1_ = memmove(dest_p0, source_p1, ((size_t) (size_p2)));
}
static N_INLINE(tyObject_HSlice__OAVyDXS0QPw7LdXClfU2hA, dotdot___stdZstrbasics_u49)(NI a_p0, NI b_p1) {
tyObject_HSlice__OAVyDXS0QPw7LdXClfU2hA result;
result.a = a_p0;
result.b = b_p1;
return result;
}
static N_INLINE(void, nimPrepareStrMutationV2)(NimStringV2* s_p0) {
{
NIM_BOOL T3_;
T3_ = (NIM_BOOL)0;
T3_ = !(((*s_p0).p == ((NimStrPayload*) NIM_NIL)));
if (!(T3_)) goto LA4_;
T3_ = ((NI)((*(*s_p0).p).cap & ((NI)1073741824)) == ((NI)1073741824));
LA4_: ;
if (!T3_) goto LA5_;
nimPrepareStrMutationImpl__system_u2348(s_p0);
}
LA5_: ;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (&nimInErrorMode__system_u4272);
return result;
}
N_LIB_PRIVATE N_NIMCALL(void, fillBuffer__pureZlexbase_u17)(tyObject_BaseLexer__ZspOFmN5MjfhmGOKIrGMRg* L_p0) {
NI charsRead;
NI toCopy;
NI s;
NI oldBufLen;
tyObject_StreamObj__nX3kZRlh8Dq3gQ2cC6DE8w* T6_;
tyObject_HSlice__OAVyDXS0QPw7LdXClfU2hA T7_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
charsRead = (NI)0;
toCopy = (NI)0;
s = (NI)0;
oldBufLen = (NI)0;
toCopy = (NI)((*L_p0).buf.len - (NI)((*L_p0).sentinel + ((NI)1)));
{
void* T5_;
if (!(((NI)0) < toCopy)) goto LA3_;
T5_ = (void*)0;
T5_ = ((void*) ((&(*L_p0).buf.p->data[((NI)0)])));
moveMem__system_u1717(T5_, ((void*) ((&(*L_p0).buf.p->data[(NI)((*L_p0).sentinel + ((NI)1))]))), (toCopy));
}
LA3_: ;
T6_ = NIM_NIL;
T6_ = (*L_p0).input;
T7_ = dotdot___stdZstrbasics_u49(toCopy, (NI)((NI)((NI)(toCopy + (*L_p0).sentinel) + ((NI)1)) - ((NI)1)));
charsRead = readDataStr__pureZstreams_u85(T6_, (&(*L_p0).buf), T7_);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
s = (NI)(toCopy + charsRead);
{
if (!(charsRead < (NI)((*L_p0).sentinel + ((NI)1)))) goto LA10_;
nimPrepareStrMutationV2((&(*L_p0).buf));
(*L_p0).buf.p->data[s] = 0;
(*L_p0).sentinel = s;
}
goto LA8_;
LA10_: ;
{
s -= ((NI)1);
{
while (1) {
{
while (1) {
NIM_BOOL T17_;
T17_ = (NIM_BOOL)0;
T17_ = (((NI)0) <= s);
if (!(T17_)) goto LA18_;
T17_ = !((((*L_p0).refillChars[(NU)((((NU8)((*L_p0).buf.p->data[s]))))>>3] &(1U<<((NU)((((NU8)((*L_p0).buf.p->data[s]))))&7U)))!=0));
LA18_: ;
if (!T17_) goto LA16;
s -= ((NI)1);
} LA16: ;
}
{
if (!(((NI)0) <= s)) goto LA21_;
(*L_p0).sentinel = s;
goto LA13;
}
goto LA19_;
LA21_: ;
{
tyObject_StreamObj__nX3kZRlh8Dq3gQ2cC6DE8w* T24_;
tyObject_HSlice__OAVyDXS0QPw7LdXClfU2hA T25_;
oldBufLen = (*L_p0).buf.len;
setLengthStrV2((&(*L_p0).buf), ((NI)((*L_p0).buf.len * ((NI)2))));
T24_ = NIM_NIL;
T24_ = (*L_p0).input;
T25_ = dotdot___stdZstrbasics_u49(oldBufLen, (NI)((*L_p0).buf.len - ((NI)1)));
charsRead = readDataStr__pureZstreams_u85(T24_, (&(*L_p0).buf), T25_);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
{
if (!(charsRead < oldBufLen)) goto LA28_;
nimPrepareStrMutationV2((&(*L_p0).buf));
(*L_p0).buf.p->data[(NI)(oldBufLen + charsRead)] = 0;
(*L_p0).sentinel = (NI)(oldBufLen + charsRead);
goto LA13;
}
LA28_: ;
s = (NI)((*L_p0).buf.len - ((NI)1));
}
LA19_: ;
}
} LA13: ;
}
LA8_: ;
}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, skipUtf8Bom__pureZlexbase_u119)(tyObject_BaseLexer__ZspOFmN5MjfhmGOKIrGMRg* L_p0) {
{
NIM_BOOL T3_;
NIM_BOOL T4_;
T3_ = (NIM_BOOL)0;
T4_ = (NIM_BOOL)0;
T4_ = ((NU8)((*L_p0).buf.p->data[((NI)0)]) == (NU8)(239));
if (!(T4_)) goto LA5_;
T4_ = ((NU8)((*L_p0).buf.p->data[((NI)1)]) == (NU8)(187));
LA5_: ;
T3_ = T4_;
if (!(T3_)) goto LA6_;
T3_ = ((NU8)((*L_p0).buf.p->data[((NI)2)]) == (NU8)(191));
LA6_: ;
if (!T3_) goto LA7_;
(*L_p0).bufpos += ((NI)3);
(*L_p0).lineStart += ((NI)3);
}
LA7_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, open__pureZlexbase_u131)(tyObject_BaseLexer__ZspOFmN5MjfhmGOKIrGMRg* L_p0, tyObject_StreamObj__nX3kZRlh8Dq3gQ2cC6DE8w* input_p1, NI bufLen_p2, tySet_tyChar__nmiMWKVIe46vacnhAFrQvw refillChars_p3) {
NimStringV2 T1_;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
eqcopy___pureZstreams_u676(&(*L_p0).input, input_p1, NIM_TRUE);
(*L_p0).bufpos = ((NI)0);
(*L_p0).offsetBase = ((NI)0);
nimCopyMem((void*)(*L_p0).refillChars, (NIM_CONST void*)refillChars_p3, 32);
T1_.len = 0; T1_.p = NIM_NIL;
T1_ = mnewString((bufLen_p2));
eqsink___system_u2606((&(*L_p0).buf), T1_);
(*L_p0).sentinel = (NI)(bufLen_p2 - ((NI)1));
(*L_p0).lineStart = ((NI)0);
(*L_p0).lineNumber = ((NI)1);
fillBuffer__pureZlexbase_u17(L_p0);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
skipUtf8Bom__pureZlexbase_u119(L_p0);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(NI, fillBaseLexer__pureZlexbase_u73)(tyObject_BaseLexer__ZspOFmN5MjfhmGOKIrGMRg* L_p0, NI pos_p1) {
NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
result = (NI)0;
{
if (!(pos_p1 < (*L_p0).sentinel)) goto LA3_;
result = (NI)(pos_p1 + ((NI)1));
}
goto LA1_;
LA3_: ;
{
fillBuffer__pureZlexbase_u17(L_p0);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
(*L_p0).offsetBase += pos_p1;
(*L_p0).bufpos = ((NI)0);
result = ((NI)0);
}
LA1_: ;
}BeforeRet_: ;
return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, handleCR__pureZlexbase_u84)(tyObject_BaseLexer__ZspOFmN5MjfhmGOKIrGMRg* L_p0, NI pos_p1) {
NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
result = (NI)0;
(*L_p0).lineNumber += ((NI)1);
result = fillBaseLexer__pureZlexbase_u73(L_p0, pos_p1);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
{
if (!((NU8)((*L_p0).buf.p->data[result]) == (NU8)(10))) goto LA3_;
result = fillBaseLexer__pureZlexbase_u73(L_p0, result);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA3_: ;
(*L_p0).lineStart = result;
}BeforeRet_: ;
return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, handleLF__pureZlexbase_u96)(tyObject_BaseLexer__ZspOFmN5MjfhmGOKIrGMRg* L_p0, NI pos_p1) {
NI result;
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
result = (NI)0;
(*L_p0).lineNumber += ((NI)1);
result = fillBaseLexer__pureZlexbase_u73(L_p0, pos_p1);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
(*L_p0).lineStart = result;
}BeforeRet_: ;
return result;
}
N_LIB_PRIVATE N_NIMCALL(NI, getColNumber__pureZlexbase_u146)(tyObject_BaseLexer__ZspOFmN5MjfhmGOKIrGMRg* L_p0, NI pos_p1) {
NI result;
result = ((NI)(pos_p1 - (*L_p0).lineStart) > 0? ((NI)(pos_p1 - (*L_p0).lineStart)) : -((NI)(pos_p1 - (*L_p0).lineStart)));
return result;
}
N_LIB_PRIVATE N_NIMCALL(void, close__pureZlexbase_u15)(tyObject_BaseLexer__ZspOFmN5MjfhmGOKIrGMRg* L_p0) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
close__pureZstreams_u58((*L_p0).input);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
}
|