qlalr: Fix and re-run qlalr on its own sources

So the generated files are up-to-date again.

Generated with:
  qlalr --qt --no-lines --no-debug lalr.g

Change-Id: I3c4adb0083be7e66fed3db92c079493b574295aa
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Kevin Funk 2017-02-28 17:21:56 +01:00
parent 8b9d246225
commit 375bbcdd01
5 changed files with 218 additions and 279 deletions

View File

@ -36,6 +36,29 @@
#include <QtCore/qfile.h> #include <QtCore/qfile.h>
#include <QtCore/qmap.h> #include <QtCore/qmap.h>
namespace {
void generateSeparator(int i, QTextStream &out)
{
if (!(i % 10)) {
if (i)
out << ",";
out << endl << " ";
} else {
out << ", ";
}
}
void generateList(const QVector<int> &list, QTextStream &out)
{
for (int i = 0; i < list.size(); ++i) {
generateSeparator(i, out);
out << list[i];
}
}
}
QString CppGenerator::copyrightHeader() const QString CppGenerator::copyrightHeader() const
{ {
@ -47,7 +70,7 @@ QString CppGenerator::copyrightHeader() const
"**\n" "**\n"
"** This file is part of the Qt Toolkit.\n" "** This file is part of the Qt Toolkit.\n"
"**\n" "**\n"
"** $QT_BEGIN_LICENSE:LGPL$\n" "** $QT_BEGIN_LICENSE:GPL-EXCEPT$\n"
"** Commercial License Usage\n" "** Commercial License Usage\n"
"** Licensees holding valid commercial Qt licenses may use this file in\n" "** Licensees holding valid commercial Qt licenses may use this file in\n"
"** accordance with the commercial license agreement provided with the\n" "** accordance with the commercial license agreement provided with the\n"
@ -56,24 +79,13 @@ QString CppGenerator::copyrightHeader() const
"** and conditions see https://www.qt.io/terms-conditions. For further\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" "** information use the contact form at https://www.qt.io/contact-us.\n"
"**\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 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"
"** GNU General Public License Usage\n" "** GNU General Public License Usage\n"
"** Alternatively, this file may be used under the terms of the GNU\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" "** General Public License version 3 as published by the Free Software\n"
"** Public license version 3 or any later version approved by the KDE Free\n" "** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT\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" "** included in the packaging of this file. Please review the following\n"
"** information to ensure the GNU General Public License requirements will\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" "** be met: https://www.gnu.org/licenses/gpl-3.0.html.\n"
"** https://www.gnu.org/licenses/gpl-3.0.html.\n"
"**\n" "**\n"
"** $QT_END_LICENSE$\n" "** $QT_END_LICENSE$\n"
"**\n" "**\n"
@ -446,7 +458,7 @@ void CppGenerator::generateDecl (QTextStream &out)
out << "class " << grammar.table_name << endl out << "class " << grammar.table_name << endl
<< "{" << endl << "{" << endl
<< "public:" << endl << "public:" << endl
<< " enum VariousConstants {" << endl; << " enum VariousConstants {" << endl;
for (Name t : qAsConst(grammar.terminals)) for (Name t : qAsConst(grammar.terminals))
{ {
@ -462,59 +474,59 @@ void CppGenerator::generateDecl (QTextStream &out)
else else
name.prepend (grammar.token_prefix); name.prepend (grammar.token_prefix);
out << " " << name << " = " << value << "," << endl; out << " " << name << " = " << value << "," << endl;
} }
out << endl out << endl
<< " ACCEPT_STATE = " << accept_state << "," << endl << " ACCEPT_STATE = " << accept_state << "," << endl
<< " RULE_COUNT = " << grammar.rules.size () << "," << endl << " RULE_COUNT = " << grammar.rules.size () << "," << endl
<< " STATE_COUNT = " << state_count << "," << endl << " STATE_COUNT = " << state_count << "," << endl
<< " TERMINAL_COUNT = " << terminal_count << "," << endl << " TERMINAL_COUNT = " << terminal_count << "," << endl
<< " NON_TERMINAL_COUNT = " << non_terminal_count << "," << endl << " NON_TERMINAL_COUNT = " << non_terminal_count << "," << endl
<< endl << endl
<< " GOTO_INDEX_OFFSET = " << compressed_action.index.size () << "," << endl << " GOTO_INDEX_OFFSET = " << compressed_action.index.size () << "," << endl
<< " GOTO_INFO_OFFSET = " << compressed_action.info.size () << "," << endl << " GOTO_INFO_OFFSET = " << compressed_action.info.size () << "," << endl
<< " GOTO_CHECK_OFFSET = " << compressed_action.check.size () << endl << " GOTO_CHECK_OFFSET = " << compressed_action.check.size () << endl
<< " };" << endl << " };" << endl
<< endl << endl
<< " static const char *const spell [];" << endl << " static const char *const spell[];" << endl
<< " static const short lhs [];" << endl << " static const short lhs[];" << endl
<< " static const short rhs [];" << endl; << " static const short rhs[];" << endl;
if (debug_info) if (debug_info)
{ {
QString prot = debugInfoProt(); QString prot = debugInfoProt();
out << endl << "#ifndef " << prot << endl out << endl << "#ifndef " << prot << endl
<< " static const int rule_index [];" << endl << " static const int rule_index[];" << endl
<< " static const int rule_info [];" << endl << " static const int rule_info[];" << endl
<< "#endif // " << prot << endl << endl; << "#endif // " << prot << endl << endl;
} }
out << " static const short goto_default [];" << endl out << " static const short goto_default[];" << endl
<< " static const short action_default [];" << endl << " static const short action_default[];" << endl
<< " static const short action_index [];" << endl << " static const short action_index[];" << endl
<< " static const short action_info [];" << endl << " static const short action_info[];" << endl
<< " static const short action_check [];" << endl << " static const short action_check[];" << endl
<< endl << endl
<< " static inline int nt_action (int state, int nt)" << endl << " static inline int nt_action (int state, int nt)" << endl
<< " {" << endl << " {" << endl
<< " const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt;" << endl << " const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt;" << endl
<< " if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt)" << endl << " if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt)" << endl
<< " return goto_default [nt];" << endl << " return goto_default [nt];" << endl
<< endl << endl
<< " return action_info [GOTO_INFO_OFFSET + yyn];" << endl << " return action_info [GOTO_INFO_OFFSET + yyn];" << endl
<< " }" << endl << " }" << endl
<< endl << endl
<< " static inline int t_action (int state, int token)" << endl << " static inline int t_action (int state, int token)" << endl
<< " {" << endl << " {" << endl
<< " const int yyn = action_index [state] + token;" << endl << " const int yyn = action_index [state] + token;" << endl
<< endl << endl
<< " if (yyn < 0 || action_check [yyn] != token)" << endl << " if (yyn < 0 || action_check [yyn] != token)" << endl
<< " return - action_default [state];" << endl << " return - action_default [state];" << endl
<< endl << endl
<< " return action_info [yyn];" << endl << " return action_info [yyn];" << endl
<< " }" << endl << " }" << endl
<< "};" << endl << "};" << endl
<< endl << endl
<< endl; << endl;
@ -539,11 +551,7 @@ void CppGenerator::generateImpl (QTextStream &out)
name_ids.insert (t, idx); name_ids.insert (t, idx);
if (idx) generateSeparator(idx, out);
out << ", ";
if (! (idx % 10))
out << endl << " ";
if (terminal) if (terminal)
{ {
@ -569,35 +577,27 @@ void CppGenerator::generateImpl (QTextStream &out)
if (debug_info) if (debug_info)
out << endl << "#endif // " << debugInfoProt() << endl; out << endl << "#endif // " << debugInfoProt() << endl;
out << "};" << endl << endl; out << endl << "};" << endl << endl;
out << "const short " << grammar.table_name << "::lhs [] = {"; out << "const short " << grammar.table_name << "::lhs [] = {";
idx = 0; idx = 0;
for (RulePointer rule = grammar.rules.begin (); rule != grammar.rules.end (); ++rule, ++idx) for (RulePointer rule = grammar.rules.begin (); rule != grammar.rules.end (); ++rule, ++idx)
{ {
if (idx) generateSeparator(idx, out);
out << ", ";
if (! (idx % 10))
out << endl << " ";
out << aut.id (rule->lhs); out << aut.id (rule->lhs);
} }
out << "};" << endl << endl; out << endl << "};" << endl << endl;
out << "const short " << grammar.table_name << "::rhs [] = {"; out << "const short " << grammar.table_name << "::rhs [] = {";
idx = 0; idx = 0;
for (RulePointer rule = grammar.rules.begin (); rule != grammar.rules.end (); ++rule, ++idx) for (RulePointer rule = grammar.rules.begin (); rule != grammar.rules.end (); ++rule, ++idx)
{ {
if (idx) generateSeparator(idx, out);
out << ", ";
if (! (idx % 10))
out << endl << " ";
out << rule->rhs.size (); out << rule->rhs.size ();
} }
out << "};" << endl << endl; out << endl << "};" << endl << endl;
if (debug_info) if (debug_info)
{ {
@ -608,35 +608,26 @@ void CppGenerator::generateImpl (QTextStream &out)
idx = 0; idx = 0;
for (auto rule = grammar.rules.cbegin (); rule != grammar.rules.cend (); ++rule, ++idx) for (auto rule = grammar.rules.cbegin (); rule != grammar.rules.cend (); ++rule, ++idx)
{ {
out << endl << " "; generateSeparator(idx, out);
if (idx)
out << ", ";
else
out << " ";
out << name_ids.value(rule->lhs); out << name_ids.value(rule->lhs);
for (const Name &n : rule->rhs) for (const Name &n : rule->rhs)
out << ", " << name_ids.value (n); out << ", " << name_ids.value (n);
} }
out << "};" << endl << endl; out << endl << "};" << endl << endl;
out << "const int " << grammar.table_name << "::rule_index [] = {"; out << "const int " << grammar.table_name << "::rule_index [] = {";
idx = 0; idx = 0;
int offset = 0; int offset = 0;
for (RulePointer rule = grammar.rules.begin (); rule != grammar.rules.end (); ++rule, ++idx) for (RulePointer rule = grammar.rules.begin (); rule != grammar.rules.end (); ++rule, ++idx)
{ {
if (idx) generateSeparator(idx, out);
out << ", ";
if (! (idx % 10))
out << endl << " ";
out << offset; out << offset;
offset += rule->rhs.size () + 1; offset += rule->rhs.size () + 1;
} }
out << "};" << endl out << endl << "};" << endl
<< "#endif // " << prot << endl << endl; << "#endif // " << prot << endl << endl;
} }
@ -644,92 +635,34 @@ void CppGenerator::generateImpl (QTextStream &out)
idx = 0; idx = 0;
for (StatePointer state = aut.states.begin (); state != aut.states.end (); ++state, ++idx) for (StatePointer state = aut.states.begin (); state != aut.states.end (); ++state, ++idx)
{ {
if (state != aut.states.begin ()) generateSeparator(idx, out);
out << ", ";
if (! (idx % 10))
out << endl << " ";
if (state->defaultReduce != grammar.rules.end ()) if (state->defaultReduce != grammar.rules.end ())
out << aut.id (state->defaultReduce); out << aut.id (state->defaultReduce);
else else
out << "0"; out << "0";
} }
out << "};" << endl << endl; out << endl << "};" << endl << endl;
out << "const short " << grammar.table_name << "::goto_default [] = {"; out << "const short " << grammar.table_name << "::goto_default [] = {";
for (int i = 0; i < defgoto.size (); ++i) generateList(defgoto, out);
{ out << endl << "};" << endl << endl;
if (i)
out << ", ";
if (! (i % 10))
out << endl << " ";
out << defgoto [i];
}
out << "};" << endl << endl;
out << "const short " << grammar.table_name << "::action_index [] = {"; out << "const short " << grammar.table_name << "::action_index [] = {";
for (int i = 0; i < compressed_action.index.size (); ++i) generateList(compressed_action.index, out);
{ out << "," << endl;
if (! (i % 10)) generateList(compressed_goto.index, out);
out << endl << " "; out << endl << "};" << endl << endl;
out << compressed_action.index [i] << ", ";
}
out << endl;
for (int i = 0; i < compressed_goto.index.size (); ++i)
{
if (i)
out << ", ";
if (! (i % 10))
out << endl << " ";
out << compressed_goto.index [i];
}
out << "};" << endl << endl;
out << "const short " << grammar.table_name << "::action_info [] = {"; out << "const short " << grammar.table_name << "::action_info [] = {";
for (int i = 0; i < compressed_action.info.size (); ++i) generateList(compressed_action.info, out);
{ out << "," << endl;
if (! (i % 10)) generateList(compressed_goto.info, out);
out << endl << " "; out << endl << "};" << endl << endl;
out << compressed_action.info [i] << ", ";
}
out << endl;
for (int i = 0; i < compressed_goto.info.size (); ++i)
{
if (i)
out << ", ";
if (! (i % 10))
out << endl << " ";
out << compressed_goto.info [i];
}
out << "};" << endl << endl;
out << "const short " << grammar.table_name << "::action_check [] = {"; out << "const short " << grammar.table_name << "::action_check [] = {";
for (int i = 0; i < compressed_action.check.size (); ++i) generateList(compressed_action.check, out);
{ out << "," << endl;
if (! (i % 10)) generateList(compressed_goto.check, out);
out << endl << " "; out << endl << "};" << endl << endl;
out << compressed_action.check [i] << ", ";
}
out << endl;
for (int i = 0; i < compressed_goto.check.size (); ++i)
{
if (i)
out << ", ";
if (! (i % 10))
out << endl << " ";
out << compressed_goto.check [i];
}
out << "};" << endl << endl;
} }

View File

@ -32,83 +32,89 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
const char *const grammar::spell [] = { const char *const grammar::spell [] = {
"end of file", "identifier", "string literal", "%decl", "%expect", "%expect-lr", "%impl", "%left", "%merged_output", "%nonassoc", "end of file", "identifier", "string literal", "%decl", "%expect", "%expect-lr", "%impl", "%left", "%merged_output", "%nonassoc",
"%parser", "%prec", "%right", "%start", "%token", "%token_prefix", ":", "|", ";", 0, "%parser", "%prec", "%right", "%start", "%token", "%token_prefix", ":", "|", ";", 0,
0, 0}; 0, 0
};
const short grammar::lhs [] = { const short grammar::lhs [] = {
22, 23, 23, 29, 25, 28, 28, 28, 28, 28, 22, 23, 23, 29, 25, 28, 28, 28, 28, 28,
28, 28, 24, 24, 31, 32, 32, 33, 33, 34, 28, 28, 24, 24, 31, 32, 32, 33, 33, 34,
34, 34, 31, 35, 35, 36, 37, 37, 38, 38, 34, 34, 31, 35, 35, 36, 37, 37, 38, 38,
30, 30, 26, 26, 40, 39, 41, 41, 44, 43, 30, 30, 26, 26, 40, 39, 41, 41, 44, 43,
43, 42, 42, 27, 45}; 43, 42, 42, 27, 45
};
const short grammar::rhs [] = { const short grammar::rhs [] = {
4, 1, 2, 2, 2, 2, 2, 2, 2, 2, 4, 1, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 1, 2, 2, 1, 2, 2, 2, 1, 2, 2, 1, 2, 2, 1, 2, 2, 2, 1,
1, 1, 2, 1, 2, 1, 1, 1, 1, 2, 1, 1, 2, 1, 2, 1, 1, 1, 1, 2,
0, 1, 1, 2, 2, 4, 3, 6, 0, 0, 0, 1, 1, 2, 2, 4, 3, 6, 0, 0,
2, 1, 2, 0, 2}; 2, 1, 2, 0, 2
};
const short grammar::action_default [] = { const short grammar::action_default [] = {
44, 2, 44, 0, 0, 0, 0, 13, 0, 0, 44, 2, 44, 0, 0, 0, 0, 13, 0, 0,
3, 0, 0, 0, 8, 10, 11, 9, 7, 6, 3, 0, 0, 0, 8, 10, 11, 9, 7, 6,
12, 20, 22, 0, 21, 0, 44, 31, 0, 14, 12, 20, 22, 0, 21, 0, 44, 31, 0, 14,
26, 24, 23, 25, 4, 33, 1, 0, 34, 44, 26, 24, 23, 25, 4, 33, 1, 0, 34, 44,
35, 42, 39, 40, 0, 31, 44, 40, 43, 0, 35, 42, 39, 40, 0, 31, 44, 40, 43, 0,
31, 41, 29, 27, 28, 32, 38, 30, 36, 31, 31, 41, 29, 27, 28, 32, 38, 30, 36, 31,
37, 5, 44, 16, 15, 18, 19, 17, 45}; 37, 5, 44, 16, 15, 18, 19, 17, 45
};
const short grammar::goto_default [] = { const short grammar::goto_default [] = {
3, 2, 13, 26, 36, 41, 10, 27, 61, 29, 3, 2, 13, 26, 36, 41, 10, 27, 61, 29,
64, 63, 23, 32, 31, 52, 55, 38, 39, 42, 64, 63, 23, 32, 31, 52, 55, 38, 39, 42,
43, 59, 44, 0}; 43, 59, 44, 0
};
const short grammar::action_index [] = { const short grammar::action_index [] = {
-22, -22, 54, 1, 5, 15, 20, -22, -1, 6, -22, -22, 30, 1, 2, 3, 4, -22, 5, 6,
-22, 3, 2, 35, -22, -22, -22, -22, -22, -22, -22, 8, -1, 35, -22, -22, -22, -22, -22, -22,
-22, -22, -22, 10, -22, 7, -22, 14, 9, -22, -22, -22, -22, 13, -22, 7, -22, -2, 20, -22,
-22, -22, 8, -22, -22, -22, 11, -2, -22, -22, -22, -22, 11, -22, -22, -22, 15, -6, -22, -22,
-22, -22, -3, 16, 13, 14, -22, 17, -22, 4, -22, -22, -3, 19, -4, 12, -22, 18, -22, 10,
14, -22, -22, -22, -22, 14, -22, -22, -22, 14, -2, -22, -22, -22, -22, -2, -22, -22, -22, -2,
-22, -22, 0, -22, 12, -22, -22, -22, -22, -22, -22, 0, -22, 20, -22, -22, -22, -22,
2, -24, -2, -24, -24, -24, -24, -24, -24, -24, 0, -24, 3, -24, -24, -24, -24, -24, -24, -24,
-24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24,
-24, -24, -24, -24, -24, -24, -4, -24, -24, -24, -24, -24, -24, -24, -24, -24, -2, -24, -24, -24,
-24, -24, -14, -24, -24, -24, -24, -24, -24, -24, -24, -24, -7, -24, -24, -24, -24, -24, -24, -24,
-24, -24, -24, -24, -24, 0, -16, -15, -24, -24, -24, -24, -24, -24, -24, 17, -19, -11, -24, -24,
15, -24, -24, -24, -24, -10, -24, -24, -24, 1, 1, -24, -24, -24, -24, -15, -24, -24, -24, -6,
-24, -24, -3, -24, -1, -24, -24, -24, -24}; -24, -24, -1, -24, -5, -24, -24, -24, -24
};
const short grammar::action_info [] = { const short grammar::action_info [] = {
17, 68, 66, 20, 19, 51, 14, 18, 34, 30, 20, 68, 66, 14, 15, 16, 17, 18, 34, 19,
62, 30, 37, 62, 40, 45, 15, 48, 48, 0, 40, 51, 30, 46, 30, 45, 37, 53, 54, 48,
0, 16, 0, 0, 0, 0, 0, 49, 49, 0, 48, 62, 0, 0, 0, 0, 0, 0, 0, 49,
46, 0, 0, 53, 54, 0, 0, 0, 0, 0, 49, 53, 54, 4, 5, 6, 8, 0, 9, 0,
0, 0, 21, 0, 22, 0, 0, 24, 25, 28, 11, 0, 21, 0, 22, 12, 0, 24, 25, 28,
0, 0, 0, 0, 0, 0, 0, 4, 5, 6, 0, 0, 0, 0, 0, 0, 0,
8, 0, 9, 0, 11, 0, 0, 0, 0, 12,
0, 0, 0, 0, 0, 0,
33, 35, 65, 7, 47, 57, 50, 1, 58, 60, 57, 47, 60, 35, 65, 1, 67, 33, 7, 56,
67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 58, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0}; 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0
};
const short grammar::action_check [] = { const short grammar::action_check [] = {
1, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 16, 18, 1, 1, 1, -1, 16, 1, 1, 17, 1, 18, 1, 19, 20, 1,
-1, 1, -1, -1, -1, -1, -1, 11, 11, -1, 1, 1, -1, -1, -1, -1, -1, -1, -1, 11,
17, -1, -1, 19, 20, -1, -1, -1, -1, -1, 11, 19, 20, 3, 4, 5, 6, -1, 8, -1,
-1, -1, 7, -1, 9, -1, -1, 12, 13, 14, 10, -1, 7, -1, 9, 15, -1, 12, 13, 14,
-1, -1, -1, -1, -1, -1, -1, 3, 4, 5, -1, -1, -1, -1, -1, -1, -1,
6, -1, 8, -1, 10, -1, -1, -1, -1, 15,
-1, -1, -1, -1, -1, -1,
14, 5, 5, 5, 20, 15, 21, 5, 8, 8, 15, 20, 8, 5, 5, 5, 11, 14, 5, 8,
11, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1}; -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1
};
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -48,68 +48,68 @@ QT_BEGIN_NAMESPACE
class grammar class grammar
{ {
public: public:
enum VariousConstants { enum VariousConstants {
EOF_SYMBOL = 0, EOF_SYMBOL = 0,
COLON = 16, COLON = 16,
DECL = 19, DECL = 19,
DECL_FILE = 3, DECL_FILE = 3,
ERROR = 21, ERROR = 21,
EXPECT = 4, EXPECT = 4,
EXPECT_RR = 5, EXPECT_RR = 5,
ID = 1, ID = 1,
IMPL = 20, IMPL = 20,
IMPL_FILE = 6, IMPL_FILE = 6,
LEFT = 7, LEFT = 7,
MERGED_OUTPUT = 8, MERGED_OUTPUT = 8,
NONASSOC = 9, NONASSOC = 9,
OR = 17, OR = 17,
PARSER = 10, PARSER = 10,
PREC = 11, PREC = 11,
RIGHT = 12, RIGHT = 12,
SEMICOLON = 18, SEMICOLON = 18,
START = 13, START = 13,
STRING_LITERAL = 2, STRING_LITERAL = 2,
TOKEN = 14, TOKEN = 14,
TOKEN_PREFIX = 15, TOKEN_PREFIX = 15,
ACCEPT_STATE = 68, ACCEPT_STATE = 68,
RULE_COUNT = 45, RULE_COUNT = 45,
STATE_COUNT = 69, STATE_COUNT = 69,
TERMINAL_COUNT = 22, TERMINAL_COUNT = 22,
NON_TERMINAL_COUNT = 24, NON_TERMINAL_COUNT = 24,
GOTO_INDEX_OFFSET = 69, GOTO_INDEX_OFFSET = 69,
GOTO_INFO_OFFSET = 76, GOTO_INFO_OFFSET = 57,
GOTO_CHECK_OFFSET = 76 GOTO_CHECK_OFFSET = 57
}; };
static const char *const spell []; static const char *const spell[];
static const short lhs []; static const short lhs[];
static const short rhs []; static const short rhs[];
static const short goto_default []; static const short goto_default[];
static const short action_default []; static const short action_default[];
static const short action_index []; static const short action_index[];
static const short action_info []; static const short action_info[];
static const short action_check []; static const short action_check[];
static inline int nt_action (int state, int nt) static inline int nt_action (int state, int nt)
{ {
const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt; const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt;
if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt) if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt)
return goto_default [nt]; return goto_default [nt];
return action_info [GOTO_INFO_OFFSET + yyn]; return action_info [GOTO_INFO_OFFSET + yyn];
} }
static inline int t_action (int state, int token) static inline int t_action (int state, int token)
{ {
const int yyn = action_index [state] + token; const int yyn = action_index [state] + token;
if (yyn < 0 || action_check [yyn] != token) if (yyn < 0 || action_check [yyn] != token)
return - action_default [state]; return - action_default [state];
return action_info [yyn]; return action_info [yyn];
} }
}; };

View File

@ -61,8 +61,7 @@
%start Specification %start Specification
/: /:/****************************************************************************
/****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
@ -163,8 +162,7 @@ protected:
}; };
:/ :/
/. /./****************************************************************************
/****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
@ -344,7 +342,8 @@ int Recognizer::nextToken()
text.clear (); text.clear ();
if (! _M_no_lines) if (! _M_no_lines)
text += QLatin1String ("\n#line ") + QString::number (_M_action_line) + " \"" + _M_input_file + "\"\n"; text += QLatin1String("\n#line ") + QString::number(_M_action_line) +
QLatin1String(" \"") + _M_input_file + QLatin1String("\"\n");
inp (); // skip ':' inp (); // skip ':'
forever forever
@ -381,7 +380,8 @@ int Recognizer::nextToken()
text.clear (); text.clear ();
if (! _M_no_lines) if (! _M_no_lines)
text += QLatin1String ("\n#line ") + QString::number (_M_action_line) + " \"" + _M_input_file + "\"\n"; text += QLatin1String("\n#line ") + QString::number(_M_action_line) +
QLatin1String(" \"") + _M_input_file + QLatin1String("\"\n");
inp (); // skip ':' inp (); // skip ':'

View File

@ -178,8 +178,8 @@ int Recognizer::nextToken()
text.clear (); text.clear ();
if (! _M_no_lines) if (! _M_no_lines)
text += QLatin1String("\n#line ") + QString::number (_M_action_line) text += QLatin1String("\n#line ") + QString::number(_M_action_line) +
+ QLatin1String(" \"") + _M_input_file + QLatin1String("\"\n"); QLatin1String(" \"") + _M_input_file + QLatin1String("\"\n");
inp (); // skip ':' inp (); // skip ':'
forever forever
@ -216,7 +216,7 @@ int Recognizer::nextToken()
text.clear (); text.clear ();
if (! _M_no_lines) if (! _M_no_lines)
text += QLatin1String ("\n#line ") + QString::number (_M_action_line) + text += QLatin1String("\n#line ") + QString::number(_M_action_line) +
QLatin1String(" \"") + _M_input_file + QLatin1String("\"\n"); QLatin1String(" \"") + _M_input_file + QLatin1String("\"\n");
inp (); // skip ':' inp (); // skip ':'