60 if (++L[
hd(args)] > 1)
return false;
69 cerr <<
"ERROR : inconsistent number of parameters in pattern-matching rule: "
71 <<
" previous rule was: "
79 if (
isNil(lrules)) { cerr <<
"ERROR : a case expression can't be empty" << endl; exit(1); }
85 while (!
isNil(lrules)) {
88 if (npat !=
len(lhs2)) {
109 if (variants.size() == 1) {
110 Tree rhs = *(variants.begin());
122 list<Tree>::iterator p;
124 Tree prev = *variants.begin();
125 int npat =
len(
hd(prev));
126 for (p=variants.begin(); p!=variants.end(); p++) {
128 if (npat !=
len(
hd(cur))) {
151 map<Tree,list<Tree> > dic;
152 map<Tree,list<Tree> >::iterator p;
158 while (!
isNil(rldef)) {
162 ldef2 =
cons(def,ldef2);
163 }
else if (!
isNil(def)) {
165 dic[
hd(def)].push_front(
tl(def));
171 for (p=dic.begin(); p!=dic.end(); p++) {
208 fprintf(stderr,
"Parse error : code = %d \n", r);
216 fFilePathnames.push_back(fullpath);
229 fprintf(stderr,
"ERROR : Unable to open file %s \n",
yyfilename);
236 fprintf(stderr,
"Parse error : code = %d \n", r);
244 fFilePathnames.push_back(fullpath);
259 return fFileCache.find(fname) != fFileCache.end();
272 if (!cached(fname)) {
273 fFileCache[fname] = parse(fname);
275 if (fFileCache[fname] == 0) exit(1);
276 return fFileCache[fname];
295 return fFilePathnames;
309 return expandrec(ldef, visited,
nil);
314 for (;!
isNil(ldef); ldef =
tl(ldef)) {
324 if (visited.find(f) == visited.end()) {
327 lresult = expandrec(getlist(f), visited, lresult);
331 lresult =
cons(d, lresult);
bool cached(string fname)
Check if a file as been read and is in the "cache".
bool isImportFile(Tree s, Tree &filename)
void yyrestart(FILE *new_file)
Immediately switch to a different input stream.
void declareMetadata(Tree key, Tree value)
Tree parse(string fname)
Parse a single faust source file.
void http_perror(const char *string)
Tree formatDefinitions(Tree rldef)
Formats a list of raw definitions represented by triplets into abstractions or pa...
vector< Tree > gDocVector
Contains parsed trees: DOCTXT, DOCEQN, DOCDGM.
Tree cons(Tree a, Tree b)
Tree expandrec(Tree ldef, set< string > &visited, Tree lresult)
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
static Tree makeDefinition(list< Tree > &variants)
Transforms a list of variants (arglist.body) into an abstraction or a boxCase.
vector< string > listSrcFiles()
Return a vector of pathnames representing the list of all the source files that have been required to...
FILE * fopensearch(const char *filename, string &fullpath)
Try to open the file searching in various directories.
int http_fetch(const char *url_tmp, char **fileBuf)
Tree expandlist(Tree ldef)
Return the list of definitions where all imports have been expanded.
Tree checkRulelist(Tree lr)
static bool standardArgList(Tree args)
Checks an argument list for containing only standard identifiers, no patterns and is linear...
static void printPatternError(Tree lhs1, Tree rhs1, Tree lhs2, Tree rhs2)
Tree getlist(string fname)
Return the list of definitions file contains.
Tree buildBoxAbstr(Tree largs, Tree body)
map< Tree, set< Tree > > gMetaDataSet
struct yy_buffer_state * yy_scan_string(const char *yy_str)
const char * tree2str(Tree t)
if t has a node of type symbol, return its name otherwise error