static void parseAnn(struct gff3File *g3f, char *line) /* parse an annotation line */ { // extra column to check for too many char *words[gffNumCols+1]; int numWords = chopString(line, "\t", words, gffNumCols+1); if (numWords != gffNumCols) gff3FileErr(g3f, "expected %d tab-separated columns: %s", gffNumCols, line); struct gff3Ann *g3a = gff3FileAlloc(g3f, sizeof(struct gff3Ann)); g3a->file = g3f; g3a->lineNum = g3f->lf->lineIx; parseFields(g3a, words); parseAttrs(g3a, words[8]); parseStdAttrs(g3a); slAddHead(&g3f->anns, g3a); }
word_t Regex_constructor(CrocThread* t) { croc_hfield(t, 0, _Ptrs); if(!croc_isNull(t, -1)) croc_eh_throwStd(t, "StateError", "Attempting to call constructor on an already-initialized Regex"); auto pat = checkCrocstrParam(t, 1); auto attrs = parseAttrs(optCrocstrParam(t, 2, "")); auto re = compilePattern(t, pat, attrs); const char* error; auto extra = pcre_study(re, 0, &error); if(error != nullptr) { (*pcre_free)(re); croc_eh_throwStd(t, "ValueError", "Error compiling regex: %s", error); } croc_memblock_new(t, sizeof(PtrStruct)); auto ptrs = cast(PtrStruct*)croc_memblock_getData(t, -1); ptrs->re = re; ptrs->extra = extra; croc_hfielda(t, 0, _Ptrs); int numGroups; pcre_fullinfo(re, extra, PCRE_INFO_CAPTURECOUNT, &numGroups); croc_memblock_new(t, sizeof(int) * ((numGroups + 1) * 3)); croc_hfielda(t, 0, _GroupIdx); getNameTable(t, re, extra); croc_hfielda(t, 0, _Names); return 0; }