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:
parent
8b9d246225
commit
375bbcdd01
@ -36,6 +36,29 @@
|
||||
#include <QtCore/qfile.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
|
||||
{
|
||||
@ -47,7 +70,7 @@ QString CppGenerator::copyrightHeader() const
|
||||
"**\n"
|
||||
"** This file is part of the Qt Toolkit.\n"
|
||||
"**\n"
|
||||
"** $QT_BEGIN_LICENSE:LGPL$\n"
|
||||
"** $QT_BEGIN_LICENSE:GPL-EXCEPT$\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"
|
||||
@ -56,24 +79,13 @@ QString CppGenerator::copyrightHeader() const
|
||||
"** 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 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"
|
||||
"** 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"
|
||||
"** General Public License version 3 as published by the Free Software\n"
|
||||
"** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT\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"
|
||||
"** be met: https://www.gnu.org/licenses/gpl-3.0.html.\n"
|
||||
"**\n"
|
||||
"** $QT_END_LICENSE$\n"
|
||||
"**\n"
|
||||
@ -446,7 +458,7 @@ void CppGenerator::generateDecl (QTextStream &out)
|
||||
out << "class " << grammar.table_name << endl
|
||||
<< "{" << endl
|
||||
<< "public:" << endl
|
||||
<< " enum VariousConstants {" << endl;
|
||||
<< " enum VariousConstants {" << endl;
|
||||
|
||||
for (Name t : qAsConst(grammar.terminals))
|
||||
{
|
||||
@ -462,59 +474,59 @@ void CppGenerator::generateDecl (QTextStream &out)
|
||||
else
|
||||
name.prepend (grammar.token_prefix);
|
||||
|
||||
out << " " << name << " = " << value << "," << endl;
|
||||
out << " " << name << " = " << value << "," << endl;
|
||||
}
|
||||
|
||||
out << endl
|
||||
<< " ACCEPT_STATE = " << accept_state << "," << endl
|
||||
<< " RULE_COUNT = " << grammar.rules.size () << "," << endl
|
||||
<< " STATE_COUNT = " << state_count << "," << endl
|
||||
<< " TERMINAL_COUNT = " << terminal_count << "," << endl
|
||||
<< " NON_TERMINAL_COUNT = " << non_terminal_count << "," << endl
|
||||
<< " ACCEPT_STATE = " << accept_state << "," << endl
|
||||
<< " RULE_COUNT = " << grammar.rules.size () << "," << endl
|
||||
<< " STATE_COUNT = " << state_count << "," << endl
|
||||
<< " TERMINAL_COUNT = " << terminal_count << "," << endl
|
||||
<< " NON_TERMINAL_COUNT = " << non_terminal_count << "," << endl
|
||||
<< endl
|
||||
<< " GOTO_INDEX_OFFSET = " << compressed_action.index.size () << "," << endl
|
||||
<< " GOTO_INFO_OFFSET = " << compressed_action.info.size () << "," << endl
|
||||
<< " GOTO_CHECK_OFFSET = " << compressed_action.check.size () << endl
|
||||
<< " };" << endl
|
||||
<< " GOTO_INDEX_OFFSET = " << compressed_action.index.size () << "," << endl
|
||||
<< " GOTO_INFO_OFFSET = " << compressed_action.info.size () << "," << endl
|
||||
<< " GOTO_CHECK_OFFSET = " << compressed_action.check.size () << endl
|
||||
<< " };" << endl
|
||||
<< endl
|
||||
<< " static const char *const spell [];" << endl
|
||||
<< " static const short lhs [];" << endl
|
||||
<< " static const short rhs [];" << endl;
|
||||
<< " static const char *const spell[];" << endl
|
||||
<< " static const short lhs[];" << endl
|
||||
<< " static const short rhs[];" << endl;
|
||||
|
||||
if (debug_info)
|
||||
{
|
||||
QString prot = debugInfoProt();
|
||||
|
||||
out << endl << "#ifndef " << prot << endl
|
||||
<< " static const int rule_index [];" << endl
|
||||
<< " static const int rule_info [];" << endl
|
||||
<< " static const int rule_index[];" << endl
|
||||
<< " static const int rule_info[];" << endl
|
||||
<< "#endif // " << prot << endl << endl;
|
||||
}
|
||||
|
||||
out << " static const short goto_default [];" << endl
|
||||
<< " static const short action_default [];" << endl
|
||||
<< " static const short action_index [];" << endl
|
||||
<< " static const short action_info [];" << endl
|
||||
<< " static const short action_check [];" << endl
|
||||
out << " static const short goto_default[];" << endl
|
||||
<< " static const short action_default[];" << endl
|
||||
<< " static const short action_index[];" << endl
|
||||
<< " static const short action_info[];" << endl
|
||||
<< " static const short action_check[];" << endl
|
||||
<< endl
|
||||
<< " static inline int nt_action (int state, int nt)" << endl
|
||||
<< " {" << endl
|
||||
<< " const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt;" << endl
|
||||
<< " if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt)" << endl
|
||||
<< " return goto_default [nt];" << endl
|
||||
<< " static inline int nt_action (int state, int nt)" << endl
|
||||
<< " {" << endl
|
||||
<< " const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt;" << endl
|
||||
<< " if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt)" << endl
|
||||
<< " return goto_default [nt];" << endl
|
||||
<< endl
|
||||
<< " return action_info [GOTO_INFO_OFFSET + yyn];" << endl
|
||||
<< " }" << endl
|
||||
<< " return action_info [GOTO_INFO_OFFSET + yyn];" << endl
|
||||
<< " }" << endl
|
||||
<< endl
|
||||
<< " static inline int t_action (int state, int token)" << endl
|
||||
<< " {" << endl
|
||||
<< " const int yyn = action_index [state] + token;" << endl
|
||||
<< " static inline int t_action (int state, int token)" << endl
|
||||
<< " {" << endl
|
||||
<< " const int yyn = action_index [state] + token;" << endl
|
||||
<< endl
|
||||
<< " if (yyn < 0 || action_check [yyn] != token)" << endl
|
||||
<< " return - action_default [state];" << endl
|
||||
<< " if (yyn < 0 || action_check [yyn] != token)" << endl
|
||||
<< " return - action_default [state];" << endl
|
||||
<< endl
|
||||
<< " return action_info [yyn];" << endl
|
||||
<< " }" << endl
|
||||
<< " return action_info [yyn];" << endl
|
||||
<< " }" << endl
|
||||
<< "};" << endl
|
||||
<< endl
|
||||
<< endl;
|
||||
@ -539,11 +551,7 @@ void CppGenerator::generateImpl (QTextStream &out)
|
||||
|
||||
name_ids.insert (t, idx);
|
||||
|
||||
if (idx)
|
||||
out << ", ";
|
||||
|
||||
if (! (idx % 10))
|
||||
out << endl << " ";
|
||||
generateSeparator(idx, out);
|
||||
|
||||
if (terminal)
|
||||
{
|
||||
@ -569,35 +577,27 @@ void CppGenerator::generateImpl (QTextStream &out)
|
||||
if (debug_info)
|
||||
out << endl << "#endif // " << debugInfoProt() << endl;
|
||||
|
||||
out << "};" << endl << endl;
|
||||
out << endl << "};" << endl << endl;
|
||||
|
||||
out << "const short " << grammar.table_name << "::lhs [] = {";
|
||||
idx = 0;
|
||||
for (RulePointer rule = grammar.rules.begin (); rule != grammar.rules.end (); ++rule, ++idx)
|
||||
{
|
||||
if (idx)
|
||||
out << ", ";
|
||||
|
||||
if (! (idx % 10))
|
||||
out << endl << " ";
|
||||
generateSeparator(idx, out);
|
||||
|
||||
out << aut.id (rule->lhs);
|
||||
}
|
||||
out << "};" << endl << endl;
|
||||
out << endl << "};" << endl << endl;
|
||||
|
||||
out << "const short " << grammar.table_name << "::rhs [] = {";
|
||||
idx = 0;
|
||||
for (RulePointer rule = grammar.rules.begin (); rule != grammar.rules.end (); ++rule, ++idx)
|
||||
{
|
||||
if (idx)
|
||||
out << ", ";
|
||||
|
||||
if (! (idx % 10))
|
||||
out << endl << " ";
|
||||
generateSeparator(idx, out);
|
||||
|
||||
out << rule->rhs.size ();
|
||||
}
|
||||
out << "};" << endl << endl;
|
||||
out << endl << "};" << endl << endl;
|
||||
|
||||
if (debug_info)
|
||||
{
|
||||
@ -608,35 +608,26 @@ void CppGenerator::generateImpl (QTextStream &out)
|
||||
idx = 0;
|
||||
for (auto rule = grammar.rules.cbegin (); rule != grammar.rules.cend (); ++rule, ++idx)
|
||||
{
|
||||
out << endl << " ";
|
||||
|
||||
if (idx)
|
||||
out << ", ";
|
||||
else
|
||||
out << " ";
|
||||
generateSeparator(idx, out);
|
||||
|
||||
out << name_ids.value(rule->lhs);
|
||||
|
||||
for (const Name &n : rule->rhs)
|
||||
out << ", " << name_ids.value (n);
|
||||
}
|
||||
out << "};" << endl << endl;
|
||||
out << endl << "};" << endl << endl;
|
||||
|
||||
out << "const int " << grammar.table_name << "::rule_index [] = {";
|
||||
idx = 0;
|
||||
int offset = 0;
|
||||
for (RulePointer rule = grammar.rules.begin (); rule != grammar.rules.end (); ++rule, ++idx)
|
||||
{
|
||||
if (idx)
|
||||
out << ", ";
|
||||
|
||||
if (! (idx % 10))
|
||||
out << endl << " ";
|
||||
generateSeparator(idx, out);
|
||||
|
||||
out << offset;
|
||||
offset += rule->rhs.size () + 1;
|
||||
}
|
||||
out << "};" << endl
|
||||
out << endl << "};" << endl
|
||||
<< "#endif // " << prot << endl << endl;
|
||||
}
|
||||
|
||||
@ -644,92 +635,34 @@ void CppGenerator::generateImpl (QTextStream &out)
|
||||
idx = 0;
|
||||
for (StatePointer state = aut.states.begin (); state != aut.states.end (); ++state, ++idx)
|
||||
{
|
||||
if (state != aut.states.begin ())
|
||||
out << ", ";
|
||||
|
||||
if (! (idx % 10))
|
||||
out << endl << " ";
|
||||
generateSeparator(idx, out);
|
||||
|
||||
if (state->defaultReduce != grammar.rules.end ())
|
||||
out << aut.id (state->defaultReduce);
|
||||
else
|
||||
out << "0";
|
||||
}
|
||||
out << "};" << endl << endl;
|
||||
out << endl << "};" << endl << endl;
|
||||
|
||||
out << "const short " << grammar.table_name << "::goto_default [] = {";
|
||||
for (int i = 0; i < defgoto.size (); ++i)
|
||||
{
|
||||
if (i)
|
||||
out << ", ";
|
||||
|
||||
if (! (i % 10))
|
||||
out << endl << " ";
|
||||
|
||||
out << defgoto [i];
|
||||
}
|
||||
out << "};" << endl << endl;
|
||||
generateList(defgoto, out);
|
||||
out << endl << "};" << endl << endl;
|
||||
|
||||
out << "const short " << grammar.table_name << "::action_index [] = {";
|
||||
for (int i = 0; i < compressed_action.index.size (); ++i)
|
||||
{
|
||||
if (! (i % 10))
|
||||
out << 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;
|
||||
generateList(compressed_action.index, out);
|
||||
out << "," << endl;
|
||||
generateList(compressed_goto.index, out);
|
||||
out << endl << "};" << endl << endl;
|
||||
|
||||
out << "const short " << grammar.table_name << "::action_info [] = {";
|
||||
for (int i = 0; i < compressed_action.info.size (); ++i)
|
||||
{
|
||||
if (! (i % 10))
|
||||
out << 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;
|
||||
generateList(compressed_action.info, out);
|
||||
out << "," << endl;
|
||||
generateList(compressed_goto.info, out);
|
||||
out << endl << "};" << endl << endl;
|
||||
|
||||
out << "const short " << grammar.table_name << "::action_check [] = {";
|
||||
for (int i = 0; i < compressed_action.check.size (); ++i)
|
||||
{
|
||||
if (! (i % 10))
|
||||
out << 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;
|
||||
generateList(compressed_action.check, out);
|
||||
out << "," << endl;
|
||||
generateList(compressed_goto.check, out);
|
||||
out << endl << "};" << endl << endl;
|
||||
}
|
||||
|
@ -32,83 +32,89 @@
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
const char *const grammar::spell [] = {
|
||||
"end of file", "identifier", "string literal", "%decl", "%expect", "%expect-lr", "%impl", "%left", "%merged_output", "%nonassoc",
|
||||
"%parser", "%prec", "%right", "%start", "%token", "%token_prefix", ":", "|", ";", 0,
|
||||
0, 0};
|
||||
"end of file", "identifier", "string literal", "%decl", "%expect", "%expect-lr", "%impl", "%left", "%merged_output", "%nonassoc",
|
||||
"%parser", "%prec", "%right", "%start", "%token", "%token_prefix", ":", "|", ";", 0,
|
||||
0, 0
|
||||
};
|
||||
|
||||
const short grammar::lhs [] = {
|
||||
22, 23, 23, 29, 25, 28, 28, 28, 28, 28,
|
||||
28, 28, 24, 24, 31, 32, 32, 33, 33, 34,
|
||||
34, 34, 31, 35, 35, 36, 37, 37, 38, 38,
|
||||
30, 30, 26, 26, 40, 39, 41, 41, 44, 43,
|
||||
43, 42, 42, 27, 45};
|
||||
22, 23, 23, 29, 25, 28, 28, 28, 28, 28,
|
||||
28, 28, 24, 24, 31, 32, 32, 33, 33, 34,
|
||||
34, 34, 31, 35, 35, 36, 37, 37, 38, 38,
|
||||
30, 30, 26, 26, 40, 39, 41, 41, 44, 43,
|
||||
43, 42, 42, 27, 45
|
||||
};
|
||||
|
||||
const short grammar::rhs [] = {
|
||||
4, 1, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 1, 2, 2, 1, 2, 2, 2, 1,
|
||||
1, 1, 2, 1, 2, 1, 1, 1, 1, 2,
|
||||
0, 1, 1, 2, 2, 4, 3, 6, 0, 0,
|
||||
2, 1, 2, 0, 2};
|
||||
4, 1, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 1, 2, 2, 1, 2, 2, 2, 1,
|
||||
1, 1, 2, 1, 2, 1, 1, 1, 1, 2,
|
||||
0, 1, 1, 2, 2, 4, 3, 6, 0, 0,
|
||||
2, 1, 2, 0, 2
|
||||
};
|
||||
|
||||
const short grammar::action_default [] = {
|
||||
44, 2, 44, 0, 0, 0, 0, 13, 0, 0,
|
||||
3, 0, 0, 0, 8, 10, 11, 9, 7, 6,
|
||||
12, 20, 22, 0, 21, 0, 44, 31, 0, 14,
|
||||
26, 24, 23, 25, 4, 33, 1, 0, 34, 44,
|
||||
35, 42, 39, 40, 0, 31, 44, 40, 43, 0,
|
||||
31, 41, 29, 27, 28, 32, 38, 30, 36, 31,
|
||||
37, 5, 44, 16, 15, 18, 19, 17, 45};
|
||||
44, 2, 44, 0, 0, 0, 0, 13, 0, 0,
|
||||
3, 0, 0, 0, 8, 10, 11, 9, 7, 6,
|
||||
12, 20, 22, 0, 21, 0, 44, 31, 0, 14,
|
||||
26, 24, 23, 25, 4, 33, 1, 0, 34, 44,
|
||||
35, 42, 39, 40, 0, 31, 44, 40, 43, 0,
|
||||
31, 41, 29, 27, 28, 32, 38, 30, 36, 31,
|
||||
37, 5, 44, 16, 15, 18, 19, 17, 45
|
||||
};
|
||||
|
||||
const short grammar::goto_default [] = {
|
||||
3, 2, 13, 26, 36, 41, 10, 27, 61, 29,
|
||||
64, 63, 23, 32, 31, 52, 55, 38, 39, 42,
|
||||
43, 59, 44, 0};
|
||||
3, 2, 13, 26, 36, 41, 10, 27, 61, 29,
|
||||
64, 63, 23, 32, 31, 52, 55, 38, 39, 42,
|
||||
43, 59, 44, 0
|
||||
};
|
||||
|
||||
const short grammar::action_index [] = {
|
||||
-22, -22, 54, 1, 5, 15, 20, -22, -1, 6,
|
||||
-22, 3, 2, 35, -22, -22, -22, -22, -22, -22,
|
||||
-22, -22, -22, 10, -22, 7, -22, 14, 9, -22,
|
||||
-22, -22, 8, -22, -22, -22, 11, -2, -22, -22,
|
||||
-22, -22, -3, 16, 13, 14, -22, 17, -22, 4,
|
||||
14, -22, -22, -22, -22, 14, -22, -22, -22, 14,
|
||||
-22, -22, 0, -22, 12, -22, -22, -22, -22,
|
||||
-22, -22, 30, 1, 2, 3, 4, -22, 5, 6,
|
||||
-22, 8, -1, 35, -22, -22, -22, -22, -22, -22,
|
||||
-22, -22, -22, 13, -22, 7, -22, -2, 20, -22,
|
||||
-22, -22, 11, -22, -22, -22, 15, -6, -22, -22,
|
||||
-22, -22, -3, 19, -4, 12, -22, 18, -22, 10,
|
||||
-2, -22, -22, -22, -22, -2, -22, -22, -22, -2,
|
||||
-22, -22, 0, -22, 20, -22, -22, -22, -22,
|
||||
|
||||
2, -24, -2, -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, -14, -24, -24, -24, -24, -24, -24, -24,
|
||||
-24, -24, -24, -24, -24, 0, -16, -15, -24, -24,
|
||||
15, -24, -24, -24, -24, -10, -24, -24, -24, 1,
|
||||
-24, -24, -3, -24, -1, -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, -2, -24, -24, -24,
|
||||
-24, -24, -7, -24, -24, -24, -24, -24, -24, -24,
|
||||
-24, -24, -24, -24, -24, 17, -19, -11, -24, -24,
|
||||
1, -24, -24, -24, -24, -15, -24, -24, -24, -6,
|
||||
-24, -24, -1, -24, -5, -24, -24, -24, -24
|
||||
};
|
||||
|
||||
const short grammar::action_info [] = {
|
||||
17, 68, 66, 20, 19, 51, 14, 18, 34, 30,
|
||||
62, 30, 37, 62, 40, 45, 15, 48, 48, 0,
|
||||
0, 16, 0, 0, 0, 0, 0, 49, 49, 0,
|
||||
46, 0, 0, 53, 54, 0, 0, 0, 0, 0,
|
||||
0, 0, 21, 0, 22, 0, 0, 24, 25, 28,
|
||||
0, 0, 0, 0, 0, 0, 0, 4, 5, 6,
|
||||
8, 0, 9, 0, 11, 0, 0, 0, 0, 12,
|
||||
0, 0, 0, 0, 0, 0,
|
||||
20, 68, 66, 14, 15, 16, 17, 18, 34, 19,
|
||||
40, 51, 30, 46, 30, 45, 37, 53, 54, 48,
|
||||
48, 62, 0, 0, 0, 0, 0, 0, 0, 49,
|
||||
49, 53, 54, 4, 5, 6, 8, 0, 9, 0,
|
||||
11, 0, 21, 0, 22, 12, 0, 24, 25, 28,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
|
||||
33, 35, 65, 7, 47, 57, 50, 1, 58, 60,
|
||||
67, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 56, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
57, 47, 60, 35, 65, 1, 67, 33, 7, 56,
|
||||
50, 0, 0, 0, 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
|
||||
};
|
||||
|
||||
const short grammar::action_check [] = {
|
||||
1, 0, 2, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 16, 18, 1, 1, 1, -1,
|
||||
-1, 1, -1, -1, -1, -1, -1, 11, 11, -1,
|
||||
17, -1, -1, 19, 20, -1, -1, -1, -1, -1,
|
||||
-1, -1, 7, -1, 9, -1, -1, 12, 13, 14,
|
||||
-1, -1, -1, -1, -1, -1, -1, 3, 4, 5,
|
||||
6, -1, 8, -1, 10, -1, -1, -1, -1, 15,
|
||||
-1, -1, -1, -1, -1, -1,
|
||||
1, 0, 2, 1, 1, 1, 1, 1, 1, 1,
|
||||
16, 1, 1, 17, 1, 18, 1, 19, 20, 1,
|
||||
1, 1, -1, -1, -1, -1, -1, -1, -1, 11,
|
||||
11, 19, 20, 3, 4, 5, 6, -1, 8, -1,
|
||||
10, -1, 7, -1, 9, 15, -1, 12, 13, 14,
|
||||
-1, -1, -1, -1, -1, -1, -1,
|
||||
|
||||
14, 5, 5, 5, 20, 15, 21, 5, 8, 8,
|
||||
11, -1, -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};
|
||||
15, 20, 8, 5, 5, 5, 11, 14, 5, 8,
|
||||
21, -1, -1, -1, -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
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -48,68 +48,68 @@ QT_BEGIN_NAMESPACE
|
||||
class grammar
|
||||
{
|
||||
public:
|
||||
enum VariousConstants {
|
||||
EOF_SYMBOL = 0,
|
||||
COLON = 16,
|
||||
DECL = 19,
|
||||
DECL_FILE = 3,
|
||||
ERROR = 21,
|
||||
EXPECT = 4,
|
||||
EXPECT_RR = 5,
|
||||
ID = 1,
|
||||
IMPL = 20,
|
||||
IMPL_FILE = 6,
|
||||
LEFT = 7,
|
||||
MERGED_OUTPUT = 8,
|
||||
NONASSOC = 9,
|
||||
OR = 17,
|
||||
PARSER = 10,
|
||||
PREC = 11,
|
||||
RIGHT = 12,
|
||||
SEMICOLON = 18,
|
||||
START = 13,
|
||||
STRING_LITERAL = 2,
|
||||
TOKEN = 14,
|
||||
TOKEN_PREFIX = 15,
|
||||
enum VariousConstants {
|
||||
EOF_SYMBOL = 0,
|
||||
COLON = 16,
|
||||
DECL = 19,
|
||||
DECL_FILE = 3,
|
||||
ERROR = 21,
|
||||
EXPECT = 4,
|
||||
EXPECT_RR = 5,
|
||||
ID = 1,
|
||||
IMPL = 20,
|
||||
IMPL_FILE = 6,
|
||||
LEFT = 7,
|
||||
MERGED_OUTPUT = 8,
|
||||
NONASSOC = 9,
|
||||
OR = 17,
|
||||
PARSER = 10,
|
||||
PREC = 11,
|
||||
RIGHT = 12,
|
||||
SEMICOLON = 18,
|
||||
START = 13,
|
||||
STRING_LITERAL = 2,
|
||||
TOKEN = 14,
|
||||
TOKEN_PREFIX = 15,
|
||||
|
||||
ACCEPT_STATE = 68,
|
||||
RULE_COUNT = 45,
|
||||
STATE_COUNT = 69,
|
||||
TERMINAL_COUNT = 22,
|
||||
NON_TERMINAL_COUNT = 24,
|
||||
ACCEPT_STATE = 68,
|
||||
RULE_COUNT = 45,
|
||||
STATE_COUNT = 69,
|
||||
TERMINAL_COUNT = 22,
|
||||
NON_TERMINAL_COUNT = 24,
|
||||
|
||||
GOTO_INDEX_OFFSET = 69,
|
||||
GOTO_INFO_OFFSET = 76,
|
||||
GOTO_CHECK_OFFSET = 76
|
||||
};
|
||||
GOTO_INDEX_OFFSET = 69,
|
||||
GOTO_INFO_OFFSET = 57,
|
||||
GOTO_CHECK_OFFSET = 57
|
||||
};
|
||||
|
||||
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)
|
||||
{
|
||||
const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt;
|
||||
if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt)
|
||||
return goto_default [nt];
|
||||
static inline int nt_action (int state, int nt)
|
||||
{
|
||||
const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt;
|
||||
if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != 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)
|
||||
{
|
||||
const int yyn = action_index [state] + token;
|
||||
static inline int t_action (int state, int token)
|
||||
{
|
||||
const int yyn = action_index [state] + token;
|
||||
|
||||
if (yyn < 0 || action_check [yyn] != token)
|
||||
return - action_default [state];
|
||||
if (yyn < 0 || action_check [yyn] != token)
|
||||
return - action_default [state];
|
||||
|
||||
return action_info [yyn];
|
||||
}
|
||||
return action_info [yyn];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -61,8 +61,7 @@
|
||||
%start Specification
|
||||
|
||||
|
||||
/:
|
||||
/****************************************************************************
|
||||
/:/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
@ -163,8 +162,7 @@ protected:
|
||||
};
|
||||
:/
|
||||
|
||||
/.
|
||||
/****************************************************************************
|
||||
/./****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
@ -344,7 +342,8 @@ int Recognizer::nextToken()
|
||||
|
||||
text.clear ();
|
||||
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 ':'
|
||||
|
||||
forever
|
||||
@ -381,7 +380,8 @@ int Recognizer::nextToken()
|
||||
|
||||
text.clear ();
|
||||
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 ':'
|
||||
|
||||
|
@ -178,8 +178,8 @@ int Recognizer::nextToken()
|
||||
|
||||
text.clear ();
|
||||
if (! _M_no_lines)
|
||||
text += QLatin1String("\n#line ") + QString::number (_M_action_line)
|
||||
+ QLatin1String(" \"") + _M_input_file + QLatin1String("\"\n");
|
||||
text += QLatin1String("\n#line ") + QString::number(_M_action_line) +
|
||||
QLatin1String(" \"") + _M_input_file + QLatin1String("\"\n");
|
||||
inp (); // skip ':'
|
||||
|
||||
forever
|
||||
@ -216,7 +216,7 @@ int Recognizer::nextToken()
|
||||
|
||||
text.clear ();
|
||||
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");
|
||||
|
||||
inp (); // skip ':'
|
||||
|
Loading…
Reference in New Issue
Block a user