GLSL: Limit recovery attempts

"switch(" was recovered with number, ), ), ), ...

Task-number: QTCREATORBUG-18967
Change-Id: I12ccea0925fb2956de7405d9c8afea5dddeaf4f9
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-01-08 11:50:00 +01:00
parent e8f0c99f12
commit f15646622a
4 changed files with 1796 additions and 1790 deletions

View File

@@ -569,6 +569,8 @@ AST *Parser::parse(int startToken)
action = nt_action(_stateStack[_tos], lhs[ruleno] - TERMINAL_COUNT);
} else if (action == 0) {
++recoveryAttempts;
if (recoveryAttempts > 10)
break;
const int line = _tokens[yyloc].line + 1;
QString message = QLatin1String("Syntax error");
if (yytoken != -1) {

File diff suppressed because it is too large Load Diff

View File

@@ -1,26 +1,31 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
** 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 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
@@ -49,8 +54,7 @@ const char *const GLSLParserTable::spell [] = {
"-=", "switch", "~", "type_name", "uint", "uniform", "usampler1D", "usampler1DArray", "usampler2D", "usampler2DArray",
"usampler2DMS", "usampler2DMSarray", "usampler2DRect", "usampler3D", "usamplerBuffer", "usamplerCube", "usamplerCubeArray", "uvec2", "uvec3", "uvec4",
"varying", "vec2", "vec3", "vec4", "|", "void", "while", "^=", "^^", "true",
"false", "preprocessor directive", "comment", "error", "reserved word"
};
"false", "preprocessor directive", "comment", "error", "reserved word"};
const short GLSLParserTable::lhs [] = {
176, 177, 177, 177, 177, 177, 179, 179, 179, 179,
@@ -84,8 +88,7 @@ const short GLSLParserTable::lhs [] = {
240, 241, 249, 249, 250, 250, 242, 251, 251, 243,
243, 244, 244, 244, 252, 252, 254, 254, 253, 253,
245, 245, 245, 245, 245, 255, 256, 256, 257, 257,
257, 258, 222, 175, 175, 259
};
257, 258, 222, 175, 175, 259};
const short GLSLParserTable::rhs [] = {
1, 1, 1, 1, 1, 3, 1, 4, 1, 3,
@@ -119,8 +122,7 @@ const short GLSLParserTable::rhs [] = {
2, 5, 3, 1, 1, 4, 7, 1, 1, 3,
2, 5, 7, 6, 1, 1, 1, 1, 2, 3,
2, 2, 2, 3, 2, 1, 1, 2, 1, 1,
1, 2, 0, 2, 2, 2
};
1, 2, 0, 2, 2, 2};
const short GLSLParserTable::action_default [] = {
0, 0, 0, 0, 32, 165, 172, 173, 174, 31,
@@ -169,8 +171,7 @@ const short GLSLParserTable::action_default [] = {
0, 0, 292, 281, 277, 0, 83, 108, 0, 0,
113, 109, 0, 0, 111, 110, 0, 112, 0, 89,
0, 0, 0, 0, 85, 0, 86, 0, 0, 87,
0, 88, 316
};
0, 88, 316};
const short GLSLParserTable::goto_default [] = {
3, 135, 126, 362, 124, 263, 112, 117, 113, 116,
@@ -181,8 +182,7 @@ const short GLSLParserTable::goto_default [] = {
160, 159, 161, 173, 172, 162, 132, 129, 163, 203,
192, 361, 369, 359, 368, 363, 367, 371, 358, 365,
366, 370, 402, 400, 410, 390, 427, 388, 394, 391,
298, 289, 288, 292, 0
};
298, 289, 288, 292, 0};
const short GLSLParserTable::action_index [] = {
86, 1180, 3189, 58, -175, -175, -175, -175, -175, -175,
@@ -279,8 +279,7 @@ const short GLSLParserTable::action_index [] = {
-85, 100, -85, -85, -85, -85, -85, -85, 36, 138,
-85, -85, -85, 31, -85, -85, 28, -85, -85, -85,
97, 105, -85, -85, -85, 98, -85, -85, -85, -85,
-85, -85, -85
};
-85, -85, -85};
const short GLSLParserTable::action_info [] = {
-25, 332, 446, 246, 339, 306, 450, 319, 428, 251,
@@ -785,8 +784,7 @@ const short GLSLParserTable::action_info [] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 430, 0,
0, 0, 0, 0, 0, 0, 0, 0
};
0, 0, 0, 0, 0, 0, 0, 0};
const short GLSLParserTable::action_check [] = {
79, 77, 45, 6, 18, 52, 76, 114, 111, 168,
@@ -1291,7 +1289,6 @@ const short GLSLParserTable::action_check [] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 75, -1,
-1, -1, -1, -1, -1, -1, -1, -1
};
-1, -1, -1, -1, -1, -1, -1, -1};
QT_END_NAMESPACE

View File

@@ -1,26 +1,31 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
** 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 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
@@ -236,14 +241,14 @@ public:
GOTO_CHECK_OFFSET = 4708
};
static const char *const spell[];
static const short lhs[];
static const short rhs[];
static const short goto_default[];
static const short action_default[];
static const short action_index[];
static const short action_info[];
static const short action_check[];
static const char *const spell [];
static const short lhs [];
static const short rhs [];
static const short goto_default [];
static const short action_default [];
static const short action_index [];
static const short action_info [];
static const short action_check [];
static inline int nt_action (int state, int nt)
{