|
From: <ma...@us...> - 2010-12-13 16:34:58
|
Revision: 1013
http://scstudio.svn.sourceforge.net/scstudio/?rev=1013&view=rev
Author: madzin
Date: 2010-12-13 16:34:52 +0000 (Mon, 13 Dec 2010)
Log Message:
-----------
Modify lexer error output message.
Modified Paths:
--------------
trunk/src/data/Z120/display_error.cpp
trunk/tests/z120_test/z120_test93.mpr.result
Modified: trunk/src/data/Z120/display_error.cpp
===================================================================
--- trunk/src/data/Z120/display_error.cpp 2010-12-12 11:05:38 UTC (rev 1012)
+++ trunk/src/data/Z120/display_error.cpp 2010-12-13 16:34:52 UTC (rev 1013)
@@ -236,24 +236,36 @@
Z120* printer = static_cast<Z120*> (z);
stringize report;
- pANTLR3_LEXER lexer;
- pANTLR3_EXCEPTION ex;
- pANTLR3_STRING ftext;
+ // Retrieve some info for easy reading.
+ pANTLR3_LEXER lexer = (pANTLR3_LEXER)(recognizer->super);
+ pANTLR3_EXCEPTION ex = lexer->rec->state->exception;
- lexer = (pANTLR3_LEXER)(recognizer->super);
- ex = lexer->rec->state->exception;
-
// See if there is a 'filename' we can use
if(ex->name == NULL)
- report << "-unknown source-[";
+ report << "-unknown source-";
else
{
- ftext = ex->streamName->to8(ex->streamName);
- report << (char*) ftext->chars << "[";
+ pANTLR3_STRING ftext = ex->streamName->to8(ex->streamName);
+
+ char* last_slash = (char *)ftext->chars;
+ bool slash_present = false;
+ // strip file path
+ for(char *ch = (char *)ftext->chars; *ch != 0; ch++)
+ {
+ if(*ch == '\\' || *ch == '/')
+ {
+ last_slash = ch;
+ slash_present = true;
+ }
+ }
+
+ if(slash_present)
+ report << last_slash+1;
+ else
+ report << last_slash;
}
+ report << "[" << recognizer->state->exception->line << "," << ex->charPositionInLine+1 << "] Lexer error.";
- report << recognizer->state->exception->line << "," << ex->charPositionInLine+1 << "]: Lexer error";
-
printer->print_report(RS_ERROR, report);
}
Modified: trunk/tests/z120_test/z120_test93.mpr.result
===================================================================
--- trunk/tests/z120_test/z120_test93.mpr.result 2010-12-12 11:05:38 UTC (rev 1012)
+++ trunk/tests/z120_test/z120_test93.mpr.result 2010-12-13 16:34:52 UTC (rev 1013)
@@ -1,4 +1,4 @@
-z120_test93.mpr[20,4]: Lexer error
+z120_test93.mpr[20,4] Lexer error.
z120_test93.mpr[20,0] Cannot match to any predicted input.
Warning 16: Multiple instances with the same name: b
Warning 20: MSC (Page_1) has unterminated 2 instance
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|