diff --git a/src/plugins/qtscripteditor/parser/javascript.g b/src/plugins/qtscripteditor/parser/javascript.g
index 80dfaddcad47229393aa98547e152568b8a3897f..33657f8a1a90083d4e9772c52eae0228f445c268 100644
--- a/src/plugins/qtscripteditor/parser/javascript.g
+++ b/src/plugins/qtscripteditor/parser/javascript.g
@@ -316,7 +316,7 @@ protected:
     { return sym_stack [tos + index - 1]; }
 
     inline Location &loc(int index)
-    { return location_stack [tos + index - 2]; }
+    { return location_stack [tos + index - 1]; }
 
 protected:
     int tos;
@@ -336,6 +336,7 @@ protected:
 
     double yylval;
     Location yylloc;
+    Location yyprevlloc;
 
     SavedToken token_buffer[TOKEN_BUFFER_SIZE];
     SavedToken *first_token;
@@ -427,6 +428,8 @@ bool JavaScriptParser::parse(JavaScriptEnginePrivate *driver)
 
     _Lcheck_token:
         if (yytoken == -1 && -TERMINAL_COUNT != action_index[action]) {
+		yyprevlloc = yylloc;
+
             if (first_token == last_token) {
                 yytoken = lexer->lex();
                 yylval = lexer->dval();
@@ -2092,7 +2095,7 @@ PropertyNameAndValueListOpt: PropertyNameAndValueList ;
             const QString msg = QString::fromUtf8("Missing `;'");
 
             diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning,
-                yylloc.startLine, yylloc.startColumn, msg));
+                yyprevlloc.startLine, yyprevlloc.startColumn, msg));
 
             first_token = &token_buffer[0];
             last_token = &token_buffer[1];
diff --git a/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp b/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp
index d5b7765ebc523136361bd34ca65f86fbc23309ac..abe49bf93ec6d014a266a9e3cfa26f96c5fd9d71 100644
--- a/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp
+++ b/src/plugins/qtscripteditor/parser/javascriptgrammar.cpp
@@ -2,41 +2,13 @@
 /****************************************************************************
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
 **
-** This file is part of the QtCore module of the Qt Toolkit.
+** This file is part of the $MODULE$ of the Qt Toolkit.
 **
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** $TROLLTECH_DUAL_LICENSE$
 **
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 **
 ****************************************************************************/
 
diff --git a/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h b/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h
index 3b51d8e42426a7fffbba5a555c27e4723100df26..8e62d4abd06a7371467d1d8b3556509efc0be556 100644
--- a/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h
+++ b/src/plugins/qtscripteditor/parser/javascriptgrammar_p.h
@@ -2,41 +2,13 @@
 /****************************************************************************
 **
 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: Qt Software Information (qt-info@nokia.com)
 **
-** This file is part of the QtCore module of the Qt Toolkit.
+** This file is part of the $MODULE$ of the Qt Toolkit.
 **
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the either Technology Preview License Agreement or the
-** Beta Release License Agreement.
+** $TROLLTECH_DUAL_LICENSE$
 **
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain
-** additional rights. These rights are described in the Nokia Qt LGPL
-** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
-** package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
-** $QT_END_LICENSE$
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 **
 ****************************************************************************/
 
diff --git a/src/plugins/qtscripteditor/parser/javascriptparser.cpp b/src/plugins/qtscripteditor/parser/javascriptparser.cpp
index ac8eabf09548eed7b35f30958996d69b6c0bf8cc..4026a970ce19216b11cea979e0e46ad8bc039ca7 100644
--- a/src/plugins/qtscripteditor/parser/javascriptparser.cpp
+++ b/src/plugins/qtscripteditor/parser/javascriptparser.cpp
@@ -132,6 +132,8 @@ bool JavaScriptParser::parse(JavaScriptEnginePrivate *driver)
 
     _Lcheck_token:
         if (yytoken == -1 && -TERMINAL_COUNT != action_index[action]) {
+		yyprevlloc = yylloc;
+
             if (first_token == last_token) {
                 yytoken = lexer->lex();
                 yylval = lexer->dval();
@@ -1097,7 +1099,7 @@ case 266: {
             const QString msg = QString::fromUtf8("Missing `;'");
 
             diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning,
-                yylloc.startLine, yylloc.startColumn, msg));
+                yyprevlloc.startLine, yyprevlloc.startColumn, msg));
 
             first_token = &token_buffer[0];
             last_token = &token_buffer[1];
diff --git a/src/plugins/qtscripteditor/parser/javascriptparser_p.h b/src/plugins/qtscripteditor/parser/javascriptparser_p.h
index d3b4e70208fe69a4309eca07a3998ad59732e6e3..f3b16f54066bbcf4714d04da566916c5396873e0 100644
--- a/src/plugins/qtscripteditor/parser/javascriptparser_p.h
+++ b/src/plugins/qtscripteditor/parser/javascriptparser_p.h
@@ -167,7 +167,7 @@ protected:
     { return sym_stack [tos + index - 1]; }
 
     inline Location &loc(int index)
-    { return location_stack [tos + index - 2]; }
+    { return location_stack [tos + index - 1]; }
 
 protected:
     int tos;
@@ -187,6 +187,7 @@ protected:
 
     double yylval;
     Location yylloc;
+    Location yyprevlloc;
 
     SavedToken token_buffer[TOKEN_BUFFER_SIZE];
     SavedToken *first_token;