Coverage Report

Created: 2025-02-15 06:25

/work/build/epan/protobuf_lang_parser.c
Line
Count
Source (jump to first uncovered line)
1
/* This file is automatically generated by Lemon from input grammar
2
** source file "/src/wireshark/epan/protobuf_lang_parser.lemon". */
3
/* protobuf_lang_parser.lemon
4
 *
5
 * C Protocol Buffers Language (PBL) Parser (for *.proto files)
6
 * Copyright 2020, Huang Qiangxiong <qiangxiong.huang@qq.com>
7
 *
8
 * SPDX-License-Identifier: GPL-2.0-or-later
9
 */
10
11
/* This parser is mainly to get MESSAGE, ENUM, and FIELD information from *.proto files.
12
 * There are three formats of *.proto files:
13
 * 1) Protocol Buffers Edition 2023 Language Specification
14
 *      https://protobuf.dev/reference/protobuf/edition-2023-spec
15
 * 2) Protocol Buffers Version 3 Language Specification:
16
 *      https://developers.google.com/protocol-buffers/docs/reference/proto3-spec
17
 * 3) Protocol Buffers Version 2 Language Specification:
18
 *      https://developers.google.com/protocol-buffers/docs/reference/proto2-spec
19
 * There are some errors about 'proto', 'option' (value), 'extensions',  and 'reserved' (fieldName) definitions on that sites.
20
 * This parser is created because Wireshark is mainly implemented in plain ANSI C but the official
21
 * Protocol Buffers Language parser is implemented in C++.
22
 */
23
#include "config.h"
24
#include <stdio.h>
25
#include <stdlib.h>
26
#include <string.h>
27
#include <stdarg.h>
28
#include <glib.h>
29
#include <assert.h>
30
#include <ws_diag_control.h>
31
#include <wsutil/file_util.h>
32
#include "protobuf_lang_tree.h"
33
#include "protobuf_lang_parser.h"
34
#include "protobuf_lang_scanner_lex.h"
35
36
0
#define NAME_TO_BE_SET "<NAME_TO_BE_SET>"
37
0
#define NEED_NOT_NAME "<NEED_NOT_NAME>"
38
39
static void *ProtobufLangParserAlloc(void *(*mallocProc)(size_t));
40
static void ProtobufLangParser(void *yyp, int yymajor, protobuf_lang_token_t *yyminor, protobuf_lang_state_t *state);
41
static void ProtobufLangParserFree(void *p, void (*freeProc)(void*));
42
43
/* Error handling function for parser */
44
void protobuf_lang_error(void* yyscanner, protobuf_lang_state_t *state, const char *msg);
45
46
/* Extended error handling function */
47
void pbl_parser_error(protobuf_lang_state_t *state, const char *fmt, ...);
48
49
/* It's just the approximate line number which is gotten when a grammar rule is reduced
50
   by the parser (lemon). That might be overridden by the lineno argument of
51
   pbl_set_node_name() later. */
52
0
#define CUR_LINENO (protobuf_lang_get_lineno(state->scanner))
53
54
DIAG_OFF_LEMON()
55
#line 81 "./protobuf_lang_parser.c"
56
/**************** End of %include directives **********************************/
57
/* These constants specify the various numeric values for terminal symbols.
58
***************** Begin token definitions *************************************/
59
#ifndef PT_IDENT
60
#define PT_IDENT                        1
61
#define PT_SYNTAX                       2
62
#define PT_EDITION                      3
63
#define PT_IMPORT                       4
64
#define PT_WEAK                         5
65
#define PT_PUBLIC                       6
66
#define PT_PACKAGE                      7
67
#define PT_OPTION                       8
68
#define PT_REQUIRED                     9
69
#define PT_OPTIONAL                    10
70
#define PT_REPEATED                    11
71
#define PT_ONEOF                       12
72
#define PT_MAP                         13
73
#define PT_RESERVED                    14
74
#define PT_ENUM                        15
75
#define PT_GROUP                       16
76
#define PT_EXTEND                      17
77
#define PT_EXTENSIONS                  18
78
#define PT_MESSAGE                     19
79
#define PT_SERVICE                     20
80
#define PT_RPC                         21
81
#define PT_STREAM                      22
82
#define PT_RETURNS                     23
83
#define PT_TO                          24
84
#define PT_ASSIGN                      25
85
#define PT_SEMICOLON                   26
86
#define PT_STRLIT                      27
87
#define PT_LPAREN                      28
88
#define PT_RPAREN                      29
89
#define PT_DOT                         30
90
#define PT_LCURLY                      31
91
#define PT_RCURLY                      32
92
#define PT_LBRACKET                    33
93
#define PT_RBRACKET                    34
94
#define PT_EQUAL                       35
95
#define PT_NOTEQUAL                    36
96
#define PT_NOTEQUAL2                   37
97
#define PT_GEQUAL                      38
98
#define PT_LEQUAL                      39
99
#define PT_ASSIGN_PLUS                 40
100
#define PT_PLUS                        41
101
#define PT_MINUS                       42
102
#define PT_MULTIPLY                    43
103
#define PT_DIV                         44
104
#define PT_LOGIC_OR                    45
105
#define PT_OR                          46
106
#define PT_LOGIC_AND                   47
107
#define PT_AND                         48
108
#define PT_NOT                         49
109
#define PT_NEG                         50
110
#define PT_XOR                         51
111
#define PT_SHL                         52
112
#define PT_SHR                         53
113
#define PT_PERCENT                     54
114
#define PT_DOLLAR                      55
115
#define PT_COND                        56
116
#define PT_COMMA                       57
117
#define PT_COLON                       58
118
#define PT_LESS                        59
119
#define PT_GREATER                     60
120
#define PT_DECIMALLIT                  61
121
#define PT_OCTALLIT                    62
122
#define PT_HEXLIT                      63
123
#endif
124
/**************** End token definitions ***************************************/
125
126
/* The next sections is a series of control #defines.
127
** various aspects of the generated parser.
128
**    YYCODETYPE         is the data type used to store the integer codes
129
**                       that represent terminal and non-terminal symbols.
130
**                       "unsigned char" is used if there are fewer than
131
**                       256 symbols.  Larger types otherwise.
132
**    YYNOCODE           is a number of type YYCODETYPE that is not used for
133
**                       any terminal or nonterminal symbol.
134
**    YYFALLBACK         If defined, this indicates that one or more tokens
135
**                       (also known as: "terminal symbols") have fall-back
136
**                       values which should be used if the original symbol
137
**                       would not parse.  This permits keywords to sometimes
138
**                       be used as identifiers, for example.
139
**    YYACTIONTYPE       is the data type used for "action codes" - numbers
140
**                       that indicate what to do in response to the next
141
**                       token.
142
**    ProtobufLangParserTOKENTYPE     is the data type used for minor type for terminal
143
**                       symbols.  Background: A "minor type" is a semantic
144
**                       value associated with a terminal or non-terminal
145
**                       symbols.  For example, for an "ID" terminal symbol,
146
**                       the minor type might be the name of the identifier.
147
**                       Each non-terminal can have a different minor type.
148
**                       Terminal symbols all have the same minor type, though.
149
**                       This macros defines the minor type for terminal
150
**                       symbols.
151
**    YYMINORTYPE        is the data type used for all minor types.
152
**                       This is typically a union of many types, one of
153
**                       which is ProtobufLangParserTOKENTYPE.  The entry in the union
154
**                       for terminal symbols is called "yy0".
155
**    YYSTACKDEPTH       is the maximum depth of the parser's stack.  If
156
**                       zero the stack is dynamically sized using realloc()
157
**    ProtobufLangParserARG_SDECL     A static variable declaration for the %extra_argument
158
**    ProtobufLangParserARG_PDECL     A parameter declaration for the %extra_argument
159
**    ProtobufLangParserARG_PARAM     Code to pass %extra_argument as a subroutine parameter
160
**    ProtobufLangParserARG_STORE     Code to store %extra_argument into yypParser
161
**    ProtobufLangParserARG_FETCH     Code to extract %extra_argument from yypParser
162
**    ProtobufLangParserCTX_*         As ProtobufLangParserARG_ except for %extra_context
163
**    YYERRORSYMBOL      is the code number of the error symbol.  If not
164
**                       defined, then do no error processing.
165
**    YYNSTATE           the combined number of states.
166
**    YYNRULE            the number of rules in the grammar
167
**    YYNTOKEN           Number of terminal symbols
168
**    YY_MAX_SHIFT       Maximum value for shift actions
169
**    YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions
170
**    YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions
171
**    YY_ERROR_ACTION    The yy_action[] code for syntax error
172
**    YY_ACCEPT_ACTION   The yy_action[] code for accept
173
**    YY_NO_ACTION       The yy_action[] code for no-op
174
**    YY_MIN_REDUCE      Minimum value for reduce actions
175
**    YY_MAX_REDUCE      Maximum value for reduce actions
176
*/
177
#ifndef INTERFACE
178
# define INTERFACE 1
179
#endif
180
/************* Begin control #defines *****************************************/
181
0
#define YYCODETYPE unsigned char
182
#define YYNOCODE 131
183
0
#define YYACTIONTYPE unsigned short int
184
#define ProtobufLangParserTOKENTYPE  protobuf_lang_token_t* 
185
typedef union {
186
  int yyinit;
187
  ProtobufLangParserTOKENTYPE yy0;
188
  pbl_node_t* yy93;
189
  int yy116;
190
  protobuf_lang_token_t* yy118;
191
  uint64_t yy180;
192
  gchar* yy254;
193
} YYMINORTYPE;
194
#ifndef YYSTACKDEPTH
195
0
#define YYSTACKDEPTH 100
196
#endif
197
#define ProtobufLangParserARG_SDECL  protobuf_lang_state_t *state ;
198
#define ProtobufLangParserARG_PDECL , protobuf_lang_state_t *state 
199
#define ProtobufLangParserARG_PARAM ,state 
200
0
#define ProtobufLangParserARG_FETCH  protobuf_lang_state_t *state =yypParser->state ;
201
0
#define ProtobufLangParserARG_STORE yypParser->state =state ;
202
#define ProtobufLangParserCTX_SDECL
203
#define ProtobufLangParserCTX_PDECL
204
#define ProtobufLangParserCTX_PARAM
205
#define ProtobufLangParserCTX_FETCH
206
#define ProtobufLangParserCTX_STORE
207
#define YYFALLBACK 1
208
#define YYNSTATE             166
209
#define YYNRULE              191
210
#define YYNRULE_WITH_ACTION  77
211
#define YYNTOKEN             64
212
0
#define YY_MAX_SHIFT         165
213
0
#define YY_MIN_SHIFTREDUCE   338
214
0
#define YY_MAX_SHIFTREDUCE   528
215
#define YY_ERROR_ACTION      529
216
0
#define YY_ACCEPT_ACTION     530
217
#define YY_NO_ACTION         531
218
0
#define YY_MIN_REDUCE        532
219
#define YY_MAX_REDUCE        722
220
/************* End control #defines *******************************************/
221
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
222
223
/* Define the yytestcase() macro to be a no-op if is not already defined
224
** otherwise.
225
**
226
** Applications can choose to define yytestcase() in the %include section
227
** to a macro that can assist in verifying code coverage.  For production
228
** code the yytestcase() macro should be turned off.  But it is useful
229
** for testing.
230
*/
231
#ifndef yytestcase
232
# define yytestcase(X)
233
#endif
234
235
236
/* Next are the tables used to determine what action to take based on the
237
** current state and lookahead token.  These tables are used to implement
238
** functions that take a state number and lookahead value and return an
239
** action integer.
240
**
241
** Suppose the action integer is N.  Then the action is determined as
242
** follows
243
**
244
**   0 <= N <= YY_MAX_SHIFT             Shift N.  That is, push the lookahead
245
**                                      token onto the stack and goto state N.
246
**
247
**   N between YY_MIN_SHIFTREDUCE       Shift to an arbitrary state then
248
**     and YY_MAX_SHIFTREDUCE           reduce by rule N-YY_MIN_SHIFTREDUCE.
249
**
250
**   N == YY_ERROR_ACTION               A syntax error has occurred.
251
**
252
**   N == YY_ACCEPT_ACTION              The parser accepts its input.
253
**
254
**   N == YY_NO_ACTION                  No such action.  Denotes unused
255
**                                      slots in the yy_action[] table.
256
**
257
**   N between YY_MIN_REDUCE            Reduce by rule N-YY_MIN_REDUCE
258
**     and YY_MAX_REDUCE
259
**
260
** The action table is constructed as a single large table named yy_action[].
261
** Given state S and lookahead X, the action is computed as either:
262
**
263
**    (A)   N = yy_action[ yy_shift_ofst[S] + X ]
264
**    (B)   N = yy_default[S]
265
**
266
** The (A) formula is preferred.  The B formula is used instead if
267
** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X.
268
**
269
** The formulas above are for computing the action when the lookahead is
270
** a terminal symbol.  If the lookahead is a non-terminal (as occurs after
271
** a reduce action) then the yy_reduce_ofst[] array is used in place of
272
** the yy_shift_ofst[] array.
273
**
274
** The following are the tables generated in this section:
275
**
276
**  yy_action[]        A single table containing all actions.
277
**  yy_lookahead[]     A table containing the lookahead for each entry in
278
**                     yy_action.  Used to detect hash collisions.
279
**  yy_shift_ofst[]    For each state, the offset into yy_action for
280
**                     shifting terminals.
281
**  yy_reduce_ofst[]   For each state, the offset into yy_action for
282
**                     shifting non-terminals after a reduce.
283
**  yy_default[]       Default action for each state.
284
**
285
*********** Begin parsing tables **********************************************/
286
#define YY_ACTTAB_COUNT (516)
287
static const YYACTIONTYPE yy_action[] = {
288
 /*     0 */   557,  528,  155,  578,  113,  112,  577,   97,  577,   99,
289
 /*    10 */   577,  141,  577,  143,  577,  101,  577,  103,  135,   39,
290
 /*    20 */    39,  592,  687,  688,  528,  444,  461,  430,  434,  435,
291
 /*    30 */   462,   90,  427,  436,  437,  438,  439,  440,  441,  442,
292
 /*    40 */   443,  445,  446,  447,  448,  449,  450,  451,  452,  453,
293
 /*    50 */   454,  455,  456,  457,  458,  459,  460,  463,  464,  465,
294
 /*    60 */   466,  404,  405,  406,  528,   39,  528,   27,   27,  528,
295
 /*    70 */    25,   25,  379,  380,  381,   60,  136,    5,   66,   61,
296
 /*    80 */    55,   24,   67,  562,   94,  682,  683,   50,  526,  526,
297
 /*    90 */   133,  528,  563,   93,  491,  389,   77,  133,   25,  379,
298
 /*   100 */   380,  381,   60,  136,    5,   66,   61,   55,   24,   67,
299
 /*   110 */   397,  677,  678,   27,   33,   33,  526,   15,  528,  404,
300
 /*   120 */   405,  406,  390,   95,   95,   25,  379,  380,  381,   60,
301
 /*   130 */   136,    5,   66,   61,   55,   24,   67,   46,   64,  559,
302
 /*   140 */    96,  579,  576,  526,   25,   25,  535,  535,   63,  350,
303
 /*   150 */   623,  541,  576,  535,    4,  548,  535,   53,   49,  546,
304
 /*   160 */    33,  547,  526,  526,   27,   27,  535,   70,  366,  486,
305
 /*   170 */   550,  129,  551,  549,  665,  613,  614,  615,  616,  129,
306
 /*   180 */   530,  165,   69,   68,  626,  667,  669,  404,  405,  406,
307
 /*   190 */    73,  666,  668,   78,   25,  627,  150,  543,  625,  558,
308
 /*   200 */   153,   66,  149,   55,  528,   67,   54,  149,  528,  706,
309
 /*   210 */    27,  153,  526,   33,   33,   25,  379,  380,  381,  139,
310
 /*   220 */    59,  696,  606,   61,  576,  528,  703,  117,   36,   36,
311
 /*   230 */   413,  117,   91,  526,   90,  542,  153,   91,  528,  391,
312
 /*   240 */   580,  128,  587,  705,   38,   37,  379,  380,  381,  605,
313
 /*   250 */   128,  413,  156,   61,  134,  691,  604,  105,  576,   33,
314
 /*   260 */   104,  151,  105,  526,  404,  405,  406,  690,  692,  399,
315
 /*   270 */    46,   64,  160,  554,   36,  576,  138,  697,  601,  106,
316
 /*   280 */   106,  138,  140,  603,  160,  404,  405,  406,  140,  581,
317
 /*   290 */   601,  119,  595,  597,  109,  671,  672,  528,  160,  124,
318
 /*   300 */   528,  597,  670,  675,  601,  413,  596,   25,   79,   80,
319
 /*   310 */   160,  157,  602,    5,  157,  162,  601,   33,   33,  711,
320
 /*   320 */    72,   71,  528,  698,  602,  526,   33,   33,   33,   33,
321
 /*   330 */   413,  358,   36,   36,  127,  582,  597,   62,  602,   92,
322
 /*   340 */   404,  405,  406,   98,  579,  528,  528,  528,  152,  676,
323
 /*   350 */   602,  159,  100,  579,  102,  579,  528,  404,  405,  406,
324
 /*   360 */   499,  161,  115,   33,  597,  528,   52,   14,   51,  116,
325
 /*   370 */     9,  597,   33,   77,   33,   76,  528,  118,   36,  597,
326
 /*   380 */    10,   77,  163,   77,  674,   76,  122,  142,  597,   11,
327
 /*   390 */   107,   42,   77,  123,   76,  597,  130,  142,  597,  144,
328
 /*   400 */    12,  146,  148,   77,    4,   76,  146,  148,  710,  144,
329
 /*   410 */   131,    4,  158,  710,  158,  339,  414,   40,  490,  485,
330
 /*   420 */   132,  137,  395,   81,   82,  377,  108,  506,  145,   16,
331
 /*   430 */   375,  114,   17,   21,  147,  505,  154,   18,  164,  344,
332
 /*   440 */   414,  343,  414,   22,   22,  342,  414,   41,    6,    8,
333
 /*   450 */     7,   22,    1,    2,    3,   13,   20,   22,   75,   23,
334
 /*   460 */   418,  111,  110,   74,  611,   47,   42,  120,  374,   48,
335
 /*   470 */    56,  373,  371,   43,  125,  121,  372,  370,   44,   57,
336
 /*   480 */    83,  126,   45,  500,   84,  396,   28,   58,  394,   62,
337
 /*   490 */    29,   85,   30,   31,   86,  378,   32,   87,  376,   34,
338
 /*   500 */    35,   88,  414,  507,  361,  610,   26,  609,  531,  424,
339
 /*   510 */    89,  346,   65,   19,  423,  345,
340
};
341
static const YYCODETYPE yy_lookahead[] = {
342
 /*     0 */   104,    1,  106,  104,    2,    3,  104,  105,  104,  105,
343
 /*    10 */   104,  105,  104,  105,  104,  105,  104,  105,   67,   70,
344
 /*    20 */    71,   70,  113,  114,    1,   25,   26,   27,   28,   29,
345
 /*    30 */    30,   31,   32,   33,   34,   35,   36,   37,   38,   39,
346
 /*    40 */    40,   41,   42,   43,   44,   45,   46,   47,   48,   49,
347
 /*    50 */    50,   51,   52,   53,   54,   55,   56,   57,   58,   59,
348
 /*    60 */    60,   61,   62,   63,    1,  116,    1,   70,   71,    1,
349
 /*    70 */     8,    8,    9,   10,   11,   12,   13,   14,   15,   16,
350
 /*    80 */    17,   18,   19,   85,   86,  113,  114,   22,   26,   26,
351
 /*    90 */    70,    1,   94,   95,   32,   32,   28,   77,    8,    9,
352
 /*   100 */    10,   11,   12,   13,   14,   15,   16,   17,   18,   19,
353
 /*   110 */    26,  113,  114,  116,   70,   71,   26,   33,    1,   61,
354
 /*   120 */    62,   63,   32,  126,  127,    8,    9,   10,   11,   12,
355
 /*   130 */    13,   14,   15,   16,   17,   18,   19,   65,   66,  104,
356
 /*   140 */    96,   97,   70,   26,    8,    8,   82,   83,   66,   32,
357
 /*   150 */    70,   70,   70,   89,   81,   83,   92,   21,   22,   87,
358
 /*   160 */   116,   89,   26,   26,   70,   71,  102,   41,   32,   32,
359
 /*   170 */    98,   70,  100,  101,  102,  111,  112,  113,  114,   78,
360
 /*   180 */   107,  108,  109,  110,  104,  113,  114,   61,   62,   63,
361
 /*   190 */     4,  119,  120,    7,    8,  115,   64,  116,  118,  104,
362
 /*   200 */   104,   15,   70,   17,    1,   19,   20,   75,    1,   70,
363
 /*   210 */   116,  104,   26,   70,   71,    8,    9,   10,   11,   65,
364
 /*   220 */    66,  127,   70,   16,   70,    1,  130,   70,   70,   71,
365
 /*   230 */    27,   74,  125,   26,   31,  116,  104,  130,    1,   32,
366
 /*   240 */    97,   70,   88,  104,   41,   42,    9,   10,   11,   70,
367
 /*   250 */    79,   27,   70,   16,   66,  101,  104,  125,   70,  116,
368
 /*   260 */   128,  129,  130,   26,   61,   62,   63,  113,  114,   32,
369
 /*   270 */    65,   66,   64,   91,  116,   70,   70,   69,   70,  121,
370
 /*   280 */   122,   75,   70,  104,   64,   61,   62,   63,   76,   69,
371
 /*   290 */    70,   68,   87,   70,   64,  113,  114,    1,   64,   68,
372
 /*   300 */     1,   70,  120,   69,   70,   27,  101,    8,    5,    6,
373
 /*   310 */    64,   70,  104,   14,   73,   69,   70,   70,   71,  114,
374
 /*   320 */    41,   42,    1,  115,  104,   26,   70,   71,   70,   71,
375
 /*   330 */    27,   32,   70,   71,   68,  115,   70,   16,  104,   64,
376
 /*   340 */    61,   62,   63,   96,   97,    1,    1,    1,   64,  115,
377
 /*   350 */   104,   70,   96,   97,   96,   97,    1,   61,   62,   63,
378
 /*   360 */    26,  115,   68,  116,   70,    1,   22,   33,   22,   68,
379
 /*   370 */    25,   70,  116,   28,  116,   30,    1,   68,  116,   70,
380
 /*   380 */    25,   28,   70,   28,  122,   30,   68,   70,   70,   25,
381
 /*   390 */    64,   57,   28,   68,   30,   70,   68,   80,   70,   70,
382
 /*   400 */    25,   70,   70,   28,   81,   30,   75,   75,   70,   80,
383
 /*   410 */    34,   81,   70,   75,   72,   26,   27,  124,   26,   26,
384
 /*   420 */    34,   34,   26,   31,   31,   26,   64,   26,   34,   33,
385
 /*   430 */    26,  108,   33,   57,   34,   26,   34,   33,  108,   26,
386
 /*   440 */    27,   26,   27,   57,   57,   26,   27,  123,   99,   93,
387
 /*   450 */   103,   57,   84,   84,   84,   90,  117,   57,   57,   57,
388
 /*   460 */    26,   25,   27,   25,    0,   57,   57,   23,   29,   28,
389
 /*   470 */    60,   29,   29,   28,   23,   29,   29,   29,   28,   57,
390
 /*   480 */    31,   29,   28,   26,   31,   26,   25,   59,   26,   16,
391
 /*   490 */    25,   31,   25,   25,   31,   26,   25,   31,   26,   25,
392
 /*   500 */    24,   31,   27,   26,   26,    0,   25,    0,  131,   26,
393
 /*   510 */    31,   29,   57,   33,   26,   26,  131,  131,  131,  131,
394
 /*   520 */   131,  131,  131,  131,  131,  131,  131,  131,  131,  131,
395
 /*   530 */   131,  131,  131,  131,  131,  131,  131,  131,  131,  131,
396
 /*   540 */   131,  131,  131,  131,  131,  131,  131,  131,  131,  131,
397
 /*   550 */   131,  131,  131,  131,  131,  131,  131,  131,  131,  131,
398
 /*   560 */   131,  131,  131,  131,  131,  131,  131,  131,  131,  131,
399
 /*   570 */   131,  131,  131,  131,  131,  131,  131,  131,  131,  131,
400
};
401
#define YY_SHIFT_COUNT    (165)
402
#define YY_SHIFT_MIN      (0)
403
#define YY_SHIFT_MAX      (507)
404
static const unsigned short int yy_shift_ofst[] = {
405
 /*     0 */     2,   63,   90,  117,  186,  224,  207,  237,  136,  203,
406
 /*    10 */   203,  203,  203,  299,   68,   68,   68,   68,   68,   68,
407
 /*    20 */     0,   68,   68,   68,   58,   68,  279,  345,  126,  126,
408
 /*    30 */   126,  126,  126,  355,  126,  296,  364,  296,  296,  375,
409
 /*    40 */    62,  137,   58,   65,  344,  346,  321,   23,   23,   23,
410
 /*    50 */    23,   23,   23,   23,   23,   23,   23,   23,   23,   23,
411
 /*    60 */    23,   23,   23,   23,   23,   23,   23,   23,  516,  516,
412
 /*    70 */    58,   58,   58,  303,  278,  278,  353,   23,   23,  278,
413
 /*    80 */   278,  516,  516,  516,  516,  516,  516,  516,  516,  516,
414
 /*    90 */   516,  334,  389,  392,  393,  376,  386,   84,  387,  396,
415
 /*   100 */   394,  399,  400,  404,  401,  409,  402,  413,  415,  419,
416
 /*   110 */   434,  435,  436,  438,  464,  439,  408,  441,  442,  443,
417
 /*   120 */   445,  444,  446,  447,  448,  450,  451,  452,  454,  449,
418
 /*   130 */   453,  457,  459,  461,  410,  422,  428,  462,  465,  473,
419
 /*   140 */   460,  463,  467,  466,  468,  469,  471,  472,  474,  455,
420
 /*   150 */   475,  477,  475,  476,  478,  480,  481,  470,  479,  482,
421
 /*   160 */   475,  483,  488,  489,  505,  507,
422
};
423
#define YY_REDUCE_COUNT (90)
424
#define YY_REDUCE_MIN   (-104)
425
#define YY_REDUCE_MAX   (370)
426
static const short yy_reduce_ofst[] = {
427
 /*     0 */    73,   72,   72,   72,   64,  132,  154,  205,   -2,  208,
428
 /*    10 */   220,  234,  246,  182,   -3,   44,  247,  256,  258,  158,
429
 /*    20 */    80,   94,  143,  262,  107,  -51, -104,   81,  -98,  -96,
430
 /*    30 */   -94,  -92,  -90,   81,  -88,  139,   81,  152,  179,   81,
431
 /*    40 */   -91,  -28,   96,  223,  231,  266,   82,  294,  301,  157,
432
 /*    50 */   309,  318,  325,  171,  101,  328,   20,  188,  -49,  206,
433
 /*    60 */   212,  317,  329,  331,  332,  338,  241,  342,  323,  330,
434
 /*    70 */  -101,   35,   95,  230,  275,  284,  119,  281,  312,  326,
435
 /*    80 */   362,  293,  324,  356,  347,  349,  368,  369,  365,  370,
436
 /*    90 */   339,
437
};
438
static const YYACTIONTYPE yy_default[] = {
439
 /*     0 */   534,  529,  529,  529,  532,  529,  529,  529,  529,  529,
440
 /*    10 */   529,  529,  529,  529,  529,  529,  529,  529,  529,  529,
441
 /*    20 */   529,  529,  529,  529,  529,  529,  529,  529,  529,  529,
442
 /*    30 */   529,  529,  529,  529,  529,  529,  529,  529,  529,  529,
443
 /*    40 */   529,  529,  529,  529,  529,  529,  529,  529,  529,  529,
444
 /*    50 */   529,  529,  529,  529,  529,  529,  529,  529,  529,  529,
445
 /*    60 */   529,  529,  529,  529,  529,  529,  529,  529,  534,  534,
446
 /*    70 */   529,  529,  529,  529,  529,  529,  529,  529,  529,  529,
447
 /*    80 */   529,  686,  681,  561,  594,  586,  545,  545,  553,  545,
448
 /*    90 */   622,  529,  529,  529,  529,  529,  529,  529,  529,  529,
449
 /*   100 */   529,  529,  529,  529,  529,  529,  529,  529,  529,  529,
450
 /*   110 */   529,  529,  529,  529,  529,  529,  529,  529,  529,  529,
451
 /*   120 */   529,  529,  529,  529,  529,  529,  529,  529,  529,  529,
452
 /*   130 */   529,  529,  529,  529,  529,  529,  529,  529,  529,  529,
453
 /*   140 */   529,  529,  529,  529,  529,  529,  529,  529,  529,  709,
454
 /*   150 */   707,  529,  708,  704,  529,  556,  529,  529,  529,  529,
455
 /*   160 */   721,  529,  529,  529,  529,  529,
456
};
457
/********** End of lemon-generated parsing tables *****************************/
458
459
/* The next table maps tokens (terminal symbols) into fallback tokens.
460
** If a construct like the following:
461
**
462
**      %fallback ID X Y Z.
463
**
464
** appears in the grammar, then ID becomes a fallback token for X, Y,
465
** and Z.  Whenever one of the tokens X, Y, or Z is input to the parser
466
** but it does not parse, the type of the token is changed to ID and
467
** the parse is retried before an error is thrown.
468
**
469
** This feature can be used, for example, to cause some keywords in a language
470
** to revert to identifiers if they keyword does not apply in the context where
471
** it appears.
472
*/
473
#ifdef YYFALLBACK
474
static const YYCODETYPE yyFallback[] = {
475
    0,  /*          $ => nothing */
476
    0,  /*   PT_IDENT => nothing */
477
    1,  /*  PT_SYNTAX => PT_IDENT */
478
    1,  /* PT_EDITION => PT_IDENT */
479
    1,  /*  PT_IMPORT => PT_IDENT */
480
    1,  /*    PT_WEAK => PT_IDENT */
481
    1,  /*  PT_PUBLIC => PT_IDENT */
482
    1,  /* PT_PACKAGE => PT_IDENT */
483
    1,  /*  PT_OPTION => PT_IDENT */
484
    1,  /* PT_REQUIRED => PT_IDENT */
485
    1,  /* PT_OPTIONAL => PT_IDENT */
486
    1,  /* PT_REPEATED => PT_IDENT */
487
    1,  /*   PT_ONEOF => PT_IDENT */
488
    1,  /*     PT_MAP => PT_IDENT */
489
    1,  /* PT_RESERVED => PT_IDENT */
490
    1,  /*    PT_ENUM => PT_IDENT */
491
    1,  /*   PT_GROUP => PT_IDENT */
492
    1,  /*  PT_EXTEND => PT_IDENT */
493
    1,  /* PT_EXTENSIONS => PT_IDENT */
494
    1,  /* PT_MESSAGE => PT_IDENT */
495
    1,  /* PT_SERVICE => PT_IDENT */
496
    1,  /*     PT_RPC => PT_IDENT */
497
    1,  /*  PT_STREAM => PT_IDENT */
498
    1,  /* PT_RETURNS => PT_IDENT */
499
    1,  /*      PT_TO => PT_IDENT */
500
    0,  /*  PT_ASSIGN => nothing */
501
    0,  /* PT_SEMICOLON => nothing */
502
    0,  /*  PT_STRLIT => nothing */
503
    0,  /*  PT_LPAREN => nothing */
504
    0,  /*  PT_RPAREN => nothing */
505
    0,  /*     PT_DOT => nothing */
506
    0,  /*  PT_LCURLY => nothing */
507
    0,  /*  PT_RCURLY => nothing */
508
    0,  /* PT_LBRACKET => nothing */
509
    0,  /* PT_RBRACKET => nothing */
510
    0,  /*   PT_EQUAL => nothing */
511
    0,  /* PT_NOTEQUAL => nothing */
512
    0,  /* PT_NOTEQUAL2 => nothing */
513
    0,  /*  PT_GEQUAL => nothing */
514
    0,  /*  PT_LEQUAL => nothing */
515
    0,  /* PT_ASSIGN_PLUS => nothing */
516
    0,  /*    PT_PLUS => nothing */
517
    0,  /*   PT_MINUS => nothing */
518
    0,  /* PT_MULTIPLY => nothing */
519
    0,  /*     PT_DIV => nothing */
520
    0,  /* PT_LOGIC_OR => nothing */
521
    0,  /*      PT_OR => nothing */
522
    0,  /* PT_LOGIC_AND => nothing */
523
    0,  /*     PT_AND => nothing */
524
    0,  /*     PT_NOT => nothing */
525
    0,  /*     PT_NEG => nothing */
526
    0,  /*     PT_XOR => nothing */
527
    0,  /*     PT_SHL => nothing */
528
    0,  /*     PT_SHR => nothing */
529
    0,  /* PT_PERCENT => nothing */
530
    0,  /*  PT_DOLLAR => nothing */
531
    0,  /*    PT_COND => nothing */
532
    0,  /*   PT_COMMA => nothing */
533
    0,  /*   PT_COLON => nothing */
534
    0,  /*    PT_LESS => nothing */
535
    0,  /* PT_GREATER => nothing */
536
    0,  /* PT_DECIMALLIT => nothing */
537
    0,  /* PT_OCTALLIT => nothing */
538
    0,  /*  PT_HEXLIT => nothing */
539
};
540
#endif /* YYFALLBACK */
541
542
/* The following structure represents a single element of the
543
** parser's stack.  Information stored includes:
544
**
545
**   +  The state number for the parser at this level of the stack.
546
**
547
**   +  The value of the token stored at this level of the stack.
548
**      (In other words, the "major" token.)
549
**
550
**   +  The semantic value stored at this level of the stack.  This is
551
**      the information used by the action routines in the grammar.
552
**      It is sometimes called the "minor" token.
553
**
554
** After the "shift" half of a SHIFTREDUCE action, the stateno field
555
** actually contains the reduce action for the second half of the
556
** SHIFTREDUCE.
557
*/
558
struct yyStackEntry {
559
  YYACTIONTYPE stateno;  /* The state-number, or reduce action in SHIFTREDUCE */
560
  YYCODETYPE major;      /* The major token value.  This is the code
561
                         ** number for the token at this stack level */
562
  YYMINORTYPE minor;     /* The user-supplied minor token value.  This
563
                         ** is the value of the token  */
564
};
565
typedef struct yyStackEntry yyStackEntry;
566
567
/* The state of the parser is completely contained in an instance of
568
** the following structure */
569
struct yyParser {
570
  yyStackEntry *yytos;          /* Pointer to top element of the stack */
571
#ifdef YYTRACKMAXSTACKDEPTH
572
  int yyhwm;                    /* High-water mark of the stack */
573
#endif
574
#ifndef YYNOERRORRECOVERY
575
  int yyerrcnt;                 /* Shifts left before out of the error */
576
#endif
577
  ProtobufLangParserARG_SDECL                /* A place to hold %extra_argument */
578
  ProtobufLangParserCTX_SDECL                /* A place to hold %extra_context */
579
#if YYSTACKDEPTH<=0
580
  int yystksz;                  /* Current side of the stack */
581
  yyStackEntry *yystack;        /* The parser's stack */
582
  yyStackEntry yystk0;          /* First stack entry */
583
#else
584
  yyStackEntry yystack[YYSTACKDEPTH];  /* The parser's stack */
585
  yyStackEntry *yystackEnd;            /* Last entry in the stack */
586
#endif
587
};
588
typedef struct yyParser yyParser;
589
590
#include <assert.h>
591
#ifndef NDEBUG
592
#include <stdio.h>
593
static FILE *yyTraceFILE = 0;
594
static char *yyTracePrompt = 0;
595
#endif /* NDEBUG */
596
597
#ifndef NDEBUG
598
/*
599
** Turn parser tracing on by giving a stream to which to write the trace
600
** and a prompt to preface each trace message.  Tracing is turned off
601
** by making either argument NULL
602
**
603
** Inputs:
604
** <ul>
605
** <li> A FILE* to which trace output should be written.
606
**      If NULL, then tracing is turned off.
607
** <li> A prefix string written at the beginning of every
608
**      line of trace output.  If NULL, then tracing is
609
**      turned off.
610
** </ul>
611
**
612
** Outputs:
613
** None.
614
*/
615
void ProtobufLangParserTrace(FILE *TraceFILE, char *zTracePrompt){
616
  yyTraceFILE = TraceFILE;
617
  yyTracePrompt = zTracePrompt;
618
  if( yyTraceFILE==0 ) yyTracePrompt = 0;
619
  else if( yyTracePrompt==0 ) yyTraceFILE = 0;
620
}
621
#endif /* NDEBUG */
622
623
#if defined(YYCOVERAGE) || !defined(NDEBUG)
624
/* For tracing shifts, the names of all terminals and nonterminals
625
** are required.  The following table supplies these names */
626
static const char *const yyTokenName[] = {
627
  /*    0 */ "$",
628
  /*    1 */ "PT_IDENT",
629
  /*    2 */ "PT_SYNTAX",
630
  /*    3 */ "PT_EDITION",
631
  /*    4 */ "PT_IMPORT",
632
  /*    5 */ "PT_WEAK",
633
  /*    6 */ "PT_PUBLIC",
634
  /*    7 */ "PT_PACKAGE",
635
  /*    8 */ "PT_OPTION",
636
  /*    9 */ "PT_REQUIRED",
637
  /*   10 */ "PT_OPTIONAL",
638
  /*   11 */ "PT_REPEATED",
639
  /*   12 */ "PT_ONEOF",
640
  /*   13 */ "PT_MAP",
641
  /*   14 */ "PT_RESERVED",
642
  /*   15 */ "PT_ENUM",
643
  /*   16 */ "PT_GROUP",
644
  /*   17 */ "PT_EXTEND",
645
  /*   18 */ "PT_EXTENSIONS",
646
  /*   19 */ "PT_MESSAGE",
647
  /*   20 */ "PT_SERVICE",
648
  /*   21 */ "PT_RPC",
649
  /*   22 */ "PT_STREAM",
650
  /*   23 */ "PT_RETURNS",
651
  /*   24 */ "PT_TO",
652
  /*   25 */ "PT_ASSIGN",
653
  /*   26 */ "PT_SEMICOLON",
654
  /*   27 */ "PT_STRLIT",
655
  /*   28 */ "PT_LPAREN",
656
  /*   29 */ "PT_RPAREN",
657
  /*   30 */ "PT_DOT",
658
  /*   31 */ "PT_LCURLY",
659
  /*   32 */ "PT_RCURLY",
660
  /*   33 */ "PT_LBRACKET",
661
  /*   34 */ "PT_RBRACKET",
662
  /*   35 */ "PT_EQUAL",
663
  /*   36 */ "PT_NOTEQUAL",
664
  /*   37 */ "PT_NOTEQUAL2",
665
  /*   38 */ "PT_GEQUAL",
666
  /*   39 */ "PT_LEQUAL",
667
  /*   40 */ "PT_ASSIGN_PLUS",
668
  /*   41 */ "PT_PLUS",
669
  /*   42 */ "PT_MINUS",
670
  /*   43 */ "PT_MULTIPLY",
671
  /*   44 */ "PT_DIV",
672
  /*   45 */ "PT_LOGIC_OR",
673
  /*   46 */ "PT_OR",
674
  /*   47 */ "PT_LOGIC_AND",
675
  /*   48 */ "PT_AND",
676
  /*   49 */ "PT_NOT",
677
  /*   50 */ "PT_NEG",
678
  /*   51 */ "PT_XOR",
679
  /*   52 */ "PT_SHL",
680
  /*   53 */ "PT_SHR",
681
  /*   54 */ "PT_PERCENT",
682
  /*   55 */ "PT_DOLLAR",
683
  /*   56 */ "PT_COND",
684
  /*   57 */ "PT_COMMA",
685
  /*   58 */ "PT_COLON",
686
  /*   59 */ "PT_LESS",
687
  /*   60 */ "PT_GREATER",
688
  /*   61 */ "PT_DECIMALLIT",
689
  /*   62 */ "PT_OCTALLIT",
690
  /*   63 */ "PT_HEXLIT",
691
  /*   64 */ "strLit",
692
  /*   65 */ "label",
693
  /*   66 */ "type",
694
  /*   67 */ "keyType",
695
  /*   68 */ "messageType",
696
  /*   69 */ "constant",
697
  /*   70 */ "exIdent",
698
  /*   71 */ "optionName",
699
  /*   72 */ "messageName",
700
  /*   73 */ "enumName",
701
  /*   74 */ "streamName",
702
  /*   75 */ "fieldName",
703
  /*   76 */ "oneofName",
704
  /*   77 */ "mapName",
705
  /*   78 */ "serviceName",
706
  /*   79 */ "rpcName",
707
  /*   80 */ "groupName",
708
  /*   81 */ "protoBody",
709
  /*   82 */ "topLevelDef",
710
  /*   83 */ "message",
711
  /*   84 */ "messageBody",
712
  /*   85 */ "rpc",
713
  /*   86 */ "rpcDecl",
714
  /*   87 */ "field",
715
  /*   88 */ "oneofField",
716
  /*   89 */ "enum",
717
  /*   90 */ "enumBody",
718
  /*   91 */ "enumField",
719
  /*   92 */ "service",
720
  /*   93 */ "serviceBody",
721
  /*   94 */ "stream",
722
  /*   95 */ "streamDecl",
723
  /*   96 */ "fieldOptions",
724
  /*   97 */ "fieldOption",
725
  /*   98 */ "oneof",
726
  /*   99 */ "oneofBody",
727
  /*  100 */ "mapField",
728
  /*  101 */ "group",
729
  /*  102 */ "extend",
730
  /*  103 */ "extendBody",
731
  /*  104 */ "intLit",
732
  /*  105 */ "fieldNumber",
733
  /*  106 */ "enumNumber",
734
  /*  107 */ "proto",
735
  /*  108 */ "wholeProtoBody",
736
  /*  109 */ "syntax",
737
  /*  110 */ "edition",
738
  /*  111 */ "import",
739
  /*  112 */ "package",
740
  /*  113 */ "option",
741
  /*  114 */ "emptyStatement",
742
  /*  115 */ "customOptionValue",
743
  /*  116 */ "extIdentInParentheses",
744
  /*  117 */ "customOptionBody",
745
  /*  118 */ "symbolsWithoutCurly",
746
  /*  119 */ "extensions",
747
  /*  120 */ "reserved",
748
  /*  121 */ "enumValueOptions",
749
  /*  122 */ "enumValueOption",
750
  /*  123 */ "rpcBody",
751
  /*  124 */ "streamBody",
752
  /*  125 */ "ranges",
753
  /*  126 */ "declarations",
754
  /*  127 */ "declaration",
755
  /*  128 */ "quoteFieldNames",
756
  /*  129 */ "reservedIdent",
757
  /*  130 */ "range",
758
};
759
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
760
761
#ifndef NDEBUG
762
/* For tracing reduce actions, the names of all rules are required.
763
*/
764
static const char *const yyRuleName[] = {
765
 /*   0 */ "wholeProtoBody ::= protoBody",
766
 /*   1 */ "syntax ::= PT_SYNTAX PT_ASSIGN strLit PT_SEMICOLON",
767
 /*   2 */ "protoBody ::=",
768
 /*   3 */ "protoBody ::= protoBody topLevelDef",
769
 /*   4 */ "import ::= PT_IMPORT strLit PT_SEMICOLON",
770
 /*   5 */ "import ::= PT_IMPORT PT_PUBLIC strLit PT_SEMICOLON",
771
 /*   6 */ "import ::= PT_IMPORT PT_WEAK strLit PT_SEMICOLON",
772
 /*   7 */ "package ::= PT_PACKAGE exIdent PT_SEMICOLON",
773
 /*   8 */ "extIdentInParentheses ::= PT_LPAREN exIdent PT_RPAREN",
774
 /*   9 */ "optionName ::= optionName exIdent",
775
 /*  10 */ "optionName ::= optionName PT_DOT extIdentInParentheses",
776
 /*  11 */ "optionName ::= optionName extIdentInParentheses",
777
 /*  12 */ "message ::= PT_MESSAGE messageName PT_LCURLY messageBody PT_RCURLY",
778
 /*  13 */ "messageBody ::=",
779
 /*  14 */ "messageBody ::= messageBody field",
780
 /*  15 */ "messageBody ::= messageBody enum",
781
 /*  16 */ "messageBody ::= messageBody message",
782
 /*  17 */ "messageBody ::= messageBody group",
783
 /*  18 */ "messageBody ::= messageBody oneof",
784
 /*  19 */ "messageBody ::= messageBody mapField",
785
 /*  20 */ "enum ::= PT_ENUM enumName PT_LCURLY enumBody PT_RCURLY",
786
 /*  21 */ "enumBody ::=",
787
 /*  22 */ "enumBody ::= enumBody enumField",
788
 /*  23 */ "enumField ::= exIdent PT_ASSIGN enumNumber PT_LBRACKET enumValueOptions PT_RBRACKET PT_SEMICOLON",
789
 /*  24 */ "enumField ::= exIdent PT_ASSIGN enumNumber",
790
 /*  25 */ "enumNumber ::= intLit",
791
 /*  26 */ "enumNumber ::= PT_PLUS intLit",
792
 /*  27 */ "enumNumber ::= PT_MINUS intLit",
793
 /*  28 */ "service ::= PT_SERVICE serviceName PT_LCURLY serviceBody PT_RCURLY",
794
 /*  29 */ "serviceBody ::=",
795
 /*  30 */ "serviceBody ::= serviceBody rpc",
796
 /*  31 */ "serviceBody ::= serviceBody stream",
797
 /*  32 */ "rpcDecl ::= PT_RPC rpcName PT_LPAREN messageType PT_RPAREN PT_RETURNS PT_LPAREN messageType PT_RPAREN",
798
 /*  33 */ "rpcDecl ::= PT_RPC rpcName PT_LPAREN PT_STREAM messageType PT_RPAREN PT_RETURNS PT_LPAREN messageType PT_RPAREN",
799
 /*  34 */ "rpcDecl ::= PT_RPC rpcName PT_LPAREN messageType PT_RPAREN PT_RETURNS PT_LPAREN PT_STREAM messageType PT_RPAREN",
800
 /*  35 */ "rpcDecl ::= PT_RPC rpcName PT_LPAREN PT_STREAM messageType PT_RPAREN PT_RETURNS PT_LPAREN PT_STREAM messageType PT_RPAREN",
801
 /*  36 */ "streamDecl ::= PT_STREAM streamName PT_LPAREN messageType PT_COMMA messageType PT_RPAREN",
802
 /*  37 */ "field ::= type fieldName PT_ASSIGN fieldNumber PT_SEMICOLON",
803
 /*  38 */ "field ::= type fieldName PT_ASSIGN fieldNumber PT_LBRACKET fieldOptions PT_RBRACKET PT_SEMICOLON",
804
 /*  39 */ "field ::= label type fieldName PT_ASSIGN fieldNumber PT_SEMICOLON",
805
 /*  40 */ "field ::= label type fieldName PT_ASSIGN fieldNumber PT_LBRACKET fieldOptions PT_RBRACKET PT_SEMICOLON",
806
 /*  41 */ "label ::= PT_REQUIRED",
807
 /*  42 */ "label ::= PT_OPTIONAL",
808
 /*  43 */ "label ::= PT_REPEATED",
809
 /*  44 */ "type ::= exIdent",
810
 /*  45 */ "fieldNumber ::= intLit",
811
 /*  46 */ "fieldNumber ::= PT_PLUS intLit",
812
 /*  47 */ "fieldOptions ::= fieldOption",
813
 /*  48 */ "fieldOptions ::= fieldOptions PT_COMMA fieldOption",
814
 /*  49 */ "fieldOption ::= optionName PT_ASSIGN constant",
815
 /*  50 */ "fieldOption ::= optionName PT_ASSIGN customOptionValue",
816
 /*  51 */ "group ::= PT_GROUP groupName PT_ASSIGN fieldNumber PT_LCURLY messageBody PT_RCURLY",
817
 /*  52 */ "group ::= label PT_GROUP groupName PT_ASSIGN fieldNumber PT_LCURLY messageBody PT_RCURLY",
818
 /*  53 */ "oneof ::= PT_ONEOF oneofName PT_LCURLY oneofBody PT_RCURLY",
819
 /*  54 */ "oneofBody ::=",
820
 /*  55 */ "oneofBody ::= oneofBody oneofField",
821
 /*  56 */ "oneofField ::= type fieldName PT_ASSIGN fieldNumber PT_LBRACKET fieldOptions PT_RBRACKET PT_SEMICOLON",
822
 /*  57 */ "oneofField ::= type fieldName PT_ASSIGN fieldNumber PT_SEMICOLON",
823
 /*  58 */ "mapField ::= PT_MAP PT_LESS keyType PT_COMMA type PT_GREATER mapName PT_ASSIGN fieldNumber PT_LBRACKET fieldOptions PT_RBRACKET PT_SEMICOLON",
824
 /*  59 */ "mapField ::= PT_MAP PT_LESS keyType PT_COMMA type PT_GREATER mapName PT_ASSIGN fieldNumber PT_SEMICOLON",
825
 /*  60 */ "keyType ::= exIdent",
826
 /*  61 */ "extend ::= PT_EXTEND messageType PT_LCURLY extendBody PT_RCURLY",
827
 /*  62 */ "extendBody ::=",
828
 /*  63 */ "extendBody ::= extendBody field",
829
 /*  64 */ "extendBody ::= extendBody group",
830
 /*  65 */ "messageType ::= exIdent",
831
 /*  66 */ "intLit ::= PT_DECIMALLIT",
832
 /*  67 */ "intLit ::= PT_OCTALLIT",
833
 /*  68 */ "intLit ::= PT_HEXLIT",
834
 /*  69 */ "constant ::= exIdent",
835
 /*  70 */ "constant ::= intLit",
836
 /*  71 */ "constant ::= PT_PLUS intLit",
837
 /*  72 */ "constant ::= PT_MINUS intLit",
838
 /*  73 */ "constant ::= PT_PLUS exIdent",
839
 /*  74 */ "constant ::= PT_MINUS exIdent",
840
 /*  75 */ "strLit ::= PT_STRLIT",
841
 /*  76 */ "strLit ::= strLit PT_STRLIT",
842
 /*  77 */ "proto ::= wholeProtoBody",
843
 /*  78 */ "proto ::= syntax wholeProtoBody",
844
 /*  79 */ "proto ::= edition wholeProtoBody",
845
 /*  80 */ "edition ::= PT_EDITION PT_ASSIGN PT_STRLIT PT_SEMICOLON",
846
 /*  81 */ "protoBody ::= protoBody import",
847
 /*  82 */ "protoBody ::= protoBody package",
848
 /*  83 */ "protoBody ::= protoBody option",
849
 /*  84 */ "protoBody ::= protoBody emptyStatement",
850
 /*  85 */ "option ::= PT_OPTION optionName PT_ASSIGN constant PT_SEMICOLON",
851
 /*  86 */ "option ::= PT_OPTION optionName PT_ASSIGN customOptionValue PT_SEMICOLON",
852
 /*  87 */ "optionName ::= exIdent",
853
 /*  88 */ "optionName ::= extIdentInParentheses",
854
 /*  89 */ "customOptionValue ::= PT_LCURLY customOptionBody PT_RCURLY",
855
 /*  90 */ "customOptionBody ::=",
856
 /*  91 */ "customOptionBody ::= customOptionBody exIdent",
857
 /*  92 */ "customOptionBody ::= customOptionBody PT_STRLIT",
858
 /*  93 */ "customOptionBody ::= customOptionBody symbolsWithoutCurly",
859
 /*  94 */ "customOptionBody ::= customOptionBody intLit",
860
 /*  95 */ "customOptionBody ::= customOptionBody customOptionValue",
861
 /*  96 */ "symbolsWithoutCurly ::= PT_LPAREN",
862
 /*  97 */ "symbolsWithoutCurly ::= PT_RPAREN",
863
 /*  98 */ "symbolsWithoutCurly ::= PT_LBRACKET",
864
 /*  99 */ "symbolsWithoutCurly ::= PT_RBRACKET",
865
 /* 100 */ "symbolsWithoutCurly ::= PT_EQUAL",
866
 /* 101 */ "symbolsWithoutCurly ::= PT_NOTEQUAL",
867
 /* 102 */ "symbolsWithoutCurly ::= PT_NOTEQUAL2",
868
 /* 103 */ "symbolsWithoutCurly ::= PT_GEQUAL",
869
 /* 104 */ "symbolsWithoutCurly ::= PT_LEQUAL",
870
 /* 105 */ "symbolsWithoutCurly ::= PT_ASSIGN_PLUS",
871
 /* 106 */ "symbolsWithoutCurly ::= PT_ASSIGN",
872
 /* 107 */ "symbolsWithoutCurly ::= PT_PLUS",
873
 /* 108 */ "symbolsWithoutCurly ::= PT_MINUS",
874
 /* 109 */ "symbolsWithoutCurly ::= PT_MULTIPLY",
875
 /* 110 */ "symbolsWithoutCurly ::= PT_DIV",
876
 /* 111 */ "symbolsWithoutCurly ::= PT_LOGIC_OR",
877
 /* 112 */ "symbolsWithoutCurly ::= PT_OR",
878
 /* 113 */ "symbolsWithoutCurly ::= PT_LOGIC_AND",
879
 /* 114 */ "symbolsWithoutCurly ::= PT_AND",
880
 /* 115 */ "symbolsWithoutCurly ::= PT_NOT",
881
 /* 116 */ "symbolsWithoutCurly ::= PT_NEG",
882
 /* 117 */ "symbolsWithoutCurly ::= PT_XOR",
883
 /* 118 */ "symbolsWithoutCurly ::= PT_SHL",
884
 /* 119 */ "symbolsWithoutCurly ::= PT_SHR",
885
 /* 120 */ "symbolsWithoutCurly ::= PT_PERCENT",
886
 /* 121 */ "symbolsWithoutCurly ::= PT_DOLLAR",
887
 /* 122 */ "symbolsWithoutCurly ::= PT_COND",
888
 /* 123 */ "symbolsWithoutCurly ::= PT_SEMICOLON",
889
 /* 124 */ "symbolsWithoutCurly ::= PT_DOT",
890
 /* 125 */ "symbolsWithoutCurly ::= PT_COMMA",
891
 /* 126 */ "symbolsWithoutCurly ::= PT_COLON",
892
 /* 127 */ "symbolsWithoutCurly ::= PT_LESS",
893
 /* 128 */ "symbolsWithoutCurly ::= PT_GREATER",
894
 /* 129 */ "topLevelDef ::= message",
895
 /* 130 */ "topLevelDef ::= enum",
896
 /* 131 */ "topLevelDef ::= extend",
897
 /* 132 */ "topLevelDef ::= service",
898
 /* 133 */ "messageBody ::= messageBody extend",
899
 /* 134 */ "messageBody ::= messageBody extensions",
900
 /* 135 */ "messageBody ::= messageBody option",
901
 /* 136 */ "messageBody ::= messageBody reserved",
902
 /* 137 */ "messageBody ::= messageBody emptyStatement",
903
 /* 138 */ "enumBody ::= enumBody reserved",
904
 /* 139 */ "enumBody ::= enumBody option",
905
 /* 140 */ "enumBody ::= enumBody emptyStatement",
906
 /* 141 */ "enumValueOptions ::= enumValueOption",
907
 /* 142 */ "enumValueOptions ::= enumValueOptions PT_COMMA enumValueOption",
908
 /* 143 */ "enumValueOption ::= optionName PT_ASSIGN constant",
909
 /* 144 */ "enumValueOption ::= optionName PT_ASSIGN customOptionValue",
910
 /* 145 */ "serviceBody ::= serviceBody option",
911
 /* 146 */ "serviceBody ::= serviceBody emptyStatement",
912
 /* 147 */ "rpc ::= rpcDecl PT_SEMICOLON",
913
 /* 148 */ "rpc ::= rpcDecl PT_LCURLY rpcBody PT_RCURLY",
914
 /* 149 */ "rpcBody ::=",
915
 /* 150 */ "rpcBody ::= rpcBody option",
916
 /* 151 */ "rpcBody ::= rpcBody emptyStatement",
917
 /* 152 */ "stream ::= streamDecl PT_SEMICOLON",
918
 /* 153 */ "stream ::= streamDecl PT_LCURLY streamBody PT_RCURLY",
919
 /* 154 */ "streamBody ::=",
920
 /* 155 */ "streamBody ::= streamBody option",
921
 /* 156 */ "streamBody ::= streamBody emptyStatement",
922
 /* 157 */ "groupName ::= exIdent",
923
 /* 158 */ "oneofBody ::= oneofBody option",
924
 /* 159 */ "oneofBody ::= oneofBody group",
925
 /* 160 */ "oneofBody ::= oneofBody emptyStatement",
926
 /* 161 */ "extensions ::= PT_EXTENSIONS ranges PT_SEMICOLON",
927
 /* 162 */ "extensions ::= PT_EXTENSIONS ranges PT_LBRACKET declarations PT_RBRACKET PT_SEMICOLON",
928
 /* 163 */ "declarations ::= declaration",
929
 /* 164 */ "declarations ::= declarations PT_COMMA declaration",
930
 /* 165 */ "declaration ::= optionName PT_ASSIGN constant",
931
 /* 166 */ "declaration ::= optionName PT_ASSIGN customOptionValue",
932
 /* 167 */ "reserved ::= PT_RESERVED ranges PT_SEMICOLON",
933
 /* 168 */ "reserved ::= PT_RESERVED quoteFieldNames PT_SEMICOLON",
934
 /* 169 */ "reserved ::= PT_RESERVED reservedIdent PT_SEMICOLON",
935
 /* 170 */ "ranges ::= range",
936
 /* 171 */ "ranges ::= ranges PT_COMMA range",
937
 /* 172 */ "range ::= intLit",
938
 /* 173 */ "range ::= intLit PT_TO intLit",
939
 /* 174 */ "range ::= intLit PT_TO exIdent",
940
 /* 175 */ "quoteFieldNames ::= strLit",
941
 /* 176 */ "quoteFieldNames ::= quoteFieldNames PT_COMMA strLit",
942
 /* 177 */ "reservedIdent ::= fieldName",
943
 /* 178 */ "reservedIdent ::= fieldName PT_COMMA fieldName",
944
 /* 179 */ "extendBody ::= extendBody emptyStatement",
945
 /* 180 */ "messageName ::= exIdent",
946
 /* 181 */ "enumName ::= exIdent",
947
 /* 182 */ "streamName ::= exIdent",
948
 /* 183 */ "fieldName ::= exIdent",
949
 /* 184 */ "oneofName ::= exIdent",
950
 /* 185 */ "mapName ::= exIdent",
951
 /* 186 */ "serviceName ::= exIdent",
952
 /* 187 */ "rpcName ::= exIdent",
953
 /* 188 */ "emptyStatement ::= PT_SEMICOLON",
954
 /* 189 */ "constant ::= strLit",
955
 /* 190 */ "exIdent ::= PT_IDENT",
956
};
957
#endif /* NDEBUG */
958
959
960
#if YYSTACKDEPTH<=0
961
/*
962
** Try to increase the size of the parser stack.  Return the number
963
** of errors.  Return 0 on success.
964
*/
965
static int yyGrowStack(yyParser *p){
966
  int newSize;
967
  int idx;
968
  yyStackEntry *pNew;
969
970
  newSize = p->yystksz*2 + 100;
971
  idx = p->yytos ? (int)(p->yytos - p->yystack) : 0;
972
  if( p->yystack==&p->yystk0 ){
973
    pNew = malloc(newSize*sizeof(pNew[0]));
974
    if( pNew ) pNew[0] = p->yystk0;
975
  }else{
976
    pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
977
  }
978
  if( pNew ){
979
    p->yystack = pNew;
980
    p->yytos = &p->yystack[idx];
981
#ifndef NDEBUG
982
    if( yyTraceFILE ){
983
      fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
984
              yyTracePrompt, p->yystksz, newSize);
985
    }
986
#endif
987
    p->yystksz = newSize;
988
  }
989
  return pNew==0;
990
}
991
#endif
992
993
/* Datatype of the argument to the memory allocated passed as the
994
** second argument to ProtobufLangParserAlloc() below.  This can be changed by
995
** putting an appropriate #define in the %include section of the input
996
** grammar.
997
*/
998
#ifndef YYMALLOCARGTYPE
999
# define YYMALLOCARGTYPE size_t
1000
#endif
1001
1002
/* Initialize a new parser that has already been allocated.
1003
*/
1004
0
void ProtobufLangParserInit(void *yypRawParser ProtobufLangParserCTX_PDECL){
1005
0
  yyParser *yypParser = (yyParser*)yypRawParser;
1006
0
  ProtobufLangParserCTX_STORE
1007
#ifdef YYTRACKMAXSTACKDEPTH
1008
  yypParser->yyhwm = 0;
1009
#endif
1010
#if YYSTACKDEPTH<=0
1011
  yypParser->yytos = NULL;
1012
  yypParser->yystack = NULL;
1013
  yypParser->yystksz = 0;
1014
  if( yyGrowStack(yypParser) ){
1015
    yypParser->yystack = &yypParser->yystk0;
1016
    yypParser->yystksz = 1;
1017
  }
1018
#endif
1019
0
#ifndef YYNOERRORRECOVERY
1020
0
  yypParser->yyerrcnt = -1;
1021
0
#endif
1022
0
  yypParser->yytos = yypParser->yystack;
1023
0
  yypParser->yystack[0].stateno = 0;
1024
0
  yypParser->yystack[0].major = 0;
1025
0
#if YYSTACKDEPTH>0
1026
0
  yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1];
1027
0
#endif
1028
0
}
1029
1030
#ifndef ProtobufLangParser_ENGINEALWAYSONSTACK
1031
/*
1032
** This function allocates a new parser.
1033
** The only argument is a pointer to a function which works like
1034
** malloc.
1035
**
1036
** Inputs:
1037
** A pointer to the function used to allocate memory.
1038
**
1039
** Outputs:
1040
** A pointer to a parser.  This pointer is used in subsequent calls
1041
** to ProtobufLangParser and ProtobufLangParserFree.
1042
*/
1043
0
void *ProtobufLangParserAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) ProtobufLangParserCTX_PDECL){
1044
0
  yyParser *yypParser;
1045
0
  yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) );
1046
0
  if( yypParser ){
1047
0
    ProtobufLangParserCTX_STORE
1048
0
    ProtobufLangParserInit(yypParser ProtobufLangParserCTX_PARAM);
1049
0
  }
1050
0
  return (void*)yypParser;
1051
0
}
1052
#endif /* ProtobufLangParser_ENGINEALWAYSONSTACK */
1053
1054
1055
/* The following function deletes the "minor type" or semantic value
1056
** associated with a symbol.  The symbol can be either a terminal
1057
** or nonterminal. "yymajor" is the symbol code, and "yypminor" is
1058
** a pointer to the value to be deleted.  The code used to do the
1059
** deletions is derived from the %destructor and/or %token_destructor
1060
** directives of the input grammar.
1061
*/
1062
static void yy_destructor(
1063
  yyParser *yypParser,    /* The parser */
1064
  YYCODETYPE yymajor,     /* Type code for object to destroy */
1065
  YYMINORTYPE *yypminor   /* The object to be destroyed */
1066
0
){
1067
0
  ProtobufLangParserARG_FETCH
1068
0
  ProtobufLangParserCTX_FETCH
1069
0
  switch( yymajor ){
1070
    /* Here is inserted the actions which take place when a
1071
    ** terminal or non-terminal is destroyed.  This can happen
1072
    ** when the symbol is popped from the stack during a
1073
    ** reduce or during error processing or when a parser is
1074
    ** being destroyed before it is finished parsing.
1075
    **
1076
    ** Note: during a reduce, the only symbols destroyed are those
1077
    ** which appear on the RHS of the rule, but which are *not* used
1078
    ** inside the C code.
1079
    */
1080
/********* Begin destructor definitions ***************************************/
1081
      /* TERMINAL Destructor */
1082
0
    case 1: /* PT_IDENT */
1083
0
    case 2: /* PT_SYNTAX */
1084
0
    case 3: /* PT_EDITION */
1085
0
    case 4: /* PT_IMPORT */
1086
0
    case 5: /* PT_WEAK */
1087
0
    case 6: /* PT_PUBLIC */
1088
0
    case 7: /* PT_PACKAGE */
1089
0
    case 8: /* PT_OPTION */
1090
0
    case 9: /* PT_REQUIRED */
1091
0
    case 10: /* PT_OPTIONAL */
1092
0
    case 11: /* PT_REPEATED */
1093
0
    case 12: /* PT_ONEOF */
1094
0
    case 13: /* PT_MAP */
1095
0
    case 14: /* PT_RESERVED */
1096
0
    case 15: /* PT_ENUM */
1097
0
    case 16: /* PT_GROUP */
1098
0
    case 17: /* PT_EXTEND */
1099
0
    case 18: /* PT_EXTENSIONS */
1100
0
    case 19: /* PT_MESSAGE */
1101
0
    case 20: /* PT_SERVICE */
1102
0
    case 21: /* PT_RPC */
1103
0
    case 22: /* PT_STREAM */
1104
0
    case 23: /* PT_RETURNS */
1105
0
    case 24: /* PT_TO */
1106
0
    case 25: /* PT_ASSIGN */
1107
0
    case 26: /* PT_SEMICOLON */
1108
0
    case 27: /* PT_STRLIT */
1109
0
    case 28: /* PT_LPAREN */
1110
0
    case 29: /* PT_RPAREN */
1111
0
    case 30: /* PT_DOT */
1112
0
    case 31: /* PT_LCURLY */
1113
0
    case 32: /* PT_RCURLY */
1114
0
    case 33: /* PT_LBRACKET */
1115
0
    case 34: /* PT_RBRACKET */
1116
0
    case 35: /* PT_EQUAL */
1117
0
    case 36: /* PT_NOTEQUAL */
1118
0
    case 37: /* PT_NOTEQUAL2 */
1119
0
    case 38: /* PT_GEQUAL */
1120
0
    case 39: /* PT_LEQUAL */
1121
0
    case 40: /* PT_ASSIGN_PLUS */
1122
0
    case 41: /* PT_PLUS */
1123
0
    case 42: /* PT_MINUS */
1124
0
    case 43: /* PT_MULTIPLY */
1125
0
    case 44: /* PT_DIV */
1126
0
    case 45: /* PT_LOGIC_OR */
1127
0
    case 46: /* PT_OR */
1128
0
    case 47: /* PT_LOGIC_AND */
1129
0
    case 48: /* PT_AND */
1130
0
    case 49: /* PT_NOT */
1131
0
    case 50: /* PT_NEG */
1132
0
    case 51: /* PT_XOR */
1133
0
    case 52: /* PT_SHL */
1134
0
    case 53: /* PT_SHR */
1135
0
    case 54: /* PT_PERCENT */
1136
0
    case 55: /* PT_DOLLAR */
1137
0
    case 56: /* PT_COND */
1138
0
    case 57: /* PT_COMMA */
1139
0
    case 58: /* PT_COLON */
1140
0
    case 59: /* PT_LESS */
1141
0
    case 60: /* PT_GREATER */
1142
0
    case 61: /* PT_DECIMALLIT */
1143
0
    case 62: /* PT_OCTALLIT */
1144
0
    case 63: /* PT_HEXLIT */
1145
0
{
1146
0
#line 66 "/src/wireshark/epan/protobuf_lang_parser.lemon"
1147
1148
    /* We manage memory allocated for token values by ourself */
1149
0
    (void) state; /* Mark unused, similar to Q_UNUSED */
1150
0
    (void) (yypminor->yy0); /* Mark unused, similar to Q_UNUSED */
1151
1152
0
#line 1177 "./protobuf_lang_parser.c"
1153
0
}
1154
0
      break;
1155
/********* End destructor definitions *****************************************/
1156
0
    default:  break;   /* If no destructor action specified: do nothing */
1157
0
  }
1158
0
}
1159
1160
/*
1161
** Pop the parser's stack once.
1162
**
1163
** If there is a destructor routine associated with the token which
1164
** is popped from the stack, then call it.
1165
*/
1166
0
static void yy_pop_parser_stack(yyParser *pParser){
1167
0
  yyStackEntry *yytos;
1168
0
  assert( pParser->yytos!=0 );
1169
0
  assert( pParser->yytos > pParser->yystack );
1170
0
  yytos = pParser->yytos--;
1171
#ifndef NDEBUG
1172
  if( yyTraceFILE ){
1173
    fprintf(yyTraceFILE,"%sPopping %s\n",
1174
      yyTracePrompt,
1175
      yyTokenName[yytos->major]);
1176
  }
1177
#endif
1178
0
  yy_destructor(pParser, yytos->major, &yytos->minor);
1179
0
}
1180
1181
/*
1182
** Clear all secondary memory allocations from the parser
1183
*/
1184
0
void ProtobufLangParserFinalize(void *p){
1185
0
  yyParser *pParser = (yyParser*)p;
1186
0
  while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser);
1187
#if YYSTACKDEPTH<=0
1188
  if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack);
1189
#endif
1190
0
}
1191
1192
#ifndef ProtobufLangParser_ENGINEALWAYSONSTACK
1193
/*
1194
** Deallocate and destroy a parser.  Destructors are called for
1195
** all stack elements before shutting the parser down.
1196
**
1197
** If the YYPARSEFREENEVERNULL macro exists (for example because it
1198
** is defined in a %include section of the input grammar) then it is
1199
** assumed that the input pointer is never NULL.
1200
*/
1201
void ProtobufLangParserFree(
1202
  void *p,                    /* The parser to be deleted */
1203
  void (*freeProc)(void*)     /* Function used to reclaim memory */
1204
0
){
1205
0
#ifndef YYPARSEFREENEVERNULL
1206
0
  if( p==0 ) return;
1207
0
#endif
1208
0
  ProtobufLangParserFinalize(p);
1209
0
  (*freeProc)(p);
1210
0
}
1211
#endif /* ProtobufLangParser_ENGINEALWAYSONSTACK */
1212
1213
/*
1214
** Return the peak depth of the stack for a parser.
1215
*/
1216
#ifdef YYTRACKMAXSTACKDEPTH
1217
int ProtobufLangParserStackPeak(void *p){
1218
  yyParser *pParser = (yyParser*)p;
1219
  return pParser->yyhwm;
1220
}
1221
#endif
1222
1223
/* This array of booleans keeps track of the parser statement
1224
** coverage.  The element yycoverage[X][Y] is set when the parser
1225
** is in state X and has a lookahead token Y.  In a well-tested
1226
** systems, every element of this matrix should end up being set.
1227
*/
1228
#if defined(YYCOVERAGE)
1229
static unsigned char yycoverage[YYNSTATE][YYNTOKEN];
1230
#endif
1231
1232
/*
1233
** Write into out a description of every state/lookahead combination that
1234
**
1235
**   (1)  has not been used by the parser, and
1236
**   (2)  is not a syntax error.
1237
**
1238
** Return the number of missed state/lookahead combinations.
1239
*/
1240
#if defined(YYCOVERAGE)
1241
int ProtobufLangParserCoverage(FILE *out){
1242
  int stateno, iLookAhead, i;
1243
  int nMissed = 0;
1244
  for(stateno=0; stateno<YYNSTATE; stateno++){
1245
    i = yy_shift_ofst[stateno];
1246
    for(iLookAhead=0; iLookAhead<YYNTOKEN; iLookAhead++){
1247
      if( yy_lookahead[i+iLookAhead]!=iLookAhead ) continue;
1248
      if( yycoverage[stateno][iLookAhead]==0 ) nMissed++;
1249
      if( out ){
1250
        fprintf(out,"State %d lookahead %s %s\n", stateno,
1251
                yyTokenName[iLookAhead],
1252
                yycoverage[stateno][iLookAhead] ? "ok" : "missed");
1253
      }
1254
    }
1255
  }
1256
  return nMissed;
1257
}
1258
#endif
1259
1260
/*
1261
** Find the appropriate action for a parser given the terminal
1262
** look-ahead token iLookAhead.
1263
*/
1264
static YYACTIONTYPE yy_find_shift_action(
1265
  YYCODETYPE iLookAhead,    /* The look-ahead token */
1266
  YYACTIONTYPE stateno      /* Current state number */
1267
0
){
1268
0
  int i;
1269
1270
0
  if( stateno>YY_MAX_SHIFT ) return stateno;
1271
0
  assert( stateno <= YY_SHIFT_COUNT );
1272
#if defined(YYCOVERAGE)
1273
  yycoverage[stateno][iLookAhead] = 1;
1274
#endif
1275
0
  do{
1276
0
    i = yy_shift_ofst[stateno];
1277
0
    assert( i>=0 );
1278
0
    assert( i<=YY_ACTTAB_COUNT );
1279
0
    assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD );
1280
0
    assert( iLookAhead!=YYNOCODE );
1281
0
    assert( iLookAhead < YYNTOKEN );
1282
0
    i += iLookAhead;
1283
0
    assert( i<(int)YY_NLOOKAHEAD );
1284
0
    if( yy_lookahead[i]!=iLookAhead ){
1285
0
#ifdef YYFALLBACK
1286
0
      YYCODETYPE iFallback;            /* Fallback token */
1287
0
      assert( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0]) );
1288
0
      iFallback = yyFallback[iLookAhead];
1289
0
      if( iFallback!=0 ){
1290
#ifndef NDEBUG
1291
        if( yyTraceFILE ){
1292
          fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
1293
             yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
1294
        }
1295
#endif
1296
0
        assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */
1297
0
        iLookAhead = iFallback;
1298
0
        continue;
1299
0
      }
1300
0
#endif
1301
#ifdef YYWILDCARD
1302
      {
1303
        int j = i - iLookAhead + YYWILDCARD;
1304
        assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) );
1305
        if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){
1306
#ifndef NDEBUG
1307
          if( yyTraceFILE ){
1308
            fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
1309
               yyTracePrompt, yyTokenName[iLookAhead],
1310
               yyTokenName[YYWILDCARD]);
1311
          }
1312
#endif /* NDEBUG */
1313
          return yy_action[j];
1314
        }
1315
      }
1316
#endif /* YYWILDCARD */
1317
0
      return yy_default[stateno];
1318
0
    }else{
1319
0
      assert( i>=0 && i<(int)(sizeof(yy_action)/sizeof(yy_action[0])) );
1320
0
      return yy_action[i];
1321
0
    }
1322
0
  }while(1);
1323
0
}
1324
1325
/*
1326
** Find the appropriate action for a parser given the non-terminal
1327
** look-ahead token iLookAhead.
1328
*/
1329
static YYACTIONTYPE yy_find_reduce_action(
1330
  YYACTIONTYPE stateno,     /* Current state number */
1331
  YYCODETYPE iLookAhead     /* The look-ahead token */
1332
0
){
1333
0
  int i;
1334
#ifdef YYERRORSYMBOL
1335
  if( stateno>YY_REDUCE_COUNT ){
1336
    return yy_default[stateno];
1337
  }
1338
#else
1339
0
  assert( stateno<=YY_REDUCE_COUNT );
1340
0
#endif
1341
0
  i = yy_reduce_ofst[stateno];
1342
0
  assert( iLookAhead!=YYNOCODE );
1343
0
  i += iLookAhead;
1344
#ifdef YYERRORSYMBOL
1345
  if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
1346
    return yy_default[stateno];
1347
  }
1348
#else
1349
0
  assert( i>=0 && i<YY_ACTTAB_COUNT );
1350
0
  assert( yy_lookahead[i]==iLookAhead );
1351
0
#endif
1352
0
  return yy_action[i];
1353
0
}
1354
1355
/*
1356
** The following routine is called if the stack overflows.
1357
*/
1358
0
static void yyStackOverflow(yyParser *yypParser){
1359
0
   ProtobufLangParserARG_FETCH
1360
0
   ProtobufLangParserCTX_FETCH
1361
#ifndef NDEBUG
1362
   if( yyTraceFILE ){
1363
     fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
1364
   }
1365
#endif
1366
0
   while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
1367
   /* Here code is inserted which will execute if the parser
1368
   ** stack every overflows */
1369
/******** Begin %stack_overflow code ******************************************/
1370
/******** End %stack_overflow code ********************************************/
1371
0
   ProtobufLangParserARG_STORE /* Suppress warning about unused %extra_argument var */
1372
0
   ProtobufLangParserCTX_STORE
1373
0
}
1374
1375
/*
1376
** Print tracing information for a SHIFT action
1377
*/
1378
#ifndef NDEBUG
1379
static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){
1380
  if( yyTraceFILE ){
1381
    if( yyNewState<YYNSTATE ){
1382
      fprintf(yyTraceFILE,"%s%s '%s', go to state %d\n",
1383
         yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major],
1384
         yyNewState);
1385
    }else{
1386
      fprintf(yyTraceFILE,"%s%s '%s', pending reduce %d\n",
1387
         yyTracePrompt, zTag, yyTokenName[yypParser->yytos->major],
1388
         yyNewState - YY_MIN_REDUCE);
1389
    }
1390
  }
1391
}
1392
#else
1393
# define yyTraceShift(X,Y,Z)
1394
#endif
1395
1396
/*
1397
** Perform a shift action.
1398
*/
1399
static void yy_shift(
1400
  yyParser *yypParser,          /* The parser to be shifted */
1401
  YYACTIONTYPE yyNewState,      /* The new state to shift in */
1402
  YYCODETYPE yyMajor,           /* The major token to shift in */
1403
  ProtobufLangParserTOKENTYPE yyMinor        /* The minor token to shift in */
1404
0
){
1405
0
  yyStackEntry *yytos;
1406
0
  yypParser->yytos++;
1407
#ifdef YYTRACKMAXSTACKDEPTH
1408
  if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
1409
    yypParser->yyhwm++;
1410
    assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) );
1411
  }
1412
#endif
1413
0
#if YYSTACKDEPTH>0
1414
0
  if( yypParser->yytos>yypParser->yystackEnd ){
1415
0
    yypParser->yytos--;
1416
0
    yyStackOverflow(yypParser);
1417
0
    return;
1418
0
  }
1419
#else
1420
  if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){
1421
    if( yyGrowStack(yypParser) ){
1422
      yypParser->yytos--;
1423
      yyStackOverflow(yypParser);
1424
      return;
1425
    }
1426
  }
1427
#endif
1428
0
  if( yyNewState > YY_MAX_SHIFT ){
1429
0
    yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
1430
0
  }
1431
0
  yytos = yypParser->yytos;
1432
0
  yytos->stateno = yyNewState;
1433
0
  yytos->major = yyMajor;
1434
0
  yytos->minor.yy0 = yyMinor;
1435
0
  yyTraceShift(yypParser, yyNewState, "Shift");
1436
0
}
1437
1438
/* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side
1439
** of that rule */
1440
static const YYCODETYPE yyRuleInfoLhs[] = {
1441
   108,  /* (0) wholeProtoBody ::= protoBody */
1442
   109,  /* (1) syntax ::= PT_SYNTAX PT_ASSIGN strLit PT_SEMICOLON */
1443
    81,  /* (2) protoBody ::= */
1444
    81,  /* (3) protoBody ::= protoBody topLevelDef */
1445
   111,  /* (4) import ::= PT_IMPORT strLit PT_SEMICOLON */
1446
   111,  /* (5) import ::= PT_IMPORT PT_PUBLIC strLit PT_SEMICOLON */
1447
   111,  /* (6) import ::= PT_IMPORT PT_WEAK strLit PT_SEMICOLON */
1448
   112,  /* (7) package ::= PT_PACKAGE exIdent PT_SEMICOLON */
1449
   116,  /* (8) extIdentInParentheses ::= PT_LPAREN exIdent PT_RPAREN */
1450
    71,  /* (9) optionName ::= optionName exIdent */
1451
    71,  /* (10) optionName ::= optionName PT_DOT extIdentInParentheses */
1452
    71,  /* (11) optionName ::= optionName extIdentInParentheses */
1453
    83,  /* (12) message ::= PT_MESSAGE messageName PT_LCURLY messageBody PT_RCURLY */
1454
    84,  /* (13) messageBody ::= */
1455
    84,  /* (14) messageBody ::= messageBody field */
1456
    84,  /* (15) messageBody ::= messageBody enum */
1457
    84,  /* (16) messageBody ::= messageBody message */
1458
    84,  /* (17) messageBody ::= messageBody group */
1459
    84,  /* (18) messageBody ::= messageBody oneof */
1460
    84,  /* (19) messageBody ::= messageBody mapField */
1461
    89,  /* (20) enum ::= PT_ENUM enumName PT_LCURLY enumBody PT_RCURLY */
1462
    90,  /* (21) enumBody ::= */
1463
    90,  /* (22) enumBody ::= enumBody enumField */
1464
    91,  /* (23) enumField ::= exIdent PT_ASSIGN enumNumber PT_LBRACKET enumValueOptions PT_RBRACKET PT_SEMICOLON */
1465
    91,  /* (24) enumField ::= exIdent PT_ASSIGN enumNumber */
1466
   106,  /* (25) enumNumber ::= intLit */
1467
   106,  /* (26) enumNumber ::= PT_PLUS intLit */
1468
   106,  /* (27) enumNumber ::= PT_MINUS intLit */
1469
    92,  /* (28) service ::= PT_SERVICE serviceName PT_LCURLY serviceBody PT_RCURLY */
1470
    93,  /* (29) serviceBody ::= */
1471
    93,  /* (30) serviceBody ::= serviceBody rpc */
1472
    93,  /* (31) serviceBody ::= serviceBody stream */
1473
    86,  /* (32) rpcDecl ::= PT_RPC rpcName PT_LPAREN messageType PT_RPAREN PT_RETURNS PT_LPAREN messageType PT_RPAREN */
1474
    86,  /* (33) rpcDecl ::= PT_RPC rpcName PT_LPAREN PT_STREAM messageType PT_RPAREN PT_RETURNS PT_LPAREN messageType PT_RPAREN */
1475
    86,  /* (34) rpcDecl ::= PT_RPC rpcName PT_LPAREN messageType PT_RPAREN PT_RETURNS PT_LPAREN PT_STREAM messageType PT_RPAREN */
1476
    86,  /* (35) rpcDecl ::= PT_RPC rpcName PT_LPAREN PT_STREAM messageType PT_RPAREN PT_RETURNS PT_LPAREN PT_STREAM messageType PT_RPAREN */
1477
    95,  /* (36) streamDecl ::= PT_STREAM streamName PT_LPAREN messageType PT_COMMA messageType PT_RPAREN */
1478
    87,  /* (37) field ::= type fieldName PT_ASSIGN fieldNumber PT_SEMICOLON */
1479
    87,  /* (38) field ::= type fieldName PT_ASSIGN fieldNumber PT_LBRACKET fieldOptions PT_RBRACKET PT_SEMICOLON */
1480
    87,  /* (39) field ::= label type fieldName PT_ASSIGN fieldNumber PT_SEMICOLON */
1481
    87,  /* (40) field ::= label type fieldName PT_ASSIGN fieldNumber PT_LBRACKET fieldOptions PT_RBRACKET PT_SEMICOLON */
1482
    65,  /* (41) label ::= PT_REQUIRED */
1483
    65,  /* (42) label ::= PT_OPTIONAL */
1484
    65,  /* (43) label ::= PT_REPEATED */
1485
    66,  /* (44) type ::= exIdent */
1486
   105,  /* (45) fieldNumber ::= intLit */
1487
   105,  /* (46) fieldNumber ::= PT_PLUS intLit */
1488
    96,  /* (47) fieldOptions ::= fieldOption */
1489
    96,  /* (48) fieldOptions ::= fieldOptions PT_COMMA fieldOption */
1490
    97,  /* (49) fieldOption ::= optionName PT_ASSIGN constant */
1491
    97,  /* (50) fieldOption ::= optionName PT_ASSIGN customOptionValue */
1492
   101,  /* (51) group ::= PT_GROUP groupName PT_ASSIGN fieldNumber PT_LCURLY messageBody PT_RCURLY */
1493
   101,  /* (52) group ::= label PT_GROUP groupName PT_ASSIGN fieldNumber PT_LCURLY messageBody PT_RCURLY */
1494
    98,  /* (53) oneof ::= PT_ONEOF oneofName PT_LCURLY oneofBody PT_RCURLY */
1495
    99,  /* (54) oneofBody ::= */
1496
    99,  /* (55) oneofBody ::= oneofBody oneofField */
1497
    88,  /* (56) oneofField ::= type fieldName PT_ASSIGN fieldNumber PT_LBRACKET fieldOptions PT_RBRACKET PT_SEMICOLON */
1498
    88,  /* (57) oneofField ::= type fieldName PT_ASSIGN fieldNumber PT_SEMICOLON */
1499
   100,  /* (58) mapField ::= PT_MAP PT_LESS keyType PT_COMMA type PT_GREATER mapName PT_ASSIGN fieldNumber PT_LBRACKET fieldOptions PT_RBRACKET PT_SEMICOLON */
1500
   100,  /* (59) mapField ::= PT_MAP PT_LESS keyType PT_COMMA type PT_GREATER mapName PT_ASSIGN fieldNumber PT_SEMICOLON */
1501
    67,  /* (60) keyType ::= exIdent */
1502
   102,  /* (61) extend ::= PT_EXTEND messageType PT_LCURLY extendBody PT_RCURLY */
1503
   103,  /* (62) extendBody ::= */
1504
   103,  /* (63) extendBody ::= extendBody field */
1505
   103,  /* (64) extendBody ::= extendBody group */
1506
    68,  /* (65) messageType ::= exIdent */
1507
   104,  /* (66) intLit ::= PT_DECIMALLIT */
1508
   104,  /* (67) intLit ::= PT_OCTALLIT */
1509
   104,  /* (68) intLit ::= PT_HEXLIT */
1510
    69,  /* (69) constant ::= exIdent */
1511
    69,  /* (70) constant ::= intLit */
1512
    69,  /* (71) constant ::= PT_PLUS intLit */
1513
    69,  /* (72) constant ::= PT_MINUS intLit */
1514
    69,  /* (73) constant ::= PT_PLUS exIdent */
1515
    69,  /* (74) constant ::= PT_MINUS exIdent */
1516
    64,  /* (75) strLit ::= PT_STRLIT */
1517
    64,  /* (76) strLit ::= strLit PT_STRLIT */
1518
   107,  /* (77) proto ::= wholeProtoBody */
1519
   107,  /* (78) proto ::= syntax wholeProtoBody */
1520
   107,  /* (79) proto ::= edition wholeProtoBody */
1521
   110,  /* (80) edition ::= PT_EDITION PT_ASSIGN PT_STRLIT PT_SEMICOLON */
1522
    81,  /* (81) protoBody ::= protoBody import */
1523
    81,  /* (82) protoBody ::= protoBody package */
1524
    81,  /* (83) protoBody ::= protoBody option */
1525
    81,  /* (84) protoBody ::= protoBody emptyStatement */
1526
   113,  /* (85) option ::= PT_OPTION optionName PT_ASSIGN constant PT_SEMICOLON */
1527
   113,  /* (86) option ::= PT_OPTION optionName PT_ASSIGN customOptionValue PT_SEMICOLON */
1528
    71,  /* (87) optionName ::= exIdent */
1529
    71,  /* (88) optionName ::= extIdentInParentheses */
1530
   115,  /* (89) customOptionValue ::= PT_LCURLY customOptionBody PT_RCURLY */
1531
   117,  /* (90) customOptionBody ::= */
1532
   117,  /* (91) customOptionBody ::= customOptionBody exIdent */
1533
   117,  /* (92) customOptionBody ::= customOptionBody PT_STRLIT */
1534
   117,  /* (93) customOptionBody ::= customOptionBody symbolsWithoutCurly */
1535
   117,  /* (94) customOptionBody ::= customOptionBody intLit */
1536
   117,  /* (95) customOptionBody ::= customOptionBody customOptionValue */
1537
   118,  /* (96) symbolsWithoutCurly ::= PT_LPAREN */
1538
   118,  /* (97) symbolsWithoutCurly ::= PT_RPAREN */
1539
   118,  /* (98) symbolsWithoutCurly ::= PT_LBRACKET */
1540
   118,  /* (99) symbolsWithoutCurly ::= PT_RBRACKET */
1541
   118,  /* (100) symbolsWithoutCurly ::= PT_EQUAL */
1542
   118,  /* (101) symbolsWithoutCurly ::= PT_NOTEQUAL */
1543
   118,  /* (102) symbolsWithoutCurly ::= PT_NOTEQUAL2 */
1544
   118,  /* (103) symbolsWithoutCurly ::= PT_GEQUAL */
1545
   118,  /* (104) symbolsWithoutCurly ::= PT_LEQUAL */
1546
   118,  /* (105) symbolsWithoutCurly ::= PT_ASSIGN_PLUS */
1547
   118,  /* (106) symbolsWithoutCurly ::= PT_ASSIGN */
1548
   118,  /* (107) symbolsWithoutCurly ::= PT_PLUS */
1549
   118,  /* (108) symbolsWithoutCurly ::= PT_MINUS */
1550
   118,  /* (109) symbolsWithoutCurly ::= PT_MULTIPLY */
1551
   118,  /* (110) symbolsWithoutCurly ::= PT_DIV */
1552
   118,  /* (111) symbolsWithoutCurly ::= PT_LOGIC_OR */
1553
   118,  /* (112) symbolsWithoutCurly ::= PT_OR */
1554
   118,  /* (113) symbolsWithoutCurly ::= PT_LOGIC_AND */
1555
   118,  /* (114) symbolsWithoutCurly ::= PT_AND */
1556
   118,  /* (115) symbolsWithoutCurly ::= PT_NOT */
1557
   118,  /* (116) symbolsWithoutCurly ::= PT_NEG */
1558
   118,  /* (117) symbolsWithoutCurly ::= PT_XOR */
1559
   118,  /* (118) symbolsWithoutCurly ::= PT_SHL */
1560
   118,  /* (119) symbolsWithoutCurly ::= PT_SHR */
1561
   118,  /* (120) symbolsWithoutCurly ::= PT_PERCENT */
1562
   118,  /* (121) symbolsWithoutCurly ::= PT_DOLLAR */
1563
   118,  /* (122) symbolsWithoutCurly ::= PT_COND */
1564
   118,  /* (123) symbolsWithoutCurly ::= PT_SEMICOLON */
1565
   118,  /* (124) symbolsWithoutCurly ::= PT_DOT */
1566
   118,  /* (125) symbolsWithoutCurly ::= PT_COMMA */
1567
   118,  /* (126) symbolsWithoutCurly ::= PT_COLON */
1568
   118,  /* (127) symbolsWithoutCurly ::= PT_LESS */
1569
   118,  /* (128) symbolsWithoutCurly ::= PT_GREATER */
1570
    82,  /* (129) topLevelDef ::= message */
1571
    82,  /* (130) topLevelDef ::= enum */
1572
    82,  /* (131) topLevelDef ::= extend */
1573
    82,  /* (132) topLevelDef ::= service */
1574
    84,  /* (133) messageBody ::= messageBody extend */
1575
    84,  /* (134) messageBody ::= messageBody extensions */
1576
    84,  /* (135) messageBody ::= messageBody option */
1577
    84,  /* (136) messageBody ::= messageBody reserved */
1578
    84,  /* (137) messageBody ::= messageBody emptyStatement */
1579
    90,  /* (138) enumBody ::= enumBody reserved */
1580
    90,  /* (139) enumBody ::= enumBody option */
1581
    90,  /* (140) enumBody ::= enumBody emptyStatement */
1582
   121,  /* (141) enumValueOptions ::= enumValueOption */
1583
   121,  /* (142) enumValueOptions ::= enumValueOptions PT_COMMA enumValueOption */
1584
   122,  /* (143) enumValueOption ::= optionName PT_ASSIGN constant */
1585
   122,  /* (144) enumValueOption ::= optionName PT_ASSIGN customOptionValue */
1586
    93,  /* (145) serviceBody ::= serviceBody option */
1587
    93,  /* (146) serviceBody ::= serviceBody emptyStatement */
1588
    85,  /* (147) rpc ::= rpcDecl PT_SEMICOLON */
1589
    85,  /* (148) rpc ::= rpcDecl PT_LCURLY rpcBody PT_RCURLY */
1590
   123,  /* (149) rpcBody ::= */
1591
   123,  /* (150) rpcBody ::= rpcBody option */
1592
   123,  /* (151) rpcBody ::= rpcBody emptyStatement */
1593
    94,  /* (152) stream ::= streamDecl PT_SEMICOLON */
1594
    94,  /* (153) stream ::= streamDecl PT_LCURLY streamBody PT_RCURLY */
1595
   124,  /* (154) streamBody ::= */
1596
   124,  /* (155) streamBody ::= streamBody option */
1597
   124,  /* (156) streamBody ::= streamBody emptyStatement */
1598
    80,  /* (157) groupName ::= exIdent */
1599
    99,  /* (158) oneofBody ::= oneofBody option */
1600
    99,  /* (159) oneofBody ::= oneofBody group */
1601
    99,  /* (160) oneofBody ::= oneofBody emptyStatement */
1602
   119,  /* (161) extensions ::= PT_EXTENSIONS ranges PT_SEMICOLON */
1603
   119,  /* (162) extensions ::= PT_EXTENSIONS ranges PT_LBRACKET declarations PT_RBRACKET PT_SEMICOLON */
1604
   126,  /* (163) declarations ::= declaration */
1605
   126,  /* (164) declarations ::= declarations PT_COMMA declaration */
1606
   127,  /* (165) declaration ::= optionName PT_ASSIGN constant */
1607
   127,  /* (166) declaration ::= optionName PT_ASSIGN customOptionValue */
1608
   120,  /* (167) reserved ::= PT_RESERVED ranges PT_SEMICOLON */
1609
   120,  /* (168) reserved ::= PT_RESERVED quoteFieldNames PT_SEMICOLON */
1610
   120,  /* (169) reserved ::= PT_RESERVED reservedIdent PT_SEMICOLON */
1611
   125,  /* (170) ranges ::= range */
1612
   125,  /* (171) ranges ::= ranges PT_COMMA range */
1613
   130,  /* (172) range ::= intLit */
1614
   130,  /* (173) range ::= intLit PT_TO intLit */
1615
   130,  /* (174) range ::= intLit PT_TO exIdent */
1616
   128,  /* (175) quoteFieldNames ::= strLit */
1617
   128,  /* (176) quoteFieldNames ::= quoteFieldNames PT_COMMA strLit */
1618
   129,  /* (177) reservedIdent ::= fieldName */
1619
   129,  /* (178) reservedIdent ::= fieldName PT_COMMA fieldName */
1620
   103,  /* (179) extendBody ::= extendBody emptyStatement */
1621
    72,  /* (180) messageName ::= exIdent */
1622
    73,  /* (181) enumName ::= exIdent */
1623
    74,  /* (182) streamName ::= exIdent */
1624
    75,  /* (183) fieldName ::= exIdent */
1625
    76,  /* (184) oneofName ::= exIdent */
1626
    77,  /* (185) mapName ::= exIdent */
1627
    78,  /* (186) serviceName ::= exIdent */
1628
    79,  /* (187) rpcName ::= exIdent */
1629
   114,  /* (188) emptyStatement ::= PT_SEMICOLON */
1630
    69,  /* (189) constant ::= strLit */
1631
    70,  /* (190) exIdent ::= PT_IDENT */
1632
};
1633
1634
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
1635
** of symbols on the right-hand side of that rule. */
1636
static const signed char yyRuleInfoNRhs[] = {
1637
   -1,  /* (0) wholeProtoBody ::= protoBody */
1638
   -4,  /* (1) syntax ::= PT_SYNTAX PT_ASSIGN strLit PT_SEMICOLON */
1639
    0,  /* (2) protoBody ::= */
1640
   -2,  /* (3) protoBody ::= protoBody topLevelDef */
1641
   -3,  /* (4) import ::= PT_IMPORT strLit PT_SEMICOLON */
1642
   -4,  /* (5) import ::= PT_IMPORT PT_PUBLIC strLit PT_SEMICOLON */
1643
   -4,  /* (6) import ::= PT_IMPORT PT_WEAK strLit PT_SEMICOLON */
1644
   -3,  /* (7) package ::= PT_PACKAGE exIdent PT_SEMICOLON */
1645
   -3,  /* (8) extIdentInParentheses ::= PT_LPAREN exIdent PT_RPAREN */
1646
   -2,  /* (9) optionName ::= optionName exIdent */
1647
   -3,  /* (10) optionName ::= optionName PT_DOT extIdentInParentheses */
1648
   -2,  /* (11) optionName ::= optionName extIdentInParentheses */
1649
   -5,  /* (12) message ::= PT_MESSAGE messageName PT_LCURLY messageBody PT_RCURLY */
1650
    0,  /* (13) messageBody ::= */
1651
   -2,  /* (14) messageBody ::= messageBody field */
1652
   -2,  /* (15) messageBody ::= messageBody enum */
1653
   -2,  /* (16) messageBody ::= messageBody message */
1654
   -2,  /* (17) messageBody ::= messageBody group */
1655
   -2,  /* (18) messageBody ::= messageBody oneof */
1656
   -2,  /* (19) messageBody ::= messageBody mapField */
1657
   -5,  /* (20) enum ::= PT_ENUM enumName PT_LCURLY enumBody PT_RCURLY */
1658
    0,  /* (21) enumBody ::= */
1659
   -2,  /* (22) enumBody ::= enumBody enumField */
1660
   -7,  /* (23) enumField ::= exIdent PT_ASSIGN enumNumber PT_LBRACKET enumValueOptions PT_RBRACKET PT_SEMICOLON */
1661
   -3,  /* (24) enumField ::= exIdent PT_ASSIGN enumNumber */
1662
   -1,  /* (25) enumNumber ::= intLit */
1663
   -2,  /* (26) enumNumber ::= PT_PLUS intLit */
1664
   -2,  /* (27) enumNumber ::= PT_MINUS intLit */
1665
   -5,  /* (28) service ::= PT_SERVICE serviceName PT_LCURLY serviceBody PT_RCURLY */
1666
    0,  /* (29) serviceBody ::= */
1667
   -2,  /* (30) serviceBody ::= serviceBody rpc */
1668
   -2,  /* (31) serviceBody ::= serviceBody stream */
1669
   -9,  /* (32) rpcDecl ::= PT_RPC rpcName PT_LPAREN messageType PT_RPAREN PT_RETURNS PT_LPAREN messageType PT_RPAREN */
1670
  -10,  /* (33) rpcDecl ::= PT_RPC rpcName PT_LPAREN PT_STREAM messageType PT_RPAREN PT_RETURNS PT_LPAREN messageType PT_RPAREN */
1671
  -10,  /* (34) rpcDecl ::= PT_RPC rpcName PT_LPAREN messageType PT_RPAREN PT_RETURNS PT_LPAREN PT_STREAM messageType PT_RPAREN */
1672
  -11,  /* (35) rpcDecl ::= PT_RPC rpcName PT_LPAREN PT_STREAM messageType PT_RPAREN PT_RETURNS PT_LPAREN PT_STREAM messageType PT_RPAREN */
1673
   -7,  /* (36) streamDecl ::= PT_STREAM streamName PT_LPAREN messageType PT_COMMA messageType PT_RPAREN */
1674
   -5,  /* (37) field ::= type fieldName PT_ASSIGN fieldNumber PT_SEMICOLON */
1675
   -8,  /* (38) field ::= type fieldName PT_ASSIGN fieldNumber PT_LBRACKET fieldOptions PT_RBRACKET PT_SEMICOLON */
1676
   -6,  /* (39) field ::= label type fieldName PT_ASSIGN fieldNumber PT_SEMICOLON */
1677
   -9,  /* (40) field ::= label type fieldName PT_ASSIGN fieldNumber PT_LBRACKET fieldOptions PT_RBRACKET PT_SEMICOLON */
1678
   -1,  /* (41) label ::= PT_REQUIRED */
1679
   -1,  /* (42) label ::= PT_OPTIONAL */
1680
   -1,  /* (43) label ::= PT_REPEATED */
1681
   -1,  /* (44) type ::= exIdent */
1682
   -1,  /* (45) fieldNumber ::= intLit */
1683
   -2,  /* (46) fieldNumber ::= PT_PLUS intLit */
1684
   -1,  /* (47) fieldOptions ::= fieldOption */
1685
   -3,  /* (48) fieldOptions ::= fieldOptions PT_COMMA fieldOption */
1686
   -3,  /* (49) fieldOption ::= optionName PT_ASSIGN constant */
1687
   -3,  /* (50) fieldOption ::= optionName PT_ASSIGN customOptionValue */
1688
   -7,  /* (51) group ::= PT_GROUP groupName PT_ASSIGN fieldNumber PT_LCURLY messageBody PT_RCURLY */
1689
   -8,  /* (52) group ::= label PT_GROUP groupName PT_ASSIGN fieldNumber PT_LCURLY messageBody PT_RCURLY */
1690
   -5,  /* (53) oneof ::= PT_ONEOF oneofName PT_LCURLY oneofBody PT_RCURLY */
1691
    0,  /* (54) oneofBody ::= */
1692
   -2,  /* (55) oneofBody ::= oneofBody oneofField */
1693
   -8,  /* (56) oneofField ::= type fieldName PT_ASSIGN fieldNumber PT_LBRACKET fieldOptions PT_RBRACKET PT_SEMICOLON */
1694
   -5,  /* (57) oneofField ::= type fieldName PT_ASSIGN fieldNumber PT_SEMICOLON */
1695
  -13,  /* (58) mapField ::= PT_MAP PT_LESS keyType PT_COMMA type PT_GREATER mapName PT_ASSIGN fieldNumber PT_LBRACKET fieldOptions PT_RBRACKET PT_SEMICOLON */
1696
  -10,  /* (59) mapField ::= PT_MAP PT_LESS keyType PT_COMMA type PT_GREATER mapName PT_ASSIGN fieldNumber PT_SEMICOLON */
1697
   -1,  /* (60) keyType ::= exIdent */
1698
   -5,  /* (61) extend ::= PT_EXTEND messageType PT_LCURLY extendBody PT_RCURLY */
1699
    0,  /* (62) extendBody ::= */
1700
   -2,  /* (63) extendBody ::= extendBody field */
1701
   -2,  /* (64) extendBody ::= extendBody group */
1702
   -1,  /* (65) messageType ::= exIdent */
1703
   -1,  /* (66) intLit ::= PT_DECIMALLIT */
1704
   -1,  /* (67) intLit ::= PT_OCTALLIT */
1705
   -1,  /* (68) intLit ::= PT_HEXLIT */
1706
   -1,  /* (69) constant ::= exIdent */
1707
   -1,  /* (70) constant ::= intLit */
1708
   -2,  /* (71) constant ::= PT_PLUS intLit */
1709
   -2,  /* (72) constant ::= PT_MINUS intLit */
1710
   -2,  /* (73) constant ::= PT_PLUS exIdent */
1711
   -2,  /* (74) constant ::= PT_MINUS exIdent */
1712
   -1,  /* (75) strLit ::= PT_STRLIT */
1713
   -2,  /* (76) strLit ::= strLit PT_STRLIT */
1714
   -1,  /* (77) proto ::= wholeProtoBody */
1715
   -2,  /* (78) proto ::= syntax wholeProtoBody */
1716
   -2,  /* (79) proto ::= edition wholeProtoBody */
1717
   -4,  /* (80) edition ::= PT_EDITION PT_ASSIGN PT_STRLIT PT_SEMICOLON */
1718
   -2,  /* (81) protoBody ::= protoBody import */
1719
   -2,  /* (82) protoBody ::= protoBody package */
1720
   -2,  /* (83) protoBody ::= protoBody option */
1721
   -2,  /* (84) protoBody ::= protoBody emptyStatement */
1722
   -5,  /* (85) option ::= PT_OPTION optionName PT_ASSIGN constant PT_SEMICOLON */
1723
   -5,  /* (86) option ::= PT_OPTION optionName PT_ASSIGN customOptionValue PT_SEMICOLON */
1724
   -1,  /* (87) optionName ::= exIdent */
1725
   -1,  /* (88) optionName ::= extIdentInParentheses */
1726
   -3,  /* (89) customOptionValue ::= PT_LCURLY customOptionBody PT_RCURLY */
1727
    0,  /* (90) customOptionBody ::= */
1728
   -2,  /* (91) customOptionBody ::= customOptionBody exIdent */
1729
   -2,  /* (92) customOptionBody ::= customOptionBody PT_STRLIT */
1730
   -2,  /* (93) customOptionBody ::= customOptionBody symbolsWithoutCurly */
1731
   -2,  /* (94) customOptionBody ::= customOptionBody intLit */
1732
   -2,  /* (95) customOptionBody ::= customOptionBody customOptionValue */
1733
   -1,  /* (96) symbolsWithoutCurly ::= PT_LPAREN */
1734
   -1,  /* (97) symbolsWithoutCurly ::= PT_RPAREN */
1735
   -1,  /* (98) symbolsWithoutCurly ::= PT_LBRACKET */
1736
   -1,  /* (99) symbolsWithoutCurly ::= PT_RBRACKET */
1737
   -1,  /* (100) symbolsWithoutCurly ::= PT_EQUAL */
1738
   -1,  /* (101) symbolsWithoutCurly ::= PT_NOTEQUAL */
1739
   -1,  /* (102) symbolsWithoutCurly ::= PT_NOTEQUAL2 */
1740
   -1,  /* (103) symbolsWithoutCurly ::= PT_GEQUAL */
1741
   -1,  /* (104) symbolsWithoutCurly ::= PT_LEQUAL */
1742
   -1,  /* (105) symbolsWithoutCurly ::= PT_ASSIGN_PLUS */
1743
   -1,  /* (106) symbolsWithoutCurly ::= PT_ASSIGN */
1744
   -1,  /* (107) symbolsWithoutCurly ::= PT_PLUS */
1745
   -1,  /* (108) symbolsWithoutCurly ::= PT_MINUS */
1746
   -1,  /* (109) symbolsWithoutCurly ::= PT_MULTIPLY */
1747
   -1,  /* (110) symbolsWithoutCurly ::= PT_DIV */
1748
   -1,  /* (111) symbolsWithoutCurly ::= PT_LOGIC_OR */
1749
   -1,  /* (112) symbolsWithoutCurly ::= PT_OR */
1750
   -1,  /* (113) symbolsWithoutCurly ::= PT_LOGIC_AND */
1751
   -1,  /* (114) symbolsWithoutCurly ::= PT_AND */
1752
   -1,  /* (115) symbolsWithoutCurly ::= PT_NOT */
1753
   -1,  /* (116) symbolsWithoutCurly ::= PT_NEG */
1754
   -1,  /* (117) symbolsWithoutCurly ::= PT_XOR */
1755
   -1,  /* (118) symbolsWithoutCurly ::= PT_SHL */
1756
   -1,  /* (119) symbolsWithoutCurly ::= PT_SHR */
1757
   -1,  /* (120) symbolsWithoutCurly ::= PT_PERCENT */
1758
   -1,  /* (121) symbolsWithoutCurly ::= PT_DOLLAR */
1759
   -1,  /* (122) symbolsWithoutCurly ::= PT_COND */
1760
   -1,  /* (123) symbolsWithoutCurly ::= PT_SEMICOLON */
1761
   -1,  /* (124) symbolsWithoutCurly ::= PT_DOT */
1762
   -1,  /* (125) symbolsWithoutCurly ::= PT_COMMA */
1763
   -1,  /* (126) symbolsWithoutCurly ::= PT_COLON */
1764
   -1,  /* (127) symbolsWithoutCurly ::= PT_LESS */
1765
   -1,  /* (128) symbolsWithoutCurly ::= PT_GREATER */
1766
   -1,  /* (129) topLevelDef ::= message */
1767
   -1,  /* (130) topLevelDef ::= enum */
1768
   -1,  /* (131) topLevelDef ::= extend */
1769
   -1,  /* (132) topLevelDef ::= service */
1770
   -2,  /* (133) messageBody ::= messageBody extend */
1771
   -2,  /* (134) messageBody ::= messageBody extensions */
1772
   -2,  /* (135) messageBody ::= messageBody option */
1773
   -2,  /* (136) messageBody ::= messageBody reserved */
1774
   -2,  /* (137) messageBody ::= messageBody emptyStatement */
1775
   -2,  /* (138) enumBody ::= enumBody reserved */
1776
   -2,  /* (139) enumBody ::= enumBody option */
1777
   -2,  /* (140) enumBody ::= enumBody emptyStatement */
1778
   -1,  /* (141) enumValueOptions ::= enumValueOption */
1779
   -3,  /* (142) enumValueOptions ::= enumValueOptions PT_COMMA enumValueOption */
1780
   -3,  /* (143) enumValueOption ::= optionName PT_ASSIGN constant */
1781
   -3,  /* (144) enumValueOption ::= optionName PT_ASSIGN customOptionValue */
1782
   -2,  /* (145) serviceBody ::= serviceBody option */
1783
   -2,  /* (146) serviceBody ::= serviceBody emptyStatement */
1784
   -2,  /* (147) rpc ::= rpcDecl PT_SEMICOLON */
1785
   -4,  /* (148) rpc ::= rpcDecl PT_LCURLY rpcBody PT_RCURLY */
1786
    0,  /* (149) rpcBody ::= */
1787
   -2,  /* (150) rpcBody ::= rpcBody option */
1788
   -2,  /* (151) rpcBody ::= rpcBody emptyStatement */
1789
   -2,  /* (152) stream ::= streamDecl PT_SEMICOLON */
1790
   -4,  /* (153) stream ::= streamDecl PT_LCURLY streamBody PT_RCURLY */
1791
    0,  /* (154) streamBody ::= */
1792
   -2,  /* (155) streamBody ::= streamBody option */
1793
   -2,  /* (156) streamBody ::= streamBody emptyStatement */
1794
   -1,  /* (157) groupName ::= exIdent */
1795
   -2,  /* (158) oneofBody ::= oneofBody option */
1796
   -2,  /* (159) oneofBody ::= oneofBody group */
1797
   -2,  /* (160) oneofBody ::= oneofBody emptyStatement */
1798
   -3,  /* (161) extensions ::= PT_EXTENSIONS ranges PT_SEMICOLON */
1799
   -6,  /* (162) extensions ::= PT_EXTENSIONS ranges PT_LBRACKET declarations PT_RBRACKET PT_SEMICOLON */
1800
   -1,  /* (163) declarations ::= declaration */
1801
   -3,  /* (164) declarations ::= declarations PT_COMMA declaration */
1802
   -3,  /* (165) declaration ::= optionName PT_ASSIGN constant */
1803
   -3,  /* (166) declaration ::= optionName PT_ASSIGN customOptionValue */
1804
   -3,  /* (167) reserved ::= PT_RESERVED ranges PT_SEMICOLON */
1805
   -3,  /* (168) reserved ::= PT_RESERVED quoteFieldNames PT_SEMICOLON */
1806
   -3,  /* (169) reserved ::= PT_RESERVED reservedIdent PT_SEMICOLON */
1807
   -1,  /* (170) ranges ::= range */
1808
   -3,  /* (171) ranges ::= ranges PT_COMMA range */
1809
   -1,  /* (172) range ::= intLit */
1810
   -3,  /* (173) range ::= intLit PT_TO intLit */
1811
   -3,  /* (174) range ::= intLit PT_TO exIdent */
1812
   -1,  /* (175) quoteFieldNames ::= strLit */
1813
   -3,  /* (176) quoteFieldNames ::= quoteFieldNames PT_COMMA strLit */
1814
   -1,  /* (177) reservedIdent ::= fieldName */
1815
   -3,  /* (178) reservedIdent ::= fieldName PT_COMMA fieldName */
1816
   -2,  /* (179) extendBody ::= extendBody emptyStatement */
1817
   -1,  /* (180) messageName ::= exIdent */
1818
   -1,  /* (181) enumName ::= exIdent */
1819
   -1,  /* (182) streamName ::= exIdent */
1820
   -1,  /* (183) fieldName ::= exIdent */
1821
   -1,  /* (184) oneofName ::= exIdent */
1822
   -1,  /* (185) mapName ::= exIdent */
1823
   -1,  /* (186) serviceName ::= exIdent */
1824
   -1,  /* (187) rpcName ::= exIdent */
1825
   -1,  /* (188) emptyStatement ::= PT_SEMICOLON */
1826
   -1,  /* (189) constant ::= strLit */
1827
   -1,  /* (190) exIdent ::= PT_IDENT */
1828
};
1829
1830
static void yy_accept(yyParser*);  /* Forward Declaration */
1831
1832
/*
1833
** Perform a reduce action and the shift that must immediately
1834
** follow the reduce.
1835
**
1836
** The yyLookahead and yyLookaheadToken parameters provide reduce actions
1837
** access to the lookahead token (if any).  The yyLookahead will be YYNOCODE
1838
** if the lookahead token has already been consumed.  As this procedure is
1839
** only called from one place, optimizing compilers will in-line it, which
1840
** means that the extra parameters have no performance impact.
1841
*/
1842
static YYACTIONTYPE yy_reduce(
1843
  yyParser *yypParser,         /* The parser */
1844
  unsigned int yyruleno,       /* Number of the rule by which to reduce */
1845
  int yyLookahead,             /* Lookahead token, or YYNOCODE if none */
1846
  ProtobufLangParserTOKENTYPE yyLookaheadToken  /* Value of the lookahead token */
1847
  ProtobufLangParserCTX_PDECL                   /* %extra_context */
1848
0
){
1849
0
  int yygoto;                     /* The next state */
1850
0
  YYACTIONTYPE yyact;             /* The next action */
1851
0
  yyStackEntry *yymsp;            /* The top of the parser's stack */
1852
0
  int yysize;                     /* Amount to pop the stack */
1853
0
  ProtobufLangParserARG_FETCH
1854
0
  (void)yyLookahead;
1855
0
  (void)yyLookaheadToken;
1856
0
  yymsp = yypParser->yytos;
1857
1858
0
  switch( yyruleno ){
1859
  /* Beginning here are the reduction cases.  A typical example
1860
  ** follows:
1861
  **   case 0:
1862
  **  #line <lineno> <grammarfile>
1863
  **     { ... }           // User supplied code
1864
  **  #line <lineno> <thisfile>
1865
  **     break;
1866
  */
1867
/********** Begin reduce actions **********************************************/
1868
0
        YYMINORTYPE yylhsminor;
1869
0
      case 0: /* wholeProtoBody ::= protoBody */
1870
0
#line 155 "/src/wireshark/epan/protobuf_lang_parser.lemon"
1871
0
{
1872
        /* set real package name */
1873
0
        pbl_set_node_name(yymsp[0].minor.yy93, state->file->package_name_lineno, state->file->package_name);
1874
        /* use the allocate mem of the name of the package node */
1875
0
        state->file->package_name = pbl_get_node_name(yymsp[0].minor.yy93);
1876
        /* put this file data into package tables */
1877
0
        pbl_node_t* packnode = (pbl_node_t*)g_hash_table_lookup(state->pool->packages, state->file->package_name);
1878
0
        if (packnode) {
1879
0
            pbl_merge_children(packnode, yymsp[0].minor.yy93);
1880
0
            pbl_free_node(yymsp[0].minor.yy93);
1881
0
        } else {
1882
0
            g_hash_table_insert(state->pool->packages, g_strdup(state->file->package_name), yymsp[0].minor.yy93);
1883
0
        }
1884
0
    }
1885
0
#line 1910 "./protobuf_lang_parser.c"
1886
0
        break;
1887
0
      case 1: /* syntax ::= PT_SYNTAX PT_ASSIGN strLit PT_SEMICOLON */
1888
0
{  yy_destructor(yypParser,2,&yymsp[-3].minor);
1889
0
#line 173 "/src/wireshark/epan/protobuf_lang_parser.lemon"
1890
0
{
1891
0
        if (!strcmp(yymsp[-1].minor.yy254, "proto3")) {
1892
0
            state->file->syntax_version = 3;
1893
0
        } else if (!strcmp(yymsp[-1].minor.yy254, "proto2")) {
1894
0
            state->file->syntax_version = 2;
1895
0
        } else {
1896
0
            pbl_parser_error(state, "Unrecognized syntax identifier [%s]. This parser only recognizes \"proto3\" or \"proto2\"!", yymsp[-1].minor.yy254);
1897
0
            state->grammar_error = TRUE;
1898
0
        }
1899
0
    }
1900
0
#line 1925 "./protobuf_lang_parser.c"
1901
0
  yy_destructor(yypParser,25,&yymsp[-2].minor);
1902
0
  yy_destructor(yypParser,26,&yymsp[0].minor);
1903
0
}
1904
0
        break;
1905
0
      case 2: /* protoBody ::= */
1906
0
#line 191 "/src/wireshark/epan/protobuf_lang_parser.lemon"
1907
0
{ yymsp[1].minor.yy93 = pbl_create_node(state->file, CUR_LINENO, PBL_PACKAGE, NAME_TO_BE_SET); }
1908
0
#line 1933 "./protobuf_lang_parser.c"
1909
0
        break;
1910
0
      case 3: /* protoBody ::= protoBody topLevelDef */
1911
0
      case 14: /* messageBody ::= messageBody field */ yytestcase(yyruleno==14);
1912
0
      case 15: /* messageBody ::= messageBody enum */ yytestcase(yyruleno==15);
1913
0
      case 16: /* messageBody ::= messageBody message */ yytestcase(yyruleno==16);
1914
0
      case 17: /* messageBody ::= messageBody group */ yytestcase(yyruleno==17);
1915
0
      case 19: /* messageBody ::= messageBody mapField */ yytestcase(yyruleno==19);
1916
0
      case 22: /* enumBody ::= enumBody enumField */ yytestcase(yyruleno==22);
1917
0
      case 30: /* serviceBody ::= serviceBody rpc */ yytestcase(yyruleno==30);
1918
0
      case 31: /* serviceBody ::= serviceBody stream */ yytestcase(yyruleno==31);
1919
0
      case 55: /* oneofBody ::= oneofBody oneofField */ yytestcase(yyruleno==55);
1920
0
      case 63: /* extendBody ::= extendBody field */ yytestcase(yyruleno==63);
1921
0
      case 64: /* extendBody ::= extendBody group */ yytestcase(yyruleno==64);
1922
0
#line 195 "/src/wireshark/epan/protobuf_lang_parser.lemon"
1923
0
{ yylhsminor.yy93 = yymsp[-1].minor.yy93; pbl_add_child(yylhsminor.yy93, yymsp[0].minor.yy93); }
1924
0
#line 1949 "./protobuf_lang_parser.c"
1925
0
  yymsp[-1].minor.yy93 = yylhsminor.yy93;
1926
0
        break;
1927
0
      case 4: /* import ::= PT_IMPORT strLit PT_SEMICOLON */
1928
0
{  yy_destructor(yypParser,4,&yymsp[-2].minor);
1929
0
#line 199 "/src/wireshark/epan/protobuf_lang_parser.lemon"
1930
0
{ pbl_add_proto_file_to_be_parsed(state->pool, yymsp[-1].minor.yy254); }
1931
0
#line 1956 "./protobuf_lang_parser.c"
1932
0
  yy_destructor(yypParser,26,&yymsp[0].minor);
1933
0
}
1934
0
        break;
1935
0
      case 5: /* import ::= PT_IMPORT PT_PUBLIC strLit PT_SEMICOLON */
1936
0
{  yy_destructor(yypParser,4,&yymsp[-3].minor);
1937
0
#line 200 "/src/wireshark/epan/protobuf_lang_parser.lemon"
1938
0
{ pbl_add_proto_file_to_be_parsed(state->pool, yymsp[-1].minor.yy254); }
1939
0
#line 1964 "./protobuf_lang_parser.c"
1940
0
  yy_destructor(yypParser,6,&yymsp[-2].minor);
1941
0
  yy_destructor(yypParser,26,&yymsp[0].minor);
1942
0
}
1943
0
        break;
1944
0
      case 6: /* import ::= PT_IMPORT PT_WEAK strLit PT_SEMICOLON */
1945
0
{  yy_destructor(yypParser,4,&yymsp[-3].minor);
1946
0
#line 201 "/src/wireshark/epan/protobuf_lang_parser.lemon"
1947
0
{ pbl_add_proto_file_to_be_parsed(state->pool, yymsp[-1].minor.yy254); }
1948
0
#line 1973 "./protobuf_lang_parser.c"
1949
0
  yy_destructor(yypParser,5,&yymsp[-2].minor);
1950
0
  yy_destructor(yypParser,26,&yymsp[0].minor);
1951
0
}
1952
0
        break;
1953
0
      case 7: /* package ::= PT_PACKAGE exIdent PT_SEMICOLON */
1954
0
{  yy_destructor(yypParser,7,&yymsp[-2].minor);
1955
0
#line 205 "/src/wireshark/epan/protobuf_lang_parser.lemon"
1956
0
{   /* The memory of (yymsp[-1].minor.yy118) will be freed after parsing, but the package_name will
1957
           be replaced by the new-allocated name of package node late */
1958
0
        state->file->package_name = yymsp[-1].minor.yy118->v;
1959
0
        state->file->package_name_lineno = yymsp[-1].minor.yy118->ln;
1960
0
    }
1961
0
#line 1986 "./protobuf_lang_parser.c"
1962
0
  yy_destructor(yypParser,26,&yymsp[0].minor);
1963
0
}
1964
0
        break;
1965
0
      case 8: /* extIdentInParentheses ::= PT_LPAREN exIdent PT_RPAREN */
1966
0
{  yy_destructor(yypParser,28,&yymsp[-2].minor);
1967
0
#line 219 "/src/wireshark/epan/protobuf_lang_parser.lemon"
1968
0
{ yymsp[-2].minor.yy0 = yymsp[-1].minor.yy118; yymsp[-2].minor.yy0->v = pbl_store_string_token(state, g_strconcat("(", yymsp[-1].minor.yy118->v, ")", NULL)); }
1969
0
#line 1994 "./protobuf_lang_parser.c"
1970
0
  yy_destructor(yypParser,29,&yymsp[0].minor);
1971
0
}
1972
0
        break;
1973
0
      case 9: /* optionName ::= optionName exIdent */
1974
0
#line 223 "/src/wireshark/epan/protobuf_lang_parser.lemon"
1975
0
{ yylhsminor.yy118 = yymsp[-1].minor.yy118; yylhsminor.yy118->v = pbl_store_string_token(state, g_strconcat(yymsp[-1].minor.yy118->v, yymsp[0].minor.yy118->v, NULL)); }
1976
0
#line 2001 "./protobuf_lang_parser.c"
1977
0
  yymsp[-1].minor.yy118 = yylhsminor.yy118;
1978
0
        break;
1979
0
      case 10: /* optionName ::= optionName PT_DOT extIdentInParentheses */
1980
0
#line 225 "/src/wireshark/epan/protobuf_lang_parser.lemon"
1981
0
{ yylhsminor.yy118 = yymsp[-2].minor.yy118; yylhsminor.yy118->v = pbl_store_string_token(state, g_strconcat(yymsp[-2].minor.yy118->v, ".", yymsp[0].minor.yy0->v, NULL)); }
1982
0
#line 2007 "./protobuf_lang_parser.c"
1983
0
  yy_destructor(yypParser,30,&yymsp[-1].minor);
1984
0
  yymsp[-2].minor.yy118 = yylhsminor.yy118;
1985
0
        break;
1986
0
      case 11: /* optionName ::= optionName extIdentInParentheses */
1987
0
#line 227 "/src/wireshark/epan/protobuf_lang_parser.lemon"
1988
0
{ yylhsminor.yy118 = yymsp[-1].minor.yy118; yylhsminor.yy118->v = pbl_store_string_token(state, g_strconcat(yymsp[-1].minor.yy118->v, ".", yymsp[0].minor.yy0->v, NULL)); }
1989
0
#line 2014 "./protobuf_lang_parser.c"
1990
0
  yymsp[-1].minor.yy118 = yylhsminor.yy118;
1991
0
        break;
1992
0
      case 12: /* message ::= PT_MESSAGE messageName PT_LCURLY messageBody PT_RCURLY */
1993
0
{  yy_destructor(yypParser,19,&yymsp[-4].minor);
1994
0
#line 307 "/src/wireshark/epan/protobuf_lang_parser.lemon"
1995
0
{ yymsp[-4].minor.yy93 = yymsp[-1].minor.yy93; pbl_set_node_name(yymsp[-4].minor.yy93, yymsp[-3].minor.yy118->ln, yymsp[-3].minor.yy118->v); }
1996
0
#line 2021 "./protobuf_lang_parser.c"
1997
0
  yy_destructor(yypParser,31,&yymsp[-2].minor);
1998
0
  yy_destructor(yypParser,32,&yymsp[0].minor);
1999
0
}
2000
0
        break;
2001
0
      case 13: /* messageBody ::= */
2002
0
      case 62: /* extendBody ::= */ yytestcase(yyruleno==62);
2003
0
#line 311 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2004
0
{ yymsp[1].minor.yy93 = pbl_create_node(state->file, CUR_LINENO, PBL_MESSAGE, NAME_TO_BE_SET); }
2005
0
#line 2030 "./protobuf_lang_parser.c"
2006
0
        break;
2007
0
      case 18: /* messageBody ::= messageBody oneof */
2008
0
#line 319 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2009
0
{ yylhsminor.yy93 = yymsp[-1].minor.yy93; pbl_merge_children(yylhsminor.yy93, yymsp[0].minor.yy93); pbl_free_node(yymsp[0].minor.yy93); }
2010
0
#line 2035 "./protobuf_lang_parser.c"
2011
0
  yymsp[-1].minor.yy93 = yylhsminor.yy93;
2012
0
        break;
2013
0
      case 20: /* enum ::= PT_ENUM enumName PT_LCURLY enumBody PT_RCURLY */
2014
0
{  yy_destructor(yypParser,15,&yymsp[-4].minor);
2015
0
#line 326 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2016
0
{ yymsp[-4].minor.yy93 = yymsp[-1].minor.yy93; pbl_set_node_name(yymsp[-4].minor.yy93, yymsp[-3].minor.yy118->ln, yymsp[-3].minor.yy118->v); }
2017
0
#line 2042 "./protobuf_lang_parser.c"
2018
0
  yy_destructor(yypParser,31,&yymsp[-2].minor);
2019
0
  yy_destructor(yypParser,32,&yymsp[0].minor);
2020
0
}
2021
0
        break;
2022
0
      case 21: /* enumBody ::= */
2023
0
#line 330 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2024
0
{ yymsp[1].minor.yy93 = pbl_create_node(state->file, CUR_LINENO, PBL_ENUM, NAME_TO_BE_SET); }
2025
0
#line 2050 "./protobuf_lang_parser.c"
2026
0
        break;
2027
0
      case 23: /* enumField ::= exIdent PT_ASSIGN enumNumber PT_LBRACKET enumValueOptions PT_RBRACKET PT_SEMICOLON */
2028
0
#line 338 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2029
0
{ yylhsminor.yy93 = pbl_create_enum_value_node(state->file, yymsp[-6].minor.yy118->ln, yymsp[-6].minor.yy118->v, yymsp[-4].minor.yy116); }
2030
0
#line 2055 "./protobuf_lang_parser.c"
2031
0
  yy_destructor(yypParser,25,&yymsp[-5].minor);
2032
0
  yy_destructor(yypParser,33,&yymsp[-3].minor);
2033
0
  yy_destructor(yypParser,34,&yymsp[-1].minor);
2034
0
  yy_destructor(yypParser,26,&yymsp[0].minor);
2035
0
  yymsp[-6].minor.yy93 = yylhsminor.yy93;
2036
0
        break;
2037
0
      case 24: /* enumField ::= exIdent PT_ASSIGN enumNumber */
2038
0
#line 340 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2039
0
{ yylhsminor.yy93 = pbl_create_enum_value_node(state->file, yymsp[-2].minor.yy118->ln, yymsp[-2].minor.yy118->v, yymsp[0].minor.yy116); }
2040
0
#line 2065 "./protobuf_lang_parser.c"
2041
0
  yy_destructor(yypParser,25,&yymsp[-1].minor);
2042
0
  yymsp[-2].minor.yy93 = yylhsminor.yy93;
2043
0
        break;
2044
0
      case 25: /* enumNumber ::= intLit */
2045
0
      case 45: /* fieldNumber ::= intLit */ yytestcase(yyruleno==45);
2046
0
#line 343 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2047
0
{ yylhsminor.yy116 = (int)yymsp[0].minor.yy180; }
2048
0
#line 2073 "./protobuf_lang_parser.c"
2049
0
  yymsp[0].minor.yy116 = yylhsminor.yy116;
2050
0
        break;
2051
0
      case 26: /* enumNumber ::= PT_PLUS intLit */
2052
0
      case 46: /* fieldNumber ::= PT_PLUS intLit */ yytestcase(yyruleno==46);
2053
0
{  yy_destructor(yypParser,41,&yymsp[-1].minor);
2054
0
#line 344 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2055
0
{ yymsp[-1].minor.yy116 = (int)yymsp[0].minor.yy180; }
2056
0
#line 2081 "./protobuf_lang_parser.c"
2057
0
}
2058
0
        break;
2059
0
      case 27: /* enumNumber ::= PT_MINUS intLit */
2060
0
{  yy_destructor(yypParser,42,&yymsp[-1].minor);
2061
0
#line 345 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2062
0
{ yymsp[-1].minor.yy116 = -(int)yymsp[0].minor.yy180; }
2063
0
#line 2088 "./protobuf_lang_parser.c"
2064
0
}
2065
0
        break;
2066
0
      case 28: /* service ::= PT_SERVICE serviceName PT_LCURLY serviceBody PT_RCURLY */
2067
0
{  yy_destructor(yypParser,20,&yymsp[-4].minor);
2068
0
#line 359 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2069
0
{ yymsp[-4].minor.yy93 = yymsp[-1].minor.yy93; pbl_set_node_name(yymsp[-4].minor.yy93, yymsp[-3].minor.yy118->ln, yymsp[-3].minor.yy118->v); }
2070
0
#line 2095 "./protobuf_lang_parser.c"
2071
0
  yy_destructor(yypParser,31,&yymsp[-2].minor);
2072
0
  yy_destructor(yypParser,32,&yymsp[0].minor);
2073
0
}
2074
0
        break;
2075
0
      case 29: /* serviceBody ::= */
2076
0
#line 361 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2077
0
{ yymsp[1].minor.yy93 = pbl_create_node(state->file, CUR_LINENO, PBL_SERVICE, NAME_TO_BE_SET); }
2078
0
#line 2103 "./protobuf_lang_parser.c"
2079
0
        break;
2080
0
      case 32: /* rpcDecl ::= PT_RPC rpcName PT_LPAREN messageType PT_RPAREN PT_RETURNS PT_LPAREN messageType PT_RPAREN */
2081
0
{  yy_destructor(yypParser,21,&yymsp[-8].minor);
2082
0
#line 373 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2083
0
{ yymsp[-8].minor.yy93 = pbl_create_method_node(state->file, yymsp[-7].minor.yy118->ln, yymsp[-7].minor.yy118->v, yymsp[-5].minor.yy254, FALSE, yymsp[-1].minor.yy254, FALSE); }
2084
0
#line 2109 "./protobuf_lang_parser.c"
2085
0
  yy_destructor(yypParser,28,&yymsp[-6].minor);
2086
0
  yy_destructor(yypParser,29,&yymsp[-4].minor);
2087
0
  yy_destructor(yypParser,23,&yymsp[-3].minor);
2088
0
  yy_destructor(yypParser,28,&yymsp[-2].minor);
2089
0
  yy_destructor(yypParser,29,&yymsp[0].minor);
2090
0
}
2091
0
        break;
2092
0
      case 33: /* rpcDecl ::= PT_RPC rpcName PT_LPAREN PT_STREAM messageType PT_RPAREN PT_RETURNS PT_LPAREN messageType PT_RPAREN */
2093
0
{  yy_destructor(yypParser,21,&yymsp[-9].minor);
2094
0
#line 375 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2095
0
{ yymsp[-9].minor.yy93 = pbl_create_method_node(state->file, yymsp[-8].minor.yy118->ln, yymsp[-8].minor.yy118->v, yymsp[-5].minor.yy254, TRUE, yymsp[-1].minor.yy254, FALSE); }
2096
0
#line 2121 "./protobuf_lang_parser.c"
2097
0
  yy_destructor(yypParser,28,&yymsp[-7].minor);
2098
0
  yy_destructor(yypParser,22,&yymsp[-6].minor);
2099
0
  yy_destructor(yypParser,29,&yymsp[-4].minor);
2100
0
  yy_destructor(yypParser,23,&yymsp[-3].minor);
2101
0
  yy_destructor(yypParser,28,&yymsp[-2].minor);
2102
0
  yy_destructor(yypParser,29,&yymsp[0].minor);
2103
0
}
2104
0
        break;
2105
0
      case 34: /* rpcDecl ::= PT_RPC rpcName PT_LPAREN messageType PT_RPAREN PT_RETURNS PT_LPAREN PT_STREAM messageType PT_RPAREN */
2106
0
{  yy_destructor(yypParser,21,&yymsp[-9].minor);
2107
0
#line 377 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2108
0
{ yymsp[-9].minor.yy93 = pbl_create_method_node(state->file, yymsp[-8].minor.yy118->ln, yymsp[-8].minor.yy118->v, yymsp[-6].minor.yy254, FALSE, yymsp[-1].minor.yy254, TRUE); }
2109
0
#line 2134 "./protobuf_lang_parser.c"
2110
0
  yy_destructor(yypParser,28,&yymsp[-7].minor);
2111
0
  yy_destructor(yypParser,29,&yymsp[-5].minor);
2112
0
  yy_destructor(yypParser,23,&yymsp[-4].minor);
2113
0
  yy_destructor(yypParser,28,&yymsp[-3].minor);
2114
0
  yy_destructor(yypParser,22,&yymsp[-2].minor);
2115
0
  yy_destructor(yypParser,29,&yymsp[0].minor);
2116
0
}
2117
0
        break;
2118
0
      case 35: /* rpcDecl ::= PT_RPC rpcName PT_LPAREN PT_STREAM messageType PT_RPAREN PT_RETURNS PT_LPAREN PT_STREAM messageType PT_RPAREN */
2119
0
{  yy_destructor(yypParser,21,&yymsp[-10].minor);
2120
0
#line 379 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2121
0
{ yymsp[-10].minor.yy93 = pbl_create_method_node(state->file, yymsp[-9].minor.yy118->ln, yymsp[-9].minor.yy118->v, yymsp[-6].minor.yy254, TRUE, yymsp[-1].minor.yy254, TRUE); }
2122
0
#line 2147 "./protobuf_lang_parser.c"
2123
0
  yy_destructor(yypParser,28,&yymsp[-8].minor);
2124
0
  yy_destructor(yypParser,22,&yymsp[-7].minor);
2125
0
  yy_destructor(yypParser,29,&yymsp[-5].minor);
2126
0
  yy_destructor(yypParser,23,&yymsp[-4].minor);
2127
0
  yy_destructor(yypParser,28,&yymsp[-3].minor);
2128
0
  yy_destructor(yypParser,22,&yymsp[-2].minor);
2129
0
  yy_destructor(yypParser,29,&yymsp[0].minor);
2130
0
}
2131
0
        break;
2132
0
      case 36: /* streamDecl ::= PT_STREAM streamName PT_LPAREN messageType PT_COMMA messageType PT_RPAREN */
2133
0
{  yy_destructor(yypParser,22,&yymsp[-6].minor);
2134
0
#line 391 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2135
0
{ yymsp[-6].minor.yy93 = pbl_create_method_node(state->file, yymsp[-5].minor.yy118->ln, yymsp[-5].minor.yy118->v, yymsp[-3].minor.yy254, TRUE, yymsp[-1].minor.yy254, TRUE); }
2136
0
#line 2161 "./protobuf_lang_parser.c"
2137
0
  yy_destructor(yypParser,28,&yymsp[-4].minor);
2138
0
  yy_destructor(yypParser,57,&yymsp[-2].minor);
2139
0
  yy_destructor(yypParser,29,&yymsp[0].minor);
2140
0
}
2141
0
        break;
2142
0
      case 37: /* field ::= type fieldName PT_ASSIGN fieldNumber PT_SEMICOLON */
2143
0
      case 57: /* oneofField ::= type fieldName PT_ASSIGN fieldNumber PT_SEMICOLON */ yytestcase(yyruleno==57);
2144
0
#line 401 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2145
0
{ yylhsminor.yy93 = pbl_create_field_node(state->file, yymsp[-3].minor.yy118->ln, NULL, yymsp[-4].minor.yy254, yymsp[-3].minor.yy118->v, yymsp[-1].minor.yy116, NULL); }
2146
0
#line 2171 "./protobuf_lang_parser.c"
2147
0
  yy_destructor(yypParser,25,&yymsp[-2].minor);
2148
0
  yy_destructor(yypParser,26,&yymsp[0].minor);
2149
0
  yymsp[-4].minor.yy93 = yylhsminor.yy93;
2150
0
        break;
2151
0
      case 38: /* field ::= type fieldName PT_ASSIGN fieldNumber PT_LBRACKET fieldOptions PT_RBRACKET PT_SEMICOLON */
2152
0
      case 56: /* oneofField ::= type fieldName PT_ASSIGN fieldNumber PT_LBRACKET fieldOptions PT_RBRACKET PT_SEMICOLON */ yytestcase(yyruleno==56);
2153
0
#line 403 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2154
0
{ yylhsminor.yy93 = pbl_create_field_node(state->file, yymsp[-6].minor.yy118->ln, NULL, yymsp[-7].minor.yy254, yymsp[-6].minor.yy118->v, yymsp[-4].minor.yy116, yymsp[-2].minor.yy93); }
2155
0
#line 2180 "./protobuf_lang_parser.c"
2156
0
  yy_destructor(yypParser,25,&yymsp[-5].minor);
2157
0
  yy_destructor(yypParser,33,&yymsp[-3].minor);
2158
0
  yy_destructor(yypParser,34,&yymsp[-1].minor);
2159
0
  yy_destructor(yypParser,26,&yymsp[0].minor);
2160
0
  yymsp[-7].minor.yy93 = yylhsminor.yy93;
2161
0
        break;
2162
0
      case 39: /* field ::= label type fieldName PT_ASSIGN fieldNumber PT_SEMICOLON */
2163
0
#line 405 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2164
0
{ yylhsminor.yy93 = pbl_create_field_node(state->file, yymsp[-3].minor.yy118->ln, yymsp[-5].minor.yy254, yymsp[-4].minor.yy254, yymsp[-3].minor.yy118->v, yymsp[-1].minor.yy116, NULL); }
2165
0
#line 2190 "./protobuf_lang_parser.c"
2166
0
  yy_destructor(yypParser,25,&yymsp[-2].minor);
2167
0
  yy_destructor(yypParser,26,&yymsp[0].minor);
2168
0
  yymsp[-5].minor.yy93 = yylhsminor.yy93;
2169
0
        break;
2170
0
      case 40: /* field ::= label type fieldName PT_ASSIGN fieldNumber PT_LBRACKET fieldOptions PT_RBRACKET PT_SEMICOLON */
2171
0
#line 407 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2172
0
{ yylhsminor.yy93 = pbl_create_field_node(state->file, yymsp[-6].minor.yy118->ln, yymsp[-8].minor.yy254, yymsp[-7].minor.yy254, yymsp[-6].minor.yy118->v, yymsp[-4].minor.yy116, yymsp[-2].minor.yy93); }
2173
0
#line 2198 "./protobuf_lang_parser.c"
2174
0
  yy_destructor(yypParser,25,&yymsp[-5].minor);
2175
0
  yy_destructor(yypParser,33,&yymsp[-3].minor);
2176
0
  yy_destructor(yypParser,34,&yymsp[-1].minor);
2177
0
  yy_destructor(yypParser,26,&yymsp[0].minor);
2178
0
  yymsp[-8].minor.yy93 = yylhsminor.yy93;
2179
0
        break;
2180
0
      case 41: /* label ::= PT_REQUIRED */
2181
0
      case 42: /* label ::= PT_OPTIONAL */ yytestcase(yyruleno==42);
2182
0
      case 43: /* label ::= PT_REPEATED */ yytestcase(yyruleno==43);
2183
0
#line 410 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2184
0
{ yylhsminor.yy254 = yymsp[0].minor.yy0->v; }
2185
0
#line 2210 "./protobuf_lang_parser.c"
2186
0
  yymsp[0].minor.yy254 = yylhsminor.yy254;
2187
0
        break;
2188
0
      case 44: /* type ::= exIdent */
2189
0
      case 60: /* keyType ::= exIdent */ yytestcase(yyruleno==60);
2190
0
      case 65: /* messageType ::= exIdent */ yytestcase(yyruleno==65);
2191
0
      case 69: /* constant ::= exIdent */ yytestcase(yyruleno==69);
2192
0
#line 418 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2193
0
{ yylhsminor.yy254 = yymsp[0].minor.yy118->v; }
2194
0
#line 2219 "./protobuf_lang_parser.c"
2195
0
  yymsp[0].minor.yy254 = yylhsminor.yy254;
2196
0
        break;
2197
0
      case 47: /* fieldOptions ::= fieldOption */
2198
0
#line 426 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2199
0
{ yylhsminor.yy93 = pbl_create_node(state->file, CUR_LINENO, PBL_OPTIONS, NEED_NOT_NAME); pbl_add_child(yylhsminor.yy93, yymsp[0].minor.yy93); }
2200
0
#line 2225 "./protobuf_lang_parser.c"
2201
0
  yymsp[0].minor.yy93 = yylhsminor.yy93;
2202
0
        break;
2203
0
      case 48: /* fieldOptions ::= fieldOptions PT_COMMA fieldOption */
2204
0
#line 428 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2205
0
{ yylhsminor.yy93 = yymsp[-2].minor.yy93; pbl_add_child(yylhsminor.yy93, yymsp[0].minor.yy93); }
2206
0
#line 2231 "./protobuf_lang_parser.c"
2207
0
  yy_destructor(yypParser,57,&yymsp[-1].minor);
2208
0
  yymsp[-2].minor.yy93 = yylhsminor.yy93;
2209
0
        break;
2210
0
      case 49: /* fieldOption ::= optionName PT_ASSIGN constant */
2211
0
#line 433 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2212
0
{ yylhsminor.yy93 = pbl_create_option_node(state->file, yymsp[-2].minor.yy118->ln, yymsp[-2].minor.yy118->v, yymsp[0].minor.yy254); }
2213
0
#line 2238 "./protobuf_lang_parser.c"
2214
0
  yy_destructor(yypParser,25,&yymsp[-1].minor);
2215
0
  yymsp[-2].minor.yy93 = yylhsminor.yy93;
2216
0
        break;
2217
0
      case 50: /* fieldOption ::= optionName PT_ASSIGN customOptionValue */
2218
0
#line 435 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2219
0
{ yylhsminor.yy93 = pbl_create_option_node(state->file, yymsp[-2].minor.yy118->ln, yymsp[-2].minor.yy118->v, pbl_store_string_token(state, g_strdup("{ ... }"))); }
2220
0
#line 2245 "./protobuf_lang_parser.c"
2221
0
  yy_destructor(yypParser,25,&yymsp[-1].minor);
2222
0
  yymsp[-2].minor.yy93 = yylhsminor.yy93;
2223
0
        break;
2224
0
      case 51: /* group ::= PT_GROUP groupName PT_ASSIGN fieldNumber PT_LCURLY messageBody PT_RCURLY */
2225
0
{  yy_destructor(yypParser,16,&yymsp[-6].minor);
2226
0
#line 440 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2227
0
{ yymsp[-6].minor.yy93 = yymsp[-1].minor.yy93; pbl_set_node_name(yymsp[-6].minor.yy93, yymsp[-5].minor.yy118->ln, yymsp[-5].minor.yy118->v); }
2228
0
#line 2253 "./protobuf_lang_parser.c"
2229
0
  yy_destructor(yypParser,25,&yymsp[-4].minor);
2230
0
  yy_destructor(yypParser,31,&yymsp[-2].minor);
2231
0
  yy_destructor(yypParser,32,&yymsp[0].minor);
2232
0
}
2233
0
        break;
2234
0
      case 52: /* group ::= label PT_GROUP groupName PT_ASSIGN fieldNumber PT_LCURLY messageBody PT_RCURLY */
2235
0
#line 442 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2236
0
{ yymsp[-7].minor.yy93 = yymsp[-1].minor.yy93; pbl_set_node_name(yymsp[-7].minor.yy93, yymsp[-5].minor.yy118->ln, yymsp[-5].minor.yy118->v); }
2237
0
#line 2262 "./protobuf_lang_parser.c"
2238
0
  yy_destructor(yypParser,16,&yymsp[-6].minor);
2239
0
  yy_destructor(yypParser,25,&yymsp[-4].minor);
2240
0
  yy_destructor(yypParser,31,&yymsp[-2].minor);
2241
0
  yy_destructor(yypParser,32,&yymsp[0].minor);
2242
0
        break;
2243
0
      case 53: /* oneof ::= PT_ONEOF oneofName PT_LCURLY oneofBody PT_RCURLY */
2244
0
{  yy_destructor(yypParser,12,&yymsp[-4].minor);
2245
0
#line 449 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2246
0
{ yymsp[-4].minor.yy93 = yymsp[-1].minor.yy93; pbl_set_node_name(yymsp[-4].minor.yy93, yymsp[-3].minor.yy118->ln, yymsp[-3].minor.yy118->v); }
2247
0
#line 2272 "./protobuf_lang_parser.c"
2248
0
  yy_destructor(yypParser,31,&yymsp[-2].minor);
2249
0
  yy_destructor(yypParser,32,&yymsp[0].minor);
2250
0
}
2251
0
        break;
2252
0
      case 54: /* oneofBody ::= */
2253
0
#line 451 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2254
0
{ yymsp[1].minor.yy93 = pbl_create_node(state->file, CUR_LINENO, PBL_ONEOF, NAME_TO_BE_SET); }
2255
0
#line 2280 "./protobuf_lang_parser.c"
2256
0
        break;
2257
0
      case 58: /* mapField ::= PT_MAP PT_LESS keyType PT_COMMA type PT_GREATER mapName PT_ASSIGN fieldNumber PT_LBRACKET fieldOptions PT_RBRACKET PT_SEMICOLON */
2258
0
{  yy_destructor(yypParser,13,&yymsp[-12].minor);
2259
0
#line 465 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2260
0
{
2261
0
        yymsp[-12].minor.yy93 = pbl_create_map_field_node(state->file, yymsp[-6].minor.yy118->ln, yymsp[-6].minor.yy118->v, yymsp[-4].minor.yy116, yymsp[-2].minor.yy93);
2262
0
        pbl_add_child(yymsp[-12].minor.yy93, pbl_create_field_node(state->file, yymsp[-6].minor.yy118->ln, NULL, yymsp[-10].minor.yy254, "key", 1, NULL)); /* add key field */
2263
0
        pbl_add_child(yymsp[-12].minor.yy93, pbl_create_field_node(state->file, yymsp[-6].minor.yy118->ln, NULL, yymsp[-8].minor.yy254, "value", 2, NULL)); /* add value field */
2264
0
    }
2265
0
#line 2290 "./protobuf_lang_parser.c"
2266
0
  yy_destructor(yypParser,59,&yymsp[-11].minor);
2267
0
  yy_destructor(yypParser,57,&yymsp[-9].minor);
2268
0
  yy_destructor(yypParser,60,&yymsp[-7].minor);
2269
0
  yy_destructor(yypParser,25,&yymsp[-5].minor);
2270
0
  yy_destructor(yypParser,33,&yymsp[-3].minor);
2271
0
  yy_destructor(yypParser,34,&yymsp[-1].minor);
2272
0
  yy_destructor(yypParser,26,&yymsp[0].minor);
2273
0
}
2274
0
        break;
2275
0
      case 59: /* mapField ::= PT_MAP PT_LESS keyType PT_COMMA type PT_GREATER mapName PT_ASSIGN fieldNumber PT_SEMICOLON */
2276
0
{  yy_destructor(yypParser,13,&yymsp[-9].minor);
2277
0
#line 471 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2278
0
{
2279
0
        yymsp[-9].minor.yy93 = pbl_create_map_field_node(state->file, yymsp[-3].minor.yy118->ln, yymsp[-3].minor.yy118->v, yymsp[-1].minor.yy116, NULL);
2280
0
        pbl_add_child(yymsp[-9].minor.yy93, pbl_create_field_node(state->file, yymsp[-3].minor.yy118->ln, NULL, yymsp[-7].minor.yy254, "key", 1, NULL)); /* add key field */
2281
0
        pbl_add_child(yymsp[-9].minor.yy93, pbl_create_field_node(state->file, yymsp[-3].minor.yy118->ln, NULL, yymsp[-5].minor.yy254, "value", 2, NULL)); /* add value field */
2282
0
    }
2283
0
#line 2308 "./protobuf_lang_parser.c"
2284
0
  yy_destructor(yypParser,59,&yymsp[-8].minor);
2285
0
  yy_destructor(yypParser,57,&yymsp[-6].minor);
2286
0
  yy_destructor(yypParser,60,&yymsp[-4].minor);
2287
0
  yy_destructor(yypParser,25,&yymsp[-2].minor);
2288
0
  yy_destructor(yypParser,26,&yymsp[0].minor);
2289
0
}
2290
0
        break;
2291
0
      case 61: /* extend ::= PT_EXTEND messageType PT_LCURLY extendBody PT_RCURLY */
2292
0
{  yy_destructor(yypParser,17,&yymsp[-4].minor);
2293
0
#line 547 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2294
0
{ yymsp[-4].minor.yy93 = NULL; pbl_free_node(yymsp[-1].minor.yy93); }
2295
0
#line 2320 "./protobuf_lang_parser.c"
2296
0
  yy_destructor(yypParser,31,&yymsp[-2].minor);
2297
0
  yy_destructor(yypParser,32,&yymsp[0].minor);
2298
0
}
2299
0
        break;
2300
0
      case 66: /* intLit ::= PT_DECIMALLIT */
2301
0
#line 570 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2302
0
{ yylhsminor.yy180 = g_ascii_strtoull(yymsp[0].minor.yy0->v, NULL, 10); }
2303
0
#line 2328 "./protobuf_lang_parser.c"
2304
0
  yymsp[0].minor.yy180 = yylhsminor.yy180;
2305
0
        break;
2306
0
      case 67: /* intLit ::= PT_OCTALLIT */
2307
0
#line 571 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2308
0
{ yylhsminor.yy180 = g_ascii_strtoull(yymsp[0].minor.yy0->v+1, NULL, 8); }
2309
0
#line 2334 "./protobuf_lang_parser.c"
2310
0
  yymsp[0].minor.yy180 = yylhsminor.yy180;
2311
0
        break;
2312
0
      case 68: /* intLit ::= PT_HEXLIT */
2313
0
#line 572 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2314
0
{ yylhsminor.yy180 = g_ascii_strtoull(yymsp[0].minor.yy0->v+2, NULL, 16); }
2315
0
#line 2340 "./protobuf_lang_parser.c"
2316
0
  yymsp[0].minor.yy180 = yylhsminor.yy180;
2317
0
        break;
2318
0
      case 70: /* constant ::= intLit */
2319
0
#line 580 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2320
0
{ yylhsminor.yy254 = pbl_store_string_token(state, ws_strdup_printf("%" PRIu64, yymsp[0].minor.yy180)); }
2321
0
#line 2346 "./protobuf_lang_parser.c"
2322
0
  yymsp[0].minor.yy254 = yylhsminor.yy254;
2323
0
        break;
2324
0
      case 71: /* constant ::= PT_PLUS intLit */
2325
0
{  yy_destructor(yypParser,41,&yymsp[-1].minor);
2326
0
#line 581 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2327
0
{ yymsp[-1].minor.yy254 = pbl_store_string_token(state, ws_strdup_printf("%" PRIu64, yymsp[0].minor.yy180)); }
2328
0
#line 2353 "./protobuf_lang_parser.c"
2329
0
}
2330
0
        break;
2331
0
      case 72: /* constant ::= PT_MINUS intLit */
2332
0
{  yy_destructor(yypParser,42,&yymsp[-1].minor);
2333
0
#line 582 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2334
0
{ yymsp[-1].minor.yy254 = pbl_store_string_token(state, ws_strdup_printf("-%" PRIu64, yymsp[0].minor.yy180)); }
2335
0
#line 2360 "./protobuf_lang_parser.c"
2336
0
}
2337
0
        break;
2338
0
      case 73: /* constant ::= PT_PLUS exIdent */
2339
0
{  yy_destructor(yypParser,41,&yymsp[-1].minor);
2340
0
#line 583 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2341
0
{ yymsp[-1].minor.yy254 = pbl_store_string_token(state, g_strconcat("+", yymsp[0].minor.yy118->v, NULL)); }
2342
0
#line 2367 "./protobuf_lang_parser.c"
2343
0
}
2344
0
        break;
2345
0
      case 74: /* constant ::= PT_MINUS exIdent */
2346
0
{  yy_destructor(yypParser,42,&yymsp[-1].minor);
2347
0
#line 584 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2348
0
{ yymsp[-1].minor.yy254 = pbl_store_string_token(state, g_strconcat("-", yymsp[0].minor.yy118->v, NULL)); }
2349
0
#line 2374 "./protobuf_lang_parser.c"
2350
0
}
2351
0
        break;
2352
0
      case 75: /* strLit ::= PT_STRLIT */
2353
0
#line 588 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2354
0
{ yylhsminor.yy254 = pbl_store_string_token(state, g_strndup(yymsp[0].minor.yy0->v + 1, strlen(yymsp[0].minor.yy0->v) - 2)); }
2355
0
#line 2380 "./protobuf_lang_parser.c"
2356
0
  yymsp[0].minor.yy254 = yylhsminor.yy254;
2357
0
        break;
2358
0
      case 76: /* strLit ::= strLit PT_STRLIT */
2359
0
#line 590 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2360
0
{ gchar *v = g_strndup(yymsp[0].minor.yy0->v + 1, strlen(yymsp[0].minor.yy0->v) - 2); yylhsminor.yy254 = pbl_store_string_token(state, g_strconcat(yymsp[-1].minor.yy254, v, NULL)); g_free(v); }
2361
0
#line 2386 "./protobuf_lang_parser.c"
2362
0
  yymsp[-1].minor.yy254 = yylhsminor.yy254;
2363
0
        break;
2364
0
      case 80: /* edition ::= PT_EDITION PT_ASSIGN PT_STRLIT PT_SEMICOLON */
2365
0
{  yy_destructor(yypParser,3,&yymsp[-3].minor);
2366
0
#line 189 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2367
0
{
2368
0
}
2369
0
#line 2394 "./protobuf_lang_parser.c"
2370
0
  yy_destructor(yypParser,25,&yymsp[-2].minor);
2371
0
  yy_destructor(yypParser,27,&yymsp[-1].minor);
2372
0
  yy_destructor(yypParser,26,&yymsp[0].minor);
2373
0
}
2374
0
        break;
2375
0
      case 85: /* option ::= PT_OPTION optionName PT_ASSIGN constant PT_SEMICOLON */
2376
0
      case 86: /* option ::= PT_OPTION optionName PT_ASSIGN customOptionValue PT_SEMICOLON */ yytestcase(yyruleno==86);
2377
0
{  yy_destructor(yypParser,8,&yymsp[-4].minor);
2378
0
#line 213 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2379
0
{
2380
0
}
2381
0
#line 2406 "./protobuf_lang_parser.c"
2382
0
  yy_destructor(yypParser,25,&yymsp[-2].minor);
2383
0
  yy_destructor(yypParser,26,&yymsp[0].minor);
2384
0
}
2385
0
        break;
2386
0
      case 89: /* customOptionValue ::= PT_LCURLY customOptionBody PT_RCURLY */
2387
0
{  yy_destructor(yypParser,31,&yymsp[-2].minor);
2388
0
#line 234 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2389
0
{
2390
0
}
2391
0
#line 2416 "./protobuf_lang_parser.c"
2392
0
  yy_destructor(yypParser,32,&yymsp[0].minor);
2393
0
}
2394
0
        break;
2395
0
      case 92: /* customOptionBody ::= customOptionBody PT_STRLIT */
2396
0
#line 259 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2397
0
{
2398
0
}
2399
0
#line 2424 "./protobuf_lang_parser.c"
2400
0
  yy_destructor(yypParser,27,&yymsp[0].minor);
2401
0
        break;
2402
0
      case 96: /* symbolsWithoutCurly ::= PT_LPAREN */
2403
0
{  yy_destructor(yypParser,28,&yymsp[0].minor);
2404
0
#line 264 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2405
0
{
2406
0
}
2407
0
#line 2432 "./protobuf_lang_parser.c"
2408
0
}
2409
0
        break;
2410
0
      case 97: /* symbolsWithoutCurly ::= PT_RPAREN */
2411
0
{  yy_destructor(yypParser,29,&yymsp[0].minor);
2412
0
#line 265 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2413
0
{
2414
0
}
2415
0
#line 2440 "./protobuf_lang_parser.c"
2416
0
}
2417
0
        break;
2418
0
      case 98: /* symbolsWithoutCurly ::= PT_LBRACKET */
2419
0
{  yy_destructor(yypParser,33,&yymsp[0].minor);
2420
0
#line 266 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2421
0
{
2422
0
}
2423
0
#line 2448 "./protobuf_lang_parser.c"
2424
0
}
2425
0
        break;
2426
0
      case 99: /* symbolsWithoutCurly ::= PT_RBRACKET */
2427
0
{  yy_destructor(yypParser,34,&yymsp[0].minor);
2428
0
#line 267 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2429
0
{
2430
0
}
2431
0
#line 2456 "./protobuf_lang_parser.c"
2432
0
}
2433
0
        break;
2434
0
      case 100: /* symbolsWithoutCurly ::= PT_EQUAL */
2435
0
{  yy_destructor(yypParser,35,&yymsp[0].minor);
2436
0
#line 268 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2437
0
{
2438
0
}
2439
0
#line 2464 "./protobuf_lang_parser.c"
2440
0
}
2441
0
        break;
2442
0
      case 101: /* symbolsWithoutCurly ::= PT_NOTEQUAL */
2443
0
{  yy_destructor(yypParser,36,&yymsp[0].minor);
2444
0
#line 269 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2445
0
{
2446
0
}
2447
0
#line 2472 "./protobuf_lang_parser.c"
2448
0
}
2449
0
        break;
2450
0
      case 102: /* symbolsWithoutCurly ::= PT_NOTEQUAL2 */
2451
0
{  yy_destructor(yypParser,37,&yymsp[0].minor);
2452
0
#line 270 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2453
0
{
2454
0
}
2455
0
#line 2480 "./protobuf_lang_parser.c"
2456
0
}
2457
0
        break;
2458
0
      case 103: /* symbolsWithoutCurly ::= PT_GEQUAL */
2459
0
{  yy_destructor(yypParser,38,&yymsp[0].minor);
2460
0
#line 271 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2461
0
{
2462
0
}
2463
0
#line 2488 "./protobuf_lang_parser.c"
2464
0
}
2465
0
        break;
2466
0
      case 104: /* symbolsWithoutCurly ::= PT_LEQUAL */
2467
0
{  yy_destructor(yypParser,39,&yymsp[0].minor);
2468
0
#line 272 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2469
0
{
2470
0
}
2471
0
#line 2496 "./protobuf_lang_parser.c"
2472
0
}
2473
0
        break;
2474
0
      case 105: /* symbolsWithoutCurly ::= PT_ASSIGN_PLUS */
2475
0
{  yy_destructor(yypParser,40,&yymsp[0].minor);
2476
0
#line 273 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2477
0
{
2478
0
}
2479
0
#line 2504 "./protobuf_lang_parser.c"
2480
0
}
2481
0
        break;
2482
0
      case 106: /* symbolsWithoutCurly ::= PT_ASSIGN */
2483
0
{  yy_destructor(yypParser,25,&yymsp[0].minor);
2484
0
#line 274 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2485
0
{
2486
0
}
2487
0
#line 2512 "./protobuf_lang_parser.c"
2488
0
}
2489
0
        break;
2490
0
      case 107: /* symbolsWithoutCurly ::= PT_PLUS */
2491
0
{  yy_destructor(yypParser,41,&yymsp[0].minor);
2492
0
#line 275 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2493
0
{
2494
0
}
2495
0
#line 2520 "./protobuf_lang_parser.c"
2496
0
}
2497
0
        break;
2498
0
      case 108: /* symbolsWithoutCurly ::= PT_MINUS */
2499
0
{  yy_destructor(yypParser,42,&yymsp[0].minor);
2500
0
#line 276 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2501
0
{
2502
0
}
2503
0
#line 2528 "./protobuf_lang_parser.c"
2504
0
}
2505
0
        break;
2506
0
      case 109: /* symbolsWithoutCurly ::= PT_MULTIPLY */
2507
0
{  yy_destructor(yypParser,43,&yymsp[0].minor);
2508
0
#line 277 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2509
0
{
2510
0
}
2511
0
#line 2536 "./protobuf_lang_parser.c"
2512
0
}
2513
0
        break;
2514
0
      case 110: /* symbolsWithoutCurly ::= PT_DIV */
2515
0
{  yy_destructor(yypParser,44,&yymsp[0].minor);
2516
0
#line 278 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2517
0
{
2518
0
}
2519
0
#line 2544 "./protobuf_lang_parser.c"
2520
0
}
2521
0
        break;
2522
0
      case 111: /* symbolsWithoutCurly ::= PT_LOGIC_OR */
2523
0
{  yy_destructor(yypParser,45,&yymsp[0].minor);
2524
0
#line 279 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2525
0
{
2526
0
}
2527
0
#line 2552 "./protobuf_lang_parser.c"
2528
0
}
2529
0
        break;
2530
0
      case 112: /* symbolsWithoutCurly ::= PT_OR */
2531
0
{  yy_destructor(yypParser,46,&yymsp[0].minor);
2532
0
#line 280 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2533
0
{
2534
0
}
2535
0
#line 2560 "./protobuf_lang_parser.c"
2536
0
}
2537
0
        break;
2538
0
      case 113: /* symbolsWithoutCurly ::= PT_LOGIC_AND */
2539
0
{  yy_destructor(yypParser,47,&yymsp[0].minor);
2540
0
#line 281 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2541
0
{
2542
0
}
2543
0
#line 2568 "./protobuf_lang_parser.c"
2544
0
}
2545
0
        break;
2546
0
      case 114: /* symbolsWithoutCurly ::= PT_AND */
2547
0
{  yy_destructor(yypParser,48,&yymsp[0].minor);
2548
0
#line 282 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2549
0
{
2550
0
}
2551
0
#line 2576 "./protobuf_lang_parser.c"
2552
0
}
2553
0
        break;
2554
0
      case 115: /* symbolsWithoutCurly ::= PT_NOT */
2555
0
{  yy_destructor(yypParser,49,&yymsp[0].minor);
2556
0
#line 283 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2557
0
{
2558
0
}
2559
0
#line 2584 "./protobuf_lang_parser.c"
2560
0
}
2561
0
        break;
2562
0
      case 116: /* symbolsWithoutCurly ::= PT_NEG */
2563
0
{  yy_destructor(yypParser,50,&yymsp[0].minor);
2564
0
#line 284 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2565
0
{
2566
0
}
2567
0
#line 2592 "./protobuf_lang_parser.c"
2568
0
}
2569
0
        break;
2570
0
      case 117: /* symbolsWithoutCurly ::= PT_XOR */
2571
0
{  yy_destructor(yypParser,51,&yymsp[0].minor);
2572
0
#line 285 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2573
0
{
2574
0
}
2575
0
#line 2600 "./protobuf_lang_parser.c"
2576
0
}
2577
0
        break;
2578
0
      case 118: /* symbolsWithoutCurly ::= PT_SHL */
2579
0
{  yy_destructor(yypParser,52,&yymsp[0].minor);
2580
0
#line 286 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2581
0
{
2582
0
}
2583
0
#line 2608 "./protobuf_lang_parser.c"
2584
0
}
2585
0
        break;
2586
0
      case 119: /* symbolsWithoutCurly ::= PT_SHR */
2587
0
{  yy_destructor(yypParser,53,&yymsp[0].minor);
2588
0
#line 287 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2589
0
{
2590
0
}
2591
0
#line 2616 "./protobuf_lang_parser.c"
2592
0
}
2593
0
        break;
2594
0
      case 120: /* symbolsWithoutCurly ::= PT_PERCENT */
2595
0
{  yy_destructor(yypParser,54,&yymsp[0].minor);
2596
0
#line 288 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2597
0
{
2598
0
}
2599
0
#line 2624 "./protobuf_lang_parser.c"
2600
0
}
2601
0
        break;
2602
0
      case 121: /* symbolsWithoutCurly ::= PT_DOLLAR */
2603
0
{  yy_destructor(yypParser,55,&yymsp[0].minor);
2604
0
#line 289 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2605
0
{
2606
0
}
2607
0
#line 2632 "./protobuf_lang_parser.c"
2608
0
}
2609
0
        break;
2610
0
      case 122: /* symbolsWithoutCurly ::= PT_COND */
2611
0
{  yy_destructor(yypParser,56,&yymsp[0].minor);
2612
0
#line 290 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2613
0
{
2614
0
}
2615
0
#line 2640 "./protobuf_lang_parser.c"
2616
0
}
2617
0
        break;
2618
0
      case 123: /* symbolsWithoutCurly ::= PT_SEMICOLON */
2619
0
      case 188: /* emptyStatement ::= PT_SEMICOLON */ yytestcase(yyruleno==188);
2620
0
{  yy_destructor(yypParser,26,&yymsp[0].minor);
2621
0
#line 291 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2622
0
{
2623
0
}
2624
0
#line 2649 "./protobuf_lang_parser.c"
2625
0
}
2626
0
        break;
2627
0
      case 124: /* symbolsWithoutCurly ::= PT_DOT */
2628
0
{  yy_destructor(yypParser,30,&yymsp[0].minor);
2629
0
#line 292 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2630
0
{
2631
0
}
2632
0
#line 2657 "./protobuf_lang_parser.c"
2633
0
}
2634
0
        break;
2635
0
      case 125: /* symbolsWithoutCurly ::= PT_COMMA */
2636
0
{  yy_destructor(yypParser,57,&yymsp[0].minor);
2637
0
#line 293 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2638
0
{
2639
0
}
2640
0
#line 2665 "./protobuf_lang_parser.c"
2641
0
}
2642
0
        break;
2643
0
      case 126: /* symbolsWithoutCurly ::= PT_COLON */
2644
0
{  yy_destructor(yypParser,58,&yymsp[0].minor);
2645
0
#line 294 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2646
0
{
2647
0
}
2648
0
#line 2673 "./protobuf_lang_parser.c"
2649
0
}
2650
0
        break;
2651
0
      case 127: /* symbolsWithoutCurly ::= PT_LESS */
2652
0
{  yy_destructor(yypParser,59,&yymsp[0].minor);
2653
0
#line 295 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2654
0
{
2655
0
}
2656
0
#line 2681 "./protobuf_lang_parser.c"
2657
0
}
2658
0
        break;
2659
0
      case 128: /* symbolsWithoutCurly ::= PT_GREATER */
2660
0
{  yy_destructor(yypParser,60,&yymsp[0].minor);
2661
0
#line 296 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2662
0
{
2663
0
}
2664
0
#line 2689 "./protobuf_lang_parser.c"
2665
0
}
2666
0
        break;
2667
0
      case 142: /* enumValueOptions ::= enumValueOptions PT_COMMA enumValueOption */
2668
0
      case 164: /* declarations ::= declarations PT_COMMA declaration */ yytestcase(yyruleno==164);
2669
0
      case 171: /* ranges ::= ranges PT_COMMA range */ yytestcase(yyruleno==171);
2670
0
      case 176: /* quoteFieldNames ::= quoteFieldNames PT_COMMA strLit */ yytestcase(yyruleno==176);
2671
0
      case 178: /* reservedIdent ::= fieldName PT_COMMA fieldName */ yytestcase(yyruleno==178);
2672
0
#line 349 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2673
0
{
2674
0
}
2675
0
#line 2700 "./protobuf_lang_parser.c"
2676
0
  yy_destructor(yypParser,57,&yymsp[-1].minor);
2677
0
        break;
2678
0
      case 143: /* enumValueOption ::= optionName PT_ASSIGN constant */
2679
0
      case 144: /* enumValueOption ::= optionName PT_ASSIGN customOptionValue */ yytestcase(yyruleno==144);
2680
0
      case 165: /* declaration ::= optionName PT_ASSIGN constant */ yytestcase(yyruleno==165);
2681
0
      case 166: /* declaration ::= optionName PT_ASSIGN customOptionValue */ yytestcase(yyruleno==166);
2682
0
#line 353 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2683
0
{
2684
0
}
2685
0
#line 2710 "./protobuf_lang_parser.c"
2686
0
  yy_destructor(yypParser,25,&yymsp[-1].minor);
2687
0
        break;
2688
0
      case 147: /* rpc ::= rpcDecl PT_SEMICOLON */
2689
0
      case 152: /* stream ::= streamDecl PT_SEMICOLON */ yytestcase(yyruleno==152);
2690
0
#line 368 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2691
0
{
2692
0
}
2693
0
#line 2718 "./protobuf_lang_parser.c"
2694
0
  yy_destructor(yypParser,26,&yymsp[0].minor);
2695
0
        break;
2696
0
      case 148: /* rpc ::= rpcDecl PT_LCURLY rpcBody PT_RCURLY */
2697
0
      case 153: /* stream ::= streamDecl PT_LCURLY streamBody PT_RCURLY */ yytestcase(yyruleno==153);
2698
0
#line 369 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2699
0
{
2700
0
}
2701
0
#line 2726 "./protobuf_lang_parser.c"
2702
0
  yy_destructor(yypParser,31,&yymsp[-2].minor);
2703
0
  yy_destructor(yypParser,32,&yymsp[0].minor);
2704
0
        break;
2705
0
      case 161: /* extensions ::= PT_EXTENSIONS ranges PT_SEMICOLON */
2706
0
{  yy_destructor(yypParser,18,&yymsp[-2].minor);
2707
0
#line 503 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2708
0
{
2709
0
}
2710
0
#line 2735 "./protobuf_lang_parser.c"
2711
0
  yy_destructor(yypParser,26,&yymsp[0].minor);
2712
0
}
2713
0
        break;
2714
0
      case 162: /* extensions ::= PT_EXTENSIONS ranges PT_LBRACKET declarations PT_RBRACKET PT_SEMICOLON */
2715
0
{  yy_destructor(yypParser,18,&yymsp[-5].minor);
2716
0
#line 504 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2717
0
{
2718
0
}
2719
0
#line 2744 "./protobuf_lang_parser.c"
2720
0
  yy_destructor(yypParser,33,&yymsp[-3].minor);
2721
0
  yy_destructor(yypParser,34,&yymsp[-1].minor);
2722
0
  yy_destructor(yypParser,26,&yymsp[0].minor);
2723
0
}
2724
0
        break;
2725
0
      case 167: /* reserved ::= PT_RESERVED ranges PT_SEMICOLON */
2726
0
      case 168: /* reserved ::= PT_RESERVED quoteFieldNames PT_SEMICOLON */ yytestcase(yyruleno==168);
2727
0
      case 169: /* reserved ::= PT_RESERVED reservedIdent PT_SEMICOLON */ yytestcase(yyruleno==169);
2728
0
{  yy_destructor(yypParser,14,&yymsp[-2].minor);
2729
0
#line 516 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2730
0
{
2731
0
}
2732
0
#line 2757 "./protobuf_lang_parser.c"
2733
0
  yy_destructor(yypParser,26,&yymsp[0].minor);
2734
0
}
2735
0
        break;
2736
0
      case 173: /* range ::= intLit PT_TO intLit */
2737
0
      case 174: /* range ::= intLit PT_TO exIdent */ yytestcase(yyruleno==174);
2738
0
#line 527 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2739
0
{
2740
0
}
2741
0
#line 2766 "./protobuf_lang_parser.c"
2742
0
  yy_destructor(yypParser,24,&yymsp[-1].minor);
2743
0
        break;
2744
0
      case 190: /* exIdent ::= PT_IDENT */
2745
0
{  yy_destructor(yypParser,1,&yymsp[0].minor);
2746
0
#line 586 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2747
0
{
2748
0
}
2749
0
#line 2774 "./protobuf_lang_parser.c"
2750
0
}
2751
0
        break;
2752
0
      default:
2753
0
      /* (77) proto ::= wholeProtoBody */ yytestcase(yyruleno==77);
2754
0
      /* (78) proto ::= syntax wholeProtoBody */ yytestcase(yyruleno==78);
2755
0
      /* (79) proto ::= edition wholeProtoBody */ yytestcase(yyruleno==79);
2756
0
      /* (81) protoBody ::= protoBody import */ yytestcase(yyruleno==81);
2757
0
      /* (82) protoBody ::= protoBody package */ yytestcase(yyruleno==82);
2758
0
      /* (83) protoBody ::= protoBody option */ yytestcase(yyruleno==83);
2759
0
      /* (84) protoBody ::= protoBody emptyStatement */ yytestcase(yyruleno==84);
2760
0
      /* (87) optionName ::= exIdent (OPTIMIZED OUT) */ assert(yyruleno!=87);
2761
0
      /* (88) optionName ::= extIdentInParentheses (OPTIMIZED OUT) */ assert(yyruleno!=88);
2762
0
      /* (90) customOptionBody ::= */ yytestcase(yyruleno==90);
2763
0
      /* (91) customOptionBody ::= customOptionBody exIdent */ yytestcase(yyruleno==91);
2764
0
      /* (93) customOptionBody ::= customOptionBody symbolsWithoutCurly */ yytestcase(yyruleno==93);
2765
0
      /* (94) customOptionBody ::= customOptionBody intLit */ yytestcase(yyruleno==94);
2766
0
      /* (95) customOptionBody ::= customOptionBody customOptionValue */ yytestcase(yyruleno==95);
2767
0
      /* (129) topLevelDef ::= message (OPTIMIZED OUT) */ assert(yyruleno!=129);
2768
0
      /* (130) topLevelDef ::= enum (OPTIMIZED OUT) */ assert(yyruleno!=130);
2769
0
      /* (131) topLevelDef ::= extend (OPTIMIZED OUT) */ assert(yyruleno!=131);
2770
0
      /* (132) topLevelDef ::= service (OPTIMIZED OUT) */ assert(yyruleno!=132);
2771
0
      /* (133) messageBody ::= messageBody extend */ yytestcase(yyruleno==133);
2772
0
      /* (134) messageBody ::= messageBody extensions */ yytestcase(yyruleno==134);
2773
0
      /* (135) messageBody ::= messageBody option */ yytestcase(yyruleno==135);
2774
0
      /* (136) messageBody ::= messageBody reserved */ yytestcase(yyruleno==136);
2775
0
      /* (137) messageBody ::= messageBody emptyStatement */ yytestcase(yyruleno==137);
2776
0
      /* (138) enumBody ::= enumBody reserved */ yytestcase(yyruleno==138);
2777
0
      /* (139) enumBody ::= enumBody option */ yytestcase(yyruleno==139);
2778
0
      /* (140) enumBody ::= enumBody emptyStatement */ yytestcase(yyruleno==140);
2779
0
      /* (141) enumValueOptions ::= enumValueOption (OPTIMIZED OUT) */ assert(yyruleno!=141);
2780
0
      /* (145) serviceBody ::= serviceBody option */ yytestcase(yyruleno==145);
2781
0
      /* (146) serviceBody ::= serviceBody emptyStatement */ yytestcase(yyruleno==146);
2782
0
      /* (149) rpcBody ::= */ yytestcase(yyruleno==149);
2783
0
      /* (150) rpcBody ::= rpcBody option */ yytestcase(yyruleno==150);
2784
0
      /* (151) rpcBody ::= rpcBody emptyStatement */ yytestcase(yyruleno==151);
2785
0
      /* (154) streamBody ::= */ yytestcase(yyruleno==154);
2786
0
      /* (155) streamBody ::= streamBody option */ yytestcase(yyruleno==155);
2787
0
      /* (156) streamBody ::= streamBody emptyStatement */ yytestcase(yyruleno==156);
2788
0
      /* (157) groupName ::= exIdent (OPTIMIZED OUT) */ assert(yyruleno!=157);
2789
0
      /* (158) oneofBody ::= oneofBody option */ yytestcase(yyruleno==158);
2790
0
      /* (159) oneofBody ::= oneofBody group */ yytestcase(yyruleno==159);
2791
0
      /* (160) oneofBody ::= oneofBody emptyStatement */ yytestcase(yyruleno==160);
2792
0
      /* (163) declarations ::= declaration (OPTIMIZED OUT) */ assert(yyruleno!=163);
2793
0
      /* (170) ranges ::= range (OPTIMIZED OUT) */ assert(yyruleno!=170);
2794
0
      /* (172) range ::= intLit */ yytestcase(yyruleno==172);
2795
0
      /* (175) quoteFieldNames ::= strLit */ yytestcase(yyruleno==175);
2796
0
      /* (177) reservedIdent ::= fieldName */ yytestcase(yyruleno==177);
2797
0
      /* (179) extendBody ::= extendBody emptyStatement */ yytestcase(yyruleno==179);
2798
0
      /* (180) messageName ::= exIdent (OPTIMIZED OUT) */ assert(yyruleno!=180);
2799
0
      /* (181) enumName ::= exIdent (OPTIMIZED OUT) */ assert(yyruleno!=181);
2800
0
      /* (182) streamName ::= exIdent (OPTIMIZED OUT) */ assert(yyruleno!=182);
2801
0
      /* (183) fieldName ::= exIdent (OPTIMIZED OUT) */ assert(yyruleno!=183);
2802
0
      /* (184) oneofName ::= exIdent (OPTIMIZED OUT) */ assert(yyruleno!=184);
2803
0
      /* (185) mapName ::= exIdent (OPTIMIZED OUT) */ assert(yyruleno!=185);
2804
0
      /* (186) serviceName ::= exIdent (OPTIMIZED OUT) */ assert(yyruleno!=186);
2805
0
      /* (187) rpcName ::= exIdent (OPTIMIZED OUT) */ assert(yyruleno!=187);
2806
0
      /* (189) constant ::= strLit */ yytestcase(yyruleno==189);
2807
0
        break;
2808
/********** End reduce actions ************************************************/
2809
0
  };
2810
0
  assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
2811
0
  yygoto = yyRuleInfoLhs[yyruleno];
2812
0
  yysize = yyRuleInfoNRhs[yyruleno];
2813
0
  yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto);
2814
2815
  /* There are no SHIFTREDUCE actions on nonterminals because the table
2816
  ** generator has simplified them to pure REDUCE actions. */
2817
0
  assert( !(yyact>YY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) );
2818
2819
  /* It is not possible for a REDUCE to be followed by an error */
2820
0
  assert( yyact!=YY_ERROR_ACTION );
2821
2822
0
  yymsp += yysize+1;
2823
0
  yypParser->yytos = yymsp;
2824
0
  yymsp->stateno = (YYACTIONTYPE)yyact;
2825
0
  yymsp->major = (YYCODETYPE)yygoto;
2826
0
  yyTraceShift(yypParser, yyact, "... then shift");
2827
0
  return yyact;
2828
0
}
2829
2830
/*
2831
** The following code executes when the parse fails
2832
*/
2833
#ifndef YYNOERRORRECOVERY
2834
static void yy_parse_failed(
2835
  yyParser *yypParser           /* The parser */
2836
0
){
2837
0
  ProtobufLangParserARG_FETCH
2838
0
  ProtobufLangParserCTX_FETCH
2839
#ifndef NDEBUG
2840
  if( yyTraceFILE ){
2841
    fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
2842
  }
2843
#endif
2844
0
  while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
2845
  /* Here code is inserted which will be executed whenever the
2846
  ** parser fails */
2847
/************ Begin %parse_failure code ***************************************/
2848
0
#line 81 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2849
2850
0
    pbl_parser_error(state, "Parse Error");
2851
0
    state->grammar_error = TRUE;
2852
0
#line 2877 "./protobuf_lang_parser.c"
2853
/************ End %parse_failure code *****************************************/
2854
0
  ProtobufLangParserARG_STORE /* Suppress warning about unused %extra_argument variable */
2855
0
  ProtobufLangParserCTX_STORE
2856
0
}
2857
#endif /* YYNOERRORRECOVERY */
2858
2859
/*
2860
** The following code executes when a syntax error first occurs.
2861
*/
2862
static void yy_syntax_error(
2863
  yyParser *yypParser,           /* The parser */
2864
  int yymajor,                   /* The major type of the error token */
2865
  ProtobufLangParserTOKENTYPE yyminor         /* The minor type of the error token */
2866
0
){
2867
0
  ProtobufLangParserARG_FETCH
2868
0
  ProtobufLangParserCTX_FETCH
2869
0
#define TOKEN yyminor
2870
/************ Begin %syntax_error code ****************************************/
2871
0
#line 72 "/src/wireshark/epan/protobuf_lang_parser.lemon"
2872
2873
0
    if (yyminor) {
2874
0
        pbl_parser_error(state, "Syntax Error: unexpected token \"%s\"", yyminor->v);
2875
0
    } else {
2876
0
        pbl_parser_error(state, "Syntax Error: missing token");
2877
0
    }
2878
0
    state->grammar_error = TRUE;
2879
0
#line 2904 "./protobuf_lang_parser.c"
2880
/************ End %syntax_error code ******************************************/
2881
0
  ProtobufLangParserARG_STORE /* Suppress warning about unused %extra_argument variable */
2882
0
  ProtobufLangParserCTX_STORE
2883
0
}
2884
2885
/*
2886
** The following is executed when the parser accepts
2887
*/
2888
static void yy_accept(
2889
  yyParser *yypParser           /* The parser */
2890
0
){
2891
0
  ProtobufLangParserARG_FETCH
2892
0
  ProtobufLangParserCTX_FETCH
2893
#ifndef NDEBUG
2894
  if( yyTraceFILE ){
2895
    fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
2896
  }
2897
#endif
2898
0
#ifndef YYNOERRORRECOVERY
2899
0
  yypParser->yyerrcnt = -1;
2900
0
#endif
2901
0
  assert( yypParser->yytos==yypParser->yystack );
2902
  /* Here code is inserted which will be executed whenever the
2903
  ** parser accepts */
2904
/*********** Begin %parse_accept code *****************************************/
2905
/*********** End %parse_accept code *******************************************/
2906
0
  ProtobufLangParserARG_STORE /* Suppress warning about unused %extra_argument variable */
2907
0
  ProtobufLangParserCTX_STORE
2908
0
}
2909
2910
/* The main parser program.
2911
** The first argument is a pointer to a structure obtained from
2912
** "ProtobufLangParserAlloc" which describes the current state of the parser.
2913
** The second argument is the major token number.  The third is
2914
** the minor token.  The fourth optional argument is whatever the
2915
** user wants (and specified in the grammar) and is available for
2916
** use by the action routines.
2917
**
2918
** Inputs:
2919
** <ul>
2920
** <li> A pointer to the parser (an opaque structure.)
2921
** <li> The major token number.
2922
** <li> The minor token number.
2923
** <li> An option argument of a grammar-specified type.
2924
** </ul>
2925
**
2926
** Outputs:
2927
** None.
2928
*/
2929
void ProtobufLangParser(
2930
  void *yyp,                   /* The parser */
2931
  int yymajor,                 /* The major token code number */
2932
  ProtobufLangParserTOKENTYPE yyminor       /* The value for the token */
2933
  ProtobufLangParserARG_PDECL               /* Optional %extra_argument parameter */
2934
0
){
2935
0
  YYMINORTYPE yyminorunion;
2936
0
  YYACTIONTYPE yyact;   /* The parser action. */
2937
0
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
2938
0
  int yyendofinput;     /* True if we are at the end of input */
2939
0
#endif
2940
#ifdef YYERRORSYMBOL
2941
  int yyerrorhit = 0;   /* True if yymajor has invoked an error */
2942
#endif
2943
0
  yyParser *yypParser = (yyParser*)yyp;  /* The parser */
2944
0
  ProtobufLangParserCTX_FETCH
2945
0
  ProtobufLangParserARG_STORE
2946
2947
0
  assert( yypParser->yytos!=0 );
2948
0
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
2949
0
  yyendofinput = (yymajor==0);
2950
0
#endif
2951
2952
0
  yyact = yypParser->yytos->stateno;
2953
#ifndef NDEBUG
2954
  if( yyTraceFILE ){
2955
    if( yyact < YY_MIN_REDUCE ){
2956
      fprintf(yyTraceFILE,"%sInput '%s' in state %d\n",
2957
              yyTracePrompt,yyTokenName[yymajor],yyact);
2958
    }else{
2959
      fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n",
2960
              yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE);
2961
    }
2962
  }
2963
#endif
2964
2965
0
  while(1){ /* Exit by "break" */
2966
0
    assert( yypParser->yytos>=yypParser->yystack );
2967
0
    assert( yyact==yypParser->yytos->stateno );
2968
0
    yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact);
2969
0
    if( yyact >= YY_MIN_REDUCE ){
2970
0
      unsigned int yyruleno = yyact - YY_MIN_REDUCE; /* Reduce by this rule */
2971
#ifndef NDEBUG
2972
      assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) );
2973
      if( yyTraceFILE ){
2974
        int yysize = yyRuleInfoNRhs[yyruleno];
2975
        if( yysize ){
2976
          fprintf(yyTraceFILE, "%sReduce %d [%s]%s, pop back to state %d.\n",
2977
            yyTracePrompt,
2978
            yyruleno, yyRuleName[yyruleno],
2979
            yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action",
2980
            yypParser->yytos[yysize].stateno);
2981
        }else{
2982
          fprintf(yyTraceFILE, "%sReduce %d [%s]%s.\n",
2983
            yyTracePrompt, yyruleno, yyRuleName[yyruleno],
2984
            yyruleno<YYNRULE_WITH_ACTION ? "" : " without external action");
2985
        }
2986
      }
2987
#endif /* NDEBUG */
2988
2989
      /* Check that the stack is large enough to grow by a single entry
2990
      ** if the RHS of the rule is empty.  This ensures that there is room
2991
      ** enough on the stack to push the LHS value */
2992
0
      if( yyRuleInfoNRhs[yyruleno]==0 ){
2993
#ifdef YYTRACKMAXSTACKDEPTH
2994
        if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){
2995
          yypParser->yyhwm++;
2996
          assert( yypParser->yyhwm ==
2997
                  (int)(yypParser->yytos - yypParser->yystack));
2998
        }
2999
#endif
3000
0
#if YYSTACKDEPTH>0
3001
0
        if( yypParser->yytos>=yypParser->yystackEnd ){
3002
0
          yyStackOverflow(yypParser);
3003
0
          break;
3004
0
        }
3005
#else
3006
        if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){
3007
          if( yyGrowStack(yypParser) ){
3008
            yyStackOverflow(yypParser);
3009
            break;
3010
          }
3011
        }
3012
#endif
3013
0
      }
3014
0
      yyact = yy_reduce(yypParser,yyruleno,yymajor,yyminor ProtobufLangParserCTX_PARAM);
3015
0
    }else if( yyact <= YY_MAX_SHIFTREDUCE ){
3016
0
      yy_shift(yypParser,yyact,(YYCODETYPE)yymajor,yyminor);
3017
0
#ifndef YYNOERRORRECOVERY
3018
0
      yypParser->yyerrcnt--;
3019
0
#endif
3020
0
      break;
3021
0
    }else if( yyact==YY_ACCEPT_ACTION ){
3022
0
      yypParser->yytos--;
3023
0
      yy_accept(yypParser);
3024
0
      return;
3025
0
    }else{
3026
0
      assert( yyact == YY_ERROR_ACTION );
3027
0
      yyminorunion.yy0 = yyminor;
3028
#ifdef YYERRORSYMBOL
3029
      int yymx;
3030
#endif
3031
#ifndef NDEBUG
3032
      if( yyTraceFILE ){
3033
        fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
3034
      }
3035
#endif
3036
#ifdef YYERRORSYMBOL
3037
      /* A syntax error has occurred.
3038
      ** The response to an error depends upon whether or not the
3039
      ** grammar defines an error token "ERROR".
3040
      **
3041
      ** This is what we do if the grammar does define ERROR:
3042
      **
3043
      **  * Call the %syntax_error function.
3044
      **
3045
      **  * Begin popping the stack until we enter a state where
3046
      **    it is legal to shift the error symbol, then shift
3047
      **    the error symbol.
3048
      **
3049
      **  * Set the error count to three.
3050
      **
3051
      **  * Begin accepting and shifting new tokens.  No new error
3052
      **    processing will occur until three tokens have been
3053
      **    shifted successfully.
3054
      **
3055
      */
3056
      if( yypParser->yyerrcnt<0 ){
3057
        yy_syntax_error(yypParser,yymajor,yyminor);
3058
      }
3059
      yymx = yypParser->yytos->major;
3060
      if( yymx==YYERRORSYMBOL || yyerrorhit ){
3061
#ifndef NDEBUG
3062
        if( yyTraceFILE ){
3063
          fprintf(yyTraceFILE,"%sDiscard input token %s\n",
3064
             yyTracePrompt,yyTokenName[yymajor]);
3065
        }
3066
#endif
3067
        yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
3068
        yymajor = YYNOCODE;
3069
      }else{
3070
        while( yypParser->yytos > yypParser->yystack ){
3071
          yyact = yy_find_reduce_action(yypParser->yytos->stateno,
3072
                                        YYERRORSYMBOL);
3073
          if( yyact<=YY_MAX_SHIFTREDUCE ) break;
3074
          yy_pop_parser_stack(yypParser);
3075
        }
3076
        if( yypParser->yytos <= yypParser->yystack || yymajor==0 ){
3077
          yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
3078
          yy_parse_failed(yypParser);
3079
#ifndef YYNOERRORRECOVERY
3080
          yypParser->yyerrcnt = -1;
3081
#endif
3082
          yymajor = YYNOCODE;
3083
        }else if( yymx!=YYERRORSYMBOL ){
3084
          yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor);
3085
        }
3086
      }
3087
      yypParser->yyerrcnt = 3;
3088
      yyerrorhit = 1;
3089
      if( yymajor==YYNOCODE ) break;
3090
      yyact = yypParser->yytos->stateno;
3091
#elif defined(YYNOERRORRECOVERY)
3092
      /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
3093
      ** do any kind of error recovery.  Instead, simply invoke the syntax
3094
      ** error routine and continue going as if nothing had happened.
3095
      **
3096
      ** Applications can set this macro (for example inside %include) if
3097
      ** they intend to abandon the parse upon the first syntax error seen.
3098
      */
3099
      yy_syntax_error(yypParser,yymajor, yyminor);
3100
      yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
3101
      break;
3102
#else  /* YYERRORSYMBOL is not defined */
3103
      /* This is what we do if the grammar does not define ERROR:
3104
      **
3105
      **  * Report an error message, and throw away the input token.
3106
      **
3107
      **  * If the input token is $, then fail the parse.
3108
      **
3109
      ** As before, subsequent error messages are suppressed until
3110
      ** three input tokens have been successfully shifted.
3111
      */
3112
0
      if( yypParser->yyerrcnt<=0 ){
3113
0
        yy_syntax_error(yypParser,yymajor, yyminor);
3114
0
      }
3115
0
      yypParser->yyerrcnt = 3;
3116
0
      yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
3117
0
      if( yyendofinput ){
3118
0
        yy_parse_failed(yypParser);
3119
0
#ifndef YYNOERRORRECOVERY
3120
0
        yypParser->yyerrcnt = -1;
3121
0
#endif
3122
0
      }
3123
0
      break;
3124
0
#endif
3125
0
    }
3126
0
  }
3127
#ifndef NDEBUG
3128
  if( yyTraceFILE ){
3129
    yyStackEntry *i;
3130
    char cDiv = '[';
3131
    fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
3132
    for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){
3133
      fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]);
3134
      cDiv = ' ';
3135
    }
3136
    fprintf(yyTraceFILE,"]\n");
3137
  }
3138
#endif
3139
0
  return;
3140
0
}
3141
3142
/*
3143
** Return the fallback token corresponding to canonical token iToken, or
3144
** 0 if iToken has no fallback.
3145
*/
3146
0
int ProtobufLangParserFallback(int iToken){
3147
0
#ifdef YYFALLBACK
3148
0
  assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) );
3149
0
  return yyFallback[iToken];
3150
#else
3151
  (void)iToken;
3152
  return 0;
3153
#endif
3154
0
}
3155
#line 56 "/src/wireshark/epan/protobuf_lang_parser.lemon"
3156
3157
DIAG_ON_LEMON()
3158
#line 592 "/src/wireshark/epan/protobuf_lang_parser.lemon"
3159
3160
3161
void
3162
protobuf_lang_error(void* yyscanner, protobuf_lang_state_t *state, const char *msg)
3163
0
{
3164
0
    int lineno;
3165
0
    void(*error_cb)(const char *format, ...);
3166
0
    const char* filepath = (state && state->file) ?
3167
0
                            state->file->filename : "UNKNOWN";
3168
3169
0
    error_cb = (state && state->pool->error_cb) ?
3170
0
                state->pool->error_cb : pbl_printf;
3171
3172
0
    lineno = yyscanner ? protobuf_lang_get_lineno(yyscanner) : -1;
3173
3174
0
    if (lineno > -1) {
3175
0
        error_cb("Protobuf: Parsing file [%s:%d] failed: %s\n", filepath, lineno, msg);
3176
0
    } else {
3177
0
        error_cb("Protobuf: Parsing file [%s] failed: %s\n", filepath, msg);
3178
0
    }
3179
0
}
3180
3181
void
3182
pbl_parser_error(protobuf_lang_state_t *state, const char *fmt, ...)
3183
0
{
3184
0
    char* msg;
3185
0
    void* scanner;
3186
0
    va_list ap;
3187
0
    va_start(ap, fmt);
3188
0
    msg = ws_strdup_vprintf(fmt, ap);
3189
0
    scanner = state ? state->scanner : NULL;
3190
0
    protobuf_lang_error(scanner, state, msg);
3191
0
    va_end(ap);
3192
0
    g_free(msg);
3193
0
}
3194
3195
static void
3196
pbl_clear_state(protobuf_lang_state_t *state, pbl_descriptor_pool_t* pool)
3197
0
{
3198
0
    if (state == NULL) {
3199
0
        return;
3200
0
    }
3201
3202
0
    state->pool = NULL;
3203
0
    state->file = NULL;
3204
0
    state->grammar_error = FALSE;
3205
0
    state->tmp_token = NULL;
3206
3207
0
    if (state->scanner) {
3208
0
        protobuf_lang_lex_destroy(state->scanner);
3209
0
        state->scanner = NULL;
3210
0
    }
3211
3212
0
    if (state->pParser) {
3213
0
        ProtobufLangParserFree(state->pParser, g_free);
3214
0
        state->pParser = NULL;
3215
0
    }
3216
3217
0
    if (state->lex_string_tokens) {
3218
0
        g_slist_free_full(state->lex_string_tokens, g_free);
3219
0
        state->lex_string_tokens = NULL;
3220
0
    }
3221
3222
0
    if (state->lex_struct_tokens) {
3223
0
        g_slist_free_full(state->lex_struct_tokens, g_free);
3224
0
        state->lex_struct_tokens = NULL;
3225
0
    }
3226
3227
0
    if (pool) {
3228
0
        pool->parser_state = NULL;
3229
0
    }
3230
0
}
3231
3232
static void
3233
pbl_reinit_state(protobuf_lang_state_t *state, pbl_descriptor_pool_t* pool, const char* filepath)
3234
0
{
3235
0
    if (state == NULL) {
3236
0
        return;
3237
0
    }
3238
0
    pbl_clear_state(state, pool);
3239
3240
0
    state->pool = pool;
3241
0
    state->file = (pbl_file_descriptor_t*) g_hash_table_lookup(pool->proto_files, filepath);
3242
0
    state->pParser = ProtobufLangParserAlloc(g_malloc0);
3243
3244
0
    if (pool) {
3245
0
        pool->parser_state = state;
3246
0
    }
3247
0
}
3248
3249
int run_pbl_parser(pbl_descriptor_pool_t* pool)
3250
0
{
3251
0
    protobuf_lang_state_t state = {0};
3252
0
    yyscan_t scanner;
3253
0
    FILE * fp;
3254
0
    int status = 0;
3255
0
    int token_id;
3256
0
    const char* filepath;
3257
3258
0
    while (!g_queue_is_empty(pool->proto_files_to_be_parsed)) {
3259
0
        filepath = (const char*) g_queue_peek_head(pool->proto_files_to_be_parsed);
3260
        /* reinit state and scanner */
3261
0
        pbl_reinit_state(&state, pool, filepath);
3262
0
        scanner = NULL;
3263
3264
        /* Note that filepath is absolute path in proto_files */
3265
0
        fp = ws_fopen(filepath, "r");
3266
0
        if (fp == NULL) {
3267
0
            pbl_parser_error(&state, "File does not exists!");
3268
0
            status = -1;
3269
0
            goto finish;
3270
0
        }
3271
3272
0
        status = protobuf_lang_lex_init(&scanner);
3273
0
        if (status != 0) {
3274
0
            pbl_parser_error(&state, "Initialize Protocol Buffers Language scanner failed!\n");
3275
0
            fclose(fp);
3276
0
            goto finish;
3277
0
        }
3278
3279
        /* associate the parser state with the lexical analyzer state */
3280
0
        protobuf_lang_set_extra(&state, scanner);
3281
0
        state.scanner = scanner;
3282
3283
0
        protobuf_lang_restart(fp, scanner);
3284
        /* uncomment the next line for debugging */
3285
        /* ProtobufLangParserTrace(stdout, ">>>"); */
3286
0
        while (!state.grammar_error && (token_id = protobuf_lang_lex(scanner))) {
3287
            /* state.tmp_token contains token string value and lineno information */
3288
0
            ProtobufLangParser(state.pParser, token_id, state.tmp_token, &state);
3289
0
        }
3290
0
        fclose(fp);
3291
3292
0
        if (state.grammar_error) {
3293
0
            status = -2;
3294
0
            goto finish;
3295
0
        } else {
3296
0
            ProtobufLangParser(state.pParser, 0, NULL, &state);
3297
0
        }
3298
3299
        /* remove the parsed file from list */
3300
0
        g_queue_pop_head(pool->proto_files_to_be_parsed);
3301
0
    }
3302
3303
0
finish:
3304
0
    pbl_clear_state(&state, pool);
3305
0
    return status;
3306
0
}
3307
3308
#line 3333 "./protobuf_lang_parser.c"