Changeset: 70e7ea9d3d7c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/70e7ea9d3d7c Modified Files: monetdb5/mal/mal_parser.c monetdb5/mal/mal_type.c Branch: default Log Message:
In the MAL parser, recognize bat and BAT as aliases, and don't use default type after error. diffs (69 lines): diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c --- a/monetdb5/mal/mal_parser.c +++ b/monetdb5/mal/mal_parser.c @@ -693,13 +693,13 @@ simpleTypeId(Client cntxt) } static int -parseTypeId(Client cntxt, int defaultType) +parseTypeId(Client cntxt) { int i = TYPE_any, kt = 0; char *s = CURRENT(cntxt); int tt; - if (s[0] == ':' && s[1] == 'b' && s[2] == 'a' && s[3] == 't' && s[4] == '[') { + if (strncmp(s, ":bat[", 5) == 0 || strncmp(s, ":BAT[", 5) == 0) { /* parse :bat[:type] */ advance(cntxt, 5); if (currChar(cntxt) == ':') { @@ -707,7 +707,7 @@ parseTypeId(Client cntxt, int defaultTyp kt = typeAlias(cntxt, tt); } else{ parseError(cntxt, "':bat[:any]' expected\n"); - return TYPE_bat; + return -1; } i = newBatType(tt); @@ -728,7 +728,7 @@ parseTypeId(Client cntxt, int defaultTyp return tt; } parseError(cntxt, "<type identifier> expected\n"); - return defaultType; + return -1; } static inline int @@ -736,7 +736,7 @@ typeElm(Client cntxt, int def) { if (currChar(cntxt) != ':') return def; /* no type qualifier */ - return parseTypeId(cntxt, def); + return parseTypeId(cntxt); } /* @@ -963,7 +963,7 @@ parseAtom(Client cntxt) if (currChar(cntxt) != ':') tpe = TYPE_void; /* no type qualifier */ else - tpe = parseTypeId(cntxt, TYPE_int); + tpe = parseTypeId(cntxt); if( ATOMindex(modnme) < 0) { if(cntxt->curprg->def->errors) freeException(cntxt->curprg->def->errors); diff --git a/monetdb5/mal/mal_type.c b/monetdb5/mal/mal_type.c --- a/monetdb5/mal/mal_type.c +++ b/monetdb5/mal/mal_type.c @@ -121,6 +121,10 @@ getAtomIndex(const char *nme, size_t len if (qt("bte")) return TYPE_bte; break; + case 'B': + if (qt("BAT")) + return TYPE_bat; + break; case 'd': if (qt("dbl")) return TYPE_dbl; _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org