summaryrefslogtreecommitdiff
path: root/idlc
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedricbosdo@openoffice.org>2010-11-07 19:10:44 +0100
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2010-11-09 09:43:27 +0100
commit35947e863677ebc86415d62073a74845a4970880 (patch)
tree3e51b609b173abab44b6cb167184468182e22a5f /idlc
parent8c9864307001ac831ba51375c893937637bd942f (diff)
Fixed i#81780 for good, even on Macos X
Diffstat (limited to 'idlc')
-rw-r--r--idlc/inc/idlc/idlc.hxx8
-rw-r--r--idlc/source/errorhandler.cxx15
-rw-r--r--idlc/source/idlc.cxx2
-rw-r--r--idlc/source/parser.y4
-rw-r--r--idlc/source/scanner.ll22
5 files changed, 40 insertions, 11 deletions
diff --git a/idlc/inc/idlc/idlc.hxx b/idlc/inc/idlc/idlc.hxx
index 61b56729a..a42362457 100644
--- a/idlc/inc/idlc/idlc.hxx
+++ b/idlc/inc/idlc/idlc.hxx
@@ -103,6 +103,12 @@ public:
{ m_warningCount++; }
sal_uInt32 getLineNumber()
{ return m_lineNumber; }
+ sal_uInt32 getOffsetStart()
+ { return m_offsetStart; }
+ sal_uInt32 getOffsetEnd()
+ { return m_offsetEnd; }
+ void setOffset( sal_uInt32 start, sal_uInt32 end)
+ { m_offsetStart = start; m_offsetEnd = end; }
void setLineNumber(sal_uInt32 lineNumber)
{ m_lineNumber = lineNumber; }
void incLineNumber()
@@ -137,6 +143,8 @@ private:
sal_uInt32 m_errorCount;
sal_uInt32 m_warningCount;
sal_uInt32 m_lineNumber;
+ sal_uInt32 m_offsetStart;
+ sal_uInt32 m_offsetEnd;
ParseState m_parseState;
StringSet m_includes;
};
diff --git a/idlc/source/errorhandler.cxx b/idlc/source/errorhandler.cxx
index 319ef4bb6..6875d6b78 100644
--- a/idlc/source/errorhandler.cxx
+++ b/idlc/source/errorhandler.cxx
@@ -489,7 +489,7 @@ static OString flagToString(sal_uInt32 flag)
return flagStr;
}
-static void errorHeader(ErrorCode eCode, sal_Int32 lineNumber)
+static void errorHeader(ErrorCode eCode, sal_Int32 lineNumber, sal_uInt32 start, sal_uInt32 end)
{
OString file;
if ( idlc()->getFileName() == idlc()->getRealFileName() )
@@ -497,14 +497,23 @@ static void errorHeader(ErrorCode eCode, sal_Int32 lineNumber)
else
file = idlc()->getFileName();
- fprintf(stderr, "%s(%lu) : %s", file.getStr(),
+ fprintf(stderr, "%s:%lu [%lu:%lu] : %s", file.getStr(),
sal::static_int_cast< unsigned long >(lineNumber),
+ sal::static_int_cast< unsigned long >(start),
+ sal::static_int_cast< unsigned long >(end),
errorCodeToMessage(eCode));
}
+
+static void errorHeader(ErrorCode eCode, sal_uInt32 lineNumber)
+{
+ errorHeader(eCode, lineNumber,
+ idlc()->getOffsetStart(), idlc()->getOffsetEnd());
+}
static void errorHeader(ErrorCode eCode)
{
- errorHeader(eCode, idlc()->getLineNumber());
+ errorHeader(eCode, idlc()->getLineNumber(),
+ idlc()->getOffsetStart(), idlc()->getOffsetEnd());
}
static void warningHeader(WarningCode wCode)
diff --git a/idlc/source/idlc.cxx b/idlc/source/idlc.cxx
index c63772827..7fcc8e8ab 100644
--- a/idlc/source/idlc.cxx
+++ b/idlc/source/idlc.cxx
@@ -220,6 +220,8 @@ Idlc::Idlc(Options* pOptions)
, m_errorCount(0)
, m_warningCount(0)
, m_lineNumber(0)
+ , m_offsetStart(0)
+ , m_offsetEnd(0)
, m_parseState(PS_NoState)
{
m_pScopes = new AstStack();
diff --git a/idlc/source/parser.y b/idlc/source/parser.y
index 8da9c7ad6..6de66aee9 100644
--- a/idlc/source/parser.y
+++ b/idlc/source/parser.y
@@ -103,8 +103,8 @@
#include <algorithm>
#include <vector>
-
-using namespace ::rtl;
+
+using namespace rtl;
#define YYDEBUG 1
#define YYERROR_VERBOSE 1
diff --git a/idlc/source/scanner.ll b/idlc/source/scanner.ll
index bbcc08fae..2206297a0 100644
--- a/idlc/source/scanner.ll
+++ b/idlc/source/scanner.ll
@@ -48,12 +48,19 @@
#include "attributeexceptions.hxx"
+
class AstExpression;
class AstArray;
class AstMember;
#include <parser.hxx>
+/* handle locations */
+int yycolumn = 1;
+
+#define YY_USER_ACTION idlc()->setOffset(yycolumn, yycolumn+yyleng-1); \
+ yycolumn += yyleng;
+
sal_Int32 beginLine = 0;
::rtl::OString docu;
@@ -227,6 +234,7 @@ static void parseLineAndFile(sal_Char* pBuf)
for (; *r != '\0' && *r != ' ' && *r != '\t'; r++) ;
*r++ = 0;
idlc()->setLineNumber((sal_uInt32)atol(h));
+ yylineno = atol(h);
/* Find file name, if present */
for (; *r != '"'; r++)
@@ -283,8 +291,10 @@ IDENTIFIER ("_"?({ALPHA}|{DIGIT})+)*
%%
[ \t\r]+ ; /* eat up whitespace */
-[\n] {
- idlc()->incLineNumber();
+[\n] {
+ idlc()->incLineNumber();
+ yycolumn = 1;
+ yylineno++;
}
attribute return IDL_ATTRIBUTE;
@@ -349,21 +359,21 @@ published return IDL_PUBLISHED;
"..." return IDL_ELLIPSIS;
("-")?{INT_LITERAL}+(l|L|u|U)? {
- return asciiToInteger(yytext, &yylval.ival, &yylval.uval);
+ return asciiToInteger(yytext, &yylval.ival, &yylval.uval);
}
("-")?{OCT_LITERAL}+(l|L|u|U)? {
- return asciiToInteger(yytext, &yylval.ival, &yylval.uval);
+ return asciiToInteger(yytext, &yylval.ival, &yylval.uval);
}
("-")?{HEX_LITERAL}+(l|L|u|U)? {
- return asciiToInteger(yytext, &yylval.ival, &yylval.uval);
+ return asciiToInteger(yytext, &yylval.ival, &yylval.uval);
}
("-")?{DIGIT}+(e|E){1}(("+"|"-")?{DIGIT}+)+(f|F)? |
("-")?"."{DIGIT}+((e|E)("+"|"-")?{DIGIT}+)?(f|F)? |
("-")?{DIGIT}*"."{DIGIT}+((e|E)("+"|"-")?{DIGIT}+)?(f|F)? {
- yylval.dval = asciiToFloat( yytext );
+ yylval.dval = asciiToFloat( yytext );
return IDL_FLOATING_PT_LITERAL;
}