1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2015 The Qt Company Ltd. 4 ** Contact: http://www.qt.io/licensing/ 5 ** 6 ** This file is part of the utils of the Qt Toolkit. 7 ** 8 ** $QT_BEGIN_LICENSE:LGPL$ 9 ** Commercial License Usage 10 ** Licensees holding valid commercial Qt licenses may use this file in 11 ** accordance with the commercial license agreement provided with the 12 ** Software or, alternatively, in accordance with the terms contained in 13 ** a written agreement between you and The Qt Company. For licensing terms 14 ** and conditions see http://www.qt.io/terms-conditions. For further 15 ** information use the contact form at http://www.qt.io/contact-us. 16 ** 17 ** GNU Lesser General Public License Usage 18 ** Alternatively, this file may be used under the terms of the GNU Lesser 19 ** General Public License version 2.1 or version 3 as published by the Free 20 ** Software Foundation and appearing in the file LICENSE.LGPLv21 and 21 ** LICENSE.LGPLv3 included in the packaging of this file. Please review the 22 ** following information to ensure the GNU Lesser General Public License 23 ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and 24 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 25 ** 26 ** As a special exception, The Qt Company gives you certain additional 27 ** rights. These rights are described in The Qt Company LGPL Exception 28 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 29 ** 30 ** GNU General Public License Usage 31 ** Alternatively, this file may be used under the terms of the GNU 32 ** General Public License version 3.0 as published by the Free Software 33 ** Foundation and appearing in the file LICENSE.GPL included in the 34 ** packaging of this file. Please review the following information to 35 ** ensure the GNU General Public License version 3.0 requirements will be 36 ** met: http://www.gnu.org/copyleft/gpl.html. 37 ** 38 ** $QT_END_LICENSE$ 39 ** 40 ****************************************************************************/ 41 42 #ifndef GRAMMAR_P_H 43 #define GRAMMAR_P_H 44 45 class grammar 46 { 47 public: 48 enum { 49 EOF_SYMBOL = 0, 50 COLON = 16, 51 DECL = 19, 52 DECL_FILE = 3, 53 ERROR = 21, 54 EXPECT = 4, 55 EXPECT_RR = 5, 56 ID = 1, 57 IMPL = 20, 58 IMPL_FILE = 6, 59 LEFT = 7, 60 MERGED_OUTPUT = 8, 61 NONASSOC = 9, 62 OR = 17, 63 PARSER = 10, 64 PREC = 11, 65 RIGHT = 12, 66 SEMICOLON = 18, 67 START = 13, 68 STRING_LITERAL = 2, 69 TOKEN = 14, 70 TOKEN_PREFIX = 15, 71 72 ACCEPT_STATE = 68, 73 RULE_COUNT = 45, 74 STATE_COUNT = 69, 75 TERMINAL_COUNT = 22, 76 NON_TERMINAL_COUNT = 24, 77 78 GOTO_INDEX_OFFSET = 69, 79 GOTO_INFO_OFFSET = 76, 80 GOTO_CHECK_OFFSET = 76 81 }; 82 83 static const char *const spell []; 84 static const int lhs []; 85 static const int rhs []; 86 static const int goto_default []; 87 static const int action_default []; 88 static const int action_index []; 89 static const int action_info []; 90 static const int action_check []; 91 nt_action(int state,int nt)92 inline int nt_action (int state, int nt) const 93 { 94 const int *const goto_index = &action_index [GOTO_INDEX_OFFSET]; 95 const int *const goto_check = &action_check [GOTO_CHECK_OFFSET]; 96 97 const int yyn = goto_index [state] + nt; 98 99 if (yyn < 0 || goto_check [yyn] != nt) 100 return goto_default [nt]; 101 102 const int *const goto_info = &action_info [GOTO_INFO_OFFSET]; 103 return goto_info [yyn]; 104 } 105 t_action(int state,int token)106 inline int t_action (int state, int token) const 107 { 108 const int yyn = action_index [state] + token; 109 110 if (yyn < 0 || action_check [yyn] != token) 111 return - action_default [state]; 112 113 return action_info [yyn]; 114 } 115 }; 116 117 118 #endif // GRAMMAR_P_H 119 120