[pure-lang-svn] SF.net SVN: pure-lang:[731] pure/trunk
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-09-06 18:04:27
|
Revision: 731 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=731&view=rev Author: agraef Date: 2008-09-06 18:04:33 +0000 (Sat, 06 Sep 2008) Log Message: ----------- Handle external objects in input more gracefully. Modified Paths: -------------- pure/trunk/interpreter.cc pure/trunk/lexer.ll pure/trunk/parser.yy Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-09-06 17:32:03 UTC (rev 730) +++ pure/trunk/interpreter.cc 2008-09-06 18:04:33 UTC (rev 731) @@ -346,14 +346,17 @@ void interpreter::error(const yy::location& l, const string& m) { + string m1 = m; + if (m.find("bad token")) + m1 = "bad anonymous function or pointer value"; nerrs++; if (source_s) { ostringstream msg; - msg << l << ": " << m << endl; + msg << l << ": " << m1 << endl; errmsg += msg.str(); } else { cout.flush(); - cerr << l << ": " << m << endl; + cerr << l << ": " << m1 << endl; } } Modified: pure/trunk/lexer.ll =================================================================== --- pure/trunk/lexer.ll 2008-09-06 17:32:03 UTC (rev 730) +++ pure/trunk/lexer.ll 2008-09-06 18:04:33 UTC (rev 731) @@ -1214,6 +1214,7 @@ } [@=|;()\[\]\\] return yy::parser::token_type(yytext[0]); "->" return token::MAPSTO; +"#<"{id}(" "{int})?">" return token::BADTOK; ([[:punct:]]|[\200-\377])+ { if (yytext[0] == '/' && yytext[1] == '*') REJECT; // comment starter while (yyleng > 1 && yytext[yyleng-1] == ';') yyless(yyleng-1); Modified: pure/trunk/parser.yy =================================================================== --- pure/trunk/parser.yy 2008-09-06 17:32:03 UTC (rev 730) +++ pure/trunk/parser.yy 2008-09-06 18:04:33 UTC (rev 731) @@ -222,6 +222,7 @@ %token EOFTOK 0 "end of file" %token ERRTOK "invalid character" +%token BADTOK "bad token" %token MAPSTO "->" %token <sval> ID "identifier" %token <csval> STR "string" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |