diff options
Diffstat (limited to 'src/tools/qlalr/cppgenerator.cpp')
-rw-r--r-- | src/tools/qlalr/cppgenerator.cpp | 71 |
1 files changed, 36 insertions, 35 deletions
diff --git a/src/tools/qlalr/cppgenerator.cpp b/src/tools/qlalr/cppgenerator.cpp index 8c292e5106..efceb8c520 100644 --- a/src/tools/qlalr/cppgenerator.cpp +++ b/src/tools/qlalr/cppgenerator.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QLALR module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** 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 http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** 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. +** 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. ** ** $QT_END_LICENSE$ ** @@ -48,31 +43,37 @@ QString CppGenerator::copyrightHeader() const "/****************************************************************************\n" "**\n" "** Copyright (C) 2016 The Qt Company Ltd.\n" - "** Contact: http://www.qt.io/licensing/\n" + "** Contact: https://www.qt.io/licensing/\n" "**\n" "** This file is part of the Qt Toolkit.\n" "**\n" - "** $QT_BEGIN_LICENSE:LGPL21$\n" + "** $QT_BEGIN_LICENSE:LGPL$\n" "** Commercial License Usage\n" "** Licensees holding valid commercial Qt licenses may use this file in\n" "** accordance with the commercial license agreement provided with the\n" "** Software or, alternatively, in accordance with the terms contained in\n" "** a written agreement between you and The Qt Company. For licensing terms\n" - "** and conditions see http://www.qt.io/terms-conditions. For further\n" - "** information use the contact form at http://www.qt.io/contact-us.\n" + "** and conditions see https://www.qt.io/terms-conditions. For further\n" + "** information use the contact form at https://www.qt.io/contact-us.\n" "**\n" "** GNU Lesser General Public License Usage\n" "** Alternatively, this file may be used under the terms of the GNU Lesser\n" - "** General Public License version 2.1 or version 3 as published by the Free\n" - "** Software Foundation and appearing in the file LICENSE.LGPLv21 and\n" - "** LICENSE.LGPLv3 included in the packaging of this file. Please review the\n" - "** following information to ensure the GNU Lesser General Public License\n" - "** requirements will be met: https://www.gnu.org/licenses/lgpl.html and\n" - "** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.\n" + "** General Public License version 3 as published by the Free Software\n" + "** Foundation and appearing in the file LICENSE.LGPL3 included in the\n" + "** packaging of this file. Please review the following information to\n" + "** ensure the GNU Lesser General Public License version 3 requirements\n" + "** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.\n" "**\n" - "** As a special exception, The Qt Company gives you certain additional\n" - "** rights. These rights are described in The Qt Company LGPL Exception\n" - "** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.\n" + "** GNU General Public License Usage\n" + "** Alternatively, this file may be used under the terms of the GNU\n" + "** General Public License version 2.0 or (at your option) the GNU General\n" + "** Public license version 3 or any later version approved by the KDE Free\n" + "** Qt Foundation. The licenses are as published by the Free Software\n" + "** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3\n" + "** included in the packaging of this file. Please review the following\n" + "** information to ensure the GNU General Public License requirements will\n" + "** be met: https://www.gnu.org/licenses/gpl-2.0.html and\n" + "** https://www.gnu.org/licenses/gpl-3.0.html.\n" "**\n" "** $QT_END_LICENSE$\n" "**\n" @@ -158,12 +159,12 @@ void CppGenerator::operator () () int r = aut.id (item->rule); - NameSet lookaheads = aut.lookaheads.value (item); + const NameSet lookaheads = aut.lookaheads.value (item); if (item->rule == grammar.goal) accept_state = q; - foreach (const Name &s, lookaheads) + for (const Name &s : lookaheads) { int &u = ACTION (q, aut.id (s)); @@ -447,7 +448,7 @@ void CppGenerator::generateDecl (QTextStream &out) << "public:" << endl << " enum VariousConstants {" << endl; - foreach (Name t, grammar.terminals) + for (Name t : qAsConst(grammar.terminals)) { QString name = *t; int value = std::distance (grammar.names.begin (), t); @@ -605,7 +606,7 @@ void CppGenerator::generateImpl (QTextStream &out) out << endl << "#ifndef " << prot << endl; out << "const int " << grammar.table_name << "::rule_info [] = {"; idx = 0; - for (RulePointer rule = grammar.rules.begin (); rule != grammar.rules.end (); ++rule, ++idx) + for (auto rule = grammar.rules.cbegin (); rule != grammar.rules.cend (); ++rule, ++idx) { out << endl << " "; @@ -616,7 +617,7 @@ void CppGenerator::generateImpl (QTextStream &out) out << name_ids.value(rule->lhs); - foreach (const Name &n, rule->rhs) + for (const Name &n : rule->rhs) out << ", " << name_ids.value (n); } out << "};" << endl << endl; |