Example #1
0
void parseD(){
	parseDa();
	if(NT == 4000  && keyword == "within"){
		read("within");
		parseD();
		buildTree("within", 2) ;
	}
}
Example #2
0
void parseE(){	
	if(NT == 4000 && keyword == "let"){		
		read("let");
		parseD();		
		read("in");		
		parseE();
		buildTree("let", 2);			
	}else if(NT == 4000 && keyword == "fn"){
		read("fn");
		parseVb();
		int n= 1;
		while(NT == 1000 || (NT == 4000 && keyword == "(")){
			parseVb();
			n++;
		}
		read(".");
		parseE();
		buildTree("lambda", n+1);
	}else{		
		parseEw();
	}
}
Example #3
0
void parseDb(){
	if(NT == 1000){
		parseVl();
		if(NT == 4000 && keyword == "="){
			read("=");
			parseE();
			buildTree("=", 2);			
		}else if(NT == 1000 || (NT == 4000 && keyword == "(")){				
			parseVb();
			int n = 1;
			while(NT == 1000 || (NT == 4000 && keyword == "(")){
				parseVb();
				n++;
			}
			read("=");		
			parseE();			
			buildTree("function_form" , n+2);
		}
	}else if(NT == 4000 && keyword == "("){	
		read("(");		
		parseD();
		read(")");
	}
}
Example #4
0
void parseIntoAxt(char *lavFile, FILE *f, 
	char *tNibDir, struct dlList *tCache, 
	char *qNibDir, struct dlList *qCache)
/* Parse a blastz lav file and put it an axt. */
{
struct lineFile *lf = lineFileOpen(lavFile, TRUE);
char *line;
struct block *blockList = NULL;
boolean isRc = FALSE;
char *tName = NULL, *qName = NULL;
char *matrix = NULL, *command = NULL;
int qSize = 0, tSize = 0;
int score = 0;

/* Check header. */
if (!lineFileNext(lf, &line, NULL))
   errAbort("%s is empty", lf->fileName);
if (!startsWith("#:lav", line))
   errAbort("%s is not a lav file\n", lf->fileName);

while (lineFileNext(lf, &line, NULL))
    {
    if (startsWith("s {", line))
        {
	parseS(lf, &tSize, &qSize);
	}
    else if (startsWith("h {", line))
        {
	parseH(lf, &tName, &qName, &isRc);
	}
    else if (startsWith("d {", line))
        {
	parseD(lf, &matrix, &command, f);
	}
    else if (startsWith("a {", line))
        {
	parseA(lf, &blockList, &score);
        if (optionExists("dropSelf"))
	    {
	    struct block *bArr[256];
	    int numBLs = 0, i = 0;
	    boolean rescore = FALSE;
	    rescore = breakUpIfOnDiagonal(blockList, isRc, qName, tName,
					  qSize, tSize, bArr, ArraySize(bArr),
					  &numBLs);
	    for (i=0;  i < numBLs;  i++)
		{
		outputBlocks(lf, bArr[i], score, f, isRc, 
			     qName, qSize, qNibDir, qCache,
			     tName, tSize, tNibDir, tCache, rescore);
		slFreeList(&bArr[i]);
		}
	    }
	else
	    {
	    outputBlocks(lf, blockList, score, f, isRc, 
			 qName, qSize, qNibDir, qCache,
			 tName, tSize, tNibDir, tCache, FALSE);
	    slFreeList(&blockList);
	    }
	}
    }
lineFileClose(&lf);
}