Changeset: 42d0637cfc71 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=42d0637cfc71 Modified Files: MonetDB5/src/mal/Tests/All MonetDB5/src/mal/Tests/parseErrors.stable.out MonetDB5/src/mal/Tests/tst023.mal MonetDB5/src/mal/Tests/tst023.stable.out MonetDB5/src/mal/Tests/tst058.stable.err MonetDB5/src/mal/Tests/tst058.stable.out MonetDB5/src/mal/mal_parser.mx Branch: Oct2010 Log Message:
Fixing 2733 Better error message handling upon illegal input. diffs (267 lines): diff -r 0198bac5a7ce -r 42d0637cfc71 MonetDB5/src/mal/Tests/All --- a/MonetDB5/src/mal/Tests/All Mon Nov 15 22:34:39 2010 +0100 +++ b/MonetDB5/src/mal/Tests/All Fri Nov 26 20:59:12 2010 +0100 @@ -54,6 +54,7 @@ tst055 tst056 tst057 +tst058 tst060 tst061 tst070 diff -r 0198bac5a7ce -r 42d0637cfc71 MonetDB5/src/mal/Tests/parseErrors.stable.out --- a/MonetDB5/src/mal/Tests/parseErrors.stable.out Mon Nov 15 22:34:39 2010 +0100 +++ b/MonetDB5/src/mal/Tests/parseErrors.stable.out Fri Nov 26 20:59:12 2010 +0100 @@ -14,9 +14,8 @@ #K := := !SyntaxException:parseError:K := := !SyntaxException:parseError: ^Type identifier expected -#io.print(1); -#io.print(2); -# + + function user.main():void; K; io.print(1); diff -r 0198bac5a7ce -r 42d0637cfc71 MonetDB5/src/mal/Tests/tst023.mal --- a/MonetDB5/src/mal/Tests/tst023.mal Mon Nov 15 22:34:39 2010 +0100 +++ b/MonetDB5/src/mal/Tests/tst023.mal Fri Nov 26 20:59:12 2010 +0100 @@ -3,6 +3,5 @@ io.print("added function to specific module"); b:= inspect.getDefinition("transaction","help"); io.print(b); -end help -comment "this is a commentary"; +end help; transaction.help(); diff -r 0198bac5a7ce -r 42d0637cfc71 MonetDB5/src/mal/Tests/tst023.stable.out --- a/MonetDB5/src/mal/Tests/tst023.stable.out Mon Nov 15 22:34:39 2010 +0100 +++ b/MonetDB5/src/mal/Tests/tst023.stable.out Fri Nov 26 20:59:12 2010 +0100 @@ -23,16 +23,20 @@ b := inspect.getDefinition("transaction","help"); io.print(b); end help; -#comment "this is a commentary"; -!SyntaxException:parseError:comment "this is a commentary"; -!SyntaxException:parseError: ^';' expected -#transaction.help(); -# function user.main():void; #test addition of a function to a known module - comment; transaction.help(); end main; +[ "added function to specific module" ] +#-----------------------------------------------------------------------------------------# +# view fcn # name +# str str # type +#-----------------------------------------------------------------------------------------# +[ "transaction.help", "function transaction.help():void;" ] +[ "transaction.help", " io.print(\"added function to specific module\");" ] +[ "transaction.help", " := inspect.getDefinition(\"transaction\",\"help\");" ] +[ "transaction.help", " io.print(b);" ] +[ "transaction.help", "end help;" ] # 07:58:39 > # 07:58:39 > Done. diff -r 0198bac5a7ce -r 42d0637cfc71 MonetDB5/src/mal/Tests/tst058.stable.err --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MonetDB5/src/mal/Tests/tst058.stable.err Fri Nov 26 20:59:12 2010 +0100 @@ -0,0 +1,73 @@ +stderr of test 'tst058` in directory 'src/mal` itself: + + +# 20:18:21 > +# 20:18:21 > mserver5 "--config=/ufs/mk/Oct2010//Linux/etc/monetdb5.conf" --debug=10 --set gdk_nr_threads=0 --set "monet_mod_path=/ufs/mk/Oct2010//Linux/lib/MonetDB5:/ufs/mk/Oct2010//Linux/lib/MonetDB5/lib:/ufs/mk/Oct2010//Linux/lib/MonetDB5/bin" --set "gdk_dbfarm=/ufs/mk/Oct2010//Linux/var/MonetDB5/dbfarm" --set mapi_open=true --set xrpc_open=true --set mapi_port=38265 --set xrpc_port=41340 --set monet_prompt= --trace --forcemito --set mal_listing=2 --dbname=mTests_src_mal tst058.mal +# 20:18:21 > + +# builtin opt gdk_arch = 64bitx86_64-unknown-linux-gnu +# builtin opt gdk_version = 1.40.2 +# builtin opt prefix = /ufs/mk/Oct2010//Linux +# builtin opt exec_prefix = ${prefix} +# builtin opt gdk_dbname = demo +# builtin opt gdk_dbfarm = ${prefix}/var/MonetDB/dbfarm +# builtin opt gdk_debug = 0 +# builtin opt gdk_alloc_map = no +# builtin opt gdk_vmtrim = yes +# builtin opt monet_admin = adm +# builtin opt monet_prompt = > +# builtin opt monet_welcome = yes +# builtin opt monet_mod_path = ${exec_prefix}/lib/MonetDB +# builtin opt monet_daemon = no +# builtin opt host = localhost +# builtin opt mapi_port = 50000 +# builtin opt mapi_clients = 2 +# builtin opt mapi_open = false +# builtin opt mapi_autosense = false +# builtin opt default_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mitosis,mergetable,deadcode,commonTerms,joinPath,reorder,deadcode,reduce,dataflow,history,multiplex,garbageCollector +# builtin opt minimal_pipe = inline,remap,deadcode,multiplex,garbageCollector +# builtin opt sql_optimizer = default_pipe +# builtin opt sql_debug = 0 +# builtin opt standoff_ns = +# builtin opt standoff_start = start +# builtin opt standoff_end = end +# config opt prefix = /ufs/mk/Oct2010//Linux +# config opt config = ${prefix}/etc/monetdb5.conf +# config opt prefix = /ufs/mk/Oct2010//Linux +# config opt exec_prefix = ${prefix} +# config opt gdk_dbfarm = ${prefix}/var/MonetDB5/dbfarm +# config opt monet_mod_path = ${exec_prefix}/lib/MonetDB5:${exec_prefix}/lib/MonetDB5/lib:${exec_prefix}/lib/MonetDB5/bin +# config opt mero_pidfile = ${prefix}/var/run/MonetDB/merovingian.pid +# config opt mero_controlport = 50001 +# config opt no_mitosis_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,commonTerms,joinPath,reorder,deadcode,reduce,dataflow,history,multiplex,garbageCollector +# config opt sequential_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,commonTerms,joinPath,reorder,deadcode,reduce,history,multiplex,garbageCollector +# config opt nov2009_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,history,multiplex,garbageCollector +# config opt replication_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,history,replication,multiplex,garbageCollector +# config opt accumulator_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,accumulators,dataflow,history,multiplex,garbageCollector +# config opt recycler_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,deadcode,constants,commonTerms,joinPath,deadcode,recycle,reduce,dataflow,history,multiplex,garbageCollector +# config opt cracker_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,selcrack,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,history,multiplex,garbageCollector +# config opt sidcrack_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,sidcrack,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,history,multiplex,garbageCollector +# config opt datacell_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,deadcode,constants,commonTerms,joinPath,datacell,deadcode,reduce,dataflow,history,multiplex,garbageCollector +# config opt octopus_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mitosis,mergetable,deadcode,constants,commonTerms,joinPath,octopus,deadcode,reduce,dataflow,history,multiplex,garbageCollector +# config opt datacyclotron_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,datacyclotron,mergetable,deadcode,commonTerms,joinPath,reorder,deadcode,reduce,dataflow,history,replication,multiplex,garbageCollector +# config opt derive_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mitosis,mergetable,deadcode,commonTerms,derivePath,joinPath,reorder,deadcode,reduce,dataflow,history,multiplex,garbageCollector +# config opt dictionary_pipe = inline,remap,dictionary,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,history,multiplex,garbageCollector +# config opt compression_pipe = inline,remap,evaluate,costModel,coercions,emptySet,aliases,mergetable,deadcode,constants,commonTerms,joinPath,deadcode,reduce,dataflow,compression,dataflow,history,multiplex,garbageCollector +# cmdline opt config = /ufs/mk/Oct2010//Linux/etc/monetdb5.conf +# cmdline opt gdk_nr_threads = 0 +# cmdline opt monet_mod_path = /ufs/mk/Oct2010//Linux/lib/MonetDB5:/ufs/mk/Oct2010//Linux/lib/MonetDB5/lib:/ufs/mk/Oct2010//Linux/lib/MonetDB5/bin +# cmdline opt gdk_dbfarm = /ufs/mk/Oct2010//Linux/var/MonetDB5/dbfarm +# cmdline opt mapi_open = true +# cmdline opt xrpc_open = true +# cmdline opt mapi_port = 38265 +# cmdline opt xrpc_port = 41340 +# cmdline opt monet_prompt = +# cmdline opt mal_listing = 2 +# cmdline opt gdk_dbname = mTests_src_mal +#warning: please don't forget to set your vault key! +#(see /ufs/mk/Oct2010//Linux/etc/monetdb5.conf) + +# 20:18:21 > +# 20:18:21 > Done. +# 20:18:21 > + diff -r 0198bac5a7ce -r 42d0637cfc71 MonetDB5/src/mal/Tests/tst058.stable.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MonetDB5/src/mal/Tests/tst058.stable.out Fri Nov 26 20:59:12 2010 +0100 @@ -0,0 +1,34 @@ +stdout of test 'tst058` in directory 'src/mal` itself: + + +# 20:18:21 > +# 20:18:21 > mserver5 "--config=/ufs/mk/Oct2010//Linux/etc/monetdb5.conf" --debug=10 --set gdk_nr_threads=0 --set "monet_mod_path=/ufs/mk/Oct2010//Linux/lib/MonetDB5:/ufs/mk/Oct2010//Linux/lib/MonetDB5/lib:/ufs/mk/Oct2010//Linux/lib/MonetDB5/bin" --set "gdk_dbfarm=/ufs/mk/Oct2010//Linux/var/MonetDB5/dbfarm" --set mapi_open=true --set xrpc_open=true --set mapi_port=38265 --set xrpc_port=41340 --set monet_prompt= --trace --forcemito --set mal_listing=2 --dbname=mTests_src_mal tst058.mal +# 20:18:21 > + +# MonetDB server v5.22.2, based on kernel v1.40.2 +# Not released +# Serving database 'mTests_src_mal', using 4 threads +# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically linked +# Found 7.750 GiB available main-memory. +# Copyright (c) 1993-July 2008 CWI. +# Copyright (c) August 2008-2010 MonetDB B.V., all rights reserved +# Visit http://monetdb.cwi.nl/ for further information +# Listening for connection requests on mapi:monetdb://eir.ins.cwi.nl:38265/ +# MonetDB/SQL module v2.40.2 loaded +# MonetDB/GIS module v0.20.2 loaded +!SyntaxException:parseError:-- some typos +!SyntaxException:parseError:^<identifier> expected +!SyntaxException:parseError:i:= 1 + 1 + 1; +!SyntaxException:parseError: ^';' expected +!SyntaxException:parseError:j:= 1 + + 1; +!SyntaxException:parseError: ^<term> expected +function user.main():void; + ; + i := calc.+(1,1); + j := calc.+(1); +end main; + +# 20:18:21 > +# 20:18:21 > Done. +# 20:18:21 > + diff -r 0198bac5a7ce -r 42d0637cfc71 MonetDB5/src/mal/mal_parser.mx --- a/MonetDB5/src/mal/mal_parser.mx Mon Nov 15 22:34:39 2010 +0100 +++ b/MonetDB5/src/mal/mal_parser.mx Fri Nov 26 20:59:12 2010 +0100 @@ -401,10 +401,6 @@ return (long) (CURRENT(cntxt) - s); } -#if HAVE_STRTOLL && !HAVE_DECL_STRTOLL -extern long long strtoll(const char *, char **, int); -#endif - @- Upon encountering an error we skip to the nearest semicolon, or comment terminated by a new line @@ -866,6 +862,7 @@ malAtomDefinition( modnme, tpe); cntxt->nspace = fixModule(cntxt->nspace, modnme); cntxt->nspace->isAtomModule = TRUE; + skipSpace(cntxt); @:helpInfo(cntxt->nspace->help) @ return ""; } @@ -920,6 +917,7 @@ return parseError(cntxt, "<derived module> not yet implemented\n"); } } + skipSpace(cntxt); @:helpInfo(cntxt->nspace->help)@ return ""; } @@ -970,8 +968,10 @@ skipToEnd(cntxt); s = loadLibrary(modnme,FALSE); - if (s) + if (s) { mnstr_printf(cntxt->fdout, "#WARNING: %s\n", s); + GDKfree(s); + } if ( (s = malInclude(cntxt, modnme, 0)) ){ mnstr_printf(cntxt->fdout, "#WARNING: %s\n", s); GDKfree(s); @@ -1262,6 +1262,7 @@ @= helpInfo if( MALkeyword(cntxt,"comment",7)){ + skipSpace(cntxt); if( (l= stringLength(cntxt))){ @1 = strCopy(cntxt,l); if (@1 ) @@ -1332,6 +1333,7 @@ curBlk->binding = nme; if( cntxt->nspace->isAtomModule) malAtomProperty(curBlk, curInstr); + skipSpace(cntxt); } else { return (MalBlkPtr) parseError(cntxt,"'address' expected\n"); } @@ -1401,7 +1403,6 @@ /* parse fcn */ if( (l== (int)strlen(curPrg->name) && strncmp(CURRENT(cntxt), curPrg->name, l)==0) || l==0) { - /* its ok */ } else { parseError(cntxt,"non matching end label, overruled\n"); } @@ -1746,10 +1747,17 @@ if( currChar(cntxt) == '(') parseError(cntxt,"module name missing\n"); else - if( currChar(cntxt) != ';' && currChar(cntxt) != '#') + if( currChar(cntxt) != ';' && currChar(cntxt) != '#'){ parseError(cntxt,"operator expected\n"); + skipToEnd(cntxt); + } + pushInstruction(curBlk,curInstr); + return; } part3: + skipSpace(cntxt); + if ( currChar(cntxt) != ';') + parseError(cntxt,"';' expected\n"); skipToEnd(cntxt); pushInstruction(curBlk,curInstr); if (cntrl== RETURNsymbol && !(curInstr->token == ASSIGNsymbol || getModuleId(curInstr)!= 0)) _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list