Subversion Repositories PlanixRsrch.SVN

Compare Revisions

Ignore whitespace Rev 248 → Rev 249

/branches/mgen-loop-detection/mgen_parse.c
25,9 → 25,31
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
#include <libmavl/mavl.h>
 
#include "mgen.h"
 
struct loop_entry{
struct mgen_sym * sym;
MGEN_CHAR * c;
};
 
int cmp_loops(const void *p1, const void *p2)
{
const struct loop_entry *l1,*l2;
l1 = (struct loop_entry *)p1;
l2 = (struct loop_entry *)p2;
 
if (l1->sym > l2->sym){
return 1;
}
if (l1->sym < l2->sym){
return 1;
}
 
return 0;
}
 
struct status {
size_t fpos;
struct rhs_elem * e;
40,15 → 62,17
 
MGEN_RING st;
MGEN_RING ss;
struct mavl * loops;
};
 
/*
static const char *
mgen_format_bool(int b)
{
return b ? "TRUE" : "FALSE";
}
*/
 
 
static int
check_string(struct mgen_stream *mf, char *str)
{
115,8 → 139,8
mgen_ring_seek(&prs->mf->ring,prs->mf->ring.absmaxpos);
mc = mgen_ring_getat(&prs->mf->ring,MGEN_CHAR,prs->mf->ring.pos);
mc = mgen_get_char_at(prs->mf,prs->mf->ring.absmaxpos);
printf("ABSMAX: %d\n",prs->mf->ring.absmaxpos);
printf("Error at '%c', Line: %d, Col: %d\n",mc->c,mc->line,mc->col);
(void)printf("ABSMAX: %d\n",prs->mf->ring.absmaxpos);
(void)printf("Error at '%c', Line: %d, Col: %d\n",mc->c,mc->line,mc->col);
 
return 0;
}
188,7 → 212,11
 
prs.rules = rules->rules;
prs.mf = mf;
prs.loops = mavl_create(cmp_loops,NULL,sizeof(struct loop_entry));
if (prs.loops==NULL)
return 0;
 
 
mgen_ring_init(&prs.st,sizeof(struct status));
mgen_ring_init(&prs.ss,sizeof(struct mgen_sym *));