1 /* A Bison parser, made by GNU Bison 3.5.  */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5    Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
6    Inc.
7 
8    This program is free software: you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation, either version 3 of the License, or
11    (at your option) any later version.
12 
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17 
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
20 
21 /* As a special exception, you may create a larger work that contains
22    part or all of the Bison parser skeleton and distribute that work
23    under terms of your choice, so long as that work isn't itself a
24    parser generator using the skeleton or a modified version thereof
25    as a parser skeleton.  Alternatively, if you modify or redistribute
26    the parser skeleton itself, you may (at your option) remove this
27    special exception, which will cause the skeleton and the resulting
28    Bison output files to be licensed under the GNU General Public
29    License without this special exception.
30 
31    This special exception was added by the Free Software Foundation in
32    version 2.2 of Bison.  */
33 
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35    simplifying the original so-called "semantic" parser.  */
36 
37 /* All symbols defined below should begin with yy or YY, to avoid
38    infringing on user name space.  This should be done even for local
39    variables, as they might otherwise be expanded by user macros.
40    There are some unavoidable exceptions within include files to
41    define necessary library symbols; they are noted "INFRINGES ON
42    USER NAME SPACE" below.  */
43 
44 /* Undocumented macros, especially those whose name start with YY_,
45    are private implementation details.  Do not rely on them.  */
46 
47 /* Identify Bison output.  */
48 #define YYBISON 1
49 
50 /* Bison version.  */
51 #define YYBISON_VERSION "3.5"
52 
53 /* Skeleton name.  */
54 #define YYSKELETON_NAME "yacc.c"
55 
56 /* Pure parsers.  */
57 #define YYPURE 2
58 
59 /* Push parsers.  */
60 #define YYPUSH 0
61 
62 /* Pull parsers.  */
63 #define YYPULL 1
64 
65 
66 
67 
68 /* First part of user prologue.  */
69 
70 #include <stdio.h>
71 #include <stdarg.h>
72 #include <string.h>
73 #include <stdlib.h>
74 #include "libyang.h"
75 #include "common.h"
76 #include "context.h"
77 #include "resolve.h"
78 #include "parser_yang.h"
79 #include "parser_yang_lex.h"
80 #include "parser.h"
81 
82 #define YANG_ADDELEM(current_ptr, size, array_name)                                      \
83     if ((size) == LY_ARRAY_MAX(size)) {                                                  \
84          LOGERR(trg->ctx, LY_EINT, "Reached limit (%"PRIu64") for storing %s.", LY_ARRAY_MAX(size), array_name); \
85          free(s);                                                                        \
86          YYABORT;                                                                        \
87     } else if (!((size) % LY_YANG_ARRAY_SIZE)) {                                         \
88         void *tmp;                                                                       \
89                                                                                          \
90         tmp = realloc((current_ptr), (sizeof *(current_ptr)) * ((size) + LY_YANG_ARRAY_SIZE)); \
91         if (!tmp) {                                                                      \
92             LOGMEM(trg->ctx);                                                            \
93             free(s);                                                                     \
94             YYABORT;                                                                     \
95         }                                                                                \
96         memset((char *)tmp + (sizeof *(current_ptr)) * (size), 0, (sizeof *(current_ptr)) * LY_YANG_ARRAY_SIZE); \
97         (current_ptr) = tmp;                                                             \
98     }                                                                                    \
99     (size)++;                                                                            \
100     actual = &(current_ptr)[(size)-1];                                                   \
101 
102 void yyerror(YYLTYPE *yylloc, void *scanner, struct yang_parameter *param, ...);
103 /* pointer on the current parsed element 'actual' */
104 
105 
106 # ifndef YY_CAST
107 #  ifdef __cplusplus
108 #   define YY_CAST(Type, Val) static_cast<Type> (Val)
109 #   define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
110 #  else
111 #   define YY_CAST(Type, Val) ((Type) (Val))
112 #   define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
113 #  endif
114 # endif
115 # ifndef YY_NULLPTR
116 #  if defined __cplusplus
117 #   if 201103L <= __cplusplus
118 #    define YY_NULLPTR nullptr
119 #   else
120 #    define YY_NULLPTR 0
121 #   endif
122 #  else
123 #   define YY_NULLPTR ((void*)0)
124 #  endif
125 # endif
126 
127 /* Enabling verbose error messages.  */
128 #ifdef YYERROR_VERBOSE
129 # undef YYERROR_VERBOSE
130 # define YYERROR_VERBOSE 1
131 #else
132 # define YYERROR_VERBOSE 0
133 #endif
134 
135 /* Use api.header.include to #include this header
136    instead of duplicating it here.  */
137 #ifndef YY_YY_PARSER_YANG_BIS_H_INCLUDED
138 # define YY_YY_PARSER_YANG_BIS_H_INCLUDED
139 /* Debug traces.  */
140 #ifndef YYDEBUG
141 # define YYDEBUG 0
142 #endif
143 #if YYDEBUG
144 extern int yydebug;
145 #endif
146 
147 /* Token type.  */
148 #ifndef YYTOKENTYPE
149 # define YYTOKENTYPE
150   enum yytokentype
151   {
152     UNION_KEYWORD = 258,
153     ANYXML_KEYWORD = 259,
154     WHITESPACE = 260,
155     ERROR = 261,
156     EOL = 262,
157     STRING = 263,
158     STRINGS = 264,
159     IDENTIFIER = 265,
160     IDENTIFIERPREFIX = 266,
161     REVISION_DATE = 267,
162     TAB = 268,
163     DOUBLEDOT = 269,
164     URI = 270,
165     INTEGER = 271,
166     NON_NEGATIVE_INTEGER = 272,
167     ZERO = 273,
168     DECIMAL = 274,
169     ARGUMENT_KEYWORD = 275,
170     AUGMENT_KEYWORD = 276,
171     BASE_KEYWORD = 277,
172     BELONGS_TO_KEYWORD = 278,
173     BIT_KEYWORD = 279,
174     CASE_KEYWORD = 280,
175     CHOICE_KEYWORD = 281,
176     CONFIG_KEYWORD = 282,
177     CONTACT_KEYWORD = 283,
178     CONTAINER_KEYWORD = 284,
179     DEFAULT_KEYWORD = 285,
180     DESCRIPTION_KEYWORD = 286,
181     ENUM_KEYWORD = 287,
182     ERROR_APP_TAG_KEYWORD = 288,
183     ERROR_MESSAGE_KEYWORD = 289,
184     EXTENSION_KEYWORD = 290,
185     DEVIATION_KEYWORD = 291,
186     DEVIATE_KEYWORD = 292,
187     FEATURE_KEYWORD = 293,
188     FRACTION_DIGITS_KEYWORD = 294,
189     GROUPING_KEYWORD = 295,
190     IDENTITY_KEYWORD = 296,
191     IF_FEATURE_KEYWORD = 297,
192     IMPORT_KEYWORD = 298,
193     INCLUDE_KEYWORD = 299,
194     INPUT_KEYWORD = 300,
195     KEY_KEYWORD = 301,
196     LEAF_KEYWORD = 302,
197     LEAF_LIST_KEYWORD = 303,
198     LENGTH_KEYWORD = 304,
199     LIST_KEYWORD = 305,
200     MANDATORY_KEYWORD = 306,
201     MAX_ELEMENTS_KEYWORD = 307,
202     MIN_ELEMENTS_KEYWORD = 308,
203     MODULE_KEYWORD = 309,
204     MUST_KEYWORD = 310,
205     NAMESPACE_KEYWORD = 311,
206     NOTIFICATION_KEYWORD = 312,
207     ORDERED_BY_KEYWORD = 313,
208     ORGANIZATION_KEYWORD = 314,
209     OUTPUT_KEYWORD = 315,
210     PATH_KEYWORD = 316,
211     PATTERN_KEYWORD = 317,
212     POSITION_KEYWORD = 318,
213     PREFIX_KEYWORD = 319,
214     PRESENCE_KEYWORD = 320,
215     RANGE_KEYWORD = 321,
216     REFERENCE_KEYWORD = 322,
217     REFINE_KEYWORD = 323,
218     REQUIRE_INSTANCE_KEYWORD = 324,
219     REVISION_KEYWORD = 325,
220     REVISION_DATE_KEYWORD = 326,
221     RPC_KEYWORD = 327,
222     STATUS_KEYWORD = 328,
223     SUBMODULE_KEYWORD = 329,
224     TYPE_KEYWORD = 330,
225     TYPEDEF_KEYWORD = 331,
226     UNIQUE_KEYWORD = 332,
227     UNITS_KEYWORD = 333,
228     USES_KEYWORD = 334,
229     VALUE_KEYWORD = 335,
230     WHEN_KEYWORD = 336,
231     YANG_VERSION_KEYWORD = 337,
232     YIN_ELEMENT_KEYWORD = 338,
233     ADD_KEYWORD = 339,
234     CURRENT_KEYWORD = 340,
235     DELETE_KEYWORD = 341,
236     DEPRECATED_KEYWORD = 342,
237     FALSE_KEYWORD = 343,
238     NOT_SUPPORTED_KEYWORD = 344,
239     OBSOLETE_KEYWORD = 345,
240     REPLACE_KEYWORD = 346,
241     SYSTEM_KEYWORD = 347,
242     TRUE_KEYWORD = 348,
243     UNBOUNDED_KEYWORD = 349,
244     USER_KEYWORD = 350,
245     ACTION_KEYWORD = 351,
246     MODIFIER_KEYWORD = 352,
247     ANYDATA_KEYWORD = 353,
248     NODE = 354,
249     NODE_PRINT = 355,
250     EXTENSION_INSTANCE = 356,
251     SUBMODULE_EXT_KEYWORD = 357
252   };
253 #endif
254 
255 /* Value type.  */
256 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
257 union YYSTYPE
258 {
259 
260   int64_t i;
261   uint32_t uint;
262   char *str;
263   char **p_str;
264   void *v;
265   char ch;
266   struct yang_type *type;
267   struct lys_deviation *dev;
268   struct lys_deviate *deviate;
269   union {
270     uint32_t index;
271     struct lys_node_container *container;
272     struct lys_node_anydata *anydata;
273     struct type_node node;
274     struct lys_node_case *cs;
275     struct lys_node_grp *grouping;
276     struct lys_refine *refine;
277     struct lys_node_notif *notif;
278     struct lys_node_uses *uses;
279     struct lys_node_inout *inout;
280     struct lys_node_augment *augment;
281   } nodes;
282   enum yytokentype token;
283   struct {
284     void *actual;
285     enum yytokentype token;
286   } backup_token;
287   struct {
288     struct lys_revision **revision;
289     int index;
290   } revisions;
291 
292 
293 };
294 typedef union YYSTYPE YYSTYPE;
295 # define YYSTYPE_IS_TRIVIAL 1
296 # define YYSTYPE_IS_DECLARED 1
297 #endif
298 
299 /* Location type.  */
300 #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
301 typedef struct YYLTYPE YYLTYPE;
302 struct YYLTYPE
303 {
304   int first_line;
305   int first_column;
306   int last_line;
307   int last_column;
308 };
309 # define YYLTYPE_IS_DECLARED 1
310 # define YYLTYPE_IS_TRIVIAL 1
311 #endif
312 
313 
314 
315 int yyparse (void *scanner, struct yang_parameter *param);
316 
317 #endif /* !YY_YY_PARSER_YANG_BIS_H_INCLUDED  */
318 
319 
320 
321 #ifdef short
322 # undef short
323 #endif
324 
325 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
326    <limits.h> and (if available) <stdint.h> are included
327    so that the code can choose integer types of a good width.  */
328 
329 #ifndef __PTRDIFF_MAX__
330 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
331 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
332 #  include <stdint.h> /* INFRINGES ON USER NAME SPACE */
333 #  define YY_STDINT_H
334 # endif
335 #endif
336 
337 /* Narrow types that promote to a signed type and that can represent a
338    signed or unsigned integer of at least N bits.  In tables they can
339    save space and decrease cache pressure.  Promoting to a signed type
340    helps avoid bugs in integer arithmetic.  */
341 
342 #ifdef __INT_LEAST8_MAX__
343 typedef __INT_LEAST8_TYPE__ yytype_int8;
344 #elif defined YY_STDINT_H
345 typedef int_least8_t yytype_int8;
346 #else
347 typedef signed char yytype_int8;
348 #endif
349 
350 #ifdef __INT_LEAST16_MAX__
351 typedef __INT_LEAST16_TYPE__ yytype_int16;
352 #elif defined YY_STDINT_H
353 typedef int_least16_t yytype_int16;
354 #else
355 typedef short yytype_int16;
356 #endif
357 
358 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
359 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
360 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
361        && UINT_LEAST8_MAX <= INT_MAX)
362 typedef uint_least8_t yytype_uint8;
363 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
364 typedef unsigned char yytype_uint8;
365 #else
366 typedef short yytype_uint8;
367 #endif
368 
369 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
370 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
371 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
372        && UINT_LEAST16_MAX <= INT_MAX)
373 typedef uint_least16_t yytype_uint16;
374 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
375 typedef unsigned short yytype_uint16;
376 #else
377 typedef int yytype_uint16;
378 #endif
379 
380 #ifndef YYPTRDIFF_T
381 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
382 #  define YYPTRDIFF_T __PTRDIFF_TYPE__
383 #  define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
384 # elif defined PTRDIFF_MAX
385 #  ifndef ptrdiff_t
386 #   include <stddef.h> /* INFRINGES ON USER NAME SPACE */
387 #  endif
388 #  define YYPTRDIFF_T ptrdiff_t
389 #  define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
390 # else
391 #  define YYPTRDIFF_T long
392 #  define YYPTRDIFF_MAXIMUM LONG_MAX
393 # endif
394 #endif
395 
396 #ifndef YYSIZE_T
397 # ifdef __SIZE_TYPE__
398 #  define YYSIZE_T __SIZE_TYPE__
399 # elif defined size_t
400 #  define YYSIZE_T size_t
401 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
402 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
403 #  define YYSIZE_T size_t
404 # else
405 #  define YYSIZE_T unsigned
406 # endif
407 #endif
408 
409 #define YYSIZE_MAXIMUM                                  \
410   YY_CAST (YYPTRDIFF_T,                                 \
411            (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1)  \
412             ? YYPTRDIFF_MAXIMUM                         \
413             : YY_CAST (YYSIZE_T, -1)))
414 
415 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
416 
417 /* Stored state numbers (used for stacks). */
418 typedef yytype_int16 yy_state_t;
419 
420 /* State numbers in computations.  */
421 typedef int yy_state_fast_t;
422 
423 #ifndef YY_
424 # if defined YYENABLE_NLS && YYENABLE_NLS
425 #  if ENABLE_NLS
426 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
427 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
428 #  endif
429 # endif
430 # ifndef YY_
431 #  define YY_(Msgid) Msgid
432 # endif
433 #endif
434 
435 #ifndef YY_ATTRIBUTE_PURE
436 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
437 #  define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
438 # else
439 #  define YY_ATTRIBUTE_PURE
440 # endif
441 #endif
442 
443 #ifndef YY_ATTRIBUTE_UNUSED
444 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
445 #  define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
446 # else
447 #  define YY_ATTRIBUTE_UNUSED
448 # endif
449 #endif
450 
451 /* Suppress unused-variable warnings by "using" E.  */
452 #if ! defined lint || defined __GNUC__
453 # define YYUSE(E) ((void) (E))
454 #else
455 # define YYUSE(E) /* empty */
456 #endif
457 
458 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
459 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
460 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                            \
461     _Pragma ("GCC diagnostic push")                                     \
462     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")              \
463     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
464 # define YY_IGNORE_MAYBE_UNINITIALIZED_END      \
465     _Pragma ("GCC diagnostic pop")
466 #else
467 # define YY_INITIAL_VALUE(Value) Value
468 #endif
469 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
470 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
471 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
472 #endif
473 #ifndef YY_INITIAL_VALUE
474 # define YY_INITIAL_VALUE(Value) /* Nothing. */
475 #endif
476 
477 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
478 # define YY_IGNORE_USELESS_CAST_BEGIN                          \
479     _Pragma ("GCC diagnostic push")                            \
480     _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
481 # define YY_IGNORE_USELESS_CAST_END            \
482     _Pragma ("GCC diagnostic pop")
483 #endif
484 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
485 # define YY_IGNORE_USELESS_CAST_BEGIN
486 # define YY_IGNORE_USELESS_CAST_END
487 #endif
488 
489 
490 #define YY_ASSERT(E) ((void) (0 && (E)))
491 
492 #if ! defined yyoverflow || YYERROR_VERBOSE
493 
494 /* The parser invokes alloca or malloc; define the necessary symbols.  */
495 
496 # ifdef YYSTACK_USE_ALLOCA
497 #  if YYSTACK_USE_ALLOCA
498 #   ifdef __GNUC__
499 #    define YYSTACK_ALLOC __builtin_alloca
500 #   elif defined __BUILTIN_VA_ARG_INCR
501 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
502 #   elif defined _AIX
503 #    define YYSTACK_ALLOC __alloca
504 #   elif defined _MSC_VER
505 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
506 #    define alloca _alloca
507 #   else
508 #    define YYSTACK_ALLOC alloca
509 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
510 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
511       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
512 #     ifndef EXIT_SUCCESS
513 #      define EXIT_SUCCESS 0
514 #     endif
515 #    endif
516 #   endif
517 #  endif
518 # endif
519 
520 # ifdef YYSTACK_ALLOC
521    /* Pacify GCC's 'empty if-body' warning.  */
522 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
523 #  ifndef YYSTACK_ALLOC_MAXIMUM
524     /* The OS might guarantee only one guard page at the bottom of the stack,
525        and a page size can be as small as 4096 bytes.  So we cannot safely
526        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
527        to allow for a few compiler-allocated temporary stack slots.  */
528 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
529 #  endif
530 # else
531 #  define YYSTACK_ALLOC YYMALLOC
532 #  define YYSTACK_FREE YYFREE
533 #  ifndef YYSTACK_ALLOC_MAXIMUM
534 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
535 #  endif
536 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
537        && ! ((defined YYMALLOC || defined malloc) \
538              && (defined YYFREE || defined free)))
539 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
540 #   ifndef EXIT_SUCCESS
541 #    define EXIT_SUCCESS 0
542 #   endif
543 #  endif
544 #  ifndef YYMALLOC
545 #   define YYMALLOC malloc
546 #   if ! defined malloc && ! defined EXIT_SUCCESS
547 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
548 #   endif
549 #  endif
550 #  ifndef YYFREE
551 #   define YYFREE free
552 #   if ! defined free && ! defined EXIT_SUCCESS
553 void free (void *); /* INFRINGES ON USER NAME SPACE */
554 #   endif
555 #  endif
556 # endif
557 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
558 
559 
560 #if (! defined yyoverflow \
561      && (! defined __cplusplus \
562          || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
563              && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
564 
565 /* A type that is properly aligned for any stack member.  */
566 union yyalloc
567 {
568   yy_state_t yyss_alloc;
569   YYSTYPE yyvs_alloc;
570   YYLTYPE yyls_alloc;
571 };
572 
573 /* The size of the maximum gap between one aligned stack and the next.  */
574 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
575 
576 /* The size of an array large to enough to hold all stacks, each with
577    N elements.  */
578 # define YYSTACK_BYTES(N) \
579      ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \
580              + YYSIZEOF (YYLTYPE)) \
581       + 2 * YYSTACK_GAP_MAXIMUM)
582 
583 # define YYCOPY_NEEDED 1
584 
585 /* Relocate STACK from its old location to the new one.  The
586    local variables YYSIZE and YYSTACKSIZE give the old and new number of
587    elements in the stack, and YYPTR gives the new location of the
588    stack.  Advance YYPTR to a properly aligned location for the next
589    stack.  */
590 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
591     do                                                                  \
592       {                                                                 \
593         YYPTRDIFF_T yynewbytes;                                         \
594         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
595         Stack = &yyptr->Stack_alloc;                                    \
596         yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
597         yyptr += yynewbytes / YYSIZEOF (*yyptr);                        \
598       }                                                                 \
599     while (0)
600 
601 #endif
602 
603 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
604 /* Copy COUNT objects from SRC to DST.  The source and destination do
605    not overlap.  */
606 # ifndef YYCOPY
607 #  if defined __GNUC__ && 1 < __GNUC__
608 #   define YYCOPY(Dst, Src, Count) \
609       __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
610 #  else
611 #   define YYCOPY(Dst, Src, Count)              \
612       do                                        \
613         {                                       \
614           YYPTRDIFF_T yyi;                      \
615           for (yyi = 0; yyi < (Count); yyi++)   \
616             (Dst)[yyi] = (Src)[yyi];            \
617         }                                       \
618       while (0)
619 #  endif
620 # endif
621 #endif /* !YYCOPY_NEEDED */
622 
623 /* YYFINAL -- State number of the termination state.  */
624 #define YYFINAL  6
625 /* YYLAST -- Last index in YYTABLE.  */
626 #define YYLAST   3466
627 
628 /* YYNTOKENS -- Number of terminals.  */
629 #define YYNTOKENS  113
630 /* YYNNTS -- Number of nonterminals.  */
631 #define YYNNTS  329
632 /* YYNRULES -- Number of rules.  */
633 #define YYNRULES  827
634 /* YYNSTATES -- Number of states.  */
635 #define YYNSTATES  1318
636 
637 #define YYUNDEFTOK  2
638 #define YYMAXUTOK   357
639 
640 
641 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
642    as returned by yylex, with out-of-bounds checking.  */
643 #define YYTRANSLATE(YYX)                                                \
644   (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
645 
646 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
647    as returned by yylex.  */
648 static const yytype_int8 yytranslate[] =
649 {
650        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
651        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
652        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
653        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
654      111,   112,     2,   103,     2,     2,     2,   107,     2,     2,
655        2,     2,     2,     2,     2,     2,     2,     2,     2,   106,
656        2,   110,     2,     2,     2,     2,     2,     2,     2,     2,
657        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
658        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
659        2,   108,     2,   109,     2,     2,     2,     2,     2,     2,
660        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
661        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
662        2,     2,     2,   104,     2,   105,     2,     2,     2,     2,
663        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
664        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
665        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
666        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
667        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
668        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
669        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
670        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
671        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
672        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
673        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
674        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
675        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
676        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
677       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
678       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
679       35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
680       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
681       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
682       65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
683       75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
684       85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
685       95,    96,    97,    98,    99,   100,   101,   102
686 };
687 
688 #if YYDEBUG
689   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
690 static const yytype_int16 yyrline[] =
691 {
692        0,   338,   338,   339,   340,   342,   365,   368,   370,   369,
693      393,   406,   416,   426,   427,   433,   438,   444,   457,   467,
694      480,   481,   487,   489,   493,   495,   499,   501,   502,   503,
695      505,   513,   521,   522,   527,   538,   549,   560,   568,   573,
696      574,   578,   579,   590,   601,   612,   616,   618,   641,   658,
697      662,   664,   665,   670,   675,   680,   686,   690,   692,   696,
698      698,   702,   704,   708,   710,   723,   734,   735,   747,   751,
699      752,   756,   757,   762,   769,   769,   780,   786,   834,   853,
700      856,   857,   858,   859,   860,   861,   862,   863,   864,   865,
701      868,   883,   890,   891,   895,   896,   897,   903,   908,   914,
702      932,   934,   935,   939,   944,   945,   967,   968,   969,   982,
703      987,   989,   990,   991,   992,  1007,  1021,  1026,  1027,  1042,
704     1043,  1044,  1050,  1055,  1061,  1118,  1123,  1124,  1126,  1142,
705     1147,  1148,  1173,  1174,  1188,  1189,  1195,  1200,  1206,  1210,
706     1212,  1265,  1276,  1279,  1282,  1287,  1292,  1298,  1303,  1309,
707     1314,  1323,  1324,  1328,  1375,  1376,  1378,  1379,  1383,  1389,
708     1402,  1403,  1404,  1408,  1409,  1411,  1415,  1433,  1438,  1440,
709     1441,  1457,  1462,  1471,  1472,  1476,  1492,  1497,  1502,  1507,
710     1513,  1517,  1536,  1551,  1552,  1556,  1557,  1567,  1572,  1577,
711     1582,  1588,  1592,  1603,  1615,  1616,  1619,  1627,  1638,  1639,
712     1654,  1655,  1656,  1668,  1674,  1679,  1685,  1690,  1692,  1693,
713     1708,  1713,  1714,  1719,  1723,  1725,  1730,  1732,  1733,  1734,
714     1747,  1759,  1760,  1762,  1770,  1782,  1783,  1798,  1799,  1800,
715     1812,  1818,  1823,  1829,  1834,  1836,  1837,  1853,  1857,  1859,
716     1863,  1865,  1869,  1871,  1875,  1877,  1887,  1894,  1895,  1899,
717     1900,  1906,  1911,  1916,  1917,  1918,  1919,  1920,  1926,  1927,
718     1928,  1929,  1930,  1931,  1932,  1933,  1936,  1946,  1953,  1954,
719     1977,  1978,  1979,  1980,  1981,  1986,  1992,  1998,  2003,  2008,
720     2009,  2010,  2015,  2016,  2018,  2058,  2068,  2071,  2072,  2073,
721     2076,  2081,  2082,  2087,  2093,  2099,  2105,  2110,  2116,  2126,
722     2181,  2184,  2185,  2186,  2189,  2200,  2205,  2206,  2212,  2225,
723     2238,  2248,  2254,  2259,  2265,  2275,  2322,  2325,  2326,  2327,
724     2328,  2337,  2343,  2349,  2362,  2375,  2385,  2391,  2396,  2401,
725     2402,  2403,  2404,  2409,  2411,  2421,  2428,  2429,  2449,  2452,
726     2453,  2454,  2464,  2471,  2478,  2485,  2491,  2497,  2499,  2500,
727     2502,  2503,  2504,  2505,  2506,  2507,  2508,  2514,  2524,  2531,
728     2532,  2546,  2547,  2548,  2549,  2555,  2560,  2565,  2568,  2578,
729     2585,  2595,  2602,  2603,  2626,  2629,  2630,  2631,  2632,  2639,
730     2646,  2653,  2658,  2664,  2674,  2681,  2682,  2714,  2715,  2716,
731     2717,  2723,  2728,  2733,  2734,  2736,  2737,  2739,  2752,  2757,
732     2758,  2790,  2793,  2807,  2823,  2845,  2896,  2915,  2934,  2955,
733     2976,  2981,  2987,  2988,  2991,  3006,  3015,  3016,  3018,  3029,
734     3038,  3039,  3040,  3041,  3047,  3052,  3057,  3058,  3059,  3064,
735     3066,  3081,  3088,  3098,  3105,  3106,  3130,  3133,  3134,  3140,
736     3145,  3150,  3151,  3152,  3159,  3167,  3182,  3212,  3213,  3214,
737     3215,  3216,  3218,  3233,  3263,  3273,  3280,  3281,  3313,  3314,
738     3315,  3316,  3322,  3327,  3332,  3333,  3334,  3336,  3348,  3368,
739     3369,  3375,  3381,  3383,  3384,  3386,  3387,  3390,  3398,  3403,
740     3404,  3406,  3407,  3408,  3410,  3418,  3423,  3424,  3456,  3457,
741     3463,  3464,  3470,  3476,  3483,  3490,  3498,  3507,  3515,  3520,
742     3521,  3553,  3554,  3560,  3561,  3567,  3574,  3582,  3587,  3588,
743     3602,  3603,  3604,  3610,  3616,  3623,  3630,  3638,  3647,  3656,
744     3661,  3662,  3666,  3667,  3672,  3678,  3683,  3685,  3686,  3687,
745     3700,  3705,  3707,  3708,  3709,  3722,  3726,  3728,  3733,  3735,
746     3736,  3756,  3761,  3763,  3764,  3765,  3785,  3790,  3792,  3793,
747     3794,  3806,  3875,  3880,  3881,  3885,  3889,  3891,  3892,  3894,
748     3898,  3900,  3900,  3907,  3910,  3919,  3938,  3940,  3941,  3944,
749     3944,  3961,  3961,  3968,  3968,  3975,  3978,  3980,  3982,  3983,
750     3985,  3987,  3989,  3990,  3992,  3994,  3995,  3997,  3998,  4000,
751     4002,  4005,  4008,  4010,  4011,  4013,  4014,  4016,  4018,  4029,
752     4030,  4033,  4034,  4046,  4047,  4049,  4050,  4052,  4053,  4059,
753     4060,  4063,  4064,  4065,  4089,  4090,  4093,  4099,  4103,  4108,
754     4109,  4110,  4113,  4118,  4128,  4130,  4131,  4133,  4134,  4136,
755     4137,  4138,  4140,  4141,  4143,  4144,  4146,  4147,  4151,  4152,
756     4179,  4217,  4218,  4220,  4222,  4224,  4225,  4227,  4228,  4230,
757     4231,  4234,  4235,  4238,  4240,  4241,  4244,  4244,  4251,  4253,
758     4254,  4255,  4256,  4257,  4258,  4259,  4261,  4262,  4263,  4265,
759     4266,  4267,  4268,  4269,  4270,  4271,  4272,  4273,  4274,  4277,
760     4278,  4279,  4280,  4281,  4282,  4283,  4284,  4285,  4286,  4287,
761     4288,  4289,  4290,  4291,  4292,  4293,  4294,  4295,  4296,  4297,
762     4298,  4299,  4300,  4301,  4302,  4303,  4304,  4305,  4306,  4307,
763     4308,  4309,  4310,  4311,  4312,  4313,  4314,  4315,  4316,  4317,
764     4318,  4319,  4320,  4321,  4322,  4323,  4324,  4325,  4326,  4327,
765     4328,  4329,  4330,  4331,  4332,  4333,  4334,  4335,  4336,  4337,
766     4338,  4339,  4340,  4341,  4342,  4343,  4344,  4345,  4346,  4348,
767     4355,  4362,  4382,  4400,  4416,  4443,  4450,  4468,  4508,  4510,
768     4511,  4512,  4513,  4514,  4515,  4516,  4517,  4518,  4519,  4520,
769     4521,  4522,  4524,  4525,  4526,  4527,  4528,  4529,  4530,  4531,
770     4532,  4533,  4534,  4535,  4536,  4537,  4539,  4540,  4541,  4542,
771     4544,  4552,  4553,  4558,  4563,  4568,  4573,  4578,  4583,  4588,
772     4593,  4598,  4603,  4608,  4613,  4618,  4623,  4628,  4642,  4662,
773     4667,  4672,  4677,  4690,  4695,  4699,  4709,  4724,  4739,  4754,
774     4769,  4789,  4804,  4805,  4811,  4818,  4833,  4836
775 };
776 #endif
777 
778 #if YYDEBUG || YYERROR_VERBOSE || 0
779 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
780    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
781 static const char *const yytname[] =
782 {
783   "$end", "error", "$undefined", "UNION_KEYWORD", "ANYXML_KEYWORD",
784   "WHITESPACE", "ERROR", "EOL", "STRING", "STRINGS", "IDENTIFIER",
785   "IDENTIFIERPREFIX", "REVISION_DATE", "TAB", "DOUBLEDOT", "URI",
786   "INTEGER", "NON_NEGATIVE_INTEGER", "ZERO", "DECIMAL", "ARGUMENT_KEYWORD",
787   "AUGMENT_KEYWORD", "BASE_KEYWORD", "BELONGS_TO_KEYWORD", "BIT_KEYWORD",
788   "CASE_KEYWORD", "CHOICE_KEYWORD", "CONFIG_KEYWORD", "CONTACT_KEYWORD",
789   "CONTAINER_KEYWORD", "DEFAULT_KEYWORD", "DESCRIPTION_KEYWORD",
790   "ENUM_KEYWORD", "ERROR_APP_TAG_KEYWORD", "ERROR_MESSAGE_KEYWORD",
791   "EXTENSION_KEYWORD", "DEVIATION_KEYWORD", "DEVIATE_KEYWORD",
792   "FEATURE_KEYWORD", "FRACTION_DIGITS_KEYWORD", "GROUPING_KEYWORD",
793   "IDENTITY_KEYWORD", "IF_FEATURE_KEYWORD", "IMPORT_KEYWORD",
794   "INCLUDE_KEYWORD", "INPUT_KEYWORD", "KEY_KEYWORD", "LEAF_KEYWORD",
795   "LEAF_LIST_KEYWORD", "LENGTH_KEYWORD", "LIST_KEYWORD",
796   "MANDATORY_KEYWORD", "MAX_ELEMENTS_KEYWORD", "MIN_ELEMENTS_KEYWORD",
797   "MODULE_KEYWORD", "MUST_KEYWORD", "NAMESPACE_KEYWORD",
798   "NOTIFICATION_KEYWORD", "ORDERED_BY_KEYWORD", "ORGANIZATION_KEYWORD",
799   "OUTPUT_KEYWORD", "PATH_KEYWORD", "PATTERN_KEYWORD", "POSITION_KEYWORD",
800   "PREFIX_KEYWORD", "PRESENCE_KEYWORD", "RANGE_KEYWORD",
801   "REFERENCE_KEYWORD", "REFINE_KEYWORD", "REQUIRE_INSTANCE_KEYWORD",
802   "REVISION_KEYWORD", "REVISION_DATE_KEYWORD", "RPC_KEYWORD",
803   "STATUS_KEYWORD", "SUBMODULE_KEYWORD", "TYPE_KEYWORD", "TYPEDEF_KEYWORD",
804   "UNIQUE_KEYWORD", "UNITS_KEYWORD", "USES_KEYWORD", "VALUE_KEYWORD",
805   "WHEN_KEYWORD", "YANG_VERSION_KEYWORD", "YIN_ELEMENT_KEYWORD",
806   "ADD_KEYWORD", "CURRENT_KEYWORD", "DELETE_KEYWORD", "DEPRECATED_KEYWORD",
807   "FALSE_KEYWORD", "NOT_SUPPORTED_KEYWORD", "OBSOLETE_KEYWORD",
808   "REPLACE_KEYWORD", "SYSTEM_KEYWORD", "TRUE_KEYWORD", "UNBOUNDED_KEYWORD",
809   "USER_KEYWORD", "ACTION_KEYWORD", "MODIFIER_KEYWORD", "ANYDATA_KEYWORD",
810   "NODE", "NODE_PRINT", "EXTENSION_INSTANCE", "SUBMODULE_EXT_KEYWORD",
811   "'+'", "'{'", "'}'", "';'", "'/'", "'['", "']'", "'='", "'('", "')'",
812   "$accept", "start", "tmp_string", "string_1", "string_2", "$@1",
813   "module_arg_str", "module_stmt", "module_header_stmts",
814   "module_header_stmt", "submodule_arg_str", "submodule_stmt",
815   "submodule_header_stmts", "submodule_header_stmt", "yang_version_arg",
816   "yang_version_stmt", "namespace_arg_str", "namespace_stmt",
817   "linkage_stmts", "import_stmt", "import_arg_str", "import_opt_stmt",
818   "include_arg_str", "include_stmt", "include_end", "include_opt_stmt",
819   "revision_date_arg", "revision_date_stmt", "belongs_to_arg_str",
820   "belongs_to_stmt", "prefix_arg", "prefix_stmt", "meta_stmts",
821   "organization_arg", "organization_stmt", "contact_arg", "contact_stmt",
822   "description_arg", "description_stmt", "reference_arg", "reference_stmt",
823   "revision_stmts", "revision_arg_stmt", "revision_stmts_opt",
824   "revision_stmt", "revision_end", "revision_opt_stmt", "date_arg_str",
825   "$@2", "body_stmts_end", "body_stmts", "body_stmt", "extension_arg_str",
826   "extension_stmt", "extension_end", "extension_opt_stmt", "argument_str",
827   "argument_stmt", "argument_end", "yin_element_arg", "yin_element_stmt",
828   "yin_element_arg_str", "status_arg", "status_stmt", "status_arg_str",
829   "feature_arg_str", "feature_stmt", "feature_end", "feature_opt_stmt",
830   "if_feature_arg", "if_feature_stmt", "if_feature_end",
831   "identity_arg_str", "identity_stmt", "identity_end", "identity_opt_stmt",
832   "base_arg", "base_stmt", "typedef_arg_str", "typedef_stmt",
833   "type_opt_stmt", "type_stmt", "type_arg_str", "type_end",
834   "type_body_stmts", "some_restrictions", "union_stmt", "union_spec",
835   "fraction_digits_arg", "fraction_digits_stmt", "fraction_digits_arg_str",
836   "length_stmt", "length_arg_str", "length_end", "message_opt_stmt",
837   "pattern_sep", "pattern_stmt", "pattern_arg_str", "pattern_end",
838   "pattern_opt_stmt", "modifier_arg", "modifier_stmt",
839   "enum_specification", "enum_stmts", "enum_stmt", "enum_arg_str",
840   "enum_end", "enum_opt_stmt", "value_arg", "value_stmt",
841   "integer_value_arg_str", "range_stmt", "range_end", "path_arg",
842   "path_stmt", "require_instance_arg", "require_instance_stmt",
843   "require_instance_arg_str", "bits_specification", "bit_stmts",
844   "bit_stmt", "bit_arg_str", "bit_end", "bit_opt_stmt",
845   "position_value_arg", "position_stmt", "position_value_arg_str",
846   "error_message_arg", "error_message_stmt", "error_app_tag_arg",
847   "error_app_tag_stmt", "units_arg", "units_stmt", "default_arg",
848   "default_stmt", "grouping_arg_str", "grouping_stmt", "grouping_end",
849   "grouping_opt_stmt", "data_def_stmt", "container_arg_str",
850   "container_stmt", "container_end", "container_opt_stmt", "leaf_stmt",
851   "leaf_arg_str", "leaf_opt_stmt", "leaf_list_arg_str", "leaf_list_stmt",
852   "leaf_list_opt_stmt", "list_arg_str", "list_stmt", "list_opt_stmt",
853   "choice_arg_str", "choice_stmt", "choice_end", "choice_opt_stmt",
854   "short_case_case_stmt", "short_case_stmt", "case_arg_str", "case_stmt",
855   "case_end", "case_opt_stmt", "anyxml_arg_str", "anyxml_stmt",
856   "anydata_arg_str", "anydata_stmt", "anyxml_end", "anyxml_opt_stmt",
857   "uses_arg_str", "uses_stmt", "uses_end", "uses_opt_stmt",
858   "refine_args_str", "refine_arg_str", "refine_stmt", "refine_end",
859   "refine_body_opt_stmts", "uses_augment_arg_str", "uses_augment_arg",
860   "uses_augment_stmt", "augment_arg_str", "augment_arg", "augment_stmt",
861   "augment_opt_stmt", "action_arg_str", "action_stmt", "rpc_arg_str",
862   "rpc_stmt", "rpc_end", "rpc_opt_stmt", "input_arg", "input_stmt",
863   "input_output_opt_stmt", "output_arg", "output_stmt",
864   "notification_arg_str", "notification_stmt", "notification_end",
865   "notification_opt_stmt", "deviation_arg", "deviation_stmt",
866   "deviation_opt_stmt", "deviation_arg_str", "deviate_body_stmt",
867   "deviate_not_supported", "deviate_not_supported_stmt",
868   "deviate_not_supported_end", "deviate_stmts", "deviate_add",
869   "deviate_add_stmt", "deviate_add_end", "deviate_add_opt_stmt",
870   "deviate_delete", "deviate_delete_stmt", "deviate_delete_end",
871   "deviate_delete_opt_stmt", "deviate_replace", "deviate_replace_stmt",
872   "deviate_replace_end", "deviate_replace_opt_stmt", "when_arg_str",
873   "when_stmt", "when_end", "when_opt_stmt", "config_arg", "config_stmt",
874   "config_arg_str", "mandatory_arg", "mandatory_stmt", "mandatory_arg_str",
875   "presence_arg", "presence_stmt", "min_value_arg", "min_elements_stmt",
876   "min_value_arg_str", "max_value_arg", "max_elements_stmt",
877   "max_value_arg_str", "ordered_by_arg", "ordered_by_stmt",
878   "ordered_by_arg_str", "must_agr_str", "must_stmt", "must_end",
879   "unique_arg", "unique_stmt", "unique_arg_str", "key_arg", "key_stmt",
880   "key_arg_str", "$@3", "range_arg_str", "absolute_schema_nodeid",
881   "absolute_schema_nodeids", "absolute_schema_nodeid_opt",
882   "descendant_schema_nodeid", "$@4", "path_arg_str", "$@5", "$@6",
883   "absolute_path", "absolute_paths", "absolute_path_opt", "relative_path",
884   "relative_path_part1", "relative_path_part1_opt", "descendant_path",
885   "descendant_path_opt", "path_predicate", "path_equality_expr",
886   "path_key_expr", "rel_path_keyexpr", "rel_path_keyexpr_part1",
887   "rel_path_keyexpr_part1_opt", "rel_path_keyexpr_part2",
888   "current_function_invocation", "positive_integer_value",
889   "non_negative_integer_value", "integer_value", "integer_value_convert",
890   "prefix_arg_str", "identifier_arg_str", "node_identifier",
891   "identifier_ref_arg_str", "stmtend", "semicolom", "curly_bracket_close",
892   "curly_bracket_open", "stmtsep", "unknown_statement", "string_opt",
893   "string_opt_part1", "string_opt_part2", "unknown_string",
894   "unknown_string_part1", "unknown_string_part2", "unknown_statement_end",
895   "unknown_statement2_opt", "unknown_statement2", "unknown_statement2_end",
896   "unknown_statement2_yang_stmt", "unknown_statement2_module_stmt",
897   "unknown_statement3_opt", "unknown_statement3_opt_end", "sep_stmt",
898   "optsep", "sep", "whitespace_opt", "string", "$@7", "strings",
899   "identifier", "identifier1", "yang_stmt", "identifiers",
900   "identifiers_ref", "type_ext_alloc", "typedef_ext_alloc",
901   "iffeature_ext_alloc", "restriction_ext_alloc", "when_ext_alloc",
902   "revision_ext_alloc", "datadef_ext_check", "not_supported_ext_check",
903   "not_supported_ext", "datadef_ext_stmt", "restriction_ext_stmt",
904   "ext_substatements", YY_NULLPTR
905 };
906 #endif
907 
908 # ifdef YYPRINT
909 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
910    (internal) symbol number NUM (which must be that of a token).  */
911 static const yytype_int16 yytoknum[] =
912 {
913        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
914      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
915      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
916      285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
917      295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
918      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
919      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
920      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
921      335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
922      345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
923      355,   356,   357,    43,   123,   125,    59,    47,    91,    93,
924       61,    40,    41
925 };
926 # endif
927 
928 #define YYPACT_NINF (-1012)
929 
930 #define yypact_value_is_default(Yyn) \
931   ((Yyn) == YYPACT_NINF)
932 
933 #define YYTABLE_NINF (-757)
934 
935 #define yytable_value_is_error(Yyn) \
936   0
937 
938   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
939      STATE-NUM.  */
940 static const yytype_int16 yypact[] =
941 {
942      440,   100, -1012, -1012,   566,  1894, -1012, -1012, -1012,   266,
943      266, -1012,   266, -1012,   266,   266, -1012,   266,   266,   266,
944      266, -1012,   266,   266, -1012, -1012, -1012, -1012,   266, -1012,
945    -1012, -1012,   266,   266,   266,   266,   266,   266,   266,   266,
946      266,   266,   266,   266,   266,   266,   266,   266,   266,   266,
947    -1012, -1012,   266, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
948    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
949    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
950    -1012, -1012, -1012,    -8,    31,    79,   868,    70,   125,   481,
951      266, -1012, -1012,  3273,  3273,  3273,  2893,  3273,    71,  2703,
952     2703,  2703,  2703,  2703,    98,  2988,    94,    52,   287,  2703,
953       77,  2703,   104,   287,  3273,  2703,  2703,   182,    58,   246,
954     2988,  2703,   321,  2703,   279,   279,   266, -1012,   266, -1012,
955      266, -1012,   266,   266,   266,   266, -1012, -1012, -1012, -1012,
956    -1012,   266, -1012,   266, -1012,   266,   266,   266,   266,   266,
957    -1012,   266,   266,   266,   266, -1012,   266,   266,   266, -1012,
958    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
959       29, -1012,   134, -1012, -1012, -1012,   -22,  2798,   266, -1012,
960    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
961    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
962    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
963    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
964    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
965    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
966    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
967    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
968    -1012, -1012, -1012,   151, -1012, -1012, -1012, -1012, -1012,   156,
969    -1012,    67, -1012, -1012, -1012,   224, -1012, -1012, -1012,   161,
970    -1012, -1012, -1012, -1012,   224, -1012, -1012, -1012, -1012, -1012,
971    -1012, -1012, -1012,   224, -1012, -1012, -1012,   224, -1012,   224,
972    -1012,   224, -1012,   224, -1012, -1012, -1012,   224, -1012, -1012,
973    -1012, -1012,   224, -1012, -1012, -1012, -1012, -1012, -1012,   224,
974    -1012, -1012, -1012,   224, -1012, -1012, -1012, -1012,   224, -1012,
975    -1012, -1012,   224, -1012, -1012, -1012, -1012,   224, -1012,   224,
976    -1012, -1012,   224, -1012,   262,   202, -1012,   224, -1012, -1012,
977    -1012,   224, -1012, -1012,   224, -1012,   224, -1012, -1012, -1012,
978    -1012,   224, -1012, -1012, -1012,   224, -1012, -1012, -1012, -1012,
979    -1012,   224, -1012, -1012,   224, -1012, -1012, -1012,   224, -1012,
980    -1012, -1012, -1012, -1012,   224, -1012, -1012, -1012,   224, -1012,
981    -1012, -1012, -1012,  2893,   279,  3273,   279,  2703,   279,  2703,
982     2703,  2703, -1012,  2703,   279,  2703,   279,    58,   279,  3273,
983     3273,  3273,  3273,  3273,   266,  3273,  3273,  3273,  3273,   266,
984     2893,  3273,  3273, -1012, -1012,   279, -1012, -1012, -1012, -1012,
985    -1012, -1012,   266, -1012,   266, -1012, -1012, -1012, -1012, -1012,
986    -1012, -1012, -1012, -1012,   266,   266, -1012,   266,   266, -1012,
987    -1012, -1012, -1012, -1012, -1012, -1012, -1012,   266, -1012, -1012,
988      266,   266, -1012,   266, -1012,   266, -1012,   266, -1012,   266,
989      266, -1012, -1012, -1012,  3368, -1012, -1012,   291, -1012, -1012,
990    -1012,   266, -1012,   266, -1012, -1012,   266,   266, -1012, -1012,
991    -1012,   266,   266,   266, -1012, -1012,   266, -1012, -1012, -1012,
992      266, -1012,   228,  2703,   266,   274, -1012,   189, -1012,   288,
993    -1012,   298, -1012,   303, -1012,   370, -1012,   380, -1012,   389,
994    -1012,   393, -1012,   407, -1012,   411, -1012,   419, -1012,   426,
995    -1012,   463, -1012,   238, -1012,   314, -1012,   317, -1012,   505,
996    -1012,   506, -1012,   521, -1012,   407, -1012,   279,   279,   266,
997      266,   266,   266,   326,   279,   279,   109,   279,   112,   608,
998      266,   266, -1012,   262, -1012,  3083,   266,   332, -1012, -1012,
999    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1000    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1001    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1002    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1003    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1004    -1012, -1012, -1012, -1012, -1012, -1012,  1964,  1994,  2191,   347,
1005    -1012, -1012,    19, -1012,    54,   266,   355, -1012, -1012,   368,
1006      373, -1012, -1012, -1012,    48,  3368, -1012,   266,   831,   279,
1007      186,   279,   279,   279,   279,   279,   279,   279,   279,   279,
1008      279,   279,   279,   279,   279,   279,   279,   279, -1012, -1012,
1009    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1010    -1012, -1012, -1012,   266, -1012,   127,   515,   266, -1012, -1012,
1011    -1012,   515, -1012, -1012,   188, -1012,   279, -1012,   473, -1012,
1012      306, -1012,  2552,   266,   266,   397,  1000, -1012, -1012, -1012,
1013    -1012,   783, -1012,   230,   503,   404,   887,   359,   438,   929,
1014     1958,  1645,   817,   947,   344,  2074,  1547,  1768,   235,   852,
1015      279,   279,   279,   279,   266,   -22,   280, -1012,   266,   266,
1016    -1012, -1012,   375,  2703,   375,   279, -1012, -1012, -1012,   224,
1017    -1012, -1012,  3368, -1012, -1012, -1012, -1012, -1012,   266,   266,
1018    -1012,  3273,  2703, -1012, -1012, -1012,    -8, -1012, -1012, -1012,
1019    -1012, -1012, -1012,   279,   474, -1012, -1012, -1012, -1012, -1012,
1020    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1021    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1022    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1023    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1024    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1025    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1026    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1027    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1028    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1029    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1030    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1031    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1032    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1033    -1012, -1012,   266,   266, -1012, -1012, -1012, -1012, -1012, -1012,
1034    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1035    -1012, -1012, -1012, -1012,  3273,  3273,   279,   279, -1012, -1012,
1036    -1012, -1012, -1012,   125,   224, -1012, -1012,   266,   266, -1012,
1037      399,   473,   266,   528,   528,   545, -1012,   567, -1012,   279,
1038    -1012,   279,   279,   279,   480, -1012,   279,   279,   279,   279,
1039      279,   279,   279,   279,   279,   279,   279,   279,   279,   279,
1040      279,   279,   279,   279,   279,   279,   279,   279,   279,   279,
1041      279,   279,   279,   279,   279,   279,   279,   279,   279,   279,
1042      279,   279,   279,   279,   279,   279,   279,   279,   279,   279,
1043     2988,  2988,   279,   279,   279,   279,   279,   279,   279,   279,
1044      279,   266,   266,   423, -1012,   570, -1012,   428,  2046, -1012,
1045    -1012,   434, -1012,   465, -1012, -1012, -1012, -1012, -1012, -1012,
1046    -1012, -1012, -1012, -1012, -1012, -1012, -1012,   479, -1012, -1012,
1047    -1012,   571, -1012, -1012, -1012, -1012, -1012, -1012,   266,   266,
1048      266,   266,   266,   266, -1012, -1012, -1012, -1012, -1012, -1012,
1049    -1012, -1012, -1012, -1012, -1012,   279, -1012,   473,   266,   279,
1050      279,   279,   279, -1012,   266, -1012, -1012, -1012,   266,   279,
1051      279,   266,    51,  3273,    51,  3273,  3273,  3273,   279,   266,
1052      459,  2367,   385,   509,   279,   279,   341,   365, -1012, -1012,
1053      483, -1012, -1012,   574, -1012, -1012,   486, -1012, -1012,   591,
1054    -1012,   592, -1012,   521, -1012,   473, -1012,   473, -1012, -1012,
1055    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1056    -1012,   885,  1126, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1057    -1012, -1012, -1012,   332,   266, -1012, -1012, -1012, -1012,   266,
1058    -1012, -1012, -1012, -1012, -1012, -1012, -1012,   467,   492,   279,
1059      279, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1060    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1061    -1012, -1012,   279,   279,   279,   279,   279,   473,   473,   279,
1062      279,   279,   279,   279,   279,   279,   279,  1460,   205,   524,
1063      216,   201,   493,   579, -1012, -1012, -1012, -1012, -1012, -1012,
1064      266, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1065    -1012, -1012, -1012, -1012, -1012, -1012,   473, -1012, -1012,   279,
1066      293,   279,   279,   497,  3178, -1012, -1012, -1012, -1012, -1012,
1067    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,   473,
1068    -1012, -1012,   279,    73,   120,   133,   163, -1012,    50, -1012,
1069    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1070    -1012,   510,   222,   279,   279,   279,   473, -1012,   824,   346,
1071      985,  3368, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1072    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1073    -1012, -1012, -1012, -1012, -1012,   279,   279,   279
1074 };
1075 
1076   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
1077      Performed when YYTABLE does not specify something else to do.  Zero
1078      means the default is an error.  */
1079 static const yytype_int16 yydefact[] =
1080 {
1081      790,     0,     2,     3,     0,   757,     1,   649,   650,     0,
1082        0,   652,     0,   763,     0,     0,   761,     0,     0,     0,
1083        0,   762,     0,     0,   766,   764,   765,   767,     0,   768,
1084      769,   770,     0,     0,     0,     0,     0,     0,     0,     0,
1085        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1086      759,   760,     0,   771,   802,   806,   619,   792,   803,   797,
1087      793,   794,   619,   809,   796,   815,   814,   819,   804,   813,
1088      818,   799,   800,   795,   798,   810,   811,   805,   816,   817,
1089      812,   820,   801,     0,     0,     0,     0,     0,     0,     0,
1090      627,   758,   651,     0,     0,     0,     0,     0,     0,     0,
1091        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1092        0,     0,   571,     0,     0,     0,     0,     0,     0,     0,
1093        0,     0,     0,     0,   791,   822,     0,   619,     0,   619,
1094        0,   619,     0,     0,     0,     0,   789,   787,   788,   786,
1095      619,     0,   619,     0,   619,     0,     0,     0,     0,     0,
1096      651,     0,     0,     0,     0,   651,     0,     0,     0,   778,
1097      777,   780,   781,   782,   776,   775,   774,   773,   785,   772,
1098        0,   779,     0,   784,   783,   619,     0,   629,   653,   679,
1099        5,   669,   680,   681,   682,   683,   684,   685,   686,   687,
1100      688,   689,   690,   691,   692,   693,   694,   695,   696,   697,
1101      698,   699,   700,   701,   702,   703,   704,   705,   706,   707,
1102      708,   709,   710,   711,   712,   713,   666,   714,   715,   716,
1103      717,   718,   719,   720,   721,   722,   723,   724,   725,   726,
1104      727,   728,   729,   730,   731,   732,   733,   734,   735,   736,
1105      737,   738,   739,   740,   741,   742,   743,   670,   744,   671,
1106      672,   673,   674,   745,   675,   676,   677,   678,   746,   747,
1107      748,   651,   608,     0,    10,   749,   667,   668,   651,     0,
1108       17,     0,    99,   750,   613,     0,   138,   651,   651,     0,
1109       47,   651,   651,   529,     0,   525,   659,   662,   660,   664,
1110      665,   663,   658,     0,    58,   656,   661,     0,   243,     0,
1111       60,     0,   239,     0,   237,   598,   170,     0,   167,   651,
1112      610,   563,     0,   559,   561,   609,   651,   651,   534,     0,
1113      530,   651,   545,     0,   541,   651,   599,   540,     0,   537,
1114      600,   651,     0,    25,   651,   651,   550,     0,   546,     0,
1115       56,   575,     0,   213,     0,     0,   236,     0,   233,   651,
1116      605,     0,    49,   651,     0,   535,     0,    62,   651,   651,
1117      219,     0,   215,    74,    76,     0,    45,   651,   651,   651,
1118      114,     0,   109,   558,     0,   555,   651,   569,     0,   241,
1119      603,   604,   601,   209,     0,   206,   651,   602,     0,   191,
1120      621,   620,   651,     0,   807,     0,   808,     0,   821,     0,
1121        0,     0,   180,     0,   823,     0,   824,     0,   825,     0,
1122        0,     0,     0,     0,   445,     0,     0,     0,     0,   452,
1123        0,     0,     0,   619,   619,   826,   651,   651,   827,   651,
1124      628,   651,     7,   619,   607,   619,   619,   101,   100,   618,
1125      616,   139,   619,   619,   611,   612,   619,   528,   527,   526,
1126       59,   651,   244,    61,   240,   238,   168,   169,   560,   651,
1127      533,   532,   531,   543,   542,   544,   538,   539,    26,   549,
1128      548,   547,    57,   214,     0,   578,   572,     0,   574,   582,
1129      234,   235,    50,   606,   536,    63,   218,   217,   216,   651,
1130       46,   111,   113,   112,   110,   556,   557,   567,   242,   207,
1131      208,   192,     0,   625,   624,     0,   150,     0,   140,     0,
1132      124,     0,   172,     0,   551,     0,   182,     0,   564,     0,
1133      518,     0,    65,     0,   368,     0,   357,     0,   334,     0,
1134      266,     0,   245,     0,   285,     0,   298,     0,   314,     0,
1135      454,     0,   383,     0,   430,     0,   370,   447,   447,   645,
1136      647,   632,   630,     6,    13,    20,   104,   614,     0,     0,
1137      657,   562,   587,   577,   581,     0,    75,   570,   651,   634,
1138      622,   623,   626,   619,   151,   149,   619,   619,   126,   125,
1139      619,   173,   171,   619,   553,   552,   619,   183,   181,   619,
1140      211,   210,   619,   520,   519,   619,    69,    68,   619,   372,
1141      369,   619,   359,   358,   619,   336,   335,   619,   268,   267,
1142      619,   247,   246,   619,   619,   619,   619,   456,   455,   619,
1143      385,   384,   619,   434,   431,   371,     0,     0,     0,   631,
1144      651,    27,    12,    27,    19,     0,     0,   617,   619,     0,
1145      576,   579,   583,   580,   585,     0,   568,   636,   156,   142,
1146        0,   175,   175,   185,   175,   522,    71,   374,   361,   338,
1147      270,   249,   286,   300,   316,   458,   387,   436,   446,   619,
1148      619,   619,   258,   259,   260,   261,   262,   263,   264,   265,
1149      619,   453,   651,   627,   651,     0,    51,     0,    14,    15,
1150       16,    51,    21,   619,     0,   102,   615,    48,   654,   584,
1151        0,   565,     0,     0,     0,     0,   153,   154,   619,   155,
1152      221,     0,   127,     0,     0,     0,     0,     0,     0,     0,
1153        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1154      449,   450,   451,   448,   648,     0,     0,     8,     0,     0,
1155      619,   619,    66,     0,    66,    22,   651,   651,   108,     0,
1156      103,   655,     0,   586,   644,   635,   638,   651,   627,   627,
1157      643,     0,     0,   152,   159,   619,     0,   162,   619,   619,
1158      619,   158,   157,   194,   220,   141,   147,   148,   146,   619,
1159      144,   145,   174,   178,   179,   176,   177,   554,   184,   189,
1160      190,   186,   187,   188,   212,   521,   523,   524,    70,    72,
1161       73,   373,   381,   382,   380,   619,   619,   378,   379,   619,
1162      360,   365,   366,   364,   619,   619,   619,   337,   345,   346,
1163      344,   619,   341,   350,   351,   352,   353,   356,   619,   348,
1164      349,   354,   355,   619,   342,   343,   269,   277,   278,   276,
1165      619,   619,   619,   619,   619,   619,   619,   275,   274,   619,
1166      248,   251,   252,   250,   619,   619,   619,   619,   619,   284,
1167      296,   297,   295,   619,   619,   290,   292,   619,   293,   294,
1168      619,   299,   312,   313,   311,   619,   619,   305,   304,   619,
1169      307,   308,   309,   310,   619,   315,   327,   328,   326,   619,
1170      619,   619,   619,   619,   619,   619,   322,   323,   324,   325,
1171      619,   321,   320,   457,   462,   463,   461,   619,   619,   619,
1172      619,   619,     0,     0,   386,   391,   392,   390,   619,   619,
1173      619,   619,   435,   439,   440,   438,   619,   619,   619,   619,
1174      619,   646,   651,   651,     0,     0,    28,    29,    52,    53,
1175       54,    55,    78,    64,     0,    23,    78,   107,   106,   105,
1176        0,   654,   637,     0,     0,     0,   224,     0,   197,   164,
1177      165,   160,   161,   163,   193,   222,   143,   376,   375,   377,
1178      363,   367,   362,   340,   347,   339,   272,   282,   279,   283,
1179      280,   281,   271,   273,   254,   253,   255,   256,   257,   288,
1180      289,   287,   291,   302,   303,   301,   306,   318,   329,   330,
1181      333,   331,   332,   317,   319,   460,   464,   465,   466,   459,
1182        0,     0,   389,   393,   394,   388,   437,   441,   442,   443,
1183      444,   633,     9,     0,    31,     0,    37,     0,    77,   619,
1184       24,     0,   588,     0,   651,   641,   639,   640,   619,   225,
1185      619,   619,   198,   196,   619,   413,   414,     0,   651,   396,
1186      397,     0,   651,   619,   619,    39,    38,   651,     0,     0,
1187        0,     0,     0,     0,   619,    80,    81,    82,    83,    84,
1188       85,    86,    87,    88,    89,    67,   651,   654,   645,   227,
1189      223,   200,   195,   619,   412,   619,   399,   398,   395,    32,
1190       41,    11,     0,     0,     0,     0,     0,     0,    79,    18,
1191        0,     0,     0,     0,   420,   401,     0,     0,   417,   418,
1192        0,   567,   651,     0,    90,   474,     0,   467,   651,     0,
1193      115,     0,   128,     0,   432,   654,   589,   654,   642,   226,
1194      231,   232,   230,   619,   229,   199,   204,   205,   203,   619,
1195      202,     0,     0,    30,    36,    33,    34,    35,    40,    44,
1196       42,    43,   619,   566,   416,   619,    92,    91,   619,   473,
1197      619,   117,   116,   619,   130,   129,   433,     0,     0,   228,
1198      201,   415,   424,   425,   423,   619,   619,   619,   619,   619,
1199      619,   400,   410,   411,   619,   405,   406,   407,   404,   408,
1200      409,   619,   420,    94,   469,   119,   132,   654,   654,   422,
1201      426,   429,   427,   428,   421,   403,   402,     0,     0,     0,
1202        0,     0,     0,     0,   419,    93,    97,    98,   619,    96,
1203        0,   468,   470,   471,   118,   122,   123,   121,   619,   131,
1204      136,   137,   135,   619,   133,   597,   654,   590,   593,    95,
1205        0,   120,   134,     0,     0,   484,   497,   477,   506,   619,
1206      651,   475,   476,   651,   481,   651,   483,   651,   482,   654,
1207      594,   595,   472,     0,     0,     0,     0,   592,   591,   619,
1208      479,   478,   619,   486,   485,   619,   499,   498,   619,   508,
1209      507,     0,     0,   488,   501,   510,   654,   480,     0,     0,
1210        0,     0,   487,   489,   492,   493,   494,   495,   496,   619,
1211      491,   500,   502,   505,   619,   504,   509,   619,   512,   513,
1212      514,   515,   516,   517,   596,   490,   503,   511
1213 };
1214 
1215   /* YYPGOTO[NTERM-NUM].  */
1216 static const yytype_int16 yypgoto[] =
1217 {
1218    -1012, -1012, -1012,   245, -1012, -1012, -1012, -1012, -1012, -1012,
1219    -1012, -1012, -1012, -1012, -1012,   -16, -1012,    -2,    -9, -1012,
1220    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1011, -1012,    22,
1221    -1012,  -534,   -24, -1012,   658, -1012,   681, -1012,    63, -1012,
1222      105,   -41, -1012, -1012,  -237, -1012, -1012,   305, -1012,  -225,
1223    -1012, -1012, -1012, -1012, -1012, -1012, -1012,  -486, -1012, -1012,
1224    -1012, -1012, -1012,    41, -1012, -1012, -1012, -1012, -1012, -1012,
1225      -11, -1012, -1012, -1012, -1012, -1012, -1012,  -657, -1012,    -3,
1226    -1012,  -653, -1012, -1012, -1012, -1012, -1012, -1012, -1012,    23,
1227    -1012,    30, -1012, -1012,    53, -1012,    35, -1012, -1012, -1012,
1228    -1012,    10, -1012, -1012,  -236, -1012, -1012, -1012, -1012,  -366,
1229    -1012,    38, -1012, -1012,    40, -1012,    43, -1012, -1012, -1012,
1230      -21, -1012, -1012, -1012, -1012,  -355, -1012, -1012,    12, -1012,
1231       18, -1012,  -704, -1012,  -480, -1012,    16, -1012, -1012,  -560,
1232    -1012,   -80, -1012, -1012,   -67, -1012, -1012, -1012,   -63, -1012,
1233    -1012,   -39, -1012, -1012,   -36, -1012, -1012, -1012, -1012, -1012,
1234      -33, -1012, -1012, -1012,   -28, -1012,   -27,   206, -1012, -1012,
1235      667, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1236    -1012, -1012, -1012, -1012,  -435, -1012,   -62, -1012, -1012,  -365,
1237    -1012, -1012,    42,   211, -1012,    44, -1012,   -87, -1012, -1012,
1238    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1239    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012,
1240    -1012, -1012,    74, -1012, -1012, -1012,  -473, -1012, -1012,  -667,
1241    -1012, -1012,  -675, -1012,  -722, -1012, -1012,  -662, -1012, -1012,
1242     -271, -1012, -1012,   -35, -1012, -1012,  -725, -1012, -1012,    46,
1243    -1012, -1012, -1012,  -390,  -319,  -335,  -461, -1012, -1012, -1012,
1244    -1012,   214,    97, -1012, -1012,   239, -1012, -1012, -1012,   135,
1245    -1012, -1012, -1012,  -441, -1012, -1012, -1012,   155,   693, -1012,
1246    -1012, -1012,   185,   -93,  -328,  1164, -1012, -1012, -1012,   526,
1247      110, -1012, -1012, -1012,  -433, -1012, -1012, -1012, -1012, -1012,
1248     -143, -1012, -1012,  -260,    84,    -4,  1453,   166,  -694,   119,
1249    -1012,   660,   -12, -1012,   137,   -20,   -23, -1012, -1012, -1012,
1250    -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012, -1012
1251 };
1252 
1253   /* YYDEFGOTO[NTERM-NUM].  */
1254 static const yytype_int16 yydefgoto[] =
1255 {
1256       -1,     1,   261,   262,   553,   933,   263,     2,   631,   632,
1257      269,     3,   633,   634,   944,   688,   332,    54,   686,   740,
1258     1023,  1106,  1025,   741,  1056,  1107,   365,    55,   279,    56,
1259      351,    57,   742,   339,   938,   293,   939,   299,   783,   356,
1260      784,   942,   521,   943,   144,   597,   718,   366,   489,  1027,
1261     1028,  1064,  1113,  1065,  1157,  1208,   271,    62,   438,   749,
1262      636,   750,   371,  1174,   372,  1119,  1066,  1162,  1210,   509,
1263     1175,   579,  1121,  1067,  1165,  1211,   275,    64,   507,   669,
1264      711,   127,   505,   575,   705,   706,   765,   766,   307,    65,
1265      308,   136,   511,   582,   713,   401,   137,   515,   588,   715,
1266      388,    66,   707,   964,   708,   957,  1043,  1103,   384,    67,
1267      385,   138,   591,   342,    68,   361,    69,   362,   709,   774,
1268      710,   955,  1040,  1102,   347,    70,   348,   303,   785,   301,
1269      786,   378,    73,   297,    74,   531,   670,   612,   723,   671,
1270      529,   672,   609,   722,   673,   533,   724,   535,   674,   725,
1271      537,   675,   726,   527,   676,   606,   721,   828,   829,   525,
1272     1177,   603,   720,   523,   677,   545,   678,   600,   719,   541,
1273      679,   621,   728,  1050,  1051,   919,  1087,  1142,  1046,  1047,
1274      920,  1109,  1110,  1071,  1141,   543,  1178,  1123,  1072,   624,
1275      729,   170,   171,   626,   172,   173,   539,  1179,   618,   727,
1276     1116,  1074,  1209,  1117,  1249,  1250,  1251,  1271,  1252,  1253,
1277     1254,  1274,  1288,  1255,  1256,  1277,  1289,  1257,  1258,  1280,
1278     1290,   519,  1180,   594,   717,   284,    75,   285,   319,    76,
1279      320,   354,    77,   328,    78,   329,   323,    79,   324,   337,
1280       80,   338,   513,   680,   585,   374,    81,   375,   312,    82,
1281      313,   459,   517,   646,  1112,   567,   376,   497,   343,   344,
1282      345,   475,   476,   563,   478,   479,   565,   643,   699,   640,
1283      950,  1126,  1237,  1238,  1244,  1268,  1127,   330,   331,   386,
1284      387,   352,   264,   377,   276,   441,   442,   638,   443,   124,
1285      390,   502,   503,   571,   176,   430,   629,   570,   702,   757,
1286     1036,   758,   759,   628,   428,   391,     4,   177,   752,   294,
1287      451,   295,   265,   266,   267,   268,   392,    83,    84,    85,
1288       86,    87,    88,    89,    90,    91,   175,   140,     5
1289 };
1290 
1291   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
1292      positive, shift that token.  If negative, reduce the rule whose
1293      number is the opposite.  If YYTABLE_NINF, syntax error.  */
1294 static const yytype_int16 yytable[] =
1295 {
1296       11,   901,   174,   881,   897,    92,    92,   780,    92,   160,
1297       92,    92,   314,    92,    92,    92,    92,    71,    92,    92,
1298      865,   877,   161,    72,    92,   639,   162,   169,    92,    92,
1299       92,    92,    92,    92,    92,    92,    92,    92,    92,    92,
1300       92,    92,    92,    92,    92,    92,    63,   848,    92,   764,
1301      163,   139,   808,   164,   835,   751,   165,   869,   779,   180,
1302      180,   166,   167,   882,   898,   506,   180,   126,    60,   305,
1303      363,   864,   876,   278,   131,    36,   277,    15,     7,   180,
1304        8,   129,   426,    41,   427,   180,    92,   296,   296,   296,
1305      296,   296,   542,   315,   353,  1144,  1149,   296,   690,   296,
1306        6,   687,   180,   296,   296,   159,   180,   128,   315,   296,
1307       61,   296,   180,   960,     7,   305,     8,     7,  -573,     8,
1308      273,   130,    92,   273,    92,     7,    92,     8,    92,    92,
1309       92,    92,     7,   423,     8,   737,   687,    92,     7,    92,
1310        8,    92,    92,    92,    92,    92,   321,    92,    92,    92,
1311       92,   141,    92,    92,    92,  -587,  -587,  -654,   645,   281,
1312      815,   142,   843,   856,   282,   296,   892,   910,     7,   334,
1313        8,   436,   335,   437,    11,    93,    94,  1269,    95,  1270,
1314       96,    97,   316,    98,    99,   100,   101,   317,   102,   103,
1315      180,     7,   635,     8,   104,   143,   180,   273,   105,   106,
1316      107,   108,   109,   110,   111,   112,   113,   114,   115,   116,
1317      117,   118,   119,   120,   121,   122,   477,   637,   123,   298,
1318      300,   302,   304,    14,  1272,    12,  1273,     7,   333,     8,
1319      340,   781,    20,   273,   355,   357,    20,  1275,   424,  1276,
1320      379,   822,   389,   130,   866,   878,   807,    20,   834,   847,
1321      735,   868,   880,   896,   180,   433,   912,  1033,   130,   309,
1322      435,    20,   325,    22,    23,   446,    20,  1278,    43,  1279,
1323      358,     7,    43,     8,    46,   359,   746,   130,    46,   270,
1324      272,   747,   280,    43,     7,     7,     8,     8,   932,    46,
1325      273,   712,   393,   576,   395,   180,   397,    43,   399,   400,
1326      402,   403,    43,   913,   305,   326,  1229,   405,    46,   407,
1327     1215,   409,   410,   411,   412,   413,   141,   415,   416,   417,
1328      418,  1224,   420,   421,   422,   953,   954,  1287,   439,   180,
1329      440,   367,   568,   368,   569,   782,   369,   380,   381,   382,
1330      914,   274,   613,   283,   292,   292,   292,   292,   292,   306,
1331      311,   318,   322,   327,   292,   336,   292,   341,   346,   350,
1332      292,   292,   360,   364,   370,   373,   292,   383,   292,   474,
1333      278,    17,    20,   277,    19,    20,    19,  1245,   573,  1246,
1334      574,   562,  1247,  1100,  1248,   296,   130,   296,   296,   296,
1335       20,   296,   577,   296,   578,    33,    20,   278,   564,   133,
1336      277,   133,   580,    18,   581,    41,    20,   583,    43,   584,
1337       11,    43,    45,   474,   698,    11,    20,    46,   614,   126,
1338     1189,   615,    48,    47,    48,   141,    43,   130,    11,   630,
1339       11,  1167,    43,  1168,    38,    20,    45,    22,    23,   645,
1340       11,    11,    43,    11,    11,  -651,  1143,  -651,    40,   859,
1341      684,  1301,    43,    11,   883,   899,    11,    11,    46,    11,
1342      695,    11,   315,    11,   795,    11,    11,  1188,  1070,    20,
1343     1148,    43,   644,   697,   586,  1187,   587,    11,   751,    11,
1344     1190,   698,    11,    11,   589,   145,   590,    11,    11,    11,
1345     1129,   296,    11,   592,  -651,   593,    11,   595,   703,   596,
1346       11,    52,   763,  1212,  1213,    43,   146,   147,  1032,   788,
1347      148,   598,   704,   599,  -651,   601,   510,   602,   512,   514,
1348      516,   149,   518,   604,   520,   605,   150,  1053,   151,   152,
1349      607,   153,   608,  1057,    20,   683,    22,    23,   154,  1076,
1350       20,   155,  1243,   798,  1125,    11,    11,    11,    11,  1048,
1351     1052,   130,   701,   315,  1234,    20,    11,    11,   738,   739,
1352      156,  1220,    11,  1300,  1305,  1267,  1297,   610,  1312,   611,
1353       43,     7,  1145,     8,  1281,  1077,    43,   157,  1197,   158,
1354      508,  1176,    46,  1083,  1293,  1302,  1308,  1152,   125,    49,
1355     1158,    43,  1291,  1236,   524,   526,   528,   530,   532,  1198,
1356      534,   536,   538,   540,  1259,  1235,   544,   546,   787,   616,
1357      619,   617,   620,     7,  1135,     8,   315,  1286,   692,   273,
1358        9,  1296,   572,  1311,   691,   622,  1298,   623,  1313,  1221,
1359      689,    92,  1034,   315,  1035,   845,   858,  1307,   274,   894,
1360       10,   823,   292,    11,   292,   292,   292,  1176,   292,  1038,
1361      292,  1039,   364,   394,   824,   396,   693,   398,   825,   951,
1362      844,   857,  1185,    58,   893,   274,   404,   744,   406,  1186,
1363      408,  1041,    41,  1042,  1054,  1085,  1055,  1086,  1155,    92,
1364     1156,    11,   826,    92,   809,   827,    59,   849,   830,   870,
1365      884,   900,   911,   831,   832,  1160,  1163,  1161,  1164,    92,
1366       92,   425,  1111,   946,  1111,   714,  1029,   716,   805,   814,
1367      821,   840,   522,   863,   875,   889,   907,   918,   926,   841,
1368      854,  1031,  1218,   890,   908,   791,   927,   792,  1044,   767,
1369       11,   296,    11,   793,    92,    92,   768,  1140,   842,   855,
1370      315,   769,   891,   909,   770,   928,   771,  1134,   292,   772,
1371      296,   625,   778,   965,    92,    92,   168,  1207,  1166,   627,
1372      804,   813,   820,   839,   853,   862,   874,   888,   906,   917,
1373      925,   929,   902,   930,   776,  1118,  1153,   641,   789,   700,
1374      796,   799,   802,   811,   818,   837,   851,   860,   872,   886,
1375      904,   915,   923,   806,   816,   833,   846,   753,   867,   879,
1376      895,   694,   921,  1260,   642,   940,   349,   940,  1294,  1303,
1377     1309,  1037,   756,    19,    20,  1295,   777,  1310,  1101,   931,
1378      790,   145,   797,   800,   803,   812,   819,   838,   852,   861,
1379      873,   887,   905,   916,   924,     0,     7,   431,     8,   760,
1380        0,     0,   273,   147,    17,     0,   148,   941,    20,   941,
1381       43,    17,     0,   743,    19,   703,    46,   149,   126,   130,
1382        0,    48,   945,   704,   151,   152,     0,   153,     0,   761,
1383      762,     0,   133,     0,   154,    33,    34,    35,     0,   133,
1384        0,   958,    42,    20,    43,     0,     0,     0,   775,   145,
1385       46,     0,   149,   128,   130,     0,   156,   150,   141,     0,
1386        0,    47,    48,     0,   934,   935,     0,     0,    92,    92,
1387      146,   147,   155,   157,   148,   158,    20,   132,    20,    43,
1388       22,    23,   836,   133,     0,    46,     0,   130,   128,  1292,
1389      134,     0,   151,   152,   135,   153,     0,     0,     0,   748,
1390        0,  1073,   154,    11,    11,     0,   956,     0,    11,   547,
1391      548,   145,    43,     0,    43,     0,    17,   922,    46,   554,
1392       20,   555,   556,     0,   156,     0,   141,     0,   557,   558,
1393        0,   130,   559,   147,     0,     0,   148,     0,    20,     0,
1394       33,   157,     0,   158,   133,     0,     0,   149,   292,     0,
1395     1171,     0,   794,     0,   151,   152,    43,   153,   315,   315,
1396        0,     0,    46,     0,   154,     0,     0,   292,   683,     0,
1397      141,     0,    17,     0,    43,    19,     0,    11,    11,     0,
1398       46,     0,    14,   128,     0,  1068,   156,     0,     0,     0,
1399        0,     0,     0,     0,   801,     0,    33,    34,    35,    28,
1400        0,     0,     0,   157,  1069,   158,     0,     0,     0,   132,
1401        0,     0,   850,     0,    92,    92,    92,    92,    92,    92,
1402      126,    39,   134,    48,     0,     0,   135,     0,     0,    44,
1403        0,     0,     0,     0,    11,  -166,     0,     0,  1010,  1011,
1404       11,     0,     0,     0,    11,     0,     0,    11,     0,   315,
1405     1306,  1133,  1139,     0,     0,    11,     0,     0,     0,   648,
1406        0,     0,   649,   650,     0,     0,   651,  1191,     0,   652,
1407        0,     0,   653,     0,     0,   654,     0,     0,   655,  1024,
1408     1026,   656,     0,     0,   657,     0,     0,   658,     0,     0,
1409      659,  1184,     0,   660,     0,     0,   661,     0,     0,   662,
1410      663,   664,   665,  1132,  1138,   666,     0,     0,   667,     0,
1411       11,  1261,     0,    17,     0,    11,    19,    20,     0,     0,
1412        0,     0,     0,     0,   696,  1130,  1136,     0,   130,  1146,
1413     1150,     0,     0,     0,     0,     0,     0,    33,    34,    35,
1414        0,   133,     0,     0,     0,     0,     0,     0,     0,     0,
1415        0,    42,     0,    43,     0,   730,   731,   732,  1314,  1228,
1416     1233,     0,     0,     0,  1172,  1182,   733,  1131,  1137,     0,
1417        0,  1147,  1151,     0,     0,     0,    92,     0,     0,   745,
1418        0,     0,     0,     0,  1092,  1093,  1094,  1095,  1096,  1097,
1419        0,  1181,   315,     0,   773,     0,     0,     0,     0,     0,
1420        0,     0,     0,     0,     0,     0,  1173,  1183,     0,  1219,
1421        0,  1227,  1232,  1299,  1304,  1045,  1049,     0,     0,    11,
1422       11,    11,    11,     0,     0,     0,   936,   937,     0,     0,
1423     1172,  1216,  1222,  1225,  1230,     0,     0,     0,  1114,   315,
1424     1120,  1122,  1124,     0,     0,     0,     0,     0,     0,     0,
1425        0,   959,     0,     0,   961,   962,   963,     0,     0,     0,
1426        0,     0,     0,     0,     0,   966,     0,     0,     0,     0,
1427        0,     0,  1173,  1217,  1223,  1226,  1231,     0,     0,     0,
1428        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1429        0,   967,   968,     0,     0,   969,     0,  1108,     0,  1115,
1430      970,   971,   972,     0,     0,     0,     0,   973,     0,     0,
1431        0,     0,     0,     0,   974,     0,     0,     0,     0,   975,
1432        0,     0,     0,     0,     0,     0,   976,   977,   978,   979,
1433      980,   981,   982,     0,     0,   983,     0,     0,     0,     0,
1434      984,   985,   986,   987,   988,     0,  1240,     0,     0,   989,
1435      990,     0,     0,   991,     0,     0,   992,     0,     0,     0,
1436        0,   993,   994,     0,     0,   995,     0,     0,     0,     0,
1437      996,     0,     0,     0,     0,   997,   998,   999,  1000,  1001,
1438     1002,  1003,     0,     0,     0,     0,  1004,     0,     0,     0,
1439        0,     0,     0,  1005,  1006,  1007,  1008,  1009,     0,     0,
1440        0,     0,     0,     0,  1012,  1013,  1014,  1015,   449,     0,
1441        0,     0,  1016,  1017,  1018,  1019,  1020,   450,     0,     0,
1442        0,   452,     0,   453,   145,   454,     0,   455,     0,     0,
1443        0,   456,     0,     0,     0,     0,   458,     0,     0,     0,
1444        0,     0,     0,   462,     0,   146,   147,   464,     0,   148,
1445        0,    20,   466,     0,     0,     0,   468,     0,     0,     0,
1446        0,   471,   130,   472,     0,     0,   473,   151,   152,     0,
1447      153,   480,     0,     0,     0,   482,     0,   154,   484,     0,
1448      485,     0,     0,     0,     0,   488,     0,    43,     0,   490,
1449        0,     0,     0,    46,     0,   494,     0,     0,   495,   156,
1450        0,   141,   498,     0,     0,   178,     0,     0,   499,     0,
1451        0,   145,   501,     0,     0,  1075,   157,     0,   158,     0,
1452        0,     0,     0,     0,  1079,  1214,  1080,  1081,     0,     0,
1453     1082,     0,     0,   147,    17,     0,   148,     0,    20,  1089,
1454     1090,     0,     0,     0,     0,     0,     0,   149,     0,   130,
1455     1098,     0,     0,    32,   151,   152,     0,   153,     0,    34,
1456       35,     0,   133,   414,   154,    37,     0,     0,   419,  1104,
1457        0,  1105,     0,     0,    43,     0,     0,     0,     0,     0,
1458       46,     0,     0,   128,    47,     0,   156,     0,   141,     0,
1459        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1460        0,     0,     0,   157,     0,   158,     0,     0,     0,   145,
1461        0,     0,   885,     0,     0,     0,     0,     0,     0,  1169,
1462        0,     0,     0,     0,     0,  1170,     0,     0,     0,     0,
1463      146,   147,    17,     0,   148,    19,    20,     0,  1192,     0,
1464        0,  1193,     0,     0,  1194,     0,  1195,   130,     0,  1196,
1465        0,     0,   151,   152,     0,   153,    33,     0,     0,     0,
1466        0,  1199,  1200,  1201,  1202,  1203,  1204,     0,     0,     0,
1467     1205,     0,    43,     0,   432,     0,     0,  1206,    46,     0,
1468        0,   434,     0,     0,     0,     0,   141,     0,     0,     0,
1469      444,   445,     0,     0,   447,   448,     0,     0,     0,     0,
1470        0,     0,     0,   158,  1239,     0,     0,     0,     0,     0,
1471      817,     0,     0,     0,  1241,     0,     0,     0,     0,  1242,
1472        0,     0,   457,     0,     0,     0,     0,     0,     0,   460,
1473      461,     0,   145,     0,   463,  1262,     0,     0,   465,     0,
1474        0,     0,     0,     0,   467,     0,     0,   469,   470,     0,
1475        0,     0,     0,     0,   147,  1282,     0,   148,  1283,    20,
1476        0,  1284,   481,     0,  1285,     0,   483,     0,   149,     0,
1477      130,   486,   487,     0,     0,   151,   152,     0,   153,     0,
1478      491,   492,   493,   133,     0,  1315,     0,     0,     0,   496,
1479     1316,     0,     0,  1317,     0,    43,     0,     0,     0,   500,
1480        0,    46,     0,     0,   128,   504,     0,   156,     0,     0,
1481        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1482        0,     0,     0,     0,     0,     0,   158,     0,     0,     0,
1483        0,     0,     0,   903,     0,     0,     0,     0,     0,   549,
1484      550,     0,   551,     0,   552,     0,     0,     0,     0,     0,
1485        0,     0,     0,     0,    -4,     0,     0,     0,     0,     0,
1486        0,     0,     0,     0,   560,     0,     0,     0,     0,     0,
1487        0,     0,   561,   949,    12,    13,    14,    15,    16,     0,
1488        0,    17,    18,     0,    19,    20,    21,    22,    23,    24,
1489       25,    26,    27,    28,     0,    29,  -753,    30,    31,     0,
1490       32,     0,   566,  -754,     0,    33,    34,    35,     0,  -754,
1491       36,     0,    37,    38,     0,    39,  -754,    40,    41,    42,
1492     -754,    43,   145,    44,  -756,    45,     0,    46,   145,  -751,
1493     -752,    47,    48,     0,    49,  -755,    50,    51,     0,     0,
1494        0,     0,     0,     0,   147,     0,     0,   148,     0,    20,
1495      147,    52,     0,   148,     0,     0,    53,     0,   145,     0,
1496      130,     0,     0,     0,   149,   151,   152,     0,   153,     0,
1497        0,   151,   152,     0,   153,     0,     0,     0,     0,   133,
1498      147,   647,     0,   148,     0,    43,     0,     0,     0,     0,
1499        0,    46,     0,     0,   149,     0,     0,   156,     0,   141,
1500      128,   151,   152,   156,   153,     0,     0,     0,     0,   133,
1501      145,     0,     0,     0,     0,     0,   158,     0,     0,     0,
1502        0,     0,   158,   810,     0,     0,     0,  1058,     0,   668,
1503      128,     0,   147,   156,     0,   148,     0,     0,     0,     0,
1504        0,  1059,  1060,   685,  1061,     0,   149,  1062,     0,     0,
1505        0,     0,   158,   151,   152,     0,   153,     0,     0,   681,
1506        0,    17,     0,   154,    19,    20,     0,     0,  1030,     0,
1507        0,     0,     0,     0,     0,     0,   130,     0,  1063,     0,
1508        0,     0,   128,     0,     0,   156,    34,    35,     0,   133,
1509        0,     0,    37,     0,     0,   734,     0,   736,     0,     0,
1510        0,    43,     0,     0,   158,     0,     0,    46,     0,   126,
1511        0,     0,    48,     0,     0,   141,     0,     0,     0,     0,
1512        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1513        0,     0,     0,     0,     0,     0,     0,     0,     0,   871,
1514        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1515        0,     0,     0,     0,     0,   179,     0,     0,     0,   947,
1516      948,   181,   310,     0,     0,     0,     0,     0,     0,     0,
1517      952,   182,   183,   184,   185,   186,   187,   188,   189,   190,
1518      191,   192,   193,   194,   195,   196,   197,   198,   199,   200,
1519      201,   202,   203,   204,   205,   206,   207,   208,   209,   210,
1520      211,   212,   213,   214,   215,   216,   217,   218,   219,   220,
1521      221,   222,   223,   224,   225,   226,   227,   228,   229,   230,
1522      231,   232,   233,   234,   235,   236,   237,   238,   239,   240,
1523      241,   242,   243,   244,   245,   246,   247,   248,   249,   250,
1524      251,   252,   253,   254,   255,   256,   257,   258,   259,   260,
1525        0,     0,     0,     0,     0,     0,   682,     0,     0,     0,
1526        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1527        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1528        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1529        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1530        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1531        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1532        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1533        0,   179,     0,     0,     0,     0,     0,   181,   310,     0,
1534        0,     0,     0,     0,     0,  1021,  1022,   182,   183,   184,
1535      185,   186,   187,   188,   189,   190,   191,   192,   193,   194,
1536      195,   196,   197,   198,   199,   200,   201,   202,   203,   204,
1537      205,   206,   207,   208,   209,   210,   211,   212,   213,   214,
1538      215,   216,   217,   218,   219,   220,   221,   222,   223,   224,
1539      225,   226,   227,   228,   229,   230,   231,   232,   233,   234,
1540      235,   236,   237,   238,   239,   240,   241,   242,   243,   244,
1541      245,   246,   247,   248,   249,   250,   251,   252,   253,   254,
1542      255,   256,   257,   258,   259,   260,     0,     0,     0,     0,
1543        0,     0,  1128,     0,     0,     0,     0,     0,     0,     0,
1544        0,     0,     0,     0,     0,     0,     0,  1078,     0,     0,
1545        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1546        0,  1084,     0,     0,     0,  1088,     0,     0,     0,     0,
1547     1091,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1548        0,     0,     0,     0,     0,     0,     0,     0,     0,  1099,
1549        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1550        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1551        0,     0,     0,     0,     0,     0,   179,     0,     0,     0,
1552        0,     0,     0,   273,     0,  1154,     0,     0,     0,     0,
1553        0,  1159,   182,   183,   184,   185,   186,   187,   188,   189,
1554      190,   191,   192,   193,   194,   195,   196,   197,   198,   199,
1555      200,   201,   202,   203,   204,   205,   206,   207,   208,   209,
1556      210,   211,   212,   213,   214,   215,   754,   217,   218,   219,
1557      220,   221,   222,   223,   224,   225,   226,   227,   228,   229,
1558      230,   231,   232,   233,   234,   235,   236,   237,   238,   239,
1559      240,   241,   242,   243,   244,   245,   246,     0,   248,     0,
1560        0,     0,     0,   253,     0,     0,     0,     0,   258,   259,
1561      260,     0,     0,     0,     0,     0,     0,   755,     0,     0,
1562        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1563        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1564        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1565        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
1566        0,     0,     0,  1263,     0,     0,  1264,   179,  1265,     0,
1567     1266,   180,   286,   181,   287,   288,     0,     0,     0,   289,
1568      290,   291,     0,   182,   183,   184,   185,   186,   187,   188,
1569      189,   190,   191,   192,   193,   194,   195,   196,   197,   198,
1570      199,   200,   201,   202,   203,   204,   205,   206,   207,   208,
1571      209,   210,   211,   212,   213,   214,   215,   216,   217,   218,
1572      219,   220,   221,   222,   223,   224,   225,   226,   227,   228,
1573      229,   230,   231,   232,   233,   234,   235,   236,   237,   238,
1574      239,   240,   241,   242,   243,   244,   245,   246,   247,   248,
1575      249,   250,   251,   252,   253,   254,   255,   256,   257,   258,
1576      259,   260,   179,     0,     0,     0,   429,   286,   181,   287,
1577      288,     0,     0,     0,   289,   290,   291,     0,   182,   183,
1578      184,   185,   186,   187,   188,   189,   190,   191,   192,   193,
1579      194,   195,   196,   197,   198,   199,   200,   201,   202,   203,
1580      204,   205,   206,   207,   208,   209,   210,   211,   212,   213,
1581      214,   215,   216,   217,   218,   219,   220,   221,   222,   223,
1582      224,   225,   226,   227,   228,   229,   230,   231,   232,   233,
1583      234,   235,   236,   237,   238,   239,   240,   241,   242,   243,
1584      244,   245,   246,   247,   248,   249,   250,   251,   252,   253,
1585      254,   255,   256,   257,   258,   259,   260,   179,     0,     0,
1586        0,   180,     0,   181,   273,     0,     0,     0,     0,     0,
1587        0,     0,     0,   182,   183,   184,   185,   186,   187,   188,
1588      189,   190,   191,   192,   193,   194,   195,   196,   197,   198,
1589      199,   200,   201,   202,   203,   204,   205,   206,   207,   208,
1590      209,   210,   211,   212,   213,   214,   215,   216,   217,   218,
1591      219,   220,   221,   222,   223,   224,   225,   226,   227,   228,
1592      229,   230,   231,   232,   233,   234,   235,   236,   237,   238,
1593      239,   240,   241,   242,   243,   244,   245,   246,   247,   248,
1594      249,   250,   251,   252,   253,   254,   255,   256,   257,   258,
1595      259,   260,   179,     0,     0,     0,   180,     0,   181,   310,
1596        0,     0,     0,     0,     0,     0,     0,     0,   182,   183,
1597      184,   185,   186,   187,   188,   189,   190,   191,   192,   193,
1598      194,   195,   196,   197,   198,   199,   200,   201,   202,   203,
1599      204,   205,   206,   207,   208,   209,   210,   211,   212,   213,
1600      214,   215,   216,   217,   218,   219,   220,   221,   222,   223,
1601      224,   225,   226,   227,   228,   229,   230,   231,   232,   233,
1602      234,   235,   236,   237,   238,   239,   240,   241,   242,   243,
1603      244,   245,   246,   247,   248,   249,   250,   251,   252,   253,
1604      254,   255,   256,   257,   258,   259,   260,   179,     0,     0,
1605        0,     0,     0,   181,   310,     0,     0,   477,     0,     0,
1606        0,     0,     0,   182,   183,   184,   185,   186,   187,   188,
1607      189,   190,   191,   192,   193,   194,   195,   196,   197,   198,
1608      199,   200,   201,   202,   203,   204,   205,   206,   207,   208,
1609      209,   210,   211,   212,   213,   214,   215,   216,   217,   218,
1610      219,   220,   221,   222,   223,   224,   225,   226,   227,   228,
1611      229,   230,   231,   232,   233,   234,   235,   236,   237,   238,
1612      239,   240,   241,   242,   243,   244,   245,   246,   247,   248,
1613      249,   250,   251,   252,   253,   254,   255,   256,   257,   258,
1614      259,   260,   179,     0,     0,     0,     0,     0,   181,   310,
1615        0,     0,  1236,     0,     0,     0,     0,     0,   182,   183,
1616      184,   185,   186,   187,   188,   189,   190,   191,   192,   193,
1617      194,   195,   196,   197,   198,   199,   200,   201,   202,   203,
1618      204,   205,   206,   207,   208,   209,   210,   211,   212,   213,
1619      214,   215,   216,   217,   218,   219,   220,   221,   222,   223,
1620      224,   225,   226,   227,   228,   229,   230,   231,   232,   233,
1621      234,   235,   236,   237,   238,   239,   240,   241,   242,   243,
1622      244,   245,   246,   247,   248,   249,   250,   251,   252,   253,
1623      254,   255,   256,   257,   258,   259,   260,   179,     0,     0,
1624        0,   180,     0,   181,     0,     0,     0,     0,     0,     0,
1625        0,     0,     0,   182,   183,   184,   185,   186,   187,   188,
1626      189,   190,   191,   192,   193,   194,   195,   196,   197,   198,
1627      199,   200,   201,   202,   203,   204,   205,   206,   207,   208,
1628      209,   210,   211,   212,   213,   214,   215,   216,   217,   218,
1629      219,   220,   221,   222,   223,   224,   225,   226,   227,   228,
1630      229,   230,   231,   232,   233,   234,   235,   236,   237,   238,
1631      239,   240,   241,   242,   243,   244,   245,   246,   247,   248,
1632      249,   250,   251,   252,   253,   254,   255,   256,   257,   258,
1633      259,   260,   179,     0,     0,     0,     0,     0,   181,   310,
1634        0,     0,     0,     0,     0,     0,     0,     0,   182,   183,
1635      184,   185,   186,   187,   188,   189,   190,   191,   192,   193,
1636      194,   195,   196,   197,   198,   199,   200,   201,   202,   203,
1637      204,   205,   206,   207,   208,   209,   210,   211,   212,   213,
1638      214,   215,   216,   217,   218,   219,   220,   221,   222,   223,
1639      224,   225,   226,   227,   228,   229,   230,   231,   232,   233,
1640      234,   235,   236,   237,   238,   239,   240,   241,   242,   243,
1641      244,   245,   246,   247,   248,   249,   250,   251,   252,   253,
1642      254,   255,   256,   257,   258,   259,   260
1643 };
1644 
1645 static const yytype_int16 yycheck[] =
1646 {
1647        4,   726,    89,   725,   726,     9,    10,   711,    12,    89,
1648       14,    15,   105,    17,    18,    19,    20,     5,    22,    23,
1649      724,   725,    89,     5,    28,   559,    89,    89,    32,    33,
1650       34,    35,    36,    37,    38,    39,    40,    41,    42,    43,
1651       44,    45,    46,    47,    48,    49,     5,   722,    52,   706,
1652       89,    86,   719,    89,   721,     5,    89,   724,   711,     8,
1653        8,    89,    89,   725,   726,   393,     8,    75,     5,    17,
1654       12,   724,   725,    96,    85,    56,    96,    23,     5,     8,
1655        7,    84,   104,    64,   106,     8,    90,    99,   100,   101,
1656      102,   103,   420,   105,   114,  1106,  1107,   109,   632,   111,
1657        0,    82,     8,   115,   116,    89,     8,    76,   120,   121,
1658        5,   123,     8,   766,     5,    17,     7,     5,    14,     7,
1659       11,    42,   126,    11,   128,     5,   130,     7,   132,   133,
1660      134,   135,     5,   104,     7,     8,    82,   141,     5,   143,
1661        7,   145,   146,   147,   148,   149,    94,   151,   152,   153,
1662      154,    81,   156,   157,   158,   107,   108,   107,   107,    88,
1663      720,    87,   722,   723,    93,   177,   726,   727,     5,    92,
1664        7,   104,    95,   106,   178,     9,    10,   104,    12,   106,
1665       14,    15,    88,    17,    18,    19,    20,    93,    22,    23,
1666        8,     5,    83,     7,    28,    70,     8,    11,    32,    33,
1667       34,    35,    36,    37,    38,    39,    40,    41,    42,    43,
1668       44,    45,    46,    47,    48,    49,    14,   105,    52,   100,
1669      101,   102,   103,    22,   104,    20,   106,     5,   109,     7,
1670      111,   711,    31,    11,   115,   116,    31,   104,   104,   106,
1671      121,   721,   123,    42,   724,   725,   719,    31,   721,   722,
1672      683,   724,   725,   726,     8,   104,    21,   951,    42,   104,
1673      104,    31,   107,    33,    34,   104,    31,   104,    67,   106,
1674       88,     5,    67,     7,    73,    93,    88,    42,    73,    94,
1675       95,    93,    97,    67,     5,     5,     7,     7,     8,    73,
1676       11,   105,   126,   104,   128,     8,   130,    67,   132,   133,
1677      134,   135,    67,    68,    17,    18,   105,   141,    73,   143,
1678      105,   145,   146,   147,   148,   149,    81,   151,   152,   153,
1679      154,   105,   156,   157,   158,   758,   759,   105,   104,     8,
1680      106,    85,   104,    87,   106,   105,    90,    16,    17,    18,
1681      105,    96,   104,    98,    99,   100,   101,   102,   103,   104,
1682      105,   106,   107,   108,   109,   110,   111,   112,   113,   114,
1683      115,   116,   117,   118,   119,   120,   121,   122,   123,   107,
1684      393,    27,    31,   393,    30,    31,    30,    84,   104,    86,
1685      106,   474,    89,  1077,    91,   397,    42,   399,   400,   401,
1686       31,   403,   104,   405,   106,    51,    31,   420,   107,    55,
1687      420,    55,   104,    28,   106,    64,    31,   104,    67,   106,
1688      414,    67,    71,   107,   108,   419,    31,    73,   104,    75,
1689     1142,   104,    78,    77,    78,    81,    67,    42,   432,   103,
1690      434,  1125,    67,  1127,    59,    31,    71,    33,    34,   107,
1691      444,   445,    67,   447,   448,     5,   105,     7,    63,   105,
1692      103,   105,    67,   457,   725,   726,   460,   461,    73,   463,
1693      105,   465,   474,   467,   105,   469,   470,  1142,  1028,    31,
1694      105,    67,   565,   105,   104,  1142,   106,   481,     5,   483,
1695     1142,   108,   486,   487,   104,     4,   106,   491,   492,   493,
1696      105,   503,   496,   104,    54,   106,   500,   104,    24,   106,
1697      504,    97,   105,  1197,  1198,    67,    25,    26,   109,   105,
1698       29,   104,    32,   106,    74,   104,   397,   106,   399,   400,
1699      401,    40,   403,   104,   405,   106,    45,   104,    47,    48,
1700      104,    50,   106,   105,    31,   628,    33,    34,    57,   105,
1701       31,    60,  1236,   105,    85,   549,   550,   551,   552,  1010,
1702     1011,    42,   645,   565,  1211,    31,   560,   561,    43,    44,
1703       79,    37,   566,  1288,  1289,  1259,  1288,   104,  1290,   106,
1704       67,     5,  1106,     7,  1268,   110,    67,    96,   111,    98,
1705      395,  1141,    73,   104,  1288,  1289,  1290,   104,    62,    80,
1706      104,    67,  1286,    14,   409,   410,   411,   412,   413,   107,
1707      415,   416,   417,   418,   107,   112,   421,   422,   105,   104,
1708      104,   106,   106,     5,   105,     7,   628,   107,   634,    11,
1709       54,  1288,   503,  1290,   633,   104,  1288,   106,  1290,   105,
1710      632,   635,   104,   645,   106,   722,   723,  1290,   393,   726,
1711       74,   721,   397,   647,   399,   400,   401,  1207,   403,   104,
1712      405,   106,   407,   127,   721,   129,   634,   131,   721,   752,
1713      722,   723,  1142,     5,   726,   420,   140,   691,   142,  1142,
1714      144,   104,    64,   106,   104,   104,   106,   106,   104,   683,
1715      106,   685,   721,   687,   719,   721,     5,   722,   721,   724,
1716      725,   726,   727,   721,   721,   104,   104,   106,   106,   703,
1717      704,   175,  1092,   744,  1094,   652,   943,   654,   719,   720,
1718      721,   722,   407,   724,   725,   726,   727,   728,   729,   722,
1719      723,   946,  1208,   726,   727,   715,   729,   715,   964,   706,
1720      734,   743,   736,   715,   738,   739,   706,  1103,   722,   723,
1721      752,   706,   726,   727,   706,   729,   706,  1102,   503,   706,
1722      762,   545,   711,   774,   758,   759,    89,  1192,  1123,   548,
1723      719,   720,   721,   722,   723,   724,   725,   726,   727,   728,
1724      729,   729,   726,   729,   711,  1094,  1111,   563,   715,   644,
1725      717,   718,   719,   720,   721,   722,   723,   724,   725,   726,
1726      727,   728,   729,   719,   720,   721,   722,   700,   724,   725,
1727      726,   635,   728,  1244,   565,   742,   113,   744,  1288,  1289,
1728     1290,   954,   702,    30,    31,  1288,   711,  1290,  1078,   735,
1729      715,     4,   717,   718,   719,   720,   721,   722,   723,   724,
1730      725,   726,   727,   728,   729,    -1,     5,   177,     7,   702,
1731       -1,    -1,    11,    26,    27,    -1,    29,   742,    31,   744,
1732       67,    27,    -1,   687,    30,    24,    73,    40,    75,    42,
1733       -1,    78,   743,    32,    47,    48,    -1,    50,    -1,   703,
1734      704,    -1,    55,    -1,    57,    51,    52,    53,    -1,    55,
1735       -1,   762,    65,    31,    67,    -1,    -1,    -1,   105,     4,
1736       73,    -1,    40,    76,    42,    -1,    79,    45,    81,    -1,
1737       -1,    77,    78,    -1,   738,   739,    -1,    -1,   912,   913,
1738       25,    26,    60,    96,    29,    98,    31,    49,    31,    67,
1739       33,    34,   105,    55,    -1,    73,    -1,    42,    76,   105,
1740       62,    -1,    47,    48,    66,    50,    -1,    -1,    -1,   694,
1741       -1,  1028,    57,   947,   948,    -1,   761,    -1,   952,   423,
1742      424,     4,    67,    -1,    67,    -1,    27,   105,    73,   433,
1743       31,   435,   436,    -1,    79,    -1,    81,    -1,   442,   443,
1744       -1,    42,   446,    26,    -1,    -1,    29,    -1,    31,    -1,
1745       51,    96,    -1,    98,    55,    -1,    -1,    40,   743,    -1,
1746      105,    -1,   105,    -1,    47,    48,    67,    50,  1010,  1011,
1747       -1,    -1,    73,    -1,    57,    -1,    -1,   762,  1101,    -1,
1748       81,    -1,    27,    -1,    67,    30,    -1,  1021,  1022,    -1,
1749       73,    -1,    22,    76,    -1,  1028,    79,    -1,    -1,    -1,
1750       -1,    -1,    -1,    -1,   105,    -1,    51,    52,    53,    39,
1751       -1,    -1,    -1,    96,  1028,    98,    -1,    -1,    -1,    49,
1752       -1,    -1,   105,    -1,  1058,  1059,  1060,  1061,  1062,  1063,
1753       75,    61,    62,    78,    -1,    -1,    66,    -1,    -1,    69,
1754       -1,    -1,    -1,    -1,  1078,    75,    -1,    -1,   912,   913,
1755     1084,    -1,    -1,    -1,  1088,    -1,    -1,  1091,    -1,  1101,
1756      105,  1102,  1103,    -1,    -1,  1099,    -1,    -1,    -1,   573,
1757       -1,    -1,   576,   577,    -1,    -1,   580,  1142,    -1,   583,
1758       -1,    -1,   586,    -1,    -1,   589,    -1,    -1,   592,   934,
1759      935,   595,    -1,    -1,   598,    -1,    -1,   601,    -1,    -1,
1760      604,  1142,    -1,   607,    -1,    -1,   610,    -1,    -1,   613,
1761      614,   615,   616,  1102,  1103,   619,    -1,    -1,   622,    -1,
1762     1154,  1244,    -1,    27,    -1,  1159,    30,    31,    -1,    -1,
1763       -1,    -1,    -1,    -1,   638,  1102,  1103,    -1,    42,  1106,
1764     1107,    -1,    -1,    -1,    -1,    -1,    -1,    51,    52,    53,
1765       -1,    55,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1766       -1,    65,    -1,    67,    -1,   669,   670,   671,  1291,  1210,
1767     1211,    -1,    -1,    -1,  1141,  1142,   680,  1102,  1103,    -1,
1768       -1,  1106,  1107,    -1,    -1,    -1,  1220,    -1,    -1,   693,
1769       -1,    -1,    -1,    -1,  1058,  1059,  1060,  1061,  1062,  1063,
1770       -1,   105,  1244,    -1,   708,    -1,    -1,    -1,    -1,    -1,
1771       -1,    -1,    -1,    -1,    -1,    -1,  1141,  1142,    -1,  1208,
1772       -1,  1210,  1211,  1288,  1289,  1010,  1011,    -1,    -1,  1263,
1773     1264,  1265,  1266,    -1,    -1,    -1,   740,   741,    -1,    -1,
1774     1207,  1208,  1209,  1210,  1211,    -1,    -1,    -1,  1093,  1291,
1775     1095,  1096,  1097,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1776       -1,   765,    -1,    -1,   768,   769,   770,    -1,    -1,    -1,
1777       -1,    -1,    -1,    -1,    -1,   779,    -1,    -1,    -1,    -1,
1778       -1,    -1,  1207,  1208,  1209,  1210,  1211,    -1,    -1,    -1,
1779       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1780       -1,   805,   806,    -1,    -1,   809,    -1,  1092,    -1,  1094,
1781      814,   815,   816,    -1,    -1,    -1,    -1,   821,    -1,    -1,
1782       -1,    -1,    -1,    -1,   828,    -1,    -1,    -1,    -1,   833,
1783       -1,    -1,    -1,    -1,    -1,    -1,   840,   841,   842,   843,
1784      844,   845,   846,    -1,    -1,   849,    -1,    -1,    -1,    -1,
1785      854,   855,   856,   857,   858,    -1,  1220,    -1,    -1,   863,
1786      864,    -1,    -1,   867,    -1,    -1,   870,    -1,    -1,    -1,
1787       -1,   875,   876,    -1,    -1,   879,    -1,    -1,    -1,    -1,
1788      884,    -1,    -1,    -1,    -1,   889,   890,   891,   892,   893,
1789      894,   895,    -1,    -1,    -1,    -1,   900,    -1,    -1,    -1,
1790       -1,    -1,    -1,   907,   908,   909,   910,   911,    -1,    -1,
1791       -1,    -1,    -1,    -1,   918,   919,   920,   921,   284,    -1,
1792       -1,    -1,   926,   927,   928,   929,   930,   293,    -1,    -1,
1793       -1,   297,    -1,   299,     4,   301,    -1,   303,    -1,    -1,
1794       -1,   307,    -1,    -1,    -1,    -1,   312,    -1,    -1,    -1,
1795       -1,    -1,    -1,   319,    -1,    25,    26,   323,    -1,    29,
1796       -1,    31,   328,    -1,    -1,    -1,   332,    -1,    -1,    -1,
1797       -1,   337,    42,   339,    -1,    -1,   342,    47,    48,    -1,
1798       50,   347,    -1,    -1,    -1,   351,    -1,    57,   354,    -1,
1799      356,    -1,    -1,    -1,    -1,   361,    -1,    67,    -1,   365,
1800       -1,    -1,    -1,    73,    -1,   371,    -1,    -1,   374,    79,
1801       -1,    81,   378,    -1,    -1,    92,    -1,    -1,   384,    -1,
1802       -1,     4,   388,    -1,    -1,  1029,    96,    -1,    98,    -1,
1803       -1,    -1,    -1,    -1,  1038,   105,  1040,  1041,    -1,    -1,
1804     1044,    -1,    -1,    26,    27,    -1,    29,    -1,    31,  1053,
1805     1054,    -1,    -1,    -1,    -1,    -1,    -1,    40,    -1,    42,
1806     1064,    -1,    -1,    46,    47,    48,    -1,    50,    -1,    52,
1807       53,    -1,    55,   150,    57,    58,    -1,    -1,   155,  1083,
1808       -1,  1085,    -1,    -1,    67,    -1,    -1,    -1,    -1,    -1,
1809       73,    -1,    -1,    76,    77,    -1,    79,    -1,    81,    -1,
1810       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1811       -1,    -1,    -1,    96,    -1,    98,    -1,    -1,    -1,     4,
1812       -1,    -1,   105,    -1,    -1,    -1,    -1,    -1,    -1,  1133,
1813       -1,    -1,    -1,    -1,    -1,  1139,    -1,    -1,    -1,    -1,
1814       25,    26,    27,    -1,    29,    30,    31,    -1,  1152,    -1,
1815       -1,  1155,    -1,    -1,  1158,    -1,  1160,    42,    -1,  1163,
1816       -1,    -1,    47,    48,    -1,    50,    51,    -1,    -1,    -1,
1817       -1,  1175,  1176,  1177,  1178,  1179,  1180,    -1,    -1,    -1,
1818     1184,    -1,    67,    -1,   261,    -1,    -1,  1191,    73,    -1,
1819       -1,   268,    -1,    -1,    -1,    -1,    81,    -1,    -1,    -1,
1820      277,   278,    -1,    -1,   281,   282,    -1,    -1,    -1,    -1,
1821       -1,    -1,    -1,    98,  1218,    -1,    -1,    -1,    -1,    -1,
1822      105,    -1,    -1,    -1,  1228,    -1,    -1,    -1,    -1,  1233,
1823       -1,    -1,   309,    -1,    -1,    -1,    -1,    -1,    -1,   316,
1824      317,    -1,     4,    -1,   321,  1249,    -1,    -1,   325,    -1,
1825       -1,    -1,    -1,    -1,   331,    -1,    -1,   334,   335,    -1,
1826       -1,    -1,    -1,    -1,    26,  1269,    -1,    29,  1272,    31,
1827       -1,  1275,   349,    -1,  1278,    -1,   353,    -1,    40,    -1,
1828       42,   358,   359,    -1,    -1,    47,    48,    -1,    50,    -1,
1829      367,   368,   369,    55,    -1,  1299,    -1,    -1,    -1,   376,
1830     1304,    -1,    -1,  1307,    -1,    67,    -1,    -1,    -1,   386,
1831       -1,    73,    -1,    -1,    76,   392,    -1,    79,    -1,    -1,
1832       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1833       -1,    -1,    -1,    -1,    -1,    -1,    98,    -1,    -1,    -1,
1834       -1,    -1,    -1,   105,    -1,    -1,    -1,    -1,    -1,   426,
1835      427,    -1,   429,    -1,   431,    -1,    -1,    -1,    -1,    -1,
1836       -1,    -1,    -1,    -1,     0,    -1,    -1,    -1,    -1,    -1,
1837       -1,    -1,    -1,    -1,   451,    -1,    -1,    -1,    -1,    -1,
1838       -1,    -1,   459,   749,    20,    21,    22,    23,    24,    -1,
1839       -1,    27,    28,    -1,    30,    31,    32,    33,    34,    35,
1840       36,    37,    38,    39,    -1,    41,    42,    43,    44,    -1,
1841       46,    -1,   489,    49,    -1,    51,    52,    53,    -1,    55,
1842       56,    -1,    58,    59,    -1,    61,    62,    63,    64,    65,
1843       66,    67,     4,    69,    70,    71,    -1,    73,     4,    75,
1844       76,    77,    78,    -1,    80,    81,    82,    83,    -1,    -1,
1845       -1,    -1,    -1,    -1,    26,    -1,    -1,    29,    -1,    31,
1846       26,    97,    -1,    29,    -1,    -1,   102,    -1,     4,    -1,
1847       42,    -1,    -1,    -1,    40,    47,    48,    -1,    50,    -1,
1848       -1,    47,    48,    -1,    50,    -1,    -1,    -1,    -1,    55,
1849       26,   568,    -1,    29,    -1,    67,    -1,    -1,    -1,    -1,
1850       -1,    73,    -1,    -1,    40,    -1,    -1,    79,    -1,    81,
1851       76,    47,    48,    79,    50,    -1,    -1,    -1,    -1,    55,
1852        4,    -1,    -1,    -1,    -1,    -1,    98,    -1,    -1,    -1,
1853       -1,    -1,    98,   105,    -1,    -1,    -1,    21,    -1,   105,
1854       76,    -1,    26,    79,    -1,    29,    -1,    -1,    -1,    -1,
1855       -1,    35,    36,   630,    38,    -1,    40,    41,    -1,    -1,
1856       -1,    -1,    98,    47,    48,    -1,    50,    -1,    -1,   105,
1857       -1,    27,    -1,    57,    30,    31,    -1,    -1,   944,    -1,
1858       -1,    -1,    -1,    -1,    -1,    -1,    42,    -1,    72,    -1,
1859       -1,    -1,    76,    -1,    -1,    79,    52,    53,    -1,    55,
1860       -1,    -1,    58,    -1,    -1,   682,    -1,   684,    -1,    -1,
1861       -1,    67,    -1,    -1,    98,    -1,    -1,    73,    -1,    75,
1862       -1,    -1,    78,    -1,    -1,    81,    -1,    -1,    -1,    -1,
1863       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1864       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   105,
1865       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1866       -1,    -1,    -1,    -1,    -1,     4,    -1,    -1,    -1,   746,
1867      747,    10,    11,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1868      757,    20,    21,    22,    23,    24,    25,    26,    27,    28,
1869       29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
1870       39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
1871       49,    50,    51,    52,    53,    54,    55,    56,    57,    58,
1872       59,    60,    61,    62,    63,    64,    65,    66,    67,    68,
1873       69,    70,    71,    72,    73,    74,    75,    76,    77,    78,
1874       79,    80,    81,    82,    83,    84,    85,    86,    87,    88,
1875       89,    90,    91,    92,    93,    94,    95,    96,    97,    98,
1876       -1,    -1,    -1,    -1,    -1,    -1,   105,    -1,    -1,    -1,
1877       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1878       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1879       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1880       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1881       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1882       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1883       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1884       -1,     4,    -1,    -1,    -1,    -1,    -1,    10,    11,    -1,
1885       -1,    -1,    -1,    -1,    -1,   932,   933,    20,    21,    22,
1886       23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
1887       33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
1888       43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
1889       53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
1890       63,    64,    65,    66,    67,    68,    69,    70,    71,    72,
1891       73,    74,    75,    76,    77,    78,    79,    80,    81,    82,
1892       83,    84,    85,    86,    87,    88,    89,    90,    91,    92,
1893       93,    94,    95,    96,    97,    98,    -1,    -1,    -1,    -1,
1894       -1,    -1,   105,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1895       -1,    -1,    -1,    -1,    -1,    -1,    -1,  1034,    -1,    -1,
1896       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1897       -1,  1048,    -1,    -1,    -1,  1052,    -1,    -1,    -1,    -1,
1898     1057,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1899       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,  1076,
1900       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1901       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1902       -1,    -1,    -1,    -1,    -1,    -1,     4,    -1,    -1,    -1,
1903       -1,    -1,    -1,    11,    -1,  1112,    -1,    -1,    -1,    -1,
1904       -1,  1118,    20,    21,    22,    23,    24,    25,    26,    27,
1905       28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
1906       38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
1907       48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
1908       58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
1909       68,    69,    70,    71,    72,    73,    74,    75,    76,    77,
1910       78,    79,    80,    81,    82,    83,    84,    -1,    86,    -1,
1911       -1,    -1,    -1,    91,    -1,    -1,    -1,    -1,    96,    97,
1912       98,    -1,    -1,    -1,    -1,    -1,    -1,   105,    -1,    -1,
1913       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1914       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1915       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1916       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
1917       -1,    -1,    -1,  1250,    -1,    -1,  1253,     4,  1255,    -1,
1918     1257,     8,     9,    10,    11,    12,    -1,    -1,    -1,    16,
1919       17,    18,    -1,    20,    21,    22,    23,    24,    25,    26,
1920       27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
1921       37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
1922       47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
1923       57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
1924       67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
1925       77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
1926       87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
1927       97,    98,     4,    -1,    -1,    -1,     8,     9,    10,    11,
1928       12,    -1,    -1,    -1,    16,    17,    18,    -1,    20,    21,
1929       22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
1930       32,    33,    34,    35,    36,    37,    38,    39,    40,    41,
1931       42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
1932       52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
1933       62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
1934       72,    73,    74,    75,    76,    77,    78,    79,    80,    81,
1935       82,    83,    84,    85,    86,    87,    88,    89,    90,    91,
1936       92,    93,    94,    95,    96,    97,    98,     4,    -1,    -1,
1937       -1,     8,    -1,    10,    11,    -1,    -1,    -1,    -1,    -1,
1938       -1,    -1,    -1,    20,    21,    22,    23,    24,    25,    26,
1939       27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
1940       37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
1941       47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
1942       57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
1943       67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
1944       77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
1945       87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
1946       97,    98,     4,    -1,    -1,    -1,     8,    -1,    10,    11,
1947       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    20,    21,
1948       22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
1949       32,    33,    34,    35,    36,    37,    38,    39,    40,    41,
1950       42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
1951       52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
1952       62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
1953       72,    73,    74,    75,    76,    77,    78,    79,    80,    81,
1954       82,    83,    84,    85,    86,    87,    88,    89,    90,    91,
1955       92,    93,    94,    95,    96,    97,    98,     4,    -1,    -1,
1956       -1,    -1,    -1,    10,    11,    -1,    -1,    14,    -1,    -1,
1957       -1,    -1,    -1,    20,    21,    22,    23,    24,    25,    26,
1958       27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
1959       37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
1960       47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
1961       57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
1962       67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
1963       77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
1964       87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
1965       97,    98,     4,    -1,    -1,    -1,    -1,    -1,    10,    11,
1966       -1,    -1,    14,    -1,    -1,    -1,    -1,    -1,    20,    21,
1967       22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
1968       32,    33,    34,    35,    36,    37,    38,    39,    40,    41,
1969       42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
1970       52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
1971       62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
1972       72,    73,    74,    75,    76,    77,    78,    79,    80,    81,
1973       82,    83,    84,    85,    86,    87,    88,    89,    90,    91,
1974       92,    93,    94,    95,    96,    97,    98,     4,    -1,    -1,
1975       -1,     8,    -1,    10,    -1,    -1,    -1,    -1,    -1,    -1,
1976       -1,    -1,    -1,    20,    21,    22,    23,    24,    25,    26,
1977       27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
1978       37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
1979       47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
1980       57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
1981       67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
1982       77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
1983       87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
1984       97,    98,     4,    -1,    -1,    -1,    -1,    -1,    10,    11,
1985       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    20,    21,
1986       22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
1987       32,    33,    34,    35,    36,    37,    38,    39,    40,    41,
1988       42,    43,    44,    45,    46,    47,    48,    49,    50,    51,
1989       52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
1990       62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
1991       72,    73,    74,    75,    76,    77,    78,    79,    80,    81,
1992       82,    83,    84,    85,    86,    87,    88,    89,    90,    91,
1993       92,    93,    94,    95,    96,    97,    98
1994 };
1995 
1996   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1997      symbol of state STATE-NUM.  */
1998 static const yytype_int16 yystos[] =
1999 {
2000        0,   114,   120,   124,   419,   441,     0,     5,     7,    54,
2001       74,   418,    20,    21,    22,    23,    24,    27,    28,    30,
2002       31,    32,    33,    34,    35,    36,    37,    38,    39,    41,
2003       43,    44,    46,    51,    52,    53,    56,    58,    59,    61,
2004       63,    64,    65,    67,    69,    71,    73,    77,    78,    80,
2005       82,    83,    97,   102,   130,   140,   142,   144,   147,   149,
2006      151,   153,   170,   176,   190,   202,   214,   222,   227,   229,
2007      238,   241,   243,   245,   247,   339,   342,   345,   347,   350,
2008      353,   359,   362,   430,   431,   432,   433,   434,   435,   436,
2009      437,   438,   418,   420,   420,   420,   420,   420,   420,   420,
2010      420,   420,   420,   420,   420,   420,   420,   420,   420,   420,
2011      420,   420,   420,   420,   420,   420,   420,   420,   420,   420,
2012      420,   420,   420,   420,   402,   402,    75,   194,    76,   192,
2013       42,   183,    49,    55,    62,    66,   204,   209,   224,   356,
2014      440,    81,   335,    70,   157,     4,    25,    26,    29,    40,
2015       45,    47,    48,    50,    57,    60,    79,    96,    98,   249,
2016      254,   257,   261,   264,   267,   273,   277,   279,   283,   299,
2017      304,   305,   307,   308,   310,   439,   407,   420,   419,     4,
2018        8,    10,    20,    21,    22,    23,    24,    25,    26,    27,
2019       28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
2020       38,    39,    40,    41,    42,    43,    44,    45,    46,    47,
2021       48,    49,    50,    51,    52,    53,    54,    55,    56,    57,
2022       58,    59,    60,    61,    62,    63,    64,    65,    66,    67,
2023       68,    69,    70,    71,    72,    73,    74,    75,    76,    77,
2024       78,    79,    80,    81,    82,    83,    84,    85,    86,    87,
2025       88,    89,    90,    91,    92,    93,    94,    95,    96,    97,
2026       98,   115,   116,   119,   395,   425,   426,   427,   428,   123,
2027      395,   169,   395,    11,   116,   189,   397,   428,   429,   141,
2028      395,    88,    93,   116,   338,   340,     9,    11,    12,    16,
2029       17,    18,   116,   148,   422,   424,   425,   246,   422,   150,
2030      422,   242,   422,   240,   422,    17,   116,   201,   203,   390,
2031       11,   116,   361,   363,   396,   425,    88,    93,   116,   341,
2032      343,    94,   116,   349,   351,   390,    18,   116,   346,   348,
2033      390,   391,   129,   422,    92,    95,   116,   352,   354,   146,
2034      422,   116,   226,   371,   372,   373,   116,   237,   239,   391,
2035      116,   143,   394,   428,   344,   422,   152,   422,    88,    93,
2036      116,   228,   230,    12,   116,   139,   160,    85,    87,    90,
2037      116,   175,   177,   116,   358,   360,   369,   396,   244,   422,
2038       16,    17,    18,   116,   221,   223,   392,   393,   213,   422,
2039      403,   418,   429,   420,   402,   420,   402,   420,   402,   420,
2040      420,   208,   420,   420,   402,   420,   402,   420,   402,   420,
2041      420,   420,   420,   420,   419,   420,   420,   420,   420,   419,
2042      420,   420,   420,   104,   104,   402,   104,   106,   417,     8,
2043      408,   424,   419,   104,   419,   104,   104,   106,   171,   104,
2044      106,   398,   399,   401,   419,   419,   104,   419,   419,   398,
2045      398,   423,   398,   398,   398,   398,   398,   419,   398,   364,
2046      419,   419,   398,   419,   398,   419,   398,   419,   398,   419,
2047      419,   398,   398,   398,   107,   374,   375,    14,   377,   378,
2048      398,   419,   398,   419,   398,   398,   419,   419,   398,   161,
2049      398,   419,   419,   419,   398,   398,   419,   370,   398,   398,
2050      419,   398,   404,   405,   419,   195,   397,   191,   395,   182,
2051      422,   205,   422,   355,   422,   210,   422,   365,   422,   334,
2052      422,   155,   160,   276,   395,   272,   395,   266,   395,   253,
2053      395,   248,   395,   258,   395,   260,   395,   263,   395,   309,
2054      395,   282,   397,   298,   395,   278,   395,   402,   402,   419,
2055      419,   419,   419,   117,   402,   402,   402,   402,   402,   402,
2056      419,   419,   396,   376,   107,   379,   419,   368,   104,   106,
2057      410,   406,   422,   104,   106,   196,   104,   104,   106,   184,
2058      104,   106,   206,   104,   106,   357,   104,   106,   211,   104,
2059      106,   225,   104,   106,   336,   104,   106,   158,   104,   106,
2060      280,   104,   106,   274,   104,   106,   268,   104,   106,   255,
2061      104,   106,   250,   104,   104,   104,   104,   106,   311,   104,
2062      106,   284,   104,   106,   302,   280,   306,   306,   416,   409,
2063      103,   121,   122,   125,   126,    83,   173,   105,   400,   144,
2064      382,   374,   378,   380,   396,   107,   366,   419,   402,   402,
2065      402,   402,   402,   402,   402,   402,   402,   402,   402,   402,
2066      402,   402,   402,   402,   402,   402,   402,   402,   105,   192,
2067      249,   252,   254,   257,   261,   264,   267,   277,   279,   283,
2068      356,   105,   105,   396,   103,   419,   131,    82,   128,   130,
2069      144,   131,   128,   142,   420,   105,   402,   105,   108,   381,
2070      382,   396,   411,    24,    32,   197,   198,   215,   217,   231,
2071      233,   193,   105,   207,   207,   212,   207,   337,   159,   281,
2072      275,   269,   256,   251,   259,   262,   265,   312,   285,   303,
2073      402,   402,   402,   402,   419,   407,   419,     8,    43,    44,
2074      132,   136,   145,   420,   145,   402,    88,    93,   116,   172,
2075      174,     5,   421,   375,    54,   105,   403,   412,   414,   415,
2076      427,   420,   420,   105,   190,   199,   200,   202,   204,   209,
2077      224,   227,   229,   402,   232,   105,   151,   153,   176,   194,
2078      245,   247,   105,   151,   153,   241,   243,   105,   105,   151,
2079      153,   214,   241,   243,   105,   105,   151,   153,   105,   151,
2080      153,   105,   151,   153,   176,   183,   335,   339,   342,   356,
2081      105,   151,   153,   176,   183,   252,   335,   105,   151,   153,
2082      176,   183,   247,   254,   257,   261,   264,   267,   270,   271,
2083      273,   277,   279,   335,   339,   342,   105,   151,   153,   176,
2084      183,   192,   249,   252,   299,   310,   335,   339,   345,   356,
2085      105,   151,   153,   176,   192,   249,   252,   299,   310,   105,
2086      151,   153,   176,   183,   194,   245,   247,   335,   339,   342,
2087      356,   105,   151,   153,   176,   183,   194,   245,   247,   335,
2088      339,   347,   350,   353,   356,   105,   151,   153,   176,   183,
2089      192,   249,   252,   299,   310,   335,   339,   347,   350,   353,
2090      356,   359,   362,   105,   151,   153,   176,   183,   192,   249,
2091      252,   356,    21,    68,   105,   151,   153,   176,   183,   288,
2092      293,   335,   105,   151,   153,   176,   183,   192,   249,   305,
2093      308,   417,     8,   118,   420,   420,   402,   402,   147,   149,
2094      151,   153,   154,   156,   127,   422,   154,   419,   419,   398,
2095      383,   396,   419,   407,   407,   234,   395,   218,   422,   402,
2096      194,   402,   402,   402,   216,   233,   402,   402,   402,   402,
2097      402,   402,   402,   402,   402,   402,   402,   402,   402,   402,
2098      402,   402,   402,   402,   402,   402,   402,   402,   402,   402,
2099      402,   402,   402,   402,   402,   402,   402,   402,   402,   402,
2100      402,   402,   402,   402,   402,   402,   402,   402,   402,   402,
2101      420,   420,   402,   402,   402,   402,   402,   402,   402,   402,
2102      402,   419,   419,   133,   395,   135,   395,   162,   163,   157,
2103      398,   162,   109,   421,   104,   106,   413,   413,   104,   106,
2104      235,   104,   106,   219,   217,   116,   291,   292,   369,   116,
2105      286,   287,   369,   104,   104,   106,   137,   105,    21,    35,
2106       36,    38,    41,    72,   164,   166,   179,   186,   192,   249,
2107      252,   296,   301,   310,   314,   402,   105,   110,   419,   402,
2108      402,   402,   402,   104,   419,   104,   106,   289,   419,   402,
2109      402,   419,   420,   420,   420,   420,   420,   420,   402,   419,
2110      421,   416,   236,   220,   402,   402,   134,   138,   116,   294,
2111      295,   366,   367,   165,   395,   116,   313,   316,   367,   178,
2112      395,   185,   395,   300,   395,    85,   384,   389,   105,   105,
2113      151,   153,   176,   183,   238,   105,   151,   153,   176,   183,
2114      222,   297,   290,   105,   140,   144,   151,   153,   105,   140,
2115      151,   153,   104,   368,   419,   104,   106,   167,   104,   419,
2116      104,   106,   180,   104,   106,   187,   302,   421,   421,   402,
2117      402,   105,   151,   153,   176,   183,   252,   273,   299,   310,
2118      335,   105,   151,   153,   183,   247,   339,   342,   345,   347,
2119      350,   356,   402,   402,   402,   402,   402,   111,   107,   402,
2120      402,   402,   402,   402,   402,   402,   402,   297,   168,   315,
2121      181,   188,   421,   421,   105,   105,   151,   153,   170,   176,
2122       37,   105,   151,   153,   105,   151,   153,   176,   183,   105,
2123      151,   153,   176,   183,   190,   112,    14,   385,   386,   402,
2124      420,   402,   402,   421,   387,    84,    86,    89,    91,   317,
2125      318,   319,   321,   322,   323,   326,   327,   330,   331,   107,
2126      386,   396,   402,   419,   419,   419,   419,   421,   388,   104,
2127      106,   320,   104,   106,   324,   104,   106,   328,   104,   106,
2128      332,   421,   402,   402,   402,   402,   107,   105,   325,   329,
2129      333,   421,   105,   245,   247,   339,   342,   347,   350,   356,
2130      359,   105,   245,   247,   356,   359,   105,   194,   245,   247,
2131      339,   342,   347,   350,   396,   402,   402,   402
2132 };
2133 
2134   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
2135 static const yytype_int16 yyr1[] =
2136 {
2137        0,   113,   114,   114,   114,   115,   116,   117,   118,   117,
2138      119,   120,   121,   122,   122,   122,   122,   123,   124,   125,
2139      126,   126,   126,   127,   128,   129,   130,   131,   131,   131,
2140      132,   133,   134,   134,   134,   134,   134,   135,   136,   137,
2141      137,   138,   138,   138,   138,   139,   140,   141,   142,   143,
2142      144,   145,   145,   145,   145,   145,   146,   147,   148,   149,
2143      150,   151,   152,   153,   154,   155,   156,   156,   157,   158,
2144      158,   159,   159,   159,   161,   160,   160,   162,   163,   163,
2145      164,   164,   164,   164,   164,   164,   164,   164,   164,   164,
2146      165,   166,   167,   167,   168,   168,   168,   168,   168,   169,
2147      170,   171,   171,   172,   173,   173,   174,   174,   174,   175,
2148      176,   177,   177,   177,   177,   178,   179,   180,   180,   181,
2149      181,   181,   181,   181,   182,   183,   184,   184,   185,   186,
2150      187,   187,   188,   188,   188,   188,   188,   188,   189,   190,
2151      191,   192,   193,   193,   193,   193,   193,   193,   193,   194,
2152      195,   196,   196,   197,   197,   197,   198,   198,   198,   198,
2153      198,   198,   198,   198,   198,   199,   200,   201,   202,   203,
2154      203,   204,   205,   206,   206,   207,   207,   207,   207,   207,
2155      208,   209,   210,   211,   211,   212,   212,   212,   212,   212,
2156      212,   213,   214,   215,   216,   216,   217,   218,   219,   219,
2157      220,   220,   220,   220,   220,   220,   221,   222,   223,   223,
2158      224,   225,   225,   226,   227,   228,   229,   230,   230,   230,
2159      231,   232,   232,   233,   234,   235,   235,   236,   236,   236,
2160      236,   236,   236,   237,   238,   239,   239,   240,   241,   242,
2161      243,   244,   245,   246,   247,   248,   249,   250,   250,   251,
2162      251,   251,   251,   251,   251,   251,   251,   251,   252,   252,
2163      252,   252,   252,   252,   252,   252,   253,   254,   255,   255,
2164      256,   256,   256,   256,   256,   256,   256,   256,   256,   256,
2165      256,   256,   256,   256,   257,   258,   259,   259,   259,   259,
2166      259,   259,   259,   259,   259,   259,   259,   259,   260,   261,
2167      262,   262,   262,   262,   262,   262,   262,   262,   262,   262,
2168      262,   262,   262,   262,   263,   264,   265,   265,   265,   265,
2169      265,   265,   265,   265,   265,   265,   265,   265,   265,   265,
2170      265,   265,   265,   265,   266,   267,   268,   268,   269,   269,
2171      269,   269,   269,   269,   269,   269,   269,   269,   270,   270,
2172      271,   271,   271,   271,   271,   271,   271,   272,   273,   274,
2173      274,   275,   275,   275,   275,   275,   275,   275,   276,   277,
2174      278,   279,   280,   280,   281,   281,   281,   281,   281,   281,
2175      281,   281,   281,   282,   283,   284,   284,   285,   285,   285,
2176      285,   285,   285,   285,   285,   286,   286,   287,   288,   289,
2177      289,   290,   290,   290,   290,   290,   290,   290,   290,   290,
2178      290,   290,   291,   291,   292,   293,   294,   294,   295,   296,
2179      297,   297,   297,   297,   297,   297,   297,   297,   297,   297,
2180      298,   299,   300,   301,   302,   302,   303,   303,   303,   303,
2181      303,   303,   303,   303,   303,   304,   305,   306,   306,   306,
2182      306,   306,   307,   308,   309,   310,   311,   311,   312,   312,
2183      312,   312,   312,   312,   312,   312,   312,   313,   314,   315,
2184      315,   315,   315,   316,   316,   317,   317,   318,   319,   320,
2185      320,   321,   321,   321,   322,   323,   324,   324,   325,   325,
2186      325,   325,   325,   325,   325,   325,   325,   326,   327,   328,
2187      328,   329,   329,   329,   329,   329,   330,   331,   332,   332,
2188      333,   333,   333,   333,   333,   333,   333,   333,   334,   335,
2189      336,   336,   337,   337,   337,   338,   339,   340,   340,   340,
2190      341,   342,   343,   343,   343,   344,   345,   346,   347,   348,
2191      348,   349,   350,   351,   351,   351,   352,   353,   354,   354,
2192      354,   355,   356,   357,   357,   358,   359,   360,   360,   361,
2193      362,   364,   363,   363,   365,   366,   367,   368,   368,   370,
2194      369,   372,   371,   373,   371,   371,   374,   375,   376,   376,
2195      377,   378,   379,   379,   380,   381,   381,   382,   382,   383,
2196      384,   385,   386,   387,   387,   388,   388,   389,   390,   391,
2197      391,   392,   392,   393,   393,   394,   394,   395,   395,   396,
2198      396,   397,   397,   397,   398,   398,   399,   400,   401,   402,
2199      402,   402,   403,   404,   405,   406,   406,   407,   407,   408,
2200      408,   408,   409,   409,   410,   410,   411,   411,   412,   412,
2201      412,   413,   413,   414,   415,   416,   416,   417,   417,   418,
2202      418,   419,   419,   420,   421,   421,   423,   422,   422,   424,
2203      424,   424,   424,   424,   424,   424,   425,   425,   425,   426,
2204      426,   426,   426,   426,   426,   426,   426,   426,   426,   427,
2205      427,   427,   427,   427,   427,   427,   427,   427,   427,   427,
2206      427,   427,   427,   427,   427,   427,   427,   427,   427,   427,
2207      427,   427,   427,   427,   427,   427,   427,   427,   427,   427,
2208      427,   427,   427,   427,   427,   427,   427,   427,   427,   427,
2209      427,   427,   427,   427,   427,   427,   427,   427,   427,   427,
2210      427,   427,   427,   427,   427,   427,   427,   427,   427,   427,
2211      427,   427,   427,   427,   427,   427,   427,   427,   427,   428,
2212      429,   430,   431,   432,   433,   434,   435,   436,   437,   438,
2213      438,   438,   438,   438,   438,   438,   438,   438,   438,   438,
2214      438,   438,   439,   439,   439,   439,   439,   439,   439,   439,
2215      439,   439,   439,   439,   439,   439,   440,   440,   440,   440,
2216      441,   441,   441,   441,   441,   441,   441,   441,   441,   441,
2217      441,   441,   441,   441,   441,   441,   441,   441,   441,   441,
2218      441,   441,   441,   441,   441,   441,   441,   441,   441,   441,
2219      441,   441,   441,   441,   441,   441,   441,   441
2220 };
2221 
2222   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
2223 static const yytype_int8 yyr2[] =
2224 {
2225        0,     2,     1,     1,     1,     1,     3,     0,     0,     6,
2226        1,    13,     1,     0,     2,     2,     2,     1,    13,     1,
2227        0,     2,     3,     1,     4,     1,     4,     0,     3,     3,
2228        7,     1,     0,     2,     2,     2,     2,     1,     4,     1,
2229        4,     0,     2,     2,     2,     1,     4,     1,     7,     1,
2230        4,     0,     2,     2,     2,     2,     1,     4,     1,     4,
2231        1,     4,     1,     4,     1,     1,     0,     3,     4,     1,
2232        4,     0,     2,     2,     0,     3,     1,     1,     0,     3,
2233        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2234        1,     4,     1,     4,     0,     3,     2,     2,     2,     1,
2235        4,     1,     4,     1,     0,     4,     2,     2,     1,     1,
2236        4,     2,     2,     2,     1,     1,     4,     1,     4,     0,
2237        3,     2,     2,     2,     1,     4,     1,     3,     1,     4,
2238        1,     4,     0,     2,     3,     2,     2,     2,     1,     4,
2239        1,     7,     0,     3,     2,     2,     2,     2,     2,     4,
2240        1,     1,     4,     1,     1,     1,     0,     2,     2,     2,
2241        3,     3,     2,     3,     3,     2,     0,     1,     4,     2,
2242        1,     4,     1,     1,     4,     0,     2,     2,     2,     2,
2243        1,     4,     1,     1,     4,     0,     2,     2,     2,     2,
2244        2,     1,     4,     3,     0,     3,     4,     1,     1,     4,
2245        0,     3,     2,     2,     2,     2,     1,     4,     2,     1,
2246        4,     1,     4,     1,     4,     1,     4,     2,     2,     1,
2247        2,     0,     2,     5,     1,     1,     4,     0,     3,     2,
2248        2,     2,     2,     1,     4,     2,     1,     1,     4,     1,
2249        4,     1,     4,     1,     4,     1,     4,     1,     4,     0,
2250        2,     2,     2,     3,     3,     3,     3,     3,     1,     1,
2251        1,     1,     1,     1,     1,     1,     1,     4,     1,     4,
2252        0,     3,     3,     3,     2,     2,     2,     2,     2,     3,
2253        3,     3,     3,     3,     7,     1,     0,     3,     3,     3,
2254        2,     3,     2,     2,     2,     2,     2,     2,     1,     7,
2255        0,     3,     3,     3,     2,     2,     3,     2,     2,     2,
2256        2,     2,     2,     2,     1,     7,     0,     3,     3,     3,
2257        2,     2,     2,     2,     2,     2,     2,     2,     2,     3,
2258        3,     3,     3,     3,     1,     4,     1,     4,     0,     3,
2259        3,     2,     2,     2,     2,     2,     2,     3,     1,     1,
2260        1,     1,     1,     1,     1,     1,     1,     1,     4,     1,
2261        4,     0,     3,     3,     2,     2,     2,     3,     1,     4,
2262        1,     4,     1,     4,     0,     3,     3,     3,     2,     2,
2263        2,     2,     2,     1,     4,     1,     4,     0,     3,     3,
2264        2,     2,     2,     3,     3,     2,     1,     1,     4,     1,
2265        4,     0,     3,     3,     2,     2,     2,     2,     2,     2,
2266        2,     2,     2,     1,     1,     7,     2,     1,     1,     7,
2267        0,     3,     3,     2,     2,     2,     3,     3,     3,     3,
2268        1,     4,     1,     4,     1,     4,     0,     3,     2,     2,
2269        2,     3,     3,     3,     3,     2,     5,     0,     3,     3,
2270        3,     3,     2,     5,     1,     4,     1,     4,     0,     3,
2271        3,     2,     2,     2,     3,     3,     3,     1,     7,     0,
2272        2,     2,     5,     2,     1,     1,     1,     1,     3,     1,
2273        3,     1,     1,     1,     1,     3,     1,     4,     0,     2,
2274        3,     2,     2,     2,     2,     2,     2,     1,     3,     1,
2275        4,     0,     2,     3,     2,     2,     1,     3,     1,     4,
2276        0,     3,     2,     2,     2,     2,     2,     2,     1,     4,
2277        1,     4,     0,     2,     2,     1,     4,     2,     2,     1,
2278        1,     4,     2,     2,     1,     1,     4,     1,     4,     2,
2279        1,     1,     4,     2,     2,     1,     1,     4,     2,     2,
2280        1,     1,     4,     1,     4,     1,     4,     2,     1,     1,
2281        4,     0,     3,     1,     1,     2,     2,     0,     2,     0,
2282        3,     0,     2,     0,     2,     1,     3,     2,     0,     2,
2283        3,     2,     0,     2,     2,     0,     2,     0,     5,     5,
2284        5,     4,     4,     0,     2,     0,     5,     5,     1,     1,
2285        1,     1,     1,     1,     1,     1,     2,     2,     1,     1,
2286        1,     2,     2,     1,     2,     4,     1,     1,     1,     0,
2287        2,     2,     3,     2,     1,     0,     1,     0,     2,     0,
2288        2,     3,     0,     5,     1,     4,     0,     3,     1,     3,
2289        3,     1,     4,     1,     1,     0,     4,     2,     5,     1,
2290        1,     0,     2,     2,     0,     1,     0,     3,     1,     1,
2291        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2292        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2293        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2294        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2295        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2296        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2297        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2298        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2299        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2300        1,     0,     0,     0,     0,     0,     0,     0,     1,     1,
2301        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2302        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2303        1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
2304        0,     3,     2,     2,     2,     2,     2,     2,     2,     2,
2305        2,     2,     2,     2,     2,     2,     2,     4,     4,     2,
2306        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
2307        2,     4,     3,     4,     4,     4,     4,     4
2308 };
2309 
2310 
2311 #define yyerrok         (yyerrstatus = 0)
2312 #define yyclearin       (yychar = YYEMPTY)
2313 #define YYEMPTY         (-2)
2314 #define YYEOF           0
2315 
2316 #define YYACCEPT        goto yyacceptlab
2317 #define YYABORT         goto yyabortlab
2318 #define YYERROR         goto yyerrorlab
2319 
2320 
2321 #define YYRECOVERING()  (!!yyerrstatus)
2322 
2323 #define YYBACKUP(Token, Value)                                    \
2324   do                                                              \
2325     if (yychar == YYEMPTY)                                        \
2326       {                                                           \
2327         yychar = (Token);                                         \
2328         yylval = (Value);                                         \
2329         YYPOPSTACK (yylen);                                       \
2330         yystate = *yyssp;                                         \
2331         goto yybackup;                                            \
2332       }                                                           \
2333     else                                                          \
2334       {                                                           \
2335         yyerror (&yylloc, scanner, param, YY_("syntax error: cannot back up")); \
2336         YYERROR;                                                  \
2337       }                                                           \
2338   while (0)
2339 
2340 /* Error token number */
2341 #define YYTERROR        1
2342 #define YYERRCODE       256
2343 
2344 
2345 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
2346    If N is 0, then set CURRENT to the empty location which ends
2347    the previous symbol: RHS[0] (always defined).  */
2348 
2349 #ifndef YYLLOC_DEFAULT
2350 # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
2351     do                                                                  \
2352       if (N)                                                            \
2353         {                                                               \
2354           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
2355           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
2356           (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
2357           (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
2358         }                                                               \
2359       else                                                              \
2360         {                                                               \
2361           (Current).first_line   = (Current).last_line   =              \
2362             YYRHSLOC (Rhs, 0).last_line;                                \
2363           (Current).first_column = (Current).last_column =              \
2364             YYRHSLOC (Rhs, 0).last_column;                              \
2365         }                                                               \
2366     while (0)
2367 #endif
2368 
2369 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
2370 
2371 
2372 /* Enable debugging if requested.  */
2373 #if YYDEBUG
2374 
2375 # ifndef YYFPRINTF
2376 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
2377 #  define YYFPRINTF fprintf
2378 # endif
2379 
2380 # define YYDPRINTF(Args)                        \
2381 do {                                            \
2382   if (yydebug)                                  \
2383     YYFPRINTF Args;                             \
2384 } while (0)
2385 
2386 
2387 /* YY_LOCATION_PRINT -- Print the location on the stream.
2388    This macro was not mandated originally: define only if we know
2389    we won't break user code: when these are the locations we know.  */
2390 
2391 #ifndef YY_LOCATION_PRINT
2392 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2393 
2394 /* Print *YYLOCP on YYO.  Private, do not rely on its existence. */
2395 
2396 YY_ATTRIBUTE_UNUSED
2397 static int
yy_location_print_(FILE * yyo,YYLTYPE const * const yylocp)2398 yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
2399 {
2400   int res = 0;
2401   int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
2402   if (0 <= yylocp->first_line)
2403     {
2404       res += YYFPRINTF (yyo, "%d", yylocp->first_line);
2405       if (0 <= yylocp->first_column)
2406         res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
2407     }
2408   if (0 <= yylocp->last_line)
2409     {
2410       if (yylocp->first_line < yylocp->last_line)
2411         {
2412           res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
2413           if (0 <= end_col)
2414             res += YYFPRINTF (yyo, ".%d", end_col);
2415         }
2416       else if (0 <= end_col && yylocp->first_column < end_col)
2417         res += YYFPRINTF (yyo, "-%d", end_col);
2418     }
2419   return res;
2420  }
2421 
2422 #  define YY_LOCATION_PRINT(File, Loc)          \
2423   yy_location_print_ (File, &(Loc))
2424 
2425 # else
2426 #  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
2427 # endif
2428 #endif
2429 
2430 
2431 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
2432 do {                                                                      \
2433   if (yydebug)                                                            \
2434     {                                                                     \
2435       YYFPRINTF (stderr, "%s ", Title);                                   \
2436       yy_symbol_print (stderr,                                            \
2437                   Type, Value, Location, scanner, param); \
2438       YYFPRINTF (stderr, "\n");                                           \
2439     }                                                                     \
2440 } while (0)
2441 
2442 
2443 /*-----------------------------------.
2444 | Print this symbol's value on YYO.  |
2445 `-----------------------------------*/
2446 
2447 static void
yy_symbol_value_print(FILE * yyo,int yytype,YYSTYPE const * const yyvaluep,YYLTYPE const * const yylocationp,void * scanner,struct yang_parameter * param)2448 yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, void *scanner, struct yang_parameter *param)
2449 {
2450   FILE *yyoutput = yyo;
2451   YYUSE (yyoutput);
2452   YYUSE (yylocationp);
2453   YYUSE (scanner);
2454   YYUSE (param);
2455   if (!yyvaluep)
2456     return;
2457 # ifdef YYPRINT
2458   if (yytype < YYNTOKENS)
2459     YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
2460 # endif
2461   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2462   YYUSE (yytype);
2463   YY_IGNORE_MAYBE_UNINITIALIZED_END
2464 }
2465 
2466 
2467 /*---------------------------.
2468 | Print this symbol on YYO.  |
2469 `---------------------------*/
2470 
2471 static void
yy_symbol_print(FILE * yyo,int yytype,YYSTYPE const * const yyvaluep,YYLTYPE const * const yylocationp,void * scanner,struct yang_parameter * param)2472 yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, void *scanner, struct yang_parameter *param)
2473 {
2474   YYFPRINTF (yyo, "%s %s (",
2475              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
2476 
2477   YY_LOCATION_PRINT (yyo, *yylocationp);
2478   YYFPRINTF (yyo, ": ");
2479   yy_symbol_value_print (yyo, yytype, yyvaluep, yylocationp, scanner, param);
2480   YYFPRINTF (yyo, ")");
2481 }
2482 
2483 /*------------------------------------------------------------------.
2484 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
2485 | TOP (included).                                                   |
2486 `------------------------------------------------------------------*/
2487 
2488 static void
yy_stack_print(yy_state_t * yybottom,yy_state_t * yytop)2489 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
2490 {
2491   YYFPRINTF (stderr, "Stack now");
2492   for (; yybottom <= yytop; yybottom++)
2493     {
2494       int yybot = *yybottom;
2495       YYFPRINTF (stderr, " %d", yybot);
2496     }
2497   YYFPRINTF (stderr, "\n");
2498 }
2499 
2500 # define YY_STACK_PRINT(Bottom, Top)                            \
2501 do {                                                            \
2502   if (yydebug)                                                  \
2503     yy_stack_print ((Bottom), (Top));                           \
2504 } while (0)
2505 
2506 
2507 /*------------------------------------------------.
2508 | Report that the YYRULE is going to be reduced.  |
2509 `------------------------------------------------*/
2510 
2511 static void
yy_reduce_print(yy_state_t * yyssp,YYSTYPE * yyvsp,YYLTYPE * yylsp,int yyrule,void * scanner,struct yang_parameter * param)2512 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, void *scanner, struct yang_parameter *param)
2513 {
2514   int yylno = yyrline[yyrule];
2515   int yynrhs = yyr2[yyrule];
2516   int yyi;
2517   YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
2518              yyrule - 1, yylno);
2519   /* The symbols being reduced.  */
2520   for (yyi = 0; yyi < yynrhs; yyi++)
2521     {
2522       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
2523       yy_symbol_print (stderr,
2524                        yystos[yyssp[yyi + 1 - yynrhs]],
2525                        &yyvsp[(yyi + 1) - (yynrhs)]
2526                        , &(yylsp[(yyi + 1) - (yynrhs)])                       , scanner, param);
2527       YYFPRINTF (stderr, "\n");
2528     }
2529 }
2530 
2531 # define YY_REDUCE_PRINT(Rule)          \
2532 do {                                    \
2533   if (yydebug)                          \
2534     yy_reduce_print (yyssp, yyvsp, yylsp, Rule, scanner, param); \
2535 } while (0)
2536 
2537 /* Nonzero means print parse trace.  It is left uninitialized so that
2538    multiple parsers can coexist.  */
2539 int yydebug;
2540 #else /* !YYDEBUG */
2541 # define YYDPRINTF(Args)
2542 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
2543 # define YY_STACK_PRINT(Bottom, Top)
2544 # define YY_REDUCE_PRINT(Rule)
2545 #endif /* !YYDEBUG */
2546 
2547 
2548 /* YYINITDEPTH -- initial size of the parser's stacks.  */
2549 #ifndef YYINITDEPTH
2550 # define YYINITDEPTH 200
2551 #endif
2552 
2553 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
2554    if the built-in stack extension method is used).
2555 
2556    Do not make this value too large; the results are undefined if
2557    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
2558    evaluated with infinite-precision integer arithmetic.  */
2559 
2560 #ifndef YYMAXDEPTH
2561 # define YYMAXDEPTH 10000
2562 #endif
2563 
2564 
2565 #if YYERROR_VERBOSE
2566 
2567 # ifndef yystrlen
2568 #  if defined __GLIBC__ && defined _STRING_H
2569 #   define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
2570 #  else
2571 /* Return the length of YYSTR.  */
2572 static YYPTRDIFF_T
yystrlen(const char * yystr)2573 yystrlen (const char *yystr)
2574 {
2575   YYPTRDIFF_T yylen;
2576   for (yylen = 0; yystr[yylen]; yylen++)
2577     continue;
2578   return yylen;
2579 }
2580 #  endif
2581 # endif
2582 
2583 # ifndef yystpcpy
2584 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
2585 #   define yystpcpy stpcpy
2586 #  else
2587 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
2588    YYDEST.  */
2589 static char *
yystpcpy(char * yydest,const char * yysrc)2590 yystpcpy (char *yydest, const char *yysrc)
2591 {
2592   char *yyd = yydest;
2593   const char *yys = yysrc;
2594 
2595   while ((*yyd++ = *yys++) != '\0')
2596     continue;
2597 
2598   return yyd - 1;
2599 }
2600 #  endif
2601 # endif
2602 
2603 # ifndef yytnamerr
2604 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
2605    quotes and backslashes, so that it's suitable for yyerror.  The
2606    heuristic is that double-quoting is unnecessary unless the string
2607    contains an apostrophe, a comma, or backslash (other than
2608    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
2609    null, do not copy; instead, return the length of what the result
2610    would have been.  */
2611 static YYPTRDIFF_T
yytnamerr(char * yyres,const char * yystr)2612 yytnamerr (char *yyres, const char *yystr)
2613 {
2614   if (*yystr == '"')
2615     {
2616       YYPTRDIFF_T yyn = 0;
2617       char const *yyp = yystr;
2618 
2619       for (;;)
2620         switch (*++yyp)
2621           {
2622           case '\'':
2623           case ',':
2624             goto do_not_strip_quotes;
2625 
2626           case '\\':
2627             if (*++yyp != '\\')
2628               goto do_not_strip_quotes;
2629             else
2630               goto append;
2631 
2632           append:
2633           default:
2634             if (yyres)
2635               yyres[yyn] = *yyp;
2636             yyn++;
2637             break;
2638 
2639           case '"':
2640             if (yyres)
2641               yyres[yyn] = '\0';
2642             return yyn;
2643           }
2644     do_not_strip_quotes: ;
2645     }
2646 
2647   if (yyres)
2648     return yystpcpy (yyres, yystr) - yyres;
2649   else
2650     return yystrlen (yystr);
2651 }
2652 # endif
2653 
2654 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
2655    about the unexpected token YYTOKEN for the state stack whose top is
2656    YYSSP.
2657 
2658    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
2659    not large enough to hold the message.  In that case, also set
2660    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
2661    required number of bytes is too large to store.  */
2662 static int
yysyntax_error(YYPTRDIFF_T * yymsg_alloc,char ** yymsg,yy_state_t * yyssp,int yytoken)2663 yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
2664                 yy_state_t *yyssp, int yytoken)
2665 {
2666   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
2667   /* Internationalized format string. */
2668   const char *yyformat = YY_NULLPTR;
2669   /* Arguments of yyformat: reported tokens (one for the "unexpected",
2670      one per "expected"). */
2671   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
2672   /* Actual size of YYARG. */
2673   int yycount = 0;
2674   /* Cumulated lengths of YYARG.  */
2675   YYPTRDIFF_T yysize = 0;
2676 
2677   /* There are many possibilities here to consider:
2678      - If this state is a consistent state with a default action, then
2679        the only way this function was invoked is if the default action
2680        is an error action.  In that case, don't check for expected
2681        tokens because there are none.
2682      - The only way there can be no lookahead present (in yychar) is if
2683        this state is a consistent state with a default action.  Thus,
2684        detecting the absence of a lookahead is sufficient to determine
2685        that there is no unexpected or expected token to report.  In that
2686        case, just report a simple "syntax error".
2687      - Don't assume there isn't a lookahead just because this state is a
2688        consistent state with a default action.  There might have been a
2689        previous inconsistent state, consistent state with a non-default
2690        action, or user semantic action that manipulated yychar.
2691      - Of course, the expected token list depends on states to have
2692        correct lookahead information, and it depends on the parser not
2693        to perform extra reductions after fetching a lookahead from the
2694        scanner and before detecting a syntax error.  Thus, state merging
2695        (from LALR or IELR) and default reductions corrupt the expected
2696        token list.  However, the list is correct for canonical LR with
2697        one exception: it will still contain any token that will not be
2698        accepted due to an error action in a later state.
2699   */
2700   if (yytoken != YYEMPTY)
2701     {
2702       int yyn = yypact[*yyssp];
2703       YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
2704       yysize = yysize0;
2705       yyarg[yycount++] = yytname[yytoken];
2706       if (!yypact_value_is_default (yyn))
2707         {
2708           /* Start YYX at -YYN if negative to avoid negative indexes in
2709              YYCHECK.  In other words, skip the first -YYN actions for
2710              this state because they are default actions.  */
2711           int yyxbegin = yyn < 0 ? -yyn : 0;
2712           /* Stay within bounds of both yycheck and yytname.  */
2713           int yychecklim = YYLAST - yyn + 1;
2714           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
2715           int yyx;
2716 
2717           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
2718             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
2719                 && !yytable_value_is_error (yytable[yyx + yyn]))
2720               {
2721                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
2722                   {
2723                     yycount = 1;
2724                     yysize = yysize0;
2725                     break;
2726                   }
2727                 yyarg[yycount++] = yytname[yyx];
2728                 {
2729                   YYPTRDIFF_T yysize1
2730                     = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
2731                   if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
2732                     yysize = yysize1;
2733                   else
2734                     return 2;
2735                 }
2736               }
2737         }
2738     }
2739 
2740   switch (yycount)
2741     {
2742 # define YYCASE_(N, S)                      \
2743       case N:                               \
2744         yyformat = S;                       \
2745       break
2746     default: /* Avoid compiler warnings. */
2747       YYCASE_(0, YY_("syntax error"));
2748       YYCASE_(1, YY_("syntax error, unexpected %s"));
2749       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
2750       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
2751       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
2752       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
2753 # undef YYCASE_
2754     }
2755 
2756   {
2757     /* Don't count the "%s"s in the final size, but reserve room for
2758        the terminator.  */
2759     YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
2760     if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
2761       yysize = yysize1;
2762     else
2763       return 2;
2764   }
2765 
2766   if (*yymsg_alloc < yysize)
2767     {
2768       *yymsg_alloc = 2 * yysize;
2769       if (! (yysize <= *yymsg_alloc
2770              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
2771         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
2772       return 1;
2773     }
2774 
2775   /* Avoid sprintf, as that infringes on the user's name space.
2776      Don't have undefined behavior even if the translation
2777      produced a string with the wrong number of "%s"s.  */
2778   {
2779     char *yyp = *yymsg;
2780     int yyi = 0;
2781     while ((*yyp = *yyformat) != '\0')
2782       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
2783         {
2784           yyp += yytnamerr (yyp, yyarg[yyi++]);
2785           yyformat += 2;
2786         }
2787       else
2788         {
2789           ++yyp;
2790           ++yyformat;
2791         }
2792   }
2793   return 0;
2794 }
2795 #endif /* YYERROR_VERBOSE */
2796 
2797 /*-----------------------------------------------.
2798 | Release the memory associated to this symbol.  |
2799 `-----------------------------------------------*/
2800 
2801 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep,YYLTYPE * yylocationp,void * scanner,struct yang_parameter * param)2802 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, void *scanner, struct yang_parameter *param)
2803 {
2804   YYUSE (yyvaluep);
2805   YYUSE (yylocationp);
2806   YYUSE (scanner);
2807   YYUSE (param);
2808   if (!yymsg)
2809     yymsg = "Deleting";
2810   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
2811 
2812   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2813   switch (yytype)
2814     {
2815     case 115: /* tmp_string  */
2816             { free((((*yyvaluep).p_str)) ? *((*yyvaluep).p_str) : NULL); }
2817         break;
2818 
2819     case 210: /* pattern_arg_str  */
2820             { free(((*yyvaluep).str)); }
2821         break;
2822 
2823     case 399: /* semicolom  */
2824             { free(((*yyvaluep).str)); }
2825         break;
2826 
2827     case 401: /* curly_bracket_open  */
2828             { free(((*yyvaluep).str)); }
2829         break;
2830 
2831     case 405: /* string_opt_part1  */
2832             { free(((*yyvaluep).str)); }
2833         break;
2834 
2835     case 430: /* type_ext_alloc  */
2836             { yang_type_free(param->module->ctx, ((*yyvaluep).v)); }
2837         break;
2838 
2839     case 431: /* typedef_ext_alloc  */
2840             { yang_type_free(param->module->ctx, &((struct lys_tpdf *)((*yyvaluep).v))->type); }
2841         break;
2842 
2843       default:
2844         break;
2845     }
2846   YY_IGNORE_MAYBE_UNINITIALIZED_END
2847 }
2848 
2849 
2850 
2851 
2852 /*----------.
2853 | yyparse.  |
2854 `----------*/
2855 
2856 int
yyparse(void * scanner,struct yang_parameter * param)2857 yyparse (void *scanner, struct yang_parameter *param)
2858 {
2859 /* The lookahead symbol.  */
2860 int yychar;
2861 char *s = NULL, *tmp_s = NULL, *ext_name = NULL;
2862 struct lys_module *trg = NULL;
2863 struct lys_node *tpdf_parent = NULL, *data_node = NULL;
2864 struct lys_ext_instance_complex *ext_instance = NULL;
2865 int is_ext_instance;
2866 void *actual = NULL;
2867 enum yytokentype backup_type, actual_type = MODULE_KEYWORD;
2868 int64_t cnt_val = 0;
2869 int is_value = 0;
2870 void *yang_type = NULL;
2871 
2872 
2873 /* The semantic value of the lookahead symbol.  */
2874 /* Default value used for initialization, for pacifying older GCCs
2875    or non-GCC compilers.  */
2876 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
2877 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
2878 
2879 /* Location data for the lookahead symbol.  */
2880 static YYLTYPE yyloc_default
2881 # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
2882   = { 1, 1, 1, 1 }
2883 # endif
2884 ;
2885 YYLTYPE yylloc = yyloc_default;
2886 
2887     /* Number of syntax errors so far.  */
2888     int yynerrs;
2889 
2890     yy_state_fast_t yystate;
2891     /* Number of tokens to shift before error messages enabled.  */
2892     int yyerrstatus;
2893 
2894     /* The stacks and their tools:
2895        'yyss': related to states.
2896        'yyvs': related to semantic values.
2897        'yyls': related to locations.
2898 
2899        Refer to the stacks through separate pointers, to allow yyoverflow
2900        to reallocate them elsewhere.  */
2901 
2902     /* The state stack.  */
2903     yy_state_t yyssa[YYINITDEPTH];
2904     yy_state_t *yyss;
2905     yy_state_t *yyssp;
2906 
2907     /* The semantic value stack.  */
2908     YYSTYPE yyvsa[YYINITDEPTH];
2909     YYSTYPE *yyvs;
2910     YYSTYPE *yyvsp;
2911 
2912     /* The location stack.  */
2913     YYLTYPE yylsa[YYINITDEPTH];
2914     YYLTYPE *yyls;
2915     YYLTYPE *yylsp;
2916 
2917     /* The locations where the error started and ended.  */
2918     YYLTYPE yyerror_range[3];
2919 
2920     YYPTRDIFF_T yystacksize;
2921 
2922   int yyn;
2923   int yyresult;
2924   /* Lookahead token as an internal (translated) token number.  */
2925   int yytoken = 0;
2926   /* The variables used to return semantic value and location from the
2927      action routines.  */
2928   YYSTYPE yyval;
2929   YYLTYPE yyloc;
2930 
2931 #if YYERROR_VERBOSE
2932   /* Buffer for error messages, and its allocated size.  */
2933   char yymsgbuf[128];
2934   char *yymsg = yymsgbuf;
2935   YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
2936 #endif
2937 
2938 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
2939 
2940   /* The number of symbols on the RHS of the reduced rule.
2941      Keep to zero when no symbol should be popped.  */
2942   int yylen = 0;
2943 
2944   yyssp = yyss = yyssa;
2945   yyvsp = yyvs = yyvsa;
2946   yylsp = yyls = yylsa;
2947   yystacksize = YYINITDEPTH;
2948 
2949   YYDPRINTF ((stderr, "Starting parse\n"));
2950 
2951   yystate = 0;
2952   yyerrstatus = 0;
2953   yynerrs = 0;
2954   yychar = YYEMPTY; /* Cause a token to be read.  */
2955 
2956 /* User initialization code.  */
2957 { yylloc.last_column = 0;
2958                   if (param->flags & EXT_INSTANCE_SUBSTMT) {
2959                     is_ext_instance = 1;
2960                     ext_instance = (struct lys_ext_instance_complex *)param->actual_node;
2961                     ext_name = (char *)param->data_node;
2962                   } else {
2963                     is_ext_instance = 0;
2964                   }
2965                   yylloc.last_line = is_ext_instance;     /* HACK for flex - return SUBMODULE_KEYWORD or SUBMODULE_EXT_KEYWORD */
2966                   param->value = &s;
2967                   param->data_node = (void **)&data_node;
2968                   param->actual_node = &actual;
2969                   backup_type = NODE;
2970                   trg = (param->submodule) ? (struct lys_module *)param->submodule : param->module;
2971                 }
2972 
2973 
2974   yylsp[0] = yylloc;
2975   goto yysetstate;
2976 
2977 
2978 /*------------------------------------------------------------.
2979 | yynewstate -- push a new state, which is found in yystate.  |
2980 `------------------------------------------------------------*/
2981 yynewstate:
2982   /* In all cases, when you get here, the value and location stacks
2983      have just been pushed.  So pushing a state here evens the stacks.  */
2984   yyssp++;
2985 
2986 
2987 /*--------------------------------------------------------------------.
2988 | yysetstate -- set current state (the top of the stack) to yystate.  |
2989 `--------------------------------------------------------------------*/
2990 yysetstate:
2991   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
2992   YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
2993   YY_IGNORE_USELESS_CAST_BEGIN
2994   *yyssp = YY_CAST (yy_state_t, yystate);
2995   YY_IGNORE_USELESS_CAST_END
2996 
2997   if (yyss + yystacksize - 1 <= yyssp)
2998 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
2999     goto yyexhaustedlab;
3000 #else
3001     {
3002       /* Get the current used size of the three stacks, in elements.  */
3003       YYPTRDIFF_T yysize = yyssp - yyss + 1;
3004 
3005 # if defined yyoverflow
3006       {
3007         /* Give user a chance to reallocate the stack.  Use copies of
3008            these so that the &'s don't force the real ones into
3009            memory.  */
3010         yy_state_t *yyss1 = yyss;
3011         YYSTYPE *yyvs1 = yyvs;
3012         YYLTYPE *yyls1 = yyls;
3013 
3014         /* Each stack pointer address is followed by the size of the
3015            data in use in that stack, in bytes.  This used to be a
3016            conditional around just the two extra args, but that might
3017            be undefined if yyoverflow is a macro.  */
3018         yyoverflow (YY_("memory exhausted"),
3019                     &yyss1, yysize * YYSIZEOF (*yyssp),
3020                     &yyvs1, yysize * YYSIZEOF (*yyvsp),
3021                     &yyls1, yysize * YYSIZEOF (*yylsp),
3022                     &yystacksize);
3023         yyss = yyss1;
3024         yyvs = yyvs1;
3025         yyls = yyls1;
3026       }
3027 # else /* defined YYSTACK_RELOCATE */
3028       /* Extend the stack our own way.  */
3029       if (YYMAXDEPTH <= yystacksize)
3030         goto yyexhaustedlab;
3031       yystacksize *= 2;
3032       if (YYMAXDEPTH < yystacksize)
3033         yystacksize = YYMAXDEPTH;
3034 
3035       {
3036         yy_state_t *yyss1 = yyss;
3037         union yyalloc *yyptr =
3038           YY_CAST (union yyalloc *,
3039                    YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
3040         if (! yyptr)
3041           goto yyexhaustedlab;
3042         YYSTACK_RELOCATE (yyss_alloc, yyss);
3043         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
3044         YYSTACK_RELOCATE (yyls_alloc, yyls);
3045 # undef YYSTACK_RELOCATE
3046         if (yyss1 != yyssa)
3047           YYSTACK_FREE (yyss1);
3048       }
3049 # endif
3050 
3051       yyssp = yyss + yysize - 1;
3052       yyvsp = yyvs + yysize - 1;
3053       yylsp = yyls + yysize - 1;
3054 
3055       YY_IGNORE_USELESS_CAST_BEGIN
3056       YYDPRINTF ((stderr, "Stack size increased to %ld\n",
3057                   YY_CAST (long, yystacksize)));
3058       YY_IGNORE_USELESS_CAST_END
3059 
3060       if (yyss + yystacksize - 1 <= yyssp)
3061         YYABORT;
3062     }
3063 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
3064 
3065   if (yystate == YYFINAL)
3066     YYACCEPT;
3067 
3068   goto yybackup;
3069 
3070 
3071 /*-----------.
3072 | yybackup.  |
3073 `-----------*/
3074 yybackup:
3075   /* Do appropriate processing given the current state.  Read a
3076      lookahead token if we need one and don't already have one.  */
3077 
3078   /* First try to decide what to do without reference to lookahead token.  */
3079   yyn = yypact[yystate];
3080   if (yypact_value_is_default (yyn))
3081     goto yydefault;
3082 
3083   /* Not known => get a lookahead token if don't already have one.  */
3084 
3085   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
3086   if (yychar == YYEMPTY)
3087     {
3088       YYDPRINTF ((stderr, "Reading a token: "));
3089       yychar = yylex (&yylval, &yylloc, scanner);
3090     }
3091 
3092   if (yychar <= YYEOF)
3093     {
3094       yychar = yytoken = YYEOF;
3095       YYDPRINTF ((stderr, "Now at end of input.\n"));
3096     }
3097   else
3098     {
3099       yytoken = YYTRANSLATE (yychar);
3100       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
3101     }
3102 
3103   /* If the proper action on seeing token YYTOKEN is to reduce or to
3104      detect an error, take that action.  */
3105   yyn += yytoken;
3106   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
3107     goto yydefault;
3108   yyn = yytable[yyn];
3109   if (yyn <= 0)
3110     {
3111       if (yytable_value_is_error (yyn))
3112         goto yyerrlab;
3113       yyn = -yyn;
3114       goto yyreduce;
3115     }
3116 
3117   /* Count tokens shifted since error; after three, turn off error
3118      status.  */
3119   if (yyerrstatus)
3120     yyerrstatus--;
3121 
3122   /* Shift the lookahead token.  */
3123   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
3124   yystate = yyn;
3125   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
3126   *++yyvsp = yylval;
3127   YY_IGNORE_MAYBE_UNINITIALIZED_END
3128   *++yylsp = yylloc;
3129 
3130   /* Discard the shifted token.  */
3131   yychar = YYEMPTY;
3132   goto yynewstate;
3133 
3134 
3135 /*-----------------------------------------------------------.
3136 | yydefault -- do the default action for the current state.  |
3137 `-----------------------------------------------------------*/
3138 yydefault:
3139   yyn = yydefact[yystate];
3140   if (yyn == 0)
3141     goto yyerrlab;
3142   goto yyreduce;
3143 
3144 
3145 /*-----------------------------.
3146 | yyreduce -- do a reduction.  |
3147 `-----------------------------*/
3148 yyreduce:
3149   /* yyn is the number of a rule to reduce with.  */
3150   yylen = yyr2[yyn];
3151 
3152   /* If YYLEN is nonzero, implement the default value of the action:
3153      '$$ = $1'.
3154 
3155      Otherwise, the following line sets YYVAL to garbage.
3156      This behavior is undocumented and Bison
3157      users should not rely upon it.  Assigning to YYVAL
3158      unconditionally makes the parser a bit smaller, and it avoids a
3159      GCC warning that YYVAL may be used uninitialized.  */
3160   yyval = yyvsp[1-yylen];
3161 
3162   /* Default location. */
3163   YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
3164   yyerror_range[1] = yyloc;
3165   YY_REDUCE_PRINT (yyn);
3166   switch (yyn)
3167     {
3168   case 5:
3169                    { if (yyget_text(scanner)[0] == '"') {
3170                       char *tmp;
3171 
3172                       s = malloc(yyget_leng(scanner) - 1 + 7 * yylval.i);
3173                       if (!s) {
3174                         LOGMEM(trg->ctx);
3175                         YYABORT;
3176                       }
3177                       if (!(tmp = yang_read_string(trg->ctx, yyget_text(scanner) + 1, s, yyget_leng(scanner) - 2, 0, yylloc.first_column))) {
3178                         YYABORT;
3179                       }
3180                       s = tmp;
3181                     } else {
3182                       s = calloc(1, yyget_leng(scanner) - 1);
3183                       if (!s) {
3184                         LOGMEM(trg->ctx);
3185                         YYABORT;
3186                       }
3187                       memcpy(s, yyget_text(scanner) + 1, yyget_leng(scanner) - 2);
3188                     }
3189                     (yyval.p_str) = &s;
3190                   }
3191     break;
3192 
3193   case 8:
3194             { if (yyget_leng(scanner) > 2) {
3195                 int length_s = strlen(s), length_tmp = yyget_leng(scanner);
3196                 char *tmp;
3197 
3198                 tmp = realloc(s, length_s + length_tmp - 1);
3199                 if (!tmp) {
3200                   LOGMEM(trg->ctx);
3201                   YYABORT;
3202                 }
3203                 s = tmp;
3204                 if (yyget_text(scanner)[0] == '"') {
3205                   if (!(tmp = yang_read_string(trg->ctx, yyget_text(scanner) + 1, s, length_tmp - 2, length_s, yylloc.first_column))) {
3206                     YYABORT;
3207                   }
3208                   s = tmp;
3209                 } else {
3210                   memcpy(s + length_s, yyget_text(scanner) + 1, length_tmp - 2);
3211                   s[length_s + length_tmp - 2] = '\0';
3212                 }
3213               }
3214             }
3215     break;
3216 
3217   case 10:
3218                                    { if (param->submodule) {
3219                                        free(s);
3220                                        LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, "module");
3221                                        YYABORT;
3222                                      }
3223                                      trg = param->module;
3224                                      if (yang_read_common(trg,s,MODULE_KEYWORD)) {
3225                                        YYABORT;
3226                                      }
3227                                      s = NULL;
3228                                      actual_type = MODULE_KEYWORD;
3229                                    }
3230     break;
3231 
3232   case 12:
3233                                         { if (!param->module->ns) {
3234                                             LOGVAL(trg->ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, "namespace", "module");
3235                                             YYABORT;
3236                                           }
3237                                           if (!param->module->prefix) {
3238                                             LOGVAL(trg->ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, "prefix", "module");
3239                                             YYABORT;
3240                                           }
3241                                         }
3242     break;
3243 
3244   case 13:
3245                             { (yyval.i) = 0; }
3246     break;
3247 
3248   case 14:
3249                                           { if (yang_check_version(param->module, param->submodule, s, (yyvsp[-1].i))) {
3250                                               YYABORT;
3251                                             }
3252                                             (yyval.i) = 1;
3253                                             s = NULL;
3254                                           }
3255     break;
3256 
3257   case 15:
3258                                        { if (yang_read_common(param->module, s, NAMESPACE_KEYWORD)) {
3259                                            YYABORT;
3260                                          }
3261                                          s = NULL;
3262                                        }
3263     break;
3264 
3265   case 16:
3266                                     { if (yang_read_prefix(trg, NULL, s)) {
3267                                         YYABORT;
3268                                       }
3269                                       s = NULL;
3270                                     }
3271     break;
3272 
3273   case 17:
3274                                       { if (!param->submodule) {
3275                                           free(s);
3276                                           LOGVAL(trg->ctx, LYE_SUBMODULE, LY_VLOG_NONE, NULL);
3277                                           YYABORT;
3278                                         }
3279                                         trg = (struct lys_module *)param->submodule;
3280                                         if (yang_read_common(trg,s,MODULE_KEYWORD)) {
3281                                           YYABORT;
3282                                         }
3283                                         s = NULL;
3284                                         actual_type = SUBMODULE_KEYWORD;
3285                                       }
3286     break;
3287 
3288   case 19:
3289                                               { if (!param->submodule->prefix) {
3290                                                   LOGVAL(trg->ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, "belongs-to", "submodule");
3291                                                   YYABORT;
3292                                                 }
3293                                                 if (!(yyvsp[0].i)) {
3294                                                   /* check version compatibility with the main module */
3295                                                   if (param->module->version > 1) {
3296                                                       LOGVAL(trg->ctx, LYE_INVER, LY_VLOG_NONE, NULL);
3297                                                       YYABORT;
3298                                                   }
3299                                                 }
3300                                               }
3301     break;
3302 
3303   case 20:
3304                               { (yyval.i) = 0; }
3305     break;
3306 
3307   case 21:
3308                                              { if (yang_check_version(param->module, param->submodule, s, (yyvsp[-1].i))) {
3309                                                  YYABORT;
3310                                                }
3311                                                (yyval.i) = 1;
3312                                                s = NULL;
3313                                              }
3314     break;
3315 
3316   case 23:
3317                          { backup_type = actual_type;
3318                            actual_type = YANG_VERSION_KEYWORD;
3319                          }
3320     break;
3321 
3322   case 25:
3323                           { backup_type = actual_type;
3324                             actual_type = NAMESPACE_KEYWORD;
3325                           }
3326     break;
3327 
3328   case 30:
3329                  { actual_type = (yyvsp[-4].token);
3330                    backup_type = NODE;
3331                    actual = NULL;
3332                  }
3333     break;
3334 
3335   case 31:
3336                                    { YANG_ADDELEM(trg->imp, trg->imp_size, "imports");
3337                                      /* HACK for unres */
3338                                      ((struct lys_import *)actual)->module = (struct lys_module *)s;
3339                                      s = NULL;
3340                                      (yyval.token) = actual_type;
3341                                      actual_type = IMPORT_KEYWORD;
3342                                    }
3343     break;
3344 
3345   case 32:
3346                         { (yyval.i) = 0; }
3347     break;
3348 
3349   case 33:
3350                                  { if (yang_read_prefix(trg, actual, s)) {
3351                                      YYABORT;
3352                                    }
3353                                    s = NULL;
3354                                  }
3355     break;
3356 
3357   case 34:
3358                                       { if (trg->version != 2) {
3359                                           LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, "description");
3360                                           free(s);
3361                                           YYABORT;
3362                                         }
3363                                         if (yang_read_description(trg, actual, s, "import", IMPORT_KEYWORD)) {
3364                                           YYABORT;
3365                                         }
3366                                         s = NULL;
3367                                         (yyval.i) = (yyvsp[-1].i);
3368                                       }
3369     break;
3370 
3371   case 35:
3372                                     { if (trg->version != 2) {
3373                                         LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, "reference");
3374                                         free(s);
3375                                         YYABORT;
3376                                       }
3377                                       if (yang_read_reference(trg, actual, s, "import", IMPORT_KEYWORD)) {
3378                                         YYABORT;
3379                                       }
3380                                       s = NULL;
3381                                       (yyval.i) = (yyvsp[-1].i);
3382                                     }
3383     break;
3384 
3385   case 36:
3386                                         { if ((yyvsp[-1].i)) {
3387                                             LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "revision-date", "import");
3388                                             free(s);
3389                                             YYABORT;
3390                                           }
3391                                           memcpy(((struct lys_import *)actual)->rev, s, LY_REV_SIZE-1);
3392                                           free(s);
3393                                           s = NULL;
3394                                           (yyval.i) = 1;
3395                                         }
3396     break;
3397 
3398   case 37:
3399                                     { YANG_ADDELEM(trg->inc, trg->inc_size, "includes");
3400                                      /* HACK for unres */
3401                                      ((struct lys_include *)actual)->submodule = (struct lys_submodule *)s;
3402                                      s = NULL;
3403                                      (yyval.token) = actual_type;
3404                                      actual_type = INCLUDE_KEYWORD;
3405                                    }
3406     break;
3407 
3408   case 38:
3409                                                               { actual_type = (yyvsp[-1].token);
3410                                                                 backup_type = NODE;
3411                                                                 actual = NULL;
3412                                                               }
3413     break;
3414 
3415   case 41:
3416                          { (yyval.i) = 0; }
3417     break;
3418 
3419   case 42:
3420                                        { if (trg->version != 2) {
3421                                            LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, "description");
3422                                            free(s);
3423                                            YYABORT;
3424                                          }
3425                                          if (yang_read_description(trg, actual, s, "include", INCLUDE_KEYWORD)) {
3426                                             YYABORT;
3427                                          }
3428                                          s = NULL;
3429                                          (yyval.i) = (yyvsp[-1].i);
3430                                        }
3431     break;
3432 
3433   case 43:
3434                                      { if (trg->version != 2) {
3435                                          LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, "reference");
3436                                          free(s);
3437                                          YYABORT;
3438                                        }
3439                                        if (yang_read_reference(trg, actual, s, "include", INCLUDE_KEYWORD)) {
3440                                          YYABORT;
3441                                        }
3442                                        s = NULL;
3443                                        (yyval.i) = (yyvsp[-1].i);
3444                                      }
3445     break;
3446 
3447   case 44:
3448                                          { if ((yyvsp[-1].i)) {
3449                                              LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "revision-date", "include");
3450                                              free(s);
3451                                              YYABORT;
3452                                            }
3453                                            memcpy(((struct lys_include *)actual)->rev, s, LY_REV_SIZE-1);
3454                                            free(s);
3455                                            s = NULL;
3456                                            (yyval.i) = 1;
3457                                          }
3458     break;
3459 
3460   case 45:
3461                                 { backup_type = actual_type;
3462                                   actual_type = REVISION_DATE_KEYWORD;
3463                                 }
3464     break;
3465 
3466   case 47:
3467                                        { (yyval.token) = actual_type;
3468                                          if (is_ext_instance) {
3469                                            if (yang_read_extcomplex_str(trg, ext_instance, "belongs-to", ext_name, &s,
3470                                                                         0, LY_STMT_BELONGSTO)) {
3471                                              YYABORT;
3472                                            }
3473                                          } else {
3474                                            if (param->submodule->prefix) {
3475                                              LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "belongs-to", "submodule");
3476                                              free(s);
3477                                              YYABORT;
3478                                            }
3479                                            if (!ly_strequal(s, param->submodule->belongsto->name, 0)) {
3480                                              LOGVAL(trg->ctx, LYE_INARG, LY_VLOG_NONE, NULL, s, "belongs-to");
3481                                              free(s);
3482                                              YYABORT;
3483                                            }
3484                                            free(s);
3485                                          }
3486                                          s = NULL;
3487                                          actual_type = BELONGS_TO_KEYWORD;
3488                                        }
3489     break;
3490 
3491   case 48:
3492                      { if (is_ext_instance) {
3493                          if (yang_read_extcomplex_str(trg, ext_instance, "prefix", "belongs-to", &s,
3494                                                       LY_STMT_BELONGSTO, LY_STMT_PREFIX)) {
3495                            YYABORT;
3496                          }
3497                        } else {
3498                          if (yang_read_prefix(trg, NULL, s)) {
3499                            YYABORT;
3500                          }
3501                        }
3502                        s = NULL;
3503                        actual_type = (yyvsp[-4].token);
3504                      }
3505     break;
3506 
3507   case 49:
3508                            { backup_type = actual_type;
3509                              actual_type = PREFIX_KEYWORD;
3510                            }
3511     break;
3512 
3513   case 52:
3514                                   { if (yang_read_common(trg, s, ORGANIZATION_KEYWORD)) {
3515                                       YYABORT;
3516                                     }
3517                                     s = NULL;
3518                                   }
3519     break;
3520 
3521   case 53:
3522                              { if (yang_read_common(trg, s, CONTACT_KEYWORD)) {
3523                                  YYABORT;
3524                                }
3525                                s = NULL;
3526                              }
3527     break;
3528 
3529   case 54:
3530                                  { if (yang_read_description(trg, NULL, s, NULL, MODULE_KEYWORD)) {
3531                                      YYABORT;
3532                                    }
3533                                    s = NULL;
3534                                  }
3535     break;
3536 
3537   case 55:
3538                                { if (yang_read_reference(trg, NULL, s, NULL, MODULE_KEYWORD)) {
3539                                    YYABORT;
3540                                  }
3541                                  s=NULL;
3542                                }
3543     break;
3544 
3545   case 56:
3546                          { backup_type = actual_type;
3547                            actual_type = ORGANIZATION_KEYWORD;
3548                          }
3549     break;
3550 
3551   case 58:
3552                     { backup_type = actual_type;
3553                       actual_type = CONTACT_KEYWORD;
3554                     }
3555     break;
3556 
3557   case 60:
3558                         { backup_type = actual_type;
3559                           actual_type = DESCRIPTION_KEYWORD;
3560                         }
3561     break;
3562 
3563   case 62:
3564                       { backup_type = actual_type;
3565                         actual_type = REFERENCE_KEYWORD;
3566                       }
3567     break;
3568 
3569   case 64:
3570                                    { if (trg->rev_size) {
3571                                       struct lys_revision *tmp;
3572 
3573                                       tmp = realloc(trg->rev, trg->rev_size * sizeof *trg->rev);
3574                                       if (!tmp) {
3575                                         LOGMEM(trg->ctx);
3576                                         YYABORT;
3577                                       }
3578                                       trg->rev = tmp;
3579                                     }
3580                                   }
3581     break;
3582 
3583   case 65:
3584                                 { (yyval.backup_token).token = actual_type;
3585                                   (yyval.backup_token).actual = actual;
3586                                   if (!is_ext_instance) {
3587                                     YANG_ADDELEM(trg->rev, trg->rev_size, "revisions");
3588                                   }
3589                                   memcpy(((struct lys_revision *)actual)->date, s, LY_REV_SIZE);
3590                                   free(s);
3591                                   s = NULL;
3592                                   actual_type = REVISION_KEYWORD;
3593                                 }
3594     break;
3595 
3596   case 67:
3597                                               { int i;
3598 
3599                                                 /* check uniqueness of the revision date - not required by RFC */
3600                                                 for (i = 0; i < (trg->rev_size - 1); i++) {
3601                                                   if (!strcmp(trg->rev[i].date, trg->rev[trg->rev_size - 1].date)) {
3602                                                     LOGWRN(trg->ctx, "Module's revisions are not unique (%s).",
3603                                                            trg->rev[trg->rev_size - 1].date);
3604                                                     break;
3605                                                   }
3606                                                 }
3607                                               }
3608     break;
3609 
3610   case 68:
3611                                                                    { actual_type = (yyvsp[-1].backup_token).token;
3612                                                                      actual = (yyvsp[-1].backup_token).actual;
3613                                                                    }
3614     break;
3615 
3616   case 72:
3617                                         { if (yang_read_description(trg, actual, s, "revision",REVISION_KEYWORD)) {
3618                                             YYABORT;
3619                                           }
3620                                           s = NULL;
3621                                         }
3622     break;
3623 
3624   case 73:
3625                                       { if (yang_read_reference(trg, actual, s, "revision", REVISION_KEYWORD)) {
3626                                           YYABORT;
3627                                         }
3628                                         s = NULL;
3629                                       }
3630     break;
3631 
3632   case 74:
3633                             { s = strdup(yyget_text(scanner));
3634                               if (!s) {
3635                                 LOGMEM(trg->ctx);
3636                                 YYABORT;
3637                               }
3638                               if (lyp_check_date(trg->ctx, s)) {
3639                                   free(s);
3640                                   YYABORT;
3641                               }
3642                             }
3643     break;
3644 
3645   case 76:
3646              { if (lyp_check_date(trg->ctx, s)) {
3647                    free(s);
3648                    YYABORT;
3649                }
3650              }
3651     break;
3652 
3653   case 77:
3654                            { void *tmp;
3655 
3656                              if (trg->tpdf_size) {
3657                                tmp = realloc(trg->tpdf, trg->tpdf_size * sizeof *trg->tpdf);
3658                                if (!tmp) {
3659                                  LOGMEM(trg->ctx);
3660                                  YYABORT;
3661                                }
3662                                trg->tpdf = tmp;
3663                              }
3664 
3665                              if (trg->features_size) {
3666                                tmp = realloc(trg->features, trg->features_size * sizeof *trg->features);
3667                                if (!tmp) {
3668                                  LOGMEM(trg->ctx);
3669                                  YYABORT;
3670                                }
3671                                trg->features = tmp;
3672                              }
3673 
3674                              if (trg->ident_size) {
3675                                tmp = realloc(trg->ident, trg->ident_size * sizeof *trg->ident);
3676                                if (!tmp) {
3677                                  LOGMEM(trg->ctx);
3678                                  YYABORT;
3679                                }
3680                                trg->ident = tmp;
3681                              }
3682 
3683                              if (trg->augment_size) {
3684                                tmp = realloc(trg->augment, trg->augment_size * sizeof *trg->augment);
3685                                if (!tmp) {
3686                                  LOGMEM(trg->ctx);
3687                                  YYABORT;
3688                                }
3689                                trg->augment = tmp;
3690                              }
3691 
3692                              if (trg->extensions_size) {
3693                                tmp = realloc(trg->extensions, trg->extensions_size * sizeof *trg->extensions);
3694                                if (!tmp) {
3695                                  LOGMEM(trg->ctx);
3696                                  YYABORT;
3697                                }
3698                                trg->extensions = tmp;
3699                              }
3700                            }
3701     break;
3702 
3703   case 78:
3704                    { /* check the module with respect to the context now */
3705                          if (!param->submodule) {
3706                            switch (lyp_ctx_check_module(trg)) {
3707                            case -1:
3708                              YYABORT;
3709                            case 0:
3710                              break;
3711                            case 1:
3712                              /* it's already there */
3713                              param->flags |= YANG_EXIST_MODULE;
3714                              YYABORT;
3715                            }
3716                          }
3717                          param->flags &= (~YANG_REMOVE_IMPORT);
3718                          if (yang_check_imports(trg, param->unres)) {
3719                            YYABORT;
3720                          }
3721                          actual = NULL;
3722                        }
3723     break;
3724 
3725   case 79:
3726                                  { actual = NULL; }
3727     break;
3728 
3729   case 90:
3730                                       { (yyval.backup_token).token = actual_type;
3731                                         (yyval.backup_token).actual = actual;
3732                                         YANG_ADDELEM(trg->extensions, trg->extensions_size, "extensions");
3733                                         trg->extensions_size--;
3734                                         ((struct lys_ext *)actual)->name = lydict_insert_zc(param->module->ctx, s);
3735                                         ((struct lys_ext *)actual)->module = trg;
3736                                         if (lyp_check_identifier(trg->ctx, ((struct lys_ext *)actual)->name, LY_IDENT_EXTENSION, trg, NULL)) {
3737                                           trg->extensions_size++;
3738                                           YYABORT;
3739                                         }
3740                                         trg->extensions_size++;
3741                                         s = NULL;
3742                                         actual_type = EXTENSION_KEYWORD;
3743                                       }
3744     break;
3745 
3746   case 91:
3747                 { struct lys_ext *ext = actual;
3748                   ext->plugin = ext_get_plugin(ext->name, ext->module->name, ext->module->rev ? ext->module->rev[0].date : NULL);
3749                   actual_type = (yyvsp[-1].backup_token).token;
3750                   actual = (yyvsp[-1].backup_token).actual;
3751                 }
3752     break;
3753 
3754   case 96:
3755                                     { if (((struct lys_ext *)actual)->flags & LYS_STATUS_MASK) {
3756                                         LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "status", "extension");
3757                                         YYABORT;
3758                                       }
3759                                       ((struct lys_ext *)actual)->flags |= (yyvsp[0].i);
3760                                     }
3761     break;
3762 
3763   case 97:
3764                                          { if (yang_read_description(trg, actual, s, "extension", NODE)) {
3765                                              YYABORT;
3766                                            }
3767                                            s = NULL;
3768                                          }
3769     break;
3770 
3771   case 98:
3772                                        { if (yang_read_reference(trg, actual, s, "extension", NODE)) {
3773                                            YYABORT;
3774                                          }
3775                                          s = NULL;
3776                                        }
3777     break;
3778 
3779   case 99:
3780                                  { (yyval.token) = actual_type;
3781                                    if (is_ext_instance) {
3782                                      if (yang_read_extcomplex_str(trg, ext_instance, "argument", ext_name, &s,
3783                                                                   0, LY_STMT_ARGUMENT)) {
3784                                        YYABORT;
3785                                      }
3786                                    } else {
3787                                      if (((struct lys_ext *)actual)->argument) {
3788                                         LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "argument", "extension");
3789                                         free(s);
3790                                         YYABORT;
3791                                      }
3792                                      ((struct lys_ext *)actual)->argument = lydict_insert_zc(param->module->ctx, s);
3793                                    }
3794                                    s = NULL;
3795                                    actual_type = ARGUMENT_KEYWORD;
3796                                  }
3797     break;
3798 
3799   case 100:
3800                                                                { actual_type = (yyvsp[-1].token); }
3801     break;
3802 
3803   case 103:
3804                                      { (yyval.uint) = (yyvsp[0].uint);
3805                                        backup_type = actual_type;
3806                                        actual_type = YIN_ELEMENT_KEYWORD;
3807                                      }
3808     break;
3809 
3810   case 105:
3811      { if (is_ext_instance) {
3812          int c;
3813          const char ***p;
3814          uint8_t *val;
3815          struct lyext_substmt *info;
3816 
3817          c = 0;
3818          p = lys_ext_complex_get_substmt(LY_STMT_ARGUMENT, ext_instance, &info);
3819          if (info->cardinality >= LY_STMT_CARD_SOME) {
3820            /* get the index in the array to add new item */
3821            for (c = 0; p[0][c + 1]; c++);
3822            val = (uint8_t *)p[1];
3823          } else {
3824            val = (uint8_t *)(p + 1);
3825          }
3826          val[c] = ((yyvsp[-1].uint) == LYS_YINELEM) ? 1 : 2;
3827        } else {
3828          ((struct lys_ext *)actual)->flags |= (yyvsp[-1].uint);
3829        }
3830      }
3831     break;
3832 
3833   case 106:
3834                                          { (yyval.uint) = LYS_YINELEM; }
3835     break;
3836 
3837   case 107:
3838                          { (yyval.uint) = 0; }
3839     break;
3840 
3841   case 108:
3842              { if (!strcmp(s, "true")) {
3843                  (yyval.uint) = LYS_YINELEM;
3844                } else if (!strcmp(s, "false")) {
3845                  (yyval.uint) = 0;
3846                } else {
3847                  LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, s);
3848                  free(s);
3849                  YYABORT;
3850                }
3851                free(s);
3852                s = NULL;
3853              }
3854     break;
3855 
3856   case 109:
3857                            { (yyval.i) = (yyvsp[0].i);
3858                              backup_type = actual_type;
3859                              actual_type = STATUS_KEYWORD;
3860                            }
3861     break;
3862 
3863   case 110:
3864                                                     { (yyval.i) = (yyvsp[-1].i); }
3865     break;
3866 
3867   case 111:
3868                                        { (yyval.i) = LYS_STATUS_CURR; }
3869     break;
3870 
3871   case 112:
3872                             { (yyval.i) = LYS_STATUS_OBSLT; }
3873     break;
3874 
3875   case 113:
3876                               { (yyval.i) = LYS_STATUS_DEPRC; }
3877     break;
3878 
3879   case 114:
3880              { if (!strcmp(s, "current")) {
3881                  (yyval.i) = LYS_STATUS_CURR;
3882                } else if (!strcmp(s, "obsolete")) {
3883                  (yyval.i) = LYS_STATUS_OBSLT;
3884                } else if (!strcmp(s, "deprecated")) {
3885                  (yyval.i) = LYS_STATUS_DEPRC;
3886                } else {
3887                  LOGVAL(trg->ctx,LYE_INSTMT, LY_VLOG_NONE, NULL, s);
3888                  free(s);
3889                  YYABORT;
3890                }
3891                free(s);
3892                s = NULL;
3893              }
3894     break;
3895 
3896   case 115:
3897                                     { /* check uniqueness of feature's names */
3898                                       if (lyp_check_identifier(trg->ctx, s, LY_IDENT_FEATURE, trg, NULL)) {
3899                                         free(s);
3900                                         YYABORT;
3901                                       }
3902                                       (yyval.backup_token).token = actual_type;
3903                                       (yyval.backup_token).actual = actual;
3904                                       YANG_ADDELEM(trg->features, trg->features_size, "features");
3905                                       ((struct lys_feature *)actual)->name = lydict_insert_zc(trg->ctx, s);
3906                                       ((struct lys_feature *)actual)->module = trg;
3907                                       s = NULL;
3908                                       actual_type = FEATURE_KEYWORD;
3909                                     }
3910     break;
3911 
3912   case 116:
3913               { actual = (yyvsp[-1].backup_token).actual;
3914                 actual_type = (yyvsp[-1].backup_token).token;
3915               }
3916     break;
3917 
3918   case 118:
3919         { struct lys_iffeature *tmp;
3920 
3921           if (((struct lys_feature *)actual)->iffeature_size) {
3922             tmp = realloc(((struct lys_feature *)actual)->iffeature,
3923                           ((struct lys_feature *)actual)->iffeature_size * sizeof *tmp);
3924             if (!tmp) {
3925               LOGMEM(trg->ctx);
3926               YYABORT;
3927             }
3928             ((struct lys_feature *)actual)->iffeature = tmp;
3929           }
3930         }
3931     break;
3932 
3933   case 121:
3934                                   { if (((struct lys_feature *)actual)->flags & LYS_STATUS_MASK) {
3935                                       LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "status", "feature");
3936                                       YYABORT;
3937                                     }
3938                                     ((struct lys_feature *)actual)->flags |= (yyvsp[0].i);
3939                                   }
3940     break;
3941 
3942   case 122:
3943                                        { if (yang_read_description(trg, actual, s, "feature", NODE)) {
3944                                            YYABORT;
3945                                          }
3946                                          s = NULL;
3947                                        }
3948     break;
3949 
3950   case 123:
3951                                      { if (yang_read_reference(trg, actual, s, "feature", NODE)) {
3952                                          YYABORT;
3953                                        }
3954                                        s = NULL;
3955                                      }
3956     break;
3957 
3958   case 124:
3959                        { (yyval.backup_token).token = actual_type;
3960                          (yyval.backup_token).actual = actual;
3961                          switch (actual_type) {
3962                          case FEATURE_KEYWORD:
3963                            YANG_ADDELEM(((struct lys_feature *)actual)->iffeature,
3964                                         ((struct lys_feature *)actual)->iffeature_size, "if-features");
3965                            break;
3966                          case IDENTITY_KEYWORD:
3967                            if (trg->version < 2) {
3968                              LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, "if-feature", "identity");
3969                              free(s);
3970                              YYABORT;
3971                            }
3972                            YANG_ADDELEM(((struct lys_ident *)actual)->iffeature,
3973                                         ((struct lys_ident *)actual)->iffeature_size, "if-features");
3974                            break;
3975                          case ENUM_KEYWORD:
3976                            if (trg->version < 2) {
3977                              LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, "if-feature");
3978                              free(s);
3979                              YYABORT;
3980                            }
3981                            YANG_ADDELEM(((struct lys_type_enum *)actual)->iffeature,
3982                                         ((struct lys_type_enum *)actual)->iffeature_size, "if-features");
3983                            break;
3984                          case BIT_KEYWORD:
3985                            if (trg->version < 2) {
3986                              LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, "if-feature", "bit");
3987                              free(s);
3988                              YYABORT;
3989                            }
3990                            YANG_ADDELEM(((struct lys_type_bit *)actual)->iffeature,
3991                                         ((struct lys_type_bit *)actual)->iffeature_size, "if-features");
3992                            break;
3993                          case REFINE_KEYWORD:
3994                            if (trg->version < 2) {
3995                              LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, "if-feature");
3996                              free(s);
3997                              YYABORT;
3998                            }
3999                            YANG_ADDELEM(((struct lys_refine *)actual)->iffeature,
4000                                         ((struct lys_refine *)actual)->iffeature_size, "if-features");
4001                            break;
4002                          case EXTENSION_INSTANCE:
4003                            /* nothing change */
4004                            break;
4005                          default:
4006                            /* lys_node_* */
4007                            YANG_ADDELEM(((struct lys_node *)actual)->iffeature,
4008                                         ((struct lys_node *)actual)->iffeature_size, "if-features");
4009                            break;
4010                          }
4011                          ((struct lys_iffeature *)actual)->features = (struct lys_feature **)s;
4012                          s = NULL;
4013                          actual_type = IF_FEATURE_KEYWORD;
4014                        }
4015     break;
4016 
4017   case 125:
4018                  { actual = (yyvsp[-1].backup_token).actual;
4019                    actual_type = (yyvsp[-1].backup_token).token;
4020                  }
4021     break;
4022 
4023   case 128:
4024                                      { const char *tmp;
4025 
4026                                        tmp = lydict_insert_zc(trg->ctx, s);
4027                                        s = NULL;
4028                                        if (dup_identities_check(tmp, trg)) {
4029                                          lydict_remove(trg->ctx, tmp);
4030                                          YYABORT;
4031                                        }
4032                                        (yyval.backup_token).token = actual_type;
4033                                        (yyval.backup_token).actual = actual;
4034                                        YANG_ADDELEM(trg->ident, trg->ident_size, "identities");
4035                                        ((struct lys_ident *)actual)->name = tmp;
4036                                        ((struct lys_ident *)actual)->module = trg;
4037                                        actual_type = IDENTITY_KEYWORD;
4038                                      }
4039     break;
4040 
4041   case 129:
4042                { actual = (yyvsp[-1].backup_token).actual;
4043                  actual_type = (yyvsp[-1].backup_token).token;
4044                }
4045     break;
4046 
4047   case 131:
4048          { void *tmp;
4049 
4050            if (((struct lys_ident *)actual)->base_size) {
4051              tmp = realloc(((struct lys_ident *)actual)->base,
4052                            ((struct lys_ident *)actual)->base_size * sizeof *((struct lys_ident *)actual)->base);
4053              if (!tmp) {
4054                LOGMEM(trg->ctx);
4055                YYABORT;
4056              }
4057              ((struct lys_ident *)actual)->base = tmp;
4058            }
4059 
4060            if (((struct lys_ident *)actual)->iffeature_size) {
4061              tmp = realloc(((struct lys_ident *)actual)->iffeature,
4062                            ((struct lys_ident *)actual)->iffeature_size * sizeof *((struct lys_ident *)actual)->iffeature);
4063              if (!tmp) {
4064                LOGMEM(trg->ctx);
4065                YYABORT;
4066              }
4067              ((struct lys_ident *)actual)->iffeature = tmp;
4068            }
4069          }
4070     break;
4071 
4072   case 133:
4073                                  { void *identity;
4074 
4075                                    if ((trg->version < 2) && ((struct lys_ident *)actual)->base_size) {
4076                                      free(s);
4077                                      LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "base", "identity");
4078                                      YYABORT;
4079                                    }
4080                                    identity = actual;
4081                                    YANG_ADDELEM(((struct lys_ident *)actual)->base,
4082                                                 ((struct lys_ident *)actual)->base_size, "bases");
4083                                    *((struct lys_ident **)actual) = (struct lys_ident *)s;
4084                                    s = NULL;
4085                                    actual = identity;
4086                                  }
4087     break;
4088 
4089   case 135:
4090                                    { if (((struct lys_ident *)actual)->flags & LYS_STATUS_MASK) {
4091                                        LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "status", "identity");
4092                                        YYABORT;
4093                                      }
4094                                      ((struct lys_ident *)actual)->flags |= (yyvsp[0].i);
4095                                    }
4096     break;
4097 
4098   case 136:
4099                                         { if (yang_read_description(trg, actual, s, "identity", NODE)) {
4100                                             YYABORT;
4101                                           }
4102                                           s = NULL;
4103                                         }
4104     break;
4105 
4106   case 137:
4107                                       { if (yang_read_reference(trg, actual, s, "identity", NODE)) {
4108                                           YYABORT;
4109                                         }
4110                                         s = NULL;
4111                                       }
4112     break;
4113 
4114   case 138:
4115                                  { backup_type = actual_type;
4116                                    actual_type = BASE_KEYWORD;
4117                                  }
4118     break;
4119 
4120   case 140:
4121                                     { tpdf_parent = (actual_type == EXTENSION_INSTANCE) ? ext_instance : actual;
4122                                       (yyval.backup_token).token = actual_type;
4123                                       (yyval.backup_token).actual = actual;
4124                                       if (lyp_check_identifier(trg->ctx, s, LY_IDENT_TYPE, trg, tpdf_parent)) {
4125                                         free(s);
4126                                         YYABORT;
4127                                       }
4128                                       switch (actual_type) {
4129                                       case MODULE_KEYWORD:
4130                                       case SUBMODULE_KEYWORD:
4131                                         YANG_ADDELEM(trg->tpdf, trg->tpdf_size, "typedefs");
4132                                         break;
4133                                       case GROUPING_KEYWORD:
4134                                         YANG_ADDELEM(((struct lys_node_grp *)tpdf_parent)->tpdf,
4135                                                      ((struct lys_node_grp *)tpdf_parent)->tpdf_size, "typedefs");
4136                                         break;
4137                                       case CONTAINER_KEYWORD:
4138                                         YANG_ADDELEM(((struct lys_node_container *)tpdf_parent)->tpdf,
4139                                                      ((struct lys_node_container *)tpdf_parent)->tpdf_size, "typedefs");
4140                                         break;
4141                                       case LIST_KEYWORD:
4142                                         YANG_ADDELEM(((struct lys_node_list *)tpdf_parent)->tpdf,
4143                                                      ((struct lys_node_list *)tpdf_parent)->tpdf_size, "typedefs");
4144                                         break;
4145                                       case RPC_KEYWORD:
4146                                       case ACTION_KEYWORD:
4147                                         YANG_ADDELEM(((struct lys_node_rpc_action *)tpdf_parent)->tpdf,
4148                                                      ((struct lys_node_rpc_action *)tpdf_parent)->tpdf_size, "typedefs");
4149                                         break;
4150                                       case INPUT_KEYWORD:
4151                                       case OUTPUT_KEYWORD:
4152                                         YANG_ADDELEM(((struct lys_node_inout *)tpdf_parent)->tpdf,
4153                                                      ((struct lys_node_inout *)tpdf_parent)->tpdf_size, "typedefs");
4154                                         break;
4155                                       case NOTIFICATION_KEYWORD:
4156                                         YANG_ADDELEM(((struct lys_node_notif *)tpdf_parent)->tpdf,
4157                                                      ((struct lys_node_notif *)tpdf_parent)->tpdf_size, "typedefs");
4158                                         break;
4159                                       case EXTENSION_INSTANCE:
4160                                         /* typedef is already allocated */
4161                                         break;
4162                                       default:
4163                                         /* another type of nodetype is error*/
4164                                         LOGINT(trg->ctx);
4165                                         free(s);
4166                                         YYABORT;
4167                                       }
4168                                       ((struct lys_tpdf *)actual)->name = lydict_insert_zc(param->module->ctx, s);
4169                                       ((struct lys_tpdf *)actual)->module = trg;
4170                                       s = NULL;
4171                                       actual_type = TYPEDEF_KEYWORD;
4172                                     }
4173     break;
4174 
4175   case 141:
4176                   { if (!((yyvsp[-1].nodes).node.flag & LYS_TYPE_DEF)) {
4177                       LOGVAL(trg->ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, "type", "typedef");
4178                       YYABORT;
4179                     }
4180                     actual_type = (yyvsp[-4].backup_token).token;
4181                     actual = (yyvsp[-4].backup_token).actual;
4182                   }
4183     break;
4184 
4185   case 142:
4186                       { (yyval.nodes).node.ptr_tpdf = actual;
4187                             (yyval.nodes).node.flag = 0;
4188                           }
4189     break;
4190 
4191   case 143:
4192                                      { (yyvsp[-2].nodes).node.flag |= LYS_TYPE_DEF;
4193                                        (yyval.nodes) = (yyvsp[-2].nodes);
4194                                      }
4195     break;
4196 
4197   case 144:
4198                               { if (yang_read_units(trg, (yyvsp[-1].nodes).node.ptr_tpdf, s, TYPEDEF_KEYWORD)) {
4199                                   YYABORT;
4200                                 }
4201                                 s = NULL;
4202                               }
4203     break;
4204 
4205   case 145:
4206                                 { if (yang_read_default(trg, (yyvsp[-1].nodes).node.ptr_tpdf, s, TYPEDEF_KEYWORD)) {
4207                                     YYABORT;
4208                                   }
4209                                   s = NULL;
4210                                 }
4211     break;
4212 
4213   case 146:
4214                                { if ((yyvsp[-1].nodes).node.ptr_tpdf->flags & LYS_STATUS_MASK) {
4215                                    LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "status", "typedef");
4216                                    YYABORT;
4217                                  }
4218                                  (yyvsp[-1].nodes).node.ptr_tpdf->flags |= (yyvsp[0].i);
4219                                }
4220     break;
4221 
4222   case 147:
4223                                     { if (yang_read_description(trg, (yyvsp[-1].nodes).node.ptr_tpdf, s, "typedef", NODE)) {
4224                                         YYABORT;
4225                                       }
4226                                       s = NULL;
4227                                     }
4228     break;
4229 
4230   case 148:
4231                                   { if (yang_read_reference(trg, (yyvsp[-1].nodes).node.ptr_tpdf, s, "typedef", NODE)) {
4232                                       YYABORT;
4233                                     }
4234                                     s = NULL;
4235                                   }
4236     break;
4237 
4238   case 149:
4239            { actual_type = (yyvsp[-1].backup_token).token;
4240              actual = (yyvsp[-1].backup_token).actual;
4241            }
4242     break;
4243 
4244   case 150:
4245                                      { (yyval.backup_token).token = actual_type;
4246                                        (yyval.backup_token).actual = actual;
4247                                        if (!(actual = yang_read_type(trg->ctx, actual, s, actual_type))) {
4248                                          YYABORT;
4249                                        }
4250                                        s = NULL;
4251                                        actual_type = TYPE_KEYWORD;
4252                                      }
4253     break;
4254 
4255   case 153:
4256                                    { if (((struct yang_type *)actual)->base == LY_TYPE_STRING &&
4257                                          ((struct yang_type *)actual)->type->info.str.pat_count) {
4258                                        void *tmp;
4259 
4260                                        tmp = realloc(((struct yang_type *)actual)->type->info.str.patterns,
4261                                                      ((struct yang_type *)actual)->type->info.str.pat_count * sizeof *((struct yang_type *)actual)->type->info.str.patterns);
4262                                        if (!tmp) {
4263                                          LOGMEM(trg->ctx);
4264                                          YYABORT;
4265                                        }
4266                                        ((struct yang_type *)actual)->type->info.str.patterns = tmp;
4267 
4268 #ifdef LY_ENABLED_CACHE
4269                                        if (!(trg->ctx->models.flags & LY_CTX_TRUSTED) && ((struct yang_type *)actual)->type->info.str.patterns_pcre) {
4270                                          tmp = realloc(((struct yang_type *)actual)->type->info.str.patterns_pcre,
4271                                                        2 * ((struct yang_type *)actual)->type->info.str.pat_count * sizeof *((struct yang_type *)actual)->type->info.str.patterns_pcre);
4272                                          if (!tmp) {
4273                                            LOGMEM(trg->ctx);
4274                                            YYABORT;
4275                                          }
4276                                          ((struct yang_type *)actual)->type->info.str.patterns_pcre = tmp;
4277                                        }
4278 #endif
4279                                      }
4280                                      if (((struct yang_type *)actual)->base == LY_TYPE_UNION) {
4281                                        struct lys_type *tmp;
4282 
4283                                        tmp = realloc(((struct yang_type *)actual)->type->info.uni.types,
4284                                                      ((struct yang_type *)actual)->type->info.uni.count * sizeof *tmp);
4285                                        if (!tmp) {
4286                                          LOGMEM(trg->ctx);
4287                                          YYABORT;
4288                                        }
4289                                        ((struct yang_type *)actual)->type->info.uni.types = tmp;
4290                                      }
4291                                      if (((struct yang_type *)actual)->base == LY_TYPE_IDENT) {
4292                                        struct lys_ident **tmp;
4293 
4294                                        tmp = realloc(((struct yang_type *)actual)->type->info.ident.ref,
4295                                                      ((struct yang_type *)actual)->type->info.ident.count* sizeof *tmp);
4296                                        if (!tmp) {
4297                                          LOGMEM(trg->ctx);
4298                                          YYABORT;
4299                                        }
4300                                        ((struct yang_type *)actual)->type->info.ident.ref = tmp;
4301                                      }
4302                                    }
4303     break;
4304 
4305   case 157:
4306                                              { if (yang_read_require_instance(trg->ctx, actual, (yyvsp[0].i))) {
4307                                                  YYABORT;
4308                                                }
4309                                              }
4310     break;
4311 
4312   case 158:
4313                                  { /* leafref_specification */
4314                                    if (yang_read_leafref_path(trg, actual, s)) {
4315                                      YYABORT;
4316                                    }
4317                                    s = NULL;
4318                                  }
4319     break;
4320 
4321   case 159:
4322                                  { /* identityref_specification */
4323                                    if (((struct yang_type *)actual)->base && ((struct yang_type *)actual)->base != LY_TYPE_IDENT) {
4324                                      LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, "base");
4325                                      return EXIT_FAILURE;
4326                                    }
4327                                    ((struct yang_type *)actual)->base = LY_TYPE_IDENT;
4328                                    yang_type = actual;
4329                                    YANG_ADDELEM(((struct yang_type *)actual)->type->info.ident.ref,
4330                                                 ((struct yang_type *)actual)->type->info.ident.count, "identity refs");
4331                                    *((struct lys_ident **)actual) = (struct lys_ident *)s;
4332                                    actual = yang_type;
4333                                    s = NULL;
4334                                  }
4335     break;
4336 
4337   case 162:
4338                                             { if (yang_read_fraction(trg->ctx, actual, (yyvsp[0].uint))) {
4339                                                 YYABORT;
4340                                               }
4341                                             }
4342     break;
4343 
4344   case 165:
4345                                  { actual_type = (yyvsp[-1].backup_token).token;
4346                                    actual = (yyvsp[-1].backup_token).actual;
4347                                  }
4348     break;
4349 
4350   case 166:
4351                    { struct yang_type *stype = (struct yang_type *)actual;
4352 
4353                          (yyval.backup_token).token = actual_type;
4354                          (yyval.backup_token).actual = actual;
4355                          if (stype->base != 0 && stype->base != LY_TYPE_UNION) {
4356                            LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Unexpected type statement.");
4357                            YYABORT;
4358                          }
4359                          stype->base = LY_TYPE_UNION;
4360                          if (strcmp(stype->name, "union")) {
4361                            /* type can be a substatement only in "union" type, not in derived types */
4362                            LOGVAL(trg->ctx, LYE_INCHILDSTMT, LY_VLOG_NONE, NULL, "type", "derived type");
4363                            YYABORT;
4364                          }
4365                          YANG_ADDELEM(stype->type->info.uni.types, stype->type->info.uni.count, "union types")
4366                          actual_type = UNION_KEYWORD;
4367                        }
4368     break;
4369 
4370   case 167:
4371                                              { (yyval.uint) = (yyvsp[0].uint);
4372                                                backup_type = actual_type;
4373                                                actual_type = FRACTION_DIGITS_KEYWORD;
4374                                              }
4375     break;
4376 
4377   case 168:
4378                                                                               { (yyval.uint) = (yyvsp[-1].uint); }
4379     break;
4380 
4381   case 169:
4382                                                        { (yyval.uint) = (yyvsp[-1].uint); }
4383     break;
4384 
4385   case 170:
4386              { char *endptr = NULL;
4387                unsigned long val;
4388                errno = 0;
4389 
4390                val = strtoul(s, &endptr, 10);
4391                if (*endptr || s[0] == '-' || errno || val == 0 || val > UINT32_MAX) {
4392                  LOGVAL(trg->ctx, LYE_INARG, LY_VLOG_NONE, NULL, s, "fraction-digits");
4393                  free(s);
4394                  s = NULL;
4395                  YYABORT;
4396                }
4397                (yyval.uint) = (uint32_t) val;
4398                free(s);
4399                s =NULL;
4400              }
4401     break;
4402 
4403   case 171:
4404              { actual = (yyvsp[-1].backup_token).actual;
4405                actual_type = (yyvsp[-1].backup_token).token;
4406              }
4407     break;
4408 
4409   case 172:
4410                        { (yyval.backup_token).token = actual_type;
4411                          (yyval.backup_token).actual = actual;
4412                          if (!(actual = yang_read_length(trg->ctx, actual, s, is_ext_instance))) {
4413                            YYABORT;
4414                          }
4415                          actual_type = LENGTH_KEYWORD;
4416                          s = NULL;
4417                        }
4418     break;
4419 
4420   case 175:
4421                          { switch (actual_type) {
4422                                case MUST_KEYWORD:
4423                                  (yyval.str) = "must";
4424                                  break;
4425                                case LENGTH_KEYWORD:
4426                                  (yyval.str) = "length";
4427                                  break;
4428                                case RANGE_KEYWORD:
4429                                  (yyval.str) = "range";
4430                                  break;
4431                                default:
4432                                  LOGINT(trg->ctx);
4433                                  YYABORT;
4434                                  break;
4435                                }
4436                              }
4437     break;
4438 
4439   case 176:
4440                                          { if (yang_read_message(trg, actual, s, (yyvsp[-1].str), ERROR_MESSAGE_KEYWORD)) {
4441                                              YYABORT;
4442                                            }
4443                                            s = NULL;
4444                                          }
4445     break;
4446 
4447   case 177:
4448                                          { if (yang_read_message(trg, actual, s, (yyvsp[-1].str), ERROR_APP_TAG_KEYWORD)) {
4449                                              YYABORT;
4450                                            }
4451                                            s = NULL;
4452                                          }
4453     break;
4454 
4455   case 178:
4456                                        { if (yang_read_description(trg, actual, s, (yyvsp[-1].str), NODE)) {
4457                                            YYABORT;
4458                                           }
4459                                           s = NULL;
4460                                         }
4461     break;
4462 
4463   case 179:
4464                                      { if (yang_read_reference(trg, actual, s, (yyvsp[-1].str), NODE)) {
4465                                          YYABORT;
4466                                        }
4467                                        s = NULL;
4468                                      }
4469     break;
4470 
4471   case 180:
4472                  { (yyval.backup_token).token = actual_type;
4473                    (yyval.backup_token).actual = actual;
4474                  }
4475     break;
4476 
4477   case 181:
4478                                                                        {struct lys_restr *pattern = actual;
4479                                                                         actual = NULL;
4480 #ifdef LY_ENABLED_CACHE
4481                                                                         if ((yyvsp[-2].backup_token).token != EXTENSION_INSTANCE &&
4482                                                                             !(data_node && data_node->nodetype != LYS_GROUPING && lys_ingrouping(data_node))) {
4483                                                                           unsigned int c = 2 * (((struct yang_type *)(yyvsp[-2].backup_token).actual)->type->info.str.pat_count - 1);
4484                                                                           YANG_ADDELEM(((struct yang_type *)(yyvsp[-2].backup_token).actual)->type->info.str.patterns_pcre, c, "patterns");
4485                                                                           ++c;
4486                                                                           YANG_ADDELEM(((struct yang_type *)(yyvsp[-2].backup_token).actual)->type->info.str.patterns_pcre, c, "patterns");
4487                                                                           actual = &(((struct yang_type *)(yyvsp[-2].backup_token).actual)->type->info.str.patterns_pcre)[2 * (((struct yang_type *)(yyvsp[-2].backup_token).actual)->type->info.str.pat_count - 1)];
4488                                                                         }
4489 #endif
4490                                                                         if (yang_read_pattern(trg->ctx, pattern, actual, (yyvsp[-1].str), (yyvsp[0].ch))) {
4491                                                                           YYABORT;
4492                                                                         }
4493                                                                         actual_type = (yyvsp[-2].backup_token).token;
4494                                                                         actual = (yyvsp[-2].backup_token).actual;
4495                                                                       }
4496     break;
4497 
4498   case 182:
4499                         { if (actual_type != EXTENSION_INSTANCE) {
4500                             if (((struct yang_type *)actual)->base != 0 && ((struct yang_type *)actual)->base != LY_TYPE_STRING) {
4501                               free(s);
4502                               LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Unexpected pattern statement.");
4503                               YYABORT;
4504                             }
4505                             ((struct yang_type *)actual)->base = LY_TYPE_STRING;
4506                             YANG_ADDELEM(((struct yang_type *)actual)->type->info.str.patterns,
4507                                          ((struct yang_type *)actual)->type->info.str.pat_count, "patterns");
4508                           }
4509                           (yyval.str) = s;
4510                           s = NULL;
4511                           actual_type = PATTERN_KEYWORD;
4512                         }
4513     break;
4514 
4515   case 183:
4516                  { (yyval.ch) = 0x06; }
4517     break;
4518 
4519   case 184:
4520          { (yyval.ch) = (yyvsp[-1].ch); }
4521     break;
4522 
4523   case 185:
4524                          { (yyval.ch) = 0x06; /* ACK */ }
4525     break;
4526 
4527   case 186:
4528                                     { if (trg->version < 2) {
4529                                         LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, "modifier");
4530                                         YYABORT;
4531                                       }
4532                                       if ((yyvsp[-1].ch) != 0x06) {
4533                                         LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "modifier", "pattern");
4534                                         YYABORT;
4535                                       }
4536                                       (yyval.ch) = (yyvsp[0].ch);
4537                                     }
4538     break;
4539 
4540   case 187:
4541                                          { if (yang_read_message(trg, actual, s, "pattern", ERROR_MESSAGE_KEYWORD)) {
4542                                              YYABORT;
4543                                            }
4544                                            s = NULL;
4545                                          }
4546     break;
4547 
4548   case 188:
4549                                          { if (yang_read_message(trg, actual, s, "pattern", ERROR_APP_TAG_KEYWORD)) {
4550                                              YYABORT;
4551                                            }
4552                                            s = NULL;
4553                                          }
4554     break;
4555 
4556   case 189:
4557                                        { if (yang_read_description(trg, actual, s, "pattern", NODE)) {
4558                                            YYABORT;
4559                                           }
4560                                           s = NULL;
4561                                         }
4562     break;
4563 
4564   case 190:
4565                                      { if (yang_read_reference(trg, actual, s, "pattern", NODE)) {
4566                                          YYABORT;
4567                                        }
4568                                        s = NULL;
4569                                      }
4570     break;
4571 
4572   case 191:
4573                      { backup_type = actual_type;
4574                        actual_type = MODIFIER_KEYWORD;
4575                      }
4576     break;
4577 
4578   case 192:
4579                                                          { if (!strcmp(s, "invert-match")) {
4580                                                              (yyval.ch) = 0x15;
4581                                                              free(s);
4582                                                              s = NULL;
4583                                                            } else {
4584                                                              LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, s);
4585                                                              free(s);
4586                                                              YYABORT;
4587                                                            }
4588                                                          }
4589     break;
4590 
4591   case 193:
4592                                                  { struct lys_type_enum * tmp;
4593 
4594                                                    cnt_val = 0;
4595                                                    tmp = realloc(((struct yang_type *)actual)->type->info.enums.enm,
4596                                                                  ((struct yang_type *)actual)->type->info.enums.count * sizeof *tmp);
4597                                                    if (!tmp) {
4598                                                      LOGMEM(trg->ctx);
4599                                                      YYABORT;
4600                                                    }
4601                                                    ((struct yang_type *)actual)->type->info.enums.enm = tmp;
4602                                                  }
4603     break;
4604 
4605   case 196:
4606            { if (yang_check_enum(trg->ctx, yang_type, actual, &cnt_val, is_value)) {
4607                YYABORT;
4608              }
4609              actual = (yyvsp[-1].backup_token).actual;
4610              actual_type = (yyvsp[-1].backup_token).token;
4611            }
4612     break;
4613 
4614   case 197:
4615                      { (yyval.backup_token).token = actual_type;
4616                        (yyval.backup_token).actual = yang_type = actual;
4617                        YANG_ADDELEM(((struct yang_type *)actual)->type->info.enums.enm, ((struct yang_type *)actual)->type->info.enums.count, "enums");
4618                        if (yang_read_enum(trg->ctx, yang_type, actual, s)) {
4619                          YYABORT;
4620                        }
4621                        s = NULL;
4622                        is_value = 0;
4623                        actual_type = ENUM_KEYWORD;
4624                      }
4625     break;
4626 
4627   case 199:
4628          { if (((struct lys_type_enum *)actual)->iffeature_size) {
4629              struct lys_iffeature *tmp;
4630 
4631              tmp = realloc(((struct lys_type_enum *)actual)->iffeature,
4632                            ((struct lys_type_enum *)actual)->iffeature_size * sizeof *tmp);
4633              if (!tmp) {
4634                LOGMEM(trg->ctx);
4635                YYABORT;
4636              }
4637              ((struct lys_type_enum *)actual)->iffeature = tmp;
4638            }
4639          }
4640     break;
4641 
4642   case 202:
4643                               { if (is_value) {
4644                                   LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "value", "enum");
4645                                   YYABORT;
4646                                 }
4647                                 ((struct lys_type_enum *)actual)->value = (yyvsp[0].i);
4648 
4649                                 /* keep the highest enum value for automatic increment */
4650                                 if ((yyvsp[0].i) >= cnt_val) {
4651                                   cnt_val = (yyvsp[0].i) + 1;
4652                                 }
4653                                 is_value = 1;
4654                               }
4655     break;
4656 
4657   case 203:
4658                                { if (((struct lys_type_enum *)actual)->flags & LYS_STATUS_MASK) {
4659                                    LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "status", "enum");
4660                                    YYABORT;
4661                                  }
4662                                  ((struct lys_type_enum *)actual)->flags |= (yyvsp[0].i);
4663                                }
4664     break;
4665 
4666   case 204:
4667                                     { if (yang_read_description(trg, actual, s, "enum", NODE)) {
4668                                         YYABORT;
4669                                       }
4670                                       s = NULL;
4671                                     }
4672     break;
4673 
4674   case 205:
4675                                   { if (yang_read_reference(trg, actual, s, "enum", NODE)) {
4676                                       YYABORT;
4677                                     }
4678                                     s = NULL;
4679                                   }
4680     break;
4681 
4682   case 206:
4683                                  { (yyval.i) = (yyvsp[0].i);
4684                                    backup_type = actual_type;
4685                                    actual_type = VALUE_KEYWORD;
4686                                  }
4687     break;
4688 
4689   case 207:
4690                                                 { (yyval.i) = (yyvsp[-1].i); }
4691     break;
4692 
4693   case 208:
4694                                             { (yyval.i) = (yyvsp[-1].i); }
4695     break;
4696 
4697   case 209:
4698               { /* convert it to int32_t */
4699                 int64_t val;
4700                 char *endptr;
4701 
4702                 val = strtoll(s, &endptr, 10);
4703                 if (val < INT32_MIN || val > INT32_MAX || *endptr) {
4704                     LOGVAL(trg->ctx, LYE_INARG, LY_VLOG_NONE, NULL, s, "value");
4705                     free(s);
4706                     YYABORT;
4707                 }
4708                 free(s);
4709                 s = NULL;
4710                 (yyval.i) = (int32_t) val;
4711              }
4712     break;
4713 
4714   case 210:
4715                                                       { actual_type = (yyvsp[-1].backup_token).token;
4716                                                         actual = (yyvsp[-1].backup_token).actual;
4717                                                       }
4718     break;
4719 
4720   case 213:
4721                        { backup_type = actual_type;
4722                          actual_type = PATH_KEYWORD;
4723                        }
4724     break;
4725 
4726   case 215:
4727                                                { (yyval.i) = (yyvsp[0].i);
4728                                                  backup_type = actual_type;
4729                                                  actual_type = REQUIRE_INSTANCE_KEYWORD;
4730                                                }
4731     break;
4732 
4733   case 216:
4734                                                                                  { (yyval.i) = (yyvsp[-1].i); }
4735     break;
4736 
4737   case 217:
4738                                               { (yyval.i) = 1; }
4739     break;
4740 
4741   case 218:
4742                           { (yyval.i) = -1; }
4743     break;
4744 
4745   case 219:
4746               { if (!strcmp(s,"true")) {
4747                   (yyval.i) = 1;
4748                 } else if (!strcmp(s,"false")) {
4749                   (yyval.i) = -1;
4750                 } else {
4751                   LOGVAL(trg->ctx, LYE_INARG, LY_VLOG_NONE, NULL, s, "require-instance");
4752                   free(s);
4753                   YYABORT;
4754                 }
4755                 free(s);
4756                 s = NULL;
4757               }
4758     break;
4759 
4760   case 220:
4761                                        { struct lys_type_bit * tmp;
4762 
4763                                          cnt_val = 0;
4764                                          tmp = realloc(((struct yang_type *)actual)->type->info.bits.bit,
4765                                                        ((struct yang_type *)actual)->type->info.bits.count * sizeof *tmp);
4766                                          if (!tmp) {
4767                                            LOGMEM(trg->ctx);
4768                                            YYABORT;
4769                                          }
4770                                          ((struct yang_type *)actual)->type->info.bits.bit = tmp;
4771                                        }
4772     break;
4773 
4774   case 223:
4775                   { if (yang_check_bit(trg->ctx, yang_type, actual, &cnt_val, is_value)) {
4776                       YYABORT;
4777                     }
4778                     actual = (yyvsp[-2].backup_token).actual;
4779                     actual_type = (yyvsp[-2].backup_token).token;
4780                   }
4781     break;
4782 
4783   case 224:
4784                                 { (yyval.backup_token).token = actual_type;
4785                                   (yyval.backup_token).actual = yang_type = actual;
4786                                   YANG_ADDELEM(((struct yang_type *)actual)->type->info.bits.bit,
4787                                                ((struct yang_type *)actual)->type->info.bits.count, "bits");
4788                                   if (yang_read_bit(trg->ctx, yang_type, actual, s)) {
4789                                     YYABORT;
4790                                   }
4791                                   s = NULL;
4792                                   is_value = 0;
4793                                   actual_type = BIT_KEYWORD;
4794                                 }
4795     break;
4796 
4797   case 226:
4798          { if (((struct lys_type_bit *)actual)->iffeature_size) {
4799              struct lys_iffeature *tmp;
4800 
4801              tmp = realloc(((struct lys_type_bit *)actual)->iffeature,
4802                            ((struct lys_type_bit *)actual)->iffeature_size * sizeof *tmp);
4803              if (!tmp) {
4804                LOGMEM(trg->ctx);
4805                YYABORT;
4806              }
4807              ((struct lys_type_bit *)actual)->iffeature = tmp;
4808            }
4809          }
4810     break;
4811 
4812   case 229:
4813                                 { if (is_value) {
4814                                     LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "position", "bit");
4815                                     YYABORT;
4816                                   }
4817                                   ((struct lys_type_bit *)actual)->pos = (yyvsp[0].uint);
4818 
4819                                   /* keep the highest position value for automatic increment */
4820                                   if ((yyvsp[0].uint) >= cnt_val) {
4821                                     cnt_val = (yyvsp[0].uint) + 1;
4822                                   }
4823                                   is_value = 1;
4824                                 }
4825     break;
4826 
4827   case 230:
4828                               { if (((struct lys_type_bit *)actual)->flags & LYS_STATUS_MASK) {
4829                                    LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "status", "bit");
4830                                    YYABORT;
4831                                  }
4832                                  ((struct lys_type_bit *)actual)->flags |= (yyvsp[0].i);
4833                               }
4834     break;
4835 
4836   case 231:
4837                                    { if (yang_read_description(trg, actual, s, "bit", NODE)) {
4838                                        YYABORT;
4839                                      }
4840                                      s = NULL;
4841                                    }
4842     break;
4843 
4844   case 232:
4845                                  { if (yang_read_reference(trg, actual, s, "bit", NODE)) {
4846                                      YYABORT;
4847                                    }
4848                                    s = NULL;
4849                                  }
4850     break;
4851 
4852   case 233:
4853                                            { (yyval.uint) = (yyvsp[0].uint);
4854                                              backup_type = actual_type;
4855                                              actual_type = POSITION_KEYWORD;
4856                                            }
4857     break;
4858 
4859   case 234:
4860                                                                { (yyval.uint) = (yyvsp[-1].uint); }
4861     break;
4862 
4863   case 235:
4864                                                           { (yyval.uint) = (yyvsp[-1].uint); }
4865     break;
4866 
4867   case 236:
4868               { /* convert it to uint32_t */
4869                 unsigned long val;
4870                 char *endptr = NULL;
4871                 errno = 0;
4872 
4873                 val = strtoul(s, &endptr, 10);
4874                 if (s[0] == '-' || *endptr || errno || val > UINT32_MAX) {
4875                   LOGVAL(trg->ctx, LYE_INARG, LY_VLOG_NONE, NULL, s, "position");
4876                   free(s);
4877                   YYABORT;
4878                 }
4879                 free(s);
4880                 s = NULL;
4881                 (yyval.uint) = (uint32_t) val;
4882               }
4883     break;
4884 
4885   case 237:
4886                           { backup_type = actual_type;
4887                             actual_type = ERROR_MESSAGE_KEYWORD;
4888                           }
4889     break;
4890 
4891   case 239:
4892                           { backup_type = actual_type;
4893                             actual_type = ERROR_APP_TAG_KEYWORD;
4894                           }
4895     break;
4896 
4897   case 241:
4898                   { backup_type = actual_type;
4899                     actual_type = UNITS_KEYWORD;
4900                   }
4901     break;
4902 
4903   case 243:
4904                     { backup_type = actual_type;
4905                       actual_type = DEFAULT_KEYWORD;
4906                     }
4907     break;
4908 
4909   case 245:
4910                                      { (yyval.backup_token).token = actual_type;
4911                                        (yyval.backup_token).actual = actual;
4912                                        if (!(actual = yang_read_node(trg, actual, param->node, s, LYS_GROUPING, sizeof(struct lys_node_grp)))) {
4913                                          YYABORT;
4914                                        }
4915                                        s = NULL;
4916                                        data_node = actual;
4917                                        actual_type = GROUPING_KEYWORD;
4918                                      }
4919     break;
4920 
4921   case 246:
4922                { LOGDBG(LY_LDGYANG, "finished parsing grouping statement \"%s\"", data_node->name);
4923                  actual_type = (yyvsp[-1].backup_token).token;
4924                  actual = (yyvsp[-1].backup_token).actual;
4925                  data_node = (yyvsp[-1].backup_token).actual;
4926                }
4927     break;
4928 
4929   case 249:
4930                           { (yyval.nodes).grouping = actual; }
4931     break;
4932 
4933   case 250:
4934                                    { if ((yyvsp[-1].nodes).grouping->flags & LYS_STATUS_MASK) {
4935                                        LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).grouping, "status", "grouping");
4936                                        YYABORT;
4937                                      }
4938                                      (yyvsp[-1].nodes).grouping->flags |= (yyvsp[0].i);
4939                                    }
4940     break;
4941 
4942   case 251:
4943                                         { if (yang_read_description(trg, (yyvsp[-1].nodes).grouping, s, "grouping", NODE_PRINT)) {
4944                                             YYABORT;
4945                                           }
4946                                           s = NULL;
4947                                         }
4948     break;
4949 
4950   case 252:
4951                                       { if (yang_read_reference(trg, (yyvsp[-1].nodes).grouping, s, "grouping", NODE_PRINT)) {
4952                                           YYABORT;
4953                                         }
4954                                         s = NULL;
4955                                       }
4956     break;
4957 
4958   case 257:
4959                                                  { if (trg->version < 2) {
4960                                                      LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_LYS, (yyvsp[-2].nodes).grouping, "notification");
4961                                                      YYABORT;
4962                                                    }
4963                                                  }
4964     break;
4965 
4966   case 266:
4967                                       { (yyval.backup_token).token = actual_type;
4968                                         (yyval.backup_token).actual = actual;
4969                                         if (!(actual = yang_read_node(trg, actual, param->node, s, LYS_CONTAINER, sizeof(struct lys_node_container)))) {
4970                                           YYABORT;
4971                                         }
4972                                         data_node = actual;
4973                                         s = NULL;
4974                                         actual_type = CONTAINER_KEYWORD;
4975                                       }
4976     break;
4977 
4978   case 267:
4979                 { LOGDBG(LY_LDGYANG, "finished parsing container statement \"%s\"", data_node->name);
4980                   actual_type = (yyvsp[-1].backup_token).token;
4981                   actual = (yyvsp[-1].backup_token).actual;
4982                   data_node = (yyvsp[-1].backup_token).actual;
4983                 }
4984     break;
4985 
4986   case 269:
4987           { void *tmp;
4988 
4989             if ((yyvsp[-1].nodes).container->iffeature_size) {
4990               tmp = realloc((yyvsp[-1].nodes).container->iffeature, (yyvsp[-1].nodes).container->iffeature_size * sizeof *(yyvsp[-1].nodes).container->iffeature);
4991               if (!tmp) {
4992                 LOGMEM(trg->ctx);
4993                 YYABORT;
4994               }
4995               (yyvsp[-1].nodes).container->iffeature = tmp;
4996             }
4997 
4998             if ((yyvsp[-1].nodes).container->must_size) {
4999               tmp = realloc((yyvsp[-1].nodes).container->must, (yyvsp[-1].nodes).container->must_size * sizeof *(yyvsp[-1].nodes).container->must);
5000               if (!tmp) {
5001                 LOGMEM(trg->ctx);
5002                 YYABORT;
5003               }
5004               (yyvsp[-1].nodes).container->must = tmp;
5005             }
5006           }
5007     break;
5008 
5009   case 270:
5010                            { (yyval.nodes).container = actual; }
5011     break;
5012 
5013   case 274:
5014                                       { if (yang_read_presence(trg, (yyvsp[-1].nodes).container, s)) {
5015                                           YYABORT;
5016                                         }
5017                                         s = NULL;
5018                                       }
5019     break;
5020 
5021   case 275:
5022                                     { if ((yyvsp[-1].nodes).container->flags & LYS_CONFIG_MASK) {
5023                                         LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).container, "config", "container");
5024                                         YYABORT;
5025                                       }
5026                                       (yyvsp[-1].nodes).container->flags |= (yyvsp[0].i);
5027                                     }
5028     break;
5029 
5030   case 276:
5031                                     { if ((yyvsp[-1].nodes).container->flags & LYS_STATUS_MASK) {
5032                                         LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).container, "status", "container");
5033                                         YYABORT;
5034                                       }
5035                                       (yyvsp[-1].nodes).container->flags |= (yyvsp[0].i);
5036                                     }
5037     break;
5038 
5039   case 277:
5040                                          { if (yang_read_description(trg, (yyvsp[-1].nodes).container, s, "container", NODE_PRINT)) {
5041                                              YYABORT;
5042                                            }
5043                                            s = NULL;
5044                                          }
5045     break;
5046 
5047   case 278:
5048                                        { if (yang_read_reference(trg, (yyvsp[-1].nodes).container, s, "container", NODE_PRINT)) {
5049                                            YYABORT;
5050                                          }
5051                                          s = NULL;
5052                                        }
5053     break;
5054 
5055   case 281:
5056                                                   { if (trg->version < 2) {
5057                                                       LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_LYS, (yyvsp[-2].nodes).container, "notification");
5058                                                       YYABORT;
5059                                                     }
5060                                                   }
5061     break;
5062 
5063   case 284:
5064                 { void *tmp;
5065 
5066                   if (!((yyvsp[-1].nodes).node.flag & LYS_TYPE_DEF)) {
5067                     LOGVAL(trg->ctx, LYE_MISSCHILDSTMT, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaf, "type", "leaf");
5068                     YYABORT;
5069                   }
5070                   if ((yyvsp[-1].nodes).node.ptr_leaf->dflt && ((yyvsp[-1].nodes).node.ptr_leaf->flags & LYS_MAND_TRUE)) {
5071                     /* RFC 6020, 7.6.4 - default statement must not with mandatory true */
5072                     LOGVAL(trg->ctx, LYE_INCHILDSTMT, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaf, "mandatory", "leaf");
5073                     LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaf, "The \"mandatory\" statement is forbidden on leaf with \"default\".");
5074                     YYABORT;
5075                   }
5076 
5077                   if ((yyvsp[-1].nodes).node.ptr_leaf->iffeature_size) {
5078                     tmp = realloc((yyvsp[-1].nodes).node.ptr_leaf->iffeature, (yyvsp[-1].nodes).node.ptr_leaf->iffeature_size * sizeof *(yyvsp[-1].nodes).node.ptr_leaf->iffeature);
5079                     if (!tmp) {
5080                       LOGMEM(trg->ctx);
5081                       YYABORT;
5082                     }
5083                     (yyvsp[-1].nodes).node.ptr_leaf->iffeature = tmp;
5084                   }
5085 
5086                   if ((yyvsp[-1].nodes).node.ptr_leaf->must_size) {
5087                     tmp = realloc((yyvsp[-1].nodes).node.ptr_leaf->must, (yyvsp[-1].nodes).node.ptr_leaf->must_size * sizeof *(yyvsp[-1].nodes).node.ptr_leaf->must);
5088                     if (!tmp) {
5089                       LOGMEM(trg->ctx);
5090                       YYABORT;
5091                     }
5092                     (yyvsp[-1].nodes).node.ptr_leaf->must = tmp;
5093                   }
5094 
5095                   LOGDBG(LY_LDGYANG, "finished parsing leaf statement \"%s\"", data_node->name);
5096                   actual_type = (yyvsp[-4].backup_token).token;
5097                   actual = (yyvsp[-4].backup_token).actual;
5098                   data_node = (yyvsp[-4].backup_token).actual;
5099                 }
5100     break;
5101 
5102   case 285:
5103                                  { (yyval.backup_token).token = actual_type;
5104                                    (yyval.backup_token).actual = actual;
5105                                    if (!(actual = yang_read_node(trg, actual, param->node, s, LYS_LEAF, sizeof(struct lys_node_leaf)))) {
5106                                      YYABORT;
5107                                    }
5108                                    data_node = actual;
5109                                    s = NULL;
5110                                    actual_type = LEAF_KEYWORD;
5111                                  }
5112     break;
5113 
5114   case 286:
5115                       { (yyval.nodes).node.ptr_leaf = actual;
5116                             (yyval.nodes).node.flag = 0;
5117                           }
5118     break;
5119 
5120   case 289:
5121                                      { (yyvsp[-2].nodes).node.flag |= LYS_TYPE_DEF;
5122                                        (yyval.nodes) = (yyvsp[-2].nodes);
5123                                      }
5124     break;
5125 
5126   case 290:
5127                               { if (yang_read_units(trg, (yyvsp[-1].nodes).node.ptr_leaf, s, LEAF_KEYWORD)) {
5128                                   YYABORT;
5129                                 }
5130                                 s = NULL;
5131                               }
5132     break;
5133 
5134   case 292:
5135                                 { if (yang_read_default(trg, (yyvsp[-1].nodes).node.ptr_leaf, s, LEAF_KEYWORD)) {
5136                                     YYABORT;
5137                                   }
5138                                   s = NULL;
5139                                 }
5140     break;
5141 
5142   case 293:
5143                                { if ((yyvsp[-1].nodes).node.ptr_leaf->flags & LYS_CONFIG_MASK) {
5144                                    LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaf, "config", "leaf");
5145                                    YYABORT;
5146                                  }
5147                                  (yyvsp[-1].nodes).node.ptr_leaf->flags |= (yyvsp[0].i);
5148                                }
5149     break;
5150 
5151   case 294:
5152                                   { if ((yyvsp[-1].nodes).node.ptr_leaf->flags & LYS_MAND_MASK) {
5153                                       LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaf, "mandatory", "leaf");
5154                                       YYABORT;
5155                                     }
5156                                     (yyvsp[-1].nodes).node.ptr_leaf->flags |= (yyvsp[0].i);
5157                                   }
5158     break;
5159 
5160   case 295:
5161                                { if ((yyvsp[-1].nodes).node.ptr_leaf->flags & LYS_STATUS_MASK) {
5162                                    LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaf, "status", "leaf");
5163                                    YYABORT;
5164                                  }
5165                                  (yyvsp[-1].nodes).node.ptr_leaf->flags |= (yyvsp[0].i);
5166                                }
5167     break;
5168 
5169   case 296:
5170                                     { if (yang_read_description(trg, (yyvsp[-1].nodes).node.ptr_leaf, s, "leaf", NODE_PRINT)) {
5171                                         YYABORT;
5172                                       }
5173                                       s = NULL;
5174                                     }
5175     break;
5176 
5177   case 297:
5178                                   { if (yang_read_reference(trg, (yyvsp[-1].nodes).node.ptr_leaf, s, "leaf", NODE_PRINT)) {
5179                                       YYABORT;
5180                                     }
5181                                     s = NULL;
5182                                   }
5183     break;
5184 
5185   case 298:
5186                                       { (yyval.backup_token).token = actual_type;
5187                                         (yyval.backup_token).actual = actual;
5188                                         if (!(actual = yang_read_node(trg, actual, param->node, s, LYS_LEAFLIST, sizeof(struct lys_node_leaflist)))) {
5189                                           YYABORT;
5190                                         }
5191                                         data_node = actual;
5192                                         s = NULL;
5193                                         actual_type = LEAF_LIST_KEYWORD;
5194                                       }
5195     break;
5196 
5197   case 299:
5198                       { void *tmp;
5199 
5200                         if ((yyvsp[-1].nodes).node.ptr_leaflist->flags & LYS_CONFIG_R) {
5201                           /* RFC 6020, 7.7.5 - ignore ordering when the list represents state data
5202                            * ignore oredering MASK - 0x7F
5203                            */
5204                           (yyvsp[-1].nodes).node.ptr_leaflist->flags &= 0x7F;
5205                         }
5206                         if (!((yyvsp[-1].nodes).node.flag & LYS_TYPE_DEF)) {
5207                           LOGVAL(trg->ctx, LYE_MISSCHILDSTMT, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaflist, "type", "leaf-list");
5208                           YYABORT;
5209                         }
5210                         if ((yyvsp[-1].nodes).node.ptr_leaflist->dflt_size && (yyvsp[-1].nodes).node.ptr_leaflist->min) {
5211                           LOGVAL(trg->ctx, LYE_INCHILDSTMT, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaflist, "min-elements", "leaf-list");
5212                           LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaflist,
5213                                  "The \"min-elements\" statement with non-zero value is forbidden on leaf-lists with the \"default\" statement.");
5214                           YYABORT;
5215                         }
5216 
5217                         if ((yyvsp[-1].nodes).node.ptr_leaflist->iffeature_size) {
5218                           tmp = realloc((yyvsp[-1].nodes).node.ptr_leaflist->iffeature, (yyvsp[-1].nodes).node.ptr_leaflist->iffeature_size * sizeof *(yyvsp[-1].nodes).node.ptr_leaflist->iffeature);
5219                           if (!tmp) {
5220                             LOGMEM(trg->ctx);
5221                             YYABORT;
5222                           }
5223                           (yyvsp[-1].nodes).node.ptr_leaflist->iffeature = tmp;
5224                         }
5225 
5226                         if ((yyvsp[-1].nodes).node.ptr_leaflist->must_size) {
5227                           tmp = realloc((yyvsp[-1].nodes).node.ptr_leaflist->must, (yyvsp[-1].nodes).node.ptr_leaflist->must_size * sizeof *(yyvsp[-1].nodes).node.ptr_leaflist->must);
5228                           if (!tmp) {
5229                             LOGMEM(trg->ctx);
5230                             YYABORT;
5231                           }
5232                           (yyvsp[-1].nodes).node.ptr_leaflist->must = tmp;
5233                         }
5234 
5235                         if ((yyvsp[-1].nodes).node.ptr_leaflist->dflt_size) {
5236                           tmp = realloc((yyvsp[-1].nodes).node.ptr_leaflist->dflt, (yyvsp[-1].nodes).node.ptr_leaflist->dflt_size * sizeof *(yyvsp[-1].nodes).node.ptr_leaflist->dflt);
5237                           if (!tmp) {
5238                             LOGMEM(trg->ctx);
5239                             YYABORT;
5240                           }
5241                           (yyvsp[-1].nodes).node.ptr_leaflist->dflt = tmp;
5242                         }
5243 
5244                         LOGDBG(LY_LDGYANG, "finished parsing leaf-list statement \"%s\"", data_node->name);
5245                         actual_type = (yyvsp[-4].backup_token).token;
5246                         actual = (yyvsp[-4].backup_token).actual;
5247                         data_node = (yyvsp[-4].backup_token).actual;
5248                       }
5249     break;
5250 
5251   case 300:
5252                            { (yyval.nodes).node.ptr_leaflist = actual;
5253                                  (yyval.nodes).node.flag = 0;
5254                                }
5255     break;
5256 
5257   case 303:
5258                                           { (yyvsp[-2].nodes).node.flag |= LYS_TYPE_DEF;
5259                                             (yyval.nodes) = (yyvsp[-2].nodes);
5260                                           }
5261     break;
5262 
5263   case 304:
5264                                      { if (trg->version < 2) {
5265                                          free(s);
5266                                          LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaflist, "default");
5267                                          YYABORT;
5268                                        }
5269                                        YANG_ADDELEM((yyvsp[-1].nodes).node.ptr_leaflist->dflt,
5270                                                     (yyvsp[-1].nodes).node.ptr_leaflist->dflt_size, "defaults");
5271                                        (*(const char **)actual) = lydict_insert_zc(param->module->ctx, s);
5272                                        s = NULL;
5273                                        actual = (yyvsp[-1].nodes).node.ptr_leaflist;
5274                                      }
5275     break;
5276 
5277   case 305:
5278                                    { if (yang_read_units(trg, (yyvsp[-1].nodes).node.ptr_leaflist, s, LEAF_LIST_KEYWORD)) {
5279                                        YYABORT;
5280                                      }
5281                                      s = NULL;
5282                                    }
5283     break;
5284 
5285   case 307:
5286                                     { if ((yyvsp[-1].nodes).node.ptr_leaflist->flags & LYS_CONFIG_MASK) {
5287                                         LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaflist, "config", "leaf-list");
5288                                         YYABORT;
5289                                       }
5290                                       (yyvsp[-1].nodes).node.ptr_leaflist->flags |= (yyvsp[0].i);
5291                                     }
5292     break;
5293 
5294   case 308:
5295                                           { if ((yyvsp[-1].nodes).node.flag & LYS_MIN_ELEMENTS) {
5296                                               LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaflist, "min-elements", "leaf-list");
5297                                               YYABORT;
5298                                             }
5299                                             (yyvsp[-1].nodes).node.ptr_leaflist->min = (yyvsp[0].uint);
5300                                             (yyvsp[-1].nodes).node.flag |= LYS_MIN_ELEMENTS;
5301                                             (yyval.nodes) = (yyvsp[-1].nodes);
5302                                             if ((yyvsp[-1].nodes).node.ptr_leaflist->max && ((yyvsp[-1].nodes).node.ptr_leaflist->min > (yyvsp[-1].nodes).node.ptr_leaflist->max)) {
5303                                               LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaflist, "Invalid value \"%d\" of \"%s\".", (yyvsp[0].uint), "min-elements");
5304                                               LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaflist, "\"min-elements\" is bigger than \"max-elements\".");
5305                                               YYABORT;
5306                                             }
5307                                           }
5308     break;
5309 
5310   case 309:
5311                                           { if ((yyvsp[-1].nodes).node.flag & LYS_MAX_ELEMENTS) {
5312                                               LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaflist, "max-elements", "leaf-list");
5313                                               YYABORT;
5314                                             }
5315                                             (yyvsp[-1].nodes).node.ptr_leaflist->max = (yyvsp[0].uint);
5316                                             (yyvsp[-1].nodes).node.flag |= LYS_MAX_ELEMENTS;
5317                                             (yyval.nodes) = (yyvsp[-1].nodes);
5318                                             if ((yyvsp[-1].nodes).node.ptr_leaflist->max && ((yyvsp[-1].nodes).node.ptr_leaflist->min > (yyvsp[-1].nodes).node.ptr_leaflist->max)) {
5319                                               LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaflist, "Invalid value \"%d\" of \"%s\".", (yyvsp[0].uint), "max-elements");
5320                                               LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaflist, "\"max-elements\" is smaller than \"min-elements\".");
5321                                               YYABORT;
5322                                             }
5323                                           }
5324     break;
5325 
5326   case 310:
5327                                         { if ((yyvsp[-1].nodes).node.flag & LYS_ORDERED_MASK) {
5328                                             LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaflist, "ordered by", "leaf-list");
5329                                             YYABORT;
5330                                           }
5331                                           if ((yyvsp[0].i) & LYS_USERORDERED) {
5332                                             (yyvsp[-1].nodes).node.ptr_leaflist->flags |= LYS_USERORDERED;
5333                                           }
5334                                           (yyvsp[-1].nodes).node.flag |= (yyvsp[0].i);
5335                                           (yyval.nodes) = (yyvsp[-1].nodes);
5336                                         }
5337     break;
5338 
5339   case 311:
5340                                     { if ((yyvsp[-1].nodes).node.ptr_leaflist->flags & LYS_STATUS_MASK) {
5341                                         LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_leaflist, "status", "leaf-list");
5342                                         YYABORT;
5343                                       }
5344                                       (yyvsp[-1].nodes).node.ptr_leaflist->flags |= (yyvsp[0].i);
5345                                     }
5346     break;
5347 
5348   case 312:
5349                                          { if (yang_read_description(trg, (yyvsp[-1].nodes).node.ptr_leaflist, s, "leaf-list", NODE_PRINT)) {
5350                                              YYABORT;
5351                                            }
5352                                            s = NULL;
5353                                          }
5354     break;
5355 
5356   case 313:
5357                                        { if (yang_read_reference(trg, (yyvsp[-1].nodes).node.ptr_leaflist, s, "leaf-list", NODE_PRINT)) {
5358                                            YYABORT;
5359                                          }
5360                                          s = NULL;
5361                                        }
5362     break;
5363 
5364   case 314:
5365                                  { (yyval.backup_token).token = actual_type;
5366                                    (yyval.backup_token).actual = actual;
5367                                    if (!(actual = yang_read_node(trg, actual, param->node, s, LYS_LIST, sizeof(struct lys_node_list)))) {
5368                                      YYABORT;
5369                                    }
5370                                    data_node = actual;
5371                                    s = NULL;
5372                                    actual_type = LIST_KEYWORD;
5373                                  }
5374     break;
5375 
5376   case 315:
5377                 { void *tmp;
5378 
5379                   if ((yyvsp[-1].nodes).node.ptr_list->iffeature_size) {
5380                     tmp = realloc((yyvsp[-1].nodes).node.ptr_list->iffeature, (yyvsp[-1].nodes).node.ptr_list->iffeature_size * sizeof *(yyvsp[-1].nodes).node.ptr_list->iffeature);
5381                     if (!tmp) {
5382                       LOGMEM(trg->ctx);
5383                       YYABORT;
5384                     }
5385                     (yyvsp[-1].nodes).node.ptr_list->iffeature = tmp;
5386                   }
5387 
5388                   if ((yyvsp[-1].nodes).node.ptr_list->must_size) {
5389                     tmp = realloc((yyvsp[-1].nodes).node.ptr_list->must, (yyvsp[-1].nodes).node.ptr_list->must_size * sizeof *(yyvsp[-1].nodes).node.ptr_list->must);
5390                     if (!tmp) {
5391                       LOGMEM(trg->ctx);
5392                       YYABORT;
5393                     }
5394                     (yyvsp[-1].nodes).node.ptr_list->must = tmp;
5395                   }
5396 
5397                   if ((yyvsp[-1].nodes).node.ptr_list->tpdf_size) {
5398                     tmp = realloc((yyvsp[-1].nodes).node.ptr_list->tpdf, (yyvsp[-1].nodes).node.ptr_list->tpdf_size * sizeof *(yyvsp[-1].nodes).node.ptr_list->tpdf);
5399                     if (!tmp) {
5400                       LOGMEM(trg->ctx);
5401                       YYABORT;
5402                     }
5403                     (yyvsp[-1].nodes).node.ptr_list->tpdf = tmp;
5404                   }
5405 
5406                   if ((yyvsp[-1].nodes).node.ptr_list->unique_size) {
5407                     tmp = realloc((yyvsp[-1].nodes).node.ptr_list->unique, (yyvsp[-1].nodes).node.ptr_list->unique_size * sizeof *(yyvsp[-1].nodes).node.ptr_list->unique);
5408                     if (!tmp) {
5409                       LOGMEM(trg->ctx);
5410                       YYABORT;
5411                     }
5412                     (yyvsp[-1].nodes).node.ptr_list->unique = tmp;
5413                   }
5414 
5415                   LOGDBG(LY_LDGYANG, "finished parsing list statement \"%s\"", data_node->name);
5416                   actual_type = (yyvsp[-4].backup_token).token;
5417                   actual = (yyvsp[-4].backup_token).actual;
5418                   data_node = (yyvsp[-4].backup_token).actual;
5419                 }
5420     break;
5421 
5422   case 316:
5423                       { (yyval.nodes).node.ptr_list = actual;
5424                             (yyval.nodes).node.flag = 0;
5425                           }
5426     break;
5427 
5428   case 320:
5429                             { if ((yyvsp[-1].nodes).node.ptr_list->keys) {
5430                                   LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_list, "key", "list");
5431                                   free(s);
5432                                   YYABORT;
5433                               }
5434                               (yyvsp[-1].nodes).node.ptr_list->keys = (struct lys_node_leaf **)s;
5435                               (yyval.nodes) = (yyvsp[-1].nodes);
5436                               s = NULL;
5437                             }
5438     break;
5439 
5440   case 321:
5441                                { YANG_ADDELEM((yyvsp[-1].nodes).node.ptr_list->unique, (yyvsp[-1].nodes).node.ptr_list->unique_size, "uniques");
5442                                  ((struct lys_unique *)actual)->expr = (const char **)s;
5443                                  (yyval.nodes) = (yyvsp[-1].nodes);
5444                                  s = NULL;
5445                                  actual = (yyvsp[-1].nodes).node.ptr_list;
5446                                }
5447     break;
5448 
5449   case 322:
5450                                { if ((yyvsp[-1].nodes).node.ptr_list->flags & LYS_CONFIG_MASK) {
5451                                    LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_list, "config", "list");
5452                                    YYABORT;
5453                                  }
5454                                  (yyvsp[-1].nodes).node.ptr_list->flags |= (yyvsp[0].i);
5455                                }
5456     break;
5457 
5458   case 323:
5459                                      { if ((yyvsp[-1].nodes).node.flag & LYS_MIN_ELEMENTS) {
5460                                          LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_list, "min-elements", "list");
5461                                          YYABORT;
5462                                        }
5463                                        (yyvsp[-1].nodes).node.ptr_list->min = (yyvsp[0].uint);
5464                                        (yyvsp[-1].nodes).node.flag |= LYS_MIN_ELEMENTS;
5465                                        (yyval.nodes) = (yyvsp[-1].nodes);
5466                                        if ((yyvsp[-1].nodes).node.ptr_list->max && ((yyvsp[-1].nodes).node.ptr_list->min > (yyvsp[-1].nodes).node.ptr_list->max)) {
5467                                          LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_list, "Invalid value \"%d\" of \"%s\".", (yyvsp[0].uint), "min-elements");
5468                                          LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_list, "\"min-elements\" is bigger than \"max-elements\".");
5469                                          YYABORT;
5470                                        }
5471                                      }
5472     break;
5473 
5474   case 324:
5475                                      { if ((yyvsp[-1].nodes).node.flag & LYS_MAX_ELEMENTS) {
5476                                          LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_list, "max-elements", "list");
5477                                          YYABORT;
5478                                        }
5479                                        (yyvsp[-1].nodes).node.ptr_list->max = (yyvsp[0].uint);
5480                                        (yyvsp[-1].nodes).node.flag |= LYS_MAX_ELEMENTS;
5481                                        (yyval.nodes) = (yyvsp[-1].nodes);
5482                                        if ((yyvsp[-1].nodes).node.ptr_list->max && ((yyvsp[-1].nodes).node.ptr_list->min > (yyvsp[-1].nodes).node.ptr_list->max)) {
5483                                          LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_list, "Invalid value \"%d\" of \"%s\".", (yyvsp[0].uint), "min-elements");
5484                                          LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_list, "\"max-elements\" is smaller than \"min-elements\".");
5485                                          YYABORT;
5486                                        }
5487                                      }
5488     break;
5489 
5490   case 325:
5491                                    { if ((yyvsp[-1].nodes).node.flag & LYS_ORDERED_MASK) {
5492                                        LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_list, "ordered by", "list");
5493                                        YYABORT;
5494                                      }
5495                                      if ((yyvsp[0].i) & LYS_USERORDERED) {
5496                                        (yyvsp[-1].nodes).node.ptr_list->flags |= LYS_USERORDERED;
5497                                      }
5498                                      (yyvsp[-1].nodes).node.flag |= (yyvsp[0].i);
5499                                      (yyval.nodes) = (yyvsp[-1].nodes);
5500                                    }
5501     break;
5502 
5503   case 326:
5504                                { if ((yyvsp[-1].nodes).node.ptr_list->flags & LYS_STATUS_MASK) {
5505                                    LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_list, "status", "list");
5506                                    YYABORT;
5507                                  }
5508                                  (yyvsp[-1].nodes).node.ptr_list->flags |= (yyvsp[0].i);
5509                                }
5510     break;
5511 
5512   case 327:
5513                                     { if (yang_read_description(trg, (yyvsp[-1].nodes).node.ptr_list, s, "list", NODE_PRINT)) {
5514                                         YYABORT;
5515                                       }
5516                                       s = NULL;
5517                                     }
5518     break;
5519 
5520   case 328:
5521                                   { if (yang_read_reference(trg, (yyvsp[-1].nodes).node.ptr_list, s, "list", NODE_PRINT)) {
5522                                       YYABORT;
5523                                     }
5524                                     s = NULL;
5525                                   }
5526     break;
5527 
5528   case 332:
5529                                              { if (trg->version < 2) {
5530                                                  LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_LYS, (yyvsp[-2].nodes).node.ptr_list, "notification");
5531                                                  YYABORT;
5532                                                }
5533                                              }
5534     break;
5535 
5536   case 334:
5537                                    { (yyval.backup_token).token = actual_type;
5538                                      (yyval.backup_token).actual = actual;
5539                                      if (!(actual = yang_read_node(trg, actual, param->node, s, LYS_CHOICE, sizeof(struct lys_node_choice)))) {
5540                                        YYABORT;
5541                                      }
5542                                      data_node = actual;
5543                                      s = NULL;
5544                                      actual_type = CHOICE_KEYWORD;
5545                                    }
5546     break;
5547 
5548   case 335:
5549              { LOGDBG(LY_LDGYANG, "finished parsing choice statement \"%s\"", data_node->name);
5550                actual_type = (yyvsp[-1].backup_token).token;
5551                actual = (yyvsp[-1].backup_token).actual;
5552                data_node = (yyvsp[-1].backup_token).actual;
5553              }
5554     break;
5555 
5556   case 337:
5557          { struct lys_iffeature *tmp;
5558 
5559            if (((yyvsp[-1].nodes).node.ptr_choice->flags & LYS_MAND_TRUE) && (yyvsp[-1].nodes).node.ptr_choice->dflt) {
5560               LOGVAL(trg->ctx, LYE_INCHILDSTMT, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_choice, "default", "choice");
5561               LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_choice, "The \"default\" statement is forbidden on choices with \"mandatory\".");
5562               YYABORT;
5563             }
5564 
5565            if ((yyvsp[-1].nodes).node.ptr_choice->iffeature_size) {
5566              tmp = realloc((yyvsp[-1].nodes).node.ptr_choice->iffeature, (yyvsp[-1].nodes).node.ptr_choice->iffeature_size * sizeof *tmp);
5567              if (!tmp) {
5568                LOGMEM(trg->ctx);
5569                YYABORT;
5570              }
5571              (yyvsp[-1].nodes).node.ptr_choice->iffeature = tmp;
5572            }
5573          }
5574     break;
5575 
5576   case 338:
5577                         { (yyval.nodes).node.ptr_choice = actual;
5578                               (yyval.nodes).node.flag = 0;
5579                             }
5580     break;
5581 
5582   case 341:
5583                                   { if ((yyvsp[-1].nodes).node.flag & LYS_CHOICE_DEFAULT) {
5584                                       LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_choice, "default", "choice");
5585                                       free(s);
5586                                       YYABORT;
5587                                     }
5588                                     (yyvsp[-1].nodes).node.ptr_choice->dflt = (struct lys_node *) s;
5589                                     s = NULL;
5590                                     (yyval.nodes) = (yyvsp[-1].nodes);
5591                                     (yyval.nodes).node.flag |= LYS_CHOICE_DEFAULT;
5592                                   }
5593     break;
5594 
5595   case 342:
5596                                  { if ((yyvsp[-1].nodes).node.ptr_choice->flags & LYS_CONFIG_MASK) {
5597                                      LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_choice, "config", "choice");
5598                                      YYABORT;
5599                                    }
5600                                    (yyvsp[-1].nodes).node.ptr_choice->flags |= (yyvsp[0].i);
5601                                    (yyval.nodes) = (yyvsp[-1].nodes);
5602                                  }
5603     break;
5604 
5605   case 343:
5606                                   { if ((yyvsp[-1].nodes).node.ptr_choice->flags & LYS_MAND_MASK) {
5607                                       LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_choice, "mandatory", "choice");
5608                                       YYABORT;
5609                                     }
5610                                     (yyvsp[-1].nodes).node.ptr_choice->flags |= (yyvsp[0].i);
5611                                     (yyval.nodes) = (yyvsp[-1].nodes);
5612                                   }
5613     break;
5614 
5615   case 344:
5616                                  { if ((yyvsp[-1].nodes).node.ptr_choice->flags & LYS_STATUS_MASK) {
5617                                      LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_choice, "status", "choice");
5618                                      YYABORT;
5619                                    }
5620                                    (yyvsp[-1].nodes).node.ptr_choice->flags |= (yyvsp[0].i);
5621                                    (yyval.nodes) = (yyvsp[-1].nodes);
5622                                  }
5623     break;
5624 
5625   case 345:
5626                                       { if (yang_read_description(trg, (yyvsp[-1].nodes).node.ptr_choice, s, "choice", NODE_PRINT)) {
5627                                           YYABORT;
5628                                         }
5629                                         s = NULL;
5630                                         (yyval.nodes) = (yyvsp[-1].nodes);
5631                                       }
5632     break;
5633 
5634   case 346:
5635                                     { if (yang_read_reference(trg, (yyvsp[-1].nodes).node.ptr_choice, s, "choice", NODE_PRINT)) {
5636                                         YYABORT;
5637                                       }
5638                                       s = NULL;
5639                                       (yyval.nodes) = (yyvsp[-1].nodes);
5640                                     }
5641     break;
5642 
5643   case 356:
5644                  { if (trg->version < 2 ) {
5645                      LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_LYS, actual, "choice");
5646                      YYABORT;
5647                    }
5648                  }
5649     break;
5650 
5651   case 357:
5652                                  { (yyval.backup_token).token = actual_type;
5653                                    (yyval.backup_token).actual = actual;
5654                                    if (!(actual = yang_read_node(trg, actual, param->node, s, LYS_CASE, sizeof(struct lys_node_case)))) {
5655                                      YYABORT;
5656                                    }
5657                                    data_node = actual;
5658                                    s = NULL;
5659                                    actual_type = CASE_KEYWORD;
5660                                  }
5661     break;
5662 
5663   case 358:
5664            { LOGDBG(LY_LDGYANG, "finished parsing case statement \"%s\"", data_node->name);
5665              actual_type = (yyvsp[-1].backup_token).token;
5666              actual = (yyvsp[-1].backup_token).actual;
5667              data_node = (yyvsp[-1].backup_token).actual;
5668            }
5669     break;
5670 
5671   case 360:
5672           { struct lys_iffeature *tmp;
5673 
5674            if ((yyvsp[-1].nodes).cs->iffeature_size) {
5675              tmp = realloc((yyvsp[-1].nodes).cs->iffeature, (yyvsp[-1].nodes).cs->iffeature_size * sizeof *tmp);
5676              if (!tmp) {
5677                LOGMEM(trg->ctx);
5678                YYABORT;
5679              }
5680              (yyvsp[-1].nodes).cs->iffeature = tmp;
5681            }
5682           }
5683     break;
5684 
5685   case 361:
5686                       { (yyval.nodes).cs = actual; }
5687     break;
5688 
5689   case 364:
5690                                { if ((yyvsp[-1].nodes).cs->flags & LYS_STATUS_MASK) {
5691                                    LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).cs, "status", "case");
5692                                    YYABORT;
5693                                  }
5694                                  (yyvsp[-1].nodes).cs->flags |= (yyvsp[0].i);
5695                                }
5696     break;
5697 
5698   case 365:
5699                                     { if (yang_read_description(trg, (yyvsp[-1].nodes).cs, s, "case", NODE_PRINT)) {
5700                                         YYABORT;
5701                                       }
5702                                       s = NULL;
5703                                     }
5704     break;
5705 
5706   case 366:
5707                                   { if (yang_read_reference(trg, (yyvsp[-1].nodes).cs, s, "case", NODE_PRINT)) {
5708                                       YYABORT;
5709                                     }
5710                                     s = NULL;
5711                                   }
5712     break;
5713 
5714   case 368:
5715                                    { (yyval.backup_token).token = actual_type;
5716                                      (yyval.backup_token).actual = actual;
5717                                      if (!(actual = yang_read_node(trg, actual, param->node, s, LYS_ANYXML, sizeof(struct lys_node_anydata)))) {
5718                                        YYABORT;
5719                                      }
5720                                      data_node = actual;
5721                                      s = NULL;
5722                                      actual_type = ANYXML_KEYWORD;
5723                                    }
5724     break;
5725 
5726   case 369:
5727              { LOGDBG(LY_LDGYANG, "finished parsing anyxml statement \"%s\"", data_node->name);
5728                actual_type = (yyvsp[-1].backup_token).token;
5729                actual = (yyvsp[-1].backup_token).actual;
5730                data_node = (yyvsp[-1].backup_token).actual;
5731              }
5732     break;
5733 
5734   case 370:
5735                                     { (yyval.backup_token).token = actual_type;
5736                                       (yyval.backup_token).actual = actual;
5737                                       if (!(actual = yang_read_node(trg, actual, param->node, s, LYS_ANYDATA, sizeof(struct lys_node_anydata)))) {
5738                                         YYABORT;
5739                                       }
5740                                       data_node = actual;
5741                                       s = NULL;
5742                                       actual_type = ANYDATA_KEYWORD;
5743                                     }
5744     break;
5745 
5746   case 371:
5747               { LOGDBG(LY_LDGYANG, "finished parsing anydata statement \"%s\"", data_node->name);
5748                 actual_type = (yyvsp[-1].backup_token).token;
5749                 actual = (yyvsp[-1].backup_token).actual;
5750                 data_node = (yyvsp[-1].backup_token).actual;
5751               }
5752     break;
5753 
5754   case 373:
5755          { void *tmp;
5756 
5757            if ((yyvsp[-1].nodes).node.ptr_anydata->iffeature_size) {
5758              tmp = realloc((yyvsp[-1].nodes).node.ptr_anydata->iffeature, (yyvsp[-1].nodes).node.ptr_anydata->iffeature_size * sizeof *(yyvsp[-1].nodes).node.ptr_anydata->iffeature);
5759              if (!tmp) {
5760                LOGMEM(trg->ctx);
5761                YYABORT;
5762              }
5763              (yyvsp[-1].nodes).node.ptr_anydata->iffeature = tmp;
5764            }
5765 
5766            if ((yyvsp[-1].nodes).node.ptr_anydata->must_size) {
5767              tmp = realloc((yyvsp[-1].nodes).node.ptr_anydata->must, (yyvsp[-1].nodes).node.ptr_anydata->must_size * sizeof *(yyvsp[-1].nodes).node.ptr_anydata->must);
5768              if (!tmp) {
5769                LOGMEM(trg->ctx);
5770                YYABORT;
5771              }
5772              (yyvsp[-1].nodes).node.ptr_anydata->must = tmp;
5773            }
5774          }
5775     break;
5776 
5777   case 374:
5778                         { (yyval.nodes).node.ptr_anydata = actual;
5779                               (yyval.nodes).node.flag = actual_type;
5780                             }
5781     break;
5782 
5783   case 378:
5784                                  { if ((yyvsp[-1].nodes).node.ptr_anydata->flags & LYS_CONFIG_MASK) {
5785                                      LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_anydata, "config",
5786                                             ((yyvsp[-1].nodes).node.flag == ANYXML_KEYWORD) ? "anyxml" : "anydata");
5787                                      YYABORT;
5788                                    }
5789                                    (yyvsp[-1].nodes).node.ptr_anydata->flags |= (yyvsp[0].i);
5790                                  }
5791     break;
5792 
5793   case 379:
5794                                     { if ((yyvsp[-1].nodes).node.ptr_anydata->flags & LYS_MAND_MASK) {
5795                                         LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_anydata, "mandatory",
5796                                                ((yyvsp[-1].nodes).node.flag == ANYXML_KEYWORD) ? "anyxml" : "anydata");
5797                                         YYABORT;
5798                                       }
5799                                       (yyvsp[-1].nodes).node.ptr_anydata->flags |= (yyvsp[0].i);
5800                                     }
5801     break;
5802 
5803   case 380:
5804                                  { if ((yyvsp[-1].nodes).node.ptr_anydata->flags & LYS_STATUS_MASK) {
5805                                      LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_anydata, "status",
5806                                             ((yyvsp[-1].nodes).node.flag == ANYXML_KEYWORD) ? "anyxml" : "anydata");
5807                                      YYABORT;
5808                                    }
5809                                    (yyvsp[-1].nodes).node.ptr_anydata->flags |= (yyvsp[0].i);
5810                                  }
5811     break;
5812 
5813   case 381:
5814                                       { if (yang_read_description(trg, (yyvsp[-1].nodes).node.ptr_anydata, s, ((yyvsp[-1].nodes).node.flag == ANYXML_KEYWORD) ? "anyxml" : "anydata", NODE_PRINT)) {
5815                                           YYABORT;
5816                                         }
5817                                         s = NULL;
5818                                       }
5819     break;
5820 
5821   case 382:
5822                                     { if (yang_read_reference(trg, (yyvsp[-1].nodes).node.ptr_anydata, s, ((yyvsp[-1].nodes).node.flag == ANYXML_KEYWORD) ? "anyxml" : "anydata", NODE_PRINT)) {
5823                                         YYABORT;
5824                                       }
5825                                       s = NULL;
5826                                     }
5827     break;
5828 
5829   case 383:
5830                                      { (yyval.backup_token).token = actual_type;
5831                                        (yyval.backup_token).actual = actual;
5832                                        if (!(actual = yang_read_node(trg, actual, param->node, s, LYS_USES, sizeof(struct lys_node_uses)))) {
5833                                          YYABORT;
5834                                        }
5835                                        data_node = actual;
5836                                        s = NULL;
5837                                        actual_type = USES_KEYWORD;
5838                                      }
5839     break;
5840 
5841   case 384:
5842            { LOGDBG(LY_LDGYANG, "finished parsing uses statement \"%s\"", data_node->name);
5843              actual_type = (yyvsp[-1].backup_token).token;
5844              actual = (yyvsp[-1].backup_token).actual;
5845              data_node = (yyvsp[-1].backup_token).actual;
5846            }
5847     break;
5848 
5849   case 386:
5850          { void *tmp;
5851 
5852            if ((yyvsp[-1].nodes).uses->iffeature_size) {
5853              tmp = realloc((yyvsp[-1].nodes).uses->iffeature, (yyvsp[-1].nodes).uses->iffeature_size * sizeof *(yyvsp[-1].nodes).uses->iffeature);
5854              if (!tmp) {
5855                LOGMEM(trg->ctx);
5856                YYABORT;
5857              }
5858              (yyvsp[-1].nodes).uses->iffeature = tmp;
5859            }
5860 
5861            if ((yyvsp[-1].nodes).uses->refine_size) {
5862              tmp = realloc((yyvsp[-1].nodes).uses->refine, (yyvsp[-1].nodes).uses->refine_size * sizeof *(yyvsp[-1].nodes).uses->refine);
5863              if (!tmp) {
5864                LOGMEM(trg->ctx);
5865                YYABORT;
5866              }
5867              (yyvsp[-1].nodes).uses->refine = tmp;
5868            }
5869 
5870            if ((yyvsp[-1].nodes).uses->augment_size) {
5871              tmp = realloc((yyvsp[-1].nodes).uses->augment, (yyvsp[-1].nodes).uses->augment_size * sizeof *(yyvsp[-1].nodes).uses->augment);
5872              if (!tmp) {
5873                LOGMEM(trg->ctx);
5874                YYABORT;
5875              }
5876              (yyvsp[-1].nodes).uses->augment = tmp;
5877            }
5878          }
5879     break;
5880 
5881   case 387:
5882                       { (yyval.nodes).uses = actual; }
5883     break;
5884 
5885   case 390:
5886                                { if ((yyvsp[-1].nodes).uses->flags & LYS_STATUS_MASK) {
5887                                    LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).uses, "status", "uses");
5888                                    YYABORT;
5889                                  }
5890                                  (yyvsp[-1].nodes).uses->flags |= (yyvsp[0].i);
5891                                }
5892     break;
5893 
5894   case 391:
5895                                     { if (yang_read_description(trg, (yyvsp[-1].nodes).uses, s, "uses", NODE_PRINT)) {
5896                                         YYABORT;
5897                                       }
5898                                       s = NULL;
5899                                     }
5900     break;
5901 
5902   case 392:
5903                                   { if (yang_read_reference(trg, (yyvsp[-1].nodes).uses, s, "uses", NODE_PRINT)) {
5904                                       YYABORT;
5905                                     }
5906                                     s = NULL;
5907                                   }
5908     break;
5909 
5910   case 397:
5911                                 { (yyval.backup_token).token = actual_type;
5912                                   (yyval.backup_token).actual = actual;
5913                                   YANG_ADDELEM(((struct lys_node_uses *)actual)->refine,
5914                                                ((struct lys_node_uses *)actual)->refine_size, "refines");
5915                                   ((struct lys_refine *)actual)->target_name = transform_schema2json(trg, s);
5916                                   free(s);
5917                                   s = NULL;
5918                                   if (!((struct lys_refine *)actual)->target_name) {
5919                                     YYABORT;
5920                                   }
5921                                   actual_type = REFINE_KEYWORD;
5922                                 }
5923     break;
5924 
5925   case 398:
5926              { actual_type = (yyvsp[-1].backup_token).token;
5927                actual = (yyvsp[-1].backup_token).actual;
5928              }
5929     break;
5930 
5931   case 400:
5932          { void *tmp;
5933 
5934            if ((yyvsp[-1].nodes).refine->iffeature_size) {
5935              tmp = realloc((yyvsp[-1].nodes).refine->iffeature, (yyvsp[-1].nodes).refine->iffeature_size * sizeof *(yyvsp[-1].nodes).refine->iffeature);
5936              if (!tmp) {
5937                LOGMEM(trg->ctx);
5938                YYABORT;
5939              }
5940              (yyvsp[-1].nodes).refine->iffeature = tmp;
5941            }
5942 
5943            if ((yyvsp[-1].nodes).refine->must_size) {
5944              tmp = realloc((yyvsp[-1].nodes).refine->must, (yyvsp[-1].nodes).refine->must_size * sizeof *(yyvsp[-1].nodes).refine->must);
5945              if (!tmp) {
5946                LOGMEM(trg->ctx);
5947                YYABORT;
5948              }
5949              (yyvsp[-1].nodes).refine->must = tmp;
5950            }
5951 
5952            if ((yyvsp[-1].nodes).refine->dflt_size) {
5953              tmp = realloc((yyvsp[-1].nodes).refine->dflt, (yyvsp[-1].nodes).refine->dflt_size * sizeof *(yyvsp[-1].nodes).refine->dflt);
5954              if (!tmp) {
5955                LOGMEM(trg->ctx);
5956                YYABORT;
5957              }
5958              (yyvsp[-1].nodes).refine->dflt = tmp;
5959            }
5960          }
5961     break;
5962 
5963   case 401:
5964                               { (yyval.nodes).refine = actual;
5965                                     actual_type = REFINE_KEYWORD;
5966                                   }
5967     break;
5968 
5969   case 402:
5970                                              { actual = (yyvsp[-2].nodes).refine;
5971                                                actual_type = REFINE_KEYWORD;
5972                                                if ((yyvsp[-2].nodes).refine->target_type) {
5973                                                  if ((yyvsp[-2].nodes).refine->target_type & (LYS_LEAF | LYS_LIST | LYS_LEAFLIST | LYS_CONTAINER | LYS_ANYDATA)) {
5974                                                    (yyvsp[-2].nodes).refine->target_type &= (LYS_LEAF | LYS_LIST | LYS_LEAFLIST | LYS_CONTAINER | LYS_ANYDATA);
5975                                                  } else {
5976                                                    LOGVAL(trg->ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, "must", "refine");
5977                                                    LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Invalid refine target nodetype for the substatements.");
5978                                                    YYABORT;
5979                                                  }
5980                                                } else {
5981                                                  (yyvsp[-2].nodes).refine->target_type = LYS_LEAF | LYS_LIST | LYS_LEAFLIST | LYS_CONTAINER | LYS_ANYDATA;
5982                                                }
5983                                              }
5984     break;
5985 
5986   case 403:
5987              { /* leaf, leaf-list, list, container, choice, case, anydata or anyxml */
5988                /* check possibility of statements combination */
5989                if ((yyvsp[-2].nodes).refine->target_type) {
5990                  if ((yyvsp[-2].nodes).refine->target_type & (LYS_LEAF | LYS_LIST | LYS_LEAFLIST | LYS_CONTAINER | LYS_CHOICE | LYS_CASE | LYS_ANYDATA)) {
5991                    (yyvsp[-2].nodes).refine->target_type &= (LYS_LEAF | LYS_LIST | LYS_LEAFLIST | LYS_CONTAINER | LYS_CHOICE | LYS_CASE | LYS_ANYDATA);
5992                  } else {
5993                    free(s);
5994                    LOGVAL(trg->ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, "if-feature", "refine");
5995                    LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Invalid refine target nodetype for the substatements.");
5996                    YYABORT;
5997                  }
5998                } else {
5999                  (yyvsp[-2].nodes).refine->target_type = LYS_LEAF | LYS_LIST | LYS_LEAFLIST | LYS_CONTAINER | LYS_CHOICE | LYS_CASE | LYS_ANYDATA;
6000                }
6001              }
6002     break;
6003 
6004   case 404:
6005                                          { if ((yyvsp[-1].nodes).refine->target_type) {
6006                                              if ((yyvsp[-1].nodes).refine->target_type & LYS_CONTAINER) {
6007                                                if ((yyvsp[-1].nodes).refine->mod.presence) {
6008                                                  LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "presence", "refine");
6009                                                  free(s);
6010                                                  YYABORT;
6011                                                }
6012                                                (yyvsp[-1].nodes).refine->target_type = LYS_CONTAINER;
6013                                                (yyvsp[-1].nodes).refine->mod.presence = lydict_insert_zc(trg->ctx, s);
6014                                              } else {
6015                                                free(s);
6016                                                LOGVAL(trg->ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, "presence", "refine");
6017                                                LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Invalid refine target nodetype for the substatements.");
6018                                                YYABORT;
6019                                              }
6020                                            } else {
6021                                              (yyvsp[-1].nodes).refine->target_type = LYS_CONTAINER;
6022                                              (yyvsp[-1].nodes).refine->mod.presence = lydict_insert_zc(trg->ctx, s);
6023                                            }
6024                                            s = NULL;
6025                                            (yyval.nodes) = (yyvsp[-1].nodes);
6026                                          }
6027     break;
6028 
6029   case 405:
6030                                         { int i;
6031 
6032                                           if ((yyvsp[-1].nodes).refine->dflt_size) {
6033                                             if (trg->version < 2) {
6034                                               LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "default", "refine");
6035                                               YYABORT;
6036                                             }
6037                                             if ((yyvsp[-1].nodes).refine->target_type & LYS_LEAFLIST) {
6038                                               (yyvsp[-1].nodes).refine->target_type = LYS_LEAFLIST;
6039                                             } else {
6040                                               free(s);
6041                                               LOGVAL(trg->ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, "default", "refine");
6042                                               LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Invalid refine target nodetype for the substatements.");
6043                                               YYABORT;
6044                                             }
6045                                           } else {
6046                                             if ((yyvsp[-1].nodes).refine->target_type) {
6047                                               if (trg->version < 2 && ((yyvsp[-1].nodes).refine->target_type & (LYS_LEAF | LYS_CHOICE))) {
6048                                                 (yyvsp[-1].nodes).refine->target_type &= (LYS_LEAF | LYS_CHOICE);
6049                                               } if (trg->version > 1 && ((yyvsp[-1].nodes).refine->target_type & (LYS_LEAF | LYS_LEAFLIST | LYS_CHOICE))) {
6050                                                 /* YANG 1.1 */
6051                                                 (yyvsp[-1].nodes).refine->target_type &= (LYS_LEAF | LYS_LEAFLIST | LYS_CHOICE);
6052                                               } else {
6053                                                 free(s);
6054                                                 LOGVAL(trg->ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, "default", "refine");
6055                                                 LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Invalid refine target nodetype for the substatements.");
6056                                                 YYABORT;
6057                                               }
6058                                             } else {
6059                                               if (trg->version < 2) {
6060                                                 (yyvsp[-1].nodes).refine->target_type = LYS_LEAF | LYS_CHOICE;
6061                                               } else {
6062                                                 /* YANG 1.1 */
6063                                                 (yyvsp[-1].nodes).refine->target_type = LYS_LEAF | LYS_LEAFLIST | LYS_CHOICE;
6064                                               }
6065                                             }
6066                                           }
6067                                           /* check for duplicity */
6068                                           for (i = 0; i < (yyvsp[-1].nodes).refine->dflt_size; ++i) {
6069                                               if (ly_strequal((yyvsp[-1].nodes).refine->dflt[i], s, 0)) {
6070                                                   LOGVAL(trg->ctx, LYE_INARG, LY_VLOG_NONE, NULL, s, "default");
6071                                                   LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Duplicated default value \"%s\".", s);
6072                                                   YYABORT;
6073                                               }
6074                                           }
6075                                           YANG_ADDELEM((yyvsp[-1].nodes).refine->dflt, (yyvsp[-1].nodes).refine->dflt_size, "defaults");
6076                                           *((const char **)actual) = lydict_insert_zc(trg->ctx, s);
6077                                           actual = (yyvsp[-1].nodes).refine;
6078                                           s = NULL;
6079                                           (yyval.nodes) = (yyvsp[-1].nodes);
6080                                         }
6081     break;
6082 
6083   case 406:
6084                                        { if ((yyvsp[-1].nodes).refine->target_type) {
6085                                            if ((yyvsp[-1].nodes).refine->target_type & (LYS_LEAF | LYS_CHOICE | LYS_LIST | LYS_CONTAINER | LYS_LEAFLIST)) {
6086                                              (yyvsp[-1].nodes).refine->target_type &= (LYS_LEAF | LYS_CHOICE | LYS_LIST | LYS_CONTAINER | LYS_LEAFLIST);
6087                                              if ((yyvsp[-1].nodes).refine->flags & LYS_CONFIG_MASK) {
6088                                                LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "config", "refine");
6089                                                YYABORT;
6090                                              }
6091                                              (yyvsp[-1].nodes).refine->flags |= (yyvsp[0].i);
6092                                            } else {
6093                                              LOGVAL(trg->ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, "config", "refine");
6094                                              LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Invalid refine target nodetype for the substatements.");
6095                                              YYABORT;
6096                                            }
6097                                          } else {
6098                                            (yyvsp[-1].nodes).refine->target_type = LYS_LEAF | LYS_CHOICE | LYS_LIST | LYS_CONTAINER | LYS_LEAFLIST;
6099                                            (yyvsp[-1].nodes).refine->flags |= (yyvsp[0].i);
6100                                          }
6101                                          (yyval.nodes) = (yyvsp[-1].nodes);
6102                                        }
6103     break;
6104 
6105   case 407:
6106                                           { if ((yyvsp[-1].nodes).refine->target_type) {
6107                                               if ((yyvsp[-1].nodes).refine->target_type & (LYS_LEAF | LYS_CHOICE | LYS_ANYDATA)) {
6108                                                 (yyvsp[-1].nodes).refine->target_type &= (LYS_LEAF | LYS_CHOICE | LYS_ANYDATA);
6109                                                 if ((yyvsp[-1].nodes).refine->flags & LYS_MAND_MASK) {
6110                                                   LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "mandatory", "refine");
6111                                                   YYABORT;
6112                                                 }
6113                                                 (yyvsp[-1].nodes).refine->flags |= (yyvsp[0].i);
6114                                               } else {
6115                                                 LOGVAL(trg->ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, "mandatory", "refine");
6116                                                 LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Invalid refine target nodetype for the substatements.");
6117                                                 YYABORT;
6118                                               }
6119                                             } else {
6120                                               (yyvsp[-1].nodes).refine->target_type = LYS_LEAF | LYS_CHOICE | LYS_ANYDATA;
6121                                               (yyvsp[-1].nodes).refine->flags |= (yyvsp[0].i);
6122                                             }
6123                                             (yyval.nodes) = (yyvsp[-1].nodes);
6124                                           }
6125     break;
6126 
6127   case 408:
6128                                              { if ((yyvsp[-1].nodes).refine->target_type) {
6129                                                  if ((yyvsp[-1].nodes).refine->target_type & (LYS_LIST | LYS_LEAFLIST)) {
6130                                                    (yyvsp[-1].nodes).refine->target_type &= (LYS_LIST | LYS_LEAFLIST);
6131                                                    if ((yyvsp[-1].nodes).refine->flags & LYS_RFN_MINSET) {
6132                                                      LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "min-elements", "refine");
6133                                                      YYABORT;
6134                                                    }
6135                                                    (yyvsp[-1].nodes).refine->flags |= LYS_RFN_MINSET;
6136                                                    (yyvsp[-1].nodes).refine->mod.list.min = (yyvsp[0].uint);
6137                                                  } else {
6138                                                    LOGVAL(trg->ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, "min-elements", "refine");
6139                                                    LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Invalid refine target nodetype for the substatements.");
6140                                                    YYABORT;
6141                                                  }
6142                                                } else {
6143                                                  (yyvsp[-1].nodes).refine->target_type = LYS_LIST | LYS_LEAFLIST;
6144                                                  (yyvsp[-1].nodes).refine->flags |= LYS_RFN_MINSET;
6145                                                  (yyvsp[-1].nodes).refine->mod.list.min = (yyvsp[0].uint);
6146                                                }
6147                                                (yyval.nodes) = (yyvsp[-1].nodes);
6148                                              }
6149     break;
6150 
6151   case 409:
6152                                              { if ((yyvsp[-1].nodes).refine->target_type) {
6153                                                  if ((yyvsp[-1].nodes).refine->target_type & (LYS_LIST | LYS_LEAFLIST)) {
6154                                                    (yyvsp[-1].nodes).refine->target_type &= (LYS_LIST | LYS_LEAFLIST);
6155                                                    if ((yyvsp[-1].nodes).refine->flags & LYS_RFN_MAXSET) {
6156                                                      LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "max-elements", "refine");
6157                                                      YYABORT;
6158                                                    }
6159                                                    (yyvsp[-1].nodes).refine->flags |= LYS_RFN_MAXSET;
6160                                                    (yyvsp[-1].nodes).refine->mod.list.max = (yyvsp[0].uint);
6161                                                  } else {
6162                                                    LOGVAL(trg->ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, "max-elements", "refine");
6163                                                    LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Invalid refine target nodetype for the substatements.");
6164                                                    YYABORT;
6165                                                  }
6166                                                } else {
6167                                                  (yyvsp[-1].nodes).refine->target_type = LYS_LIST | LYS_LEAFLIST;
6168                                                  (yyvsp[-1].nodes).refine->flags |= LYS_RFN_MAXSET;
6169                                                  (yyvsp[-1].nodes).refine->mod.list.max = (yyvsp[0].uint);
6170                                                }
6171                                                (yyval.nodes) = (yyvsp[-1].nodes);
6172                                              }
6173     break;
6174 
6175   case 410:
6176                                             { if (yang_read_description(trg, (yyvsp[-1].nodes).refine, s, "refine", NODE)) {
6177                                                 YYABORT;
6178                                               }
6179                                               s = NULL;
6180                                             }
6181     break;
6182 
6183   case 411:
6184                                           { if (yang_read_reference(trg, (yyvsp[-1].nodes).refine, s, "refine", NODE)) {
6185                                               YYABORT;
6186                                             }
6187                                             s = NULL;
6188                                           }
6189     break;
6190 
6191   case 414:
6192                                        { void *parent;
6193 
6194                                          (yyval.backup_token).token = actual_type;
6195                                          (yyval.backup_token).actual = actual;
6196                                          parent = actual;
6197                                          YANG_ADDELEM(((struct lys_node_uses *)actual)->augment,
6198                                                       ((struct lys_node_uses *)actual)->augment_size, "augments");
6199                                          if (yang_read_augment(trg, parent, actual, s)) {
6200                                            YYABORT;
6201                                          }
6202                                          data_node = actual;
6203                                          s = NULL;
6204                                          actual_type = AUGMENT_KEYWORD;
6205                                        }
6206     break;
6207 
6208   case 415:
6209                        { LOGDBG(LY_LDGYANG, "finished parsing augment statement \"%s\"", data_node->name);
6210                          actual_type = (yyvsp[-4].backup_token).token;
6211                          actual = (yyvsp[-4].backup_token).actual;
6212                          data_node = (yyvsp[-4].backup_token).actual;
6213                        }
6214     break;
6215 
6216   case 418:
6217                              { (yyval.backup_token).token = actual_type;
6218                                (yyval.backup_token).actual = actual;
6219                                YANG_ADDELEM(trg->augment, trg->augment_size, "augments");
6220                                if (yang_read_augment(trg, NULL, actual, s)) {
6221                                  YYABORT;
6222                                }
6223                                data_node = actual;
6224                                s = NULL;
6225                                actual_type = AUGMENT_KEYWORD;
6226                              }
6227     break;
6228 
6229   case 419:
6230                   { LOGDBG(LY_LDGYANG, "finished parsing augment statement \"%s\"", data_node->name);
6231                     actual_type = (yyvsp[-4].backup_token).token;
6232                     actual = (yyvsp[-4].backup_token).actual;
6233                     data_node = (yyvsp[-4].backup_token).actual;
6234                   }
6235     break;
6236 
6237   case 420:
6238                          { (yyval.nodes).augment = actual; }
6239     break;
6240 
6241   case 423:
6242                                   { if ((yyvsp[-1].nodes).augment->flags & LYS_STATUS_MASK) {
6243                                       LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).augment, "status", "augment");
6244                                       YYABORT;
6245                                     }
6246                                     (yyvsp[-1].nodes).augment->flags |= (yyvsp[0].i);
6247                                   }
6248     break;
6249 
6250   case 424:
6251                                        { if (yang_read_description(trg, (yyvsp[-1].nodes).augment, s, "augment", NODE_PRINT)) {
6252                                            YYABORT;
6253                                          }
6254                                          s = NULL;
6255                                        }
6256     break;
6257 
6258   case 425:
6259                                      { if (yang_read_reference(trg, (yyvsp[-1].nodes).augment, s, "augment", NODE_PRINT)) {
6260                                          YYABORT;
6261                                        }
6262                                        s = NULL;
6263                                      }
6264     break;
6265 
6266   case 428:
6267                                                 { if (trg->version < 2) {
6268                                                     LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_LYS, (yyvsp[-2].nodes).augment, "notification");
6269                                                     YYABORT;
6270                                                   }
6271                                                 }
6272     break;
6273 
6274   case 430:
6275                                    { if (param->module->version != 2) {
6276                                        LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_LYS, actual, "action");
6277                                        free(s);
6278                                        YYABORT;
6279                                      }
6280                                      (yyval.backup_token).token = actual_type;
6281                                      (yyval.backup_token).actual = actual;
6282                                      if (!(actual = yang_read_node(trg, actual, param->node, s, LYS_ACTION, sizeof(struct lys_node_rpc_action)))) {
6283                                        YYABORT;
6284                                      }
6285                                      data_node = actual;
6286                                      s = NULL;
6287                                      actual_type = ACTION_KEYWORD;
6288                                    }
6289     break;
6290 
6291   case 431:
6292              { LOGDBG(LY_LDGYANG, "finished parsing action statement \"%s\"", data_node->name);
6293                actual_type = (yyvsp[-1].backup_token).token;
6294                actual = (yyvsp[-1].backup_token).actual;
6295                data_node = (yyvsp[-1].backup_token).actual;
6296              }
6297     break;
6298 
6299   case 432:
6300                                 { (yyval.backup_token).token = actual_type;
6301                                   (yyval.backup_token).actual = actual;
6302                                   if (!(actual = yang_read_node(trg, NULL, param->node, s, LYS_RPC, sizeof(struct lys_node_rpc_action)))) {
6303                                     YYABORT;
6304                                   }
6305                                   data_node = actual;
6306                                   s = NULL;
6307                                   actual_type = RPC_KEYWORD;
6308                                 }
6309     break;
6310 
6311   case 433:
6312           { LOGDBG(LY_LDGYANG, "finished parsing rpc statement \"%s\"", data_node->name);
6313             actual_type = (yyvsp[-1].backup_token).token;
6314             actual = (yyvsp[-1].backup_token).actual;
6315             data_node = (yyvsp[-1].backup_token).actual;
6316           }
6317     break;
6318 
6319   case 435:
6320           { void *tmp;
6321 
6322             if ((yyvsp[-1].nodes).node.ptr_rpc->iffeature_size) {
6323               tmp = realloc((yyvsp[-1].nodes).node.ptr_rpc->iffeature, (yyvsp[-1].nodes).node.ptr_rpc->iffeature_size * sizeof *(yyvsp[-1].nodes).node.ptr_rpc->iffeature);
6324               if (!tmp) {
6325                 LOGMEM(trg->ctx);
6326                 YYABORT;
6327               }
6328               (yyvsp[-1].nodes).node.ptr_rpc->iffeature = tmp;
6329             }
6330 
6331             if ((yyvsp[-1].nodes).node.ptr_rpc->tpdf_size) {
6332               tmp = realloc((yyvsp[-1].nodes).node.ptr_rpc->tpdf, (yyvsp[-1].nodes).node.ptr_rpc->tpdf_size * sizeof *(yyvsp[-1].nodes).node.ptr_rpc->tpdf);
6333               if (!tmp) {
6334                 LOGMEM(trg->ctx);
6335                 YYABORT;
6336               }
6337               (yyvsp[-1].nodes).node.ptr_rpc->tpdf = tmp;
6338             }
6339           }
6340     break;
6341 
6342   case 436:
6343                      { (yyval.nodes).node.ptr_rpc = actual;
6344                            (yyval.nodes).node.flag = 0;
6345                          }
6346     break;
6347 
6348   case 438:
6349                               { if ((yyvsp[-1].nodes).node.ptr_rpc->flags & LYS_STATUS_MASK) {
6350                                   LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).node.ptr_rpc, "status", "rpc");
6351                                   YYABORT;
6352                                 }
6353                                 (yyvsp[-1].nodes).node.ptr_rpc->flags |= (yyvsp[0].i);
6354                              }
6355     break;
6356 
6357   case 439:
6358                                    { if (yang_read_description(trg, (yyvsp[-1].nodes).node.ptr_rpc, s, "rpc", NODE_PRINT)) {
6359                                        YYABORT;
6360                                      }
6361                                      s = NULL;
6362                                    }
6363     break;
6364 
6365   case 440:
6366                                  { if (yang_read_reference(trg, (yyvsp[-1].nodes).node.ptr_rpc, s, "rpc", NODE_PRINT)) {
6367                                      YYABORT;
6368                                    }
6369                                    s = NULL;
6370                                  }
6371     break;
6372 
6373   case 443:
6374                                      { if ((yyvsp[-2].nodes).node.flag & LYS_RPC_INPUT) {
6375                                          LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-2].nodes).node.ptr_rpc, "input", "rpc");
6376                                          YYABORT;
6377                                        }
6378                                        (yyvsp[-2].nodes).node.flag |= LYS_RPC_INPUT;
6379                                        (yyval.nodes) = (yyvsp[-2].nodes);
6380                                      }
6381     break;
6382 
6383   case 444:
6384                                       { if ((yyvsp[-2].nodes).node.flag & LYS_RPC_OUTPUT) {
6385                                           LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-2].nodes).node.ptr_rpc, "output", "rpc");
6386                                           YYABORT;
6387                                         }
6388                                         (yyvsp[-2].nodes).node.flag |= LYS_RPC_OUTPUT;
6389                                         (yyval.nodes) = (yyvsp[-2].nodes);
6390                                       }
6391     break;
6392 
6393   case 445:
6394                                 { (yyval.backup_token).token = actual_type;
6395                                   (yyval.backup_token).actual = actual;
6396                                   s = strdup("input");
6397                                   if (!s) {
6398                                     LOGMEM(trg->ctx);
6399                                     YYABORT;
6400                                   }
6401                                   if (!(actual = yang_read_node(trg, actual, param->node, s, LYS_INPUT, sizeof(struct lys_node_inout)))) {
6402                                     YYABORT;
6403                                   }
6404                                   data_node = actual;
6405                                   s = NULL;
6406                                   actual_type = INPUT_KEYWORD;
6407                                 }
6408     break;
6409 
6410   case 446:
6411                 { void *tmp;
6412                   struct lys_node_inout *input = actual;
6413 
6414                   if (input->must_size) {
6415                     tmp = realloc(input->must, input->must_size * sizeof *input->must);
6416                     if (!tmp) {
6417                       LOGMEM(trg->ctx);
6418                       YYABORT;
6419                     }
6420                     input->must = tmp;
6421                   }
6422 
6423                   if (input->tpdf_size) {
6424                     tmp = realloc(input->tpdf, input->tpdf_size * sizeof *input->tpdf);
6425                     if (!tmp) {
6426                       LOGMEM(trg->ctx);
6427                       YYABORT;
6428                     }
6429                     input->tpdf = tmp;
6430                   }
6431 
6432                   LOGDBG(LY_LDGYANG, "finished parsing input statement \"%s\"", data_node->name);
6433                   actual_type = (yyvsp[-4].backup_token).token;
6434                   actual = (yyvsp[-4].backup_token).actual;
6435                   data_node = (yyvsp[-4].backup_token).actual;
6436                 }
6437     break;
6438 
6439   case 452:
6440                                   { (yyval.backup_token).token = actual_type;
6441                                     (yyval.backup_token).actual = actual;
6442                                     s = strdup("output");
6443                                     if (!s) {
6444                                       LOGMEM(trg->ctx);
6445                                       YYABORT;
6446                                     }
6447                                     if (!(actual = yang_read_node(trg, actual, param->node, s, LYS_OUTPUT, sizeof(struct lys_node_inout)))) {
6448                                       YYABORT;
6449                                     }
6450                                     data_node = actual;
6451                                     s = NULL;
6452                                     actual_type = OUTPUT_KEYWORD;
6453                                   }
6454     break;
6455 
6456   case 453:
6457                  { void *tmp;
6458                    struct lys_node_inout *output = actual;
6459 
6460                    if (output->must_size) {
6461                      tmp = realloc(output->must, output->must_size * sizeof *output->must);
6462                      if (!tmp) {
6463                        LOGMEM(trg->ctx);
6464                        YYABORT;
6465                      }
6466                      output->must = tmp;
6467                    }
6468 
6469                    if (output->tpdf_size) {
6470                      tmp = realloc(output->tpdf, output->tpdf_size * sizeof *output->tpdf);
6471                      if (!tmp) {
6472                        LOGMEM(trg->ctx);
6473                        YYABORT;
6474                      }
6475                      output->tpdf = tmp;
6476                    }
6477 
6478                    LOGDBG(LY_LDGYANG, "finished parsing output statement \"%s\"", data_node->name);
6479                    actual_type = (yyvsp[-4].backup_token).token;
6480                    actual = (yyvsp[-4].backup_token).actual;
6481                    data_node = (yyvsp[-4].backup_token).actual;
6482                  }
6483     break;
6484 
6485   case 454:
6486                                          { (yyval.backup_token).token = actual_type;
6487                                            (yyval.backup_token).actual = actual;
6488                                            if (!(actual = yang_read_node(trg, actual, param->node, s, LYS_NOTIF, sizeof(struct lys_node_notif)))) {
6489                                              YYABORT;
6490                                            }
6491                                            data_node = actual;
6492                                            s = NULL;
6493                                            actual_type = NOTIFICATION_KEYWORD;
6494                                          }
6495     break;
6496 
6497   case 455:
6498                    { LOGDBG(LY_LDGYANG, "finished parsing notification statement \"%s\"", data_node->name);
6499                      actual_type = (yyvsp[-1].backup_token).token;
6500                      actual = (yyvsp[-1].backup_token).actual;
6501                      data_node = (yyvsp[-1].backup_token).actual;
6502                    }
6503     break;
6504 
6505   case 457:
6506           { void *tmp;
6507 
6508             if ((yyvsp[-1].nodes).notif->must_size) {
6509               tmp = realloc((yyvsp[-1].nodes).notif->must, (yyvsp[-1].nodes).notif->must_size * sizeof *(yyvsp[-1].nodes).notif->must);
6510               if (!tmp) {
6511                 LOGMEM(trg->ctx);
6512                 YYABORT;
6513               }
6514               (yyvsp[-1].nodes).notif->must = tmp;
6515             }
6516 
6517            if ((yyvsp[-1].nodes).notif->iffeature_size) {
6518              tmp = realloc((yyvsp[-1].nodes).notif->iffeature, (yyvsp[-1].nodes).notif->iffeature_size * sizeof *(yyvsp[-1].nodes).notif->iffeature);
6519              if (!tmp) {
6520                LOGMEM(trg->ctx);
6521                YYABORT;
6522              }
6523              (yyvsp[-1].nodes).notif->iffeature = tmp;
6524            }
6525 
6526            if ((yyvsp[-1].nodes).notif->tpdf_size) {
6527              tmp = realloc((yyvsp[-1].nodes).notif->tpdf, (yyvsp[-1].nodes).notif->tpdf_size * sizeof *(yyvsp[-1].nodes).notif->tpdf);
6528              if (!tmp) {
6529                LOGMEM(trg->ctx);
6530                YYABORT;
6531              }
6532              (yyvsp[-1].nodes).notif->tpdf = tmp;
6533            }
6534           }
6535     break;
6536 
6537   case 458:
6538                               { (yyval.nodes).notif = actual; }
6539     break;
6540 
6541   case 461:
6542                                        { if ((yyvsp[-1].nodes).notif->flags & LYS_STATUS_MASK) {
6543                                            LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_LYS, (yyvsp[-1].nodes).notif, "status", "notification");
6544                                            YYABORT;
6545                                          }
6546                                          (yyvsp[-1].nodes).notif->flags |= (yyvsp[0].i);
6547                                        }
6548     break;
6549 
6550   case 462:
6551                                             { if (yang_read_description(trg, (yyvsp[-1].nodes).notif, s, "notification", NODE_PRINT)) {
6552                                                 YYABORT;
6553                                               }
6554                                               s = NULL;
6555                                             }
6556     break;
6557 
6558   case 463:
6559                                           { if (yang_read_reference(trg, (yyvsp[-1].nodes).notif, s, "notification", NODE_PRINT)) {
6560                                               YYABORT;
6561                                             }
6562                                             s = NULL;
6563                                           }
6564     break;
6565 
6566   case 467:
6567                                  { (yyval.backup_token).token = actual_type;
6568                                    (yyval.backup_token).actual = actual;
6569                                    YANG_ADDELEM(trg->deviation, trg->deviation_size, "deviations");
6570                                    ((struct lys_deviation *)actual)->target_name = transform_schema2json(trg, s);
6571                                    free(s);
6572                                    if (!((struct lys_deviation *)actual)->target_name) {
6573                                      YYABORT;
6574                                    }
6575                                    s = NULL;
6576                                    actual_type = DEVIATION_KEYWORD;
6577                                  }
6578     break;
6579 
6580   case 468:
6581                     { void *tmp;
6582 
6583                       if ((yyvsp[-1].dev)->deviate_size) {
6584                         tmp = realloc((yyvsp[-1].dev)->deviate, (yyvsp[-1].dev)->deviate_size * sizeof *(yyvsp[-1].dev)->deviate);
6585                         if (!tmp) {
6586                           LOGINT(trg->ctx);
6587                           YYABORT;
6588                         }
6589                         (yyvsp[-1].dev)->deviate = tmp;
6590                       } else {
6591                         LOGVAL(trg->ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, "deviate", "deviation");
6592                         YYABORT;
6593                       }
6594                       actual_type = (yyvsp[-4].backup_token).token;
6595                       actual = (yyvsp[-4].backup_token).actual;
6596                     }
6597     break;
6598 
6599   case 469:
6600                            { (yyval.dev) = actual; }
6601     break;
6602 
6603   case 470:
6604                                          { if (yang_read_description(trg, (yyvsp[-1].dev), s, "deviation", NODE)) {
6605                                              YYABORT;
6606                                            }
6607                                            s = NULL;
6608                                            (yyval.dev) = (yyvsp[-1].dev);
6609                                          }
6610     break;
6611 
6612   case 471:
6613                                        { if (yang_read_reference(trg, (yyvsp[-1].dev), s, "deviation", NODE)) {
6614                                            YYABORT;
6615                                          }
6616                                          s = NULL;
6617                                          (yyval.dev) = (yyvsp[-1].dev);
6618                                        }
6619     break;
6620 
6621   case 477:
6622                                              { (yyval.backup_token).token = actual_type;
6623                                                (yyval.backup_token).actual = actual;
6624                                                if (!(actual = yang_read_deviate_unsupported(trg->ctx, actual))) {
6625                                                  YYABORT;
6626                                                }
6627                                                actual_type = NOT_SUPPORTED_KEYWORD;
6628                                              }
6629     break;
6630 
6631   case 478:
6632                             { actual_type = (yyvsp[-2].backup_token).token;
6633                               actual = (yyvsp[-2].backup_token).actual;
6634                             }
6635     break;
6636 
6637   case 484:
6638                          { (yyval.backup_token).token = actual_type;
6639                            (yyval.backup_token).actual = actual;
6640                            if (!(actual = yang_read_deviate(trg->ctx, actual, LY_DEVIATE_ADD))) {
6641                              YYABORT;
6642                            }
6643                            actual_type = ADD_KEYWORD;
6644                          }
6645     break;
6646 
6647   case 485:
6648                   { actual_type = (yyvsp[-2].backup_token).token;
6649                     actual = (yyvsp[-2].backup_token).actual;
6650                   }
6651     break;
6652 
6653   case 487:
6654          { void *tmp;
6655 
6656            if ((yyvsp[-1].deviate)->must_size) {
6657              tmp = realloc((yyvsp[-1].deviate)->must, (yyvsp[-1].deviate)->must_size * sizeof *(yyvsp[-1].deviate)->must);
6658              if (!tmp) {
6659                LOGMEM(trg->ctx);
6660                YYABORT;
6661              }
6662              (yyvsp[-1].deviate)->must = tmp;
6663            }
6664 
6665            if ((yyvsp[-1].deviate)->unique_size) {
6666              tmp = realloc((yyvsp[-1].deviate)->unique, (yyvsp[-1].deviate)->unique_size * sizeof *(yyvsp[-1].deviate)->unique);
6667              if (!tmp) {
6668                LOGMEM(trg->ctx);
6669                YYABORT;
6670              }
6671              (yyvsp[-1].deviate)->unique = tmp;
6672            }
6673 
6674            if ((yyvsp[-1].deviate)->dflt_size) {
6675              tmp = realloc((yyvsp[-1].deviate)->dflt, (yyvsp[-1].deviate)->dflt_size * sizeof *(yyvsp[-1].deviate)->dflt);
6676              if (!tmp) {
6677                LOGMEM(trg->ctx);
6678                YYABORT;
6679              }
6680              (yyvsp[-1].deviate)->dflt = tmp;
6681            }
6682          }
6683     break;
6684 
6685   case 488:
6686                              { (yyval.deviate) = actual; }
6687     break;
6688 
6689   case 489:
6690                                      { if (yang_read_units(trg, actual, s, ADD_KEYWORD)) {
6691                                          YYABORT;
6692                                        }
6693                                        s = NULL;
6694                                        (yyval.deviate) = (yyvsp[-1].deviate);
6695                                      }
6696     break;
6697 
6698   case 491:
6699                                       { YANG_ADDELEM((yyvsp[-1].deviate)->unique, (yyvsp[-1].deviate)->unique_size, "uniques");
6700                                         ((struct lys_unique *)actual)->expr = (const char **)s;
6701                                         s = NULL;
6702                                         actual = (yyvsp[-1].deviate);
6703                                         (yyval.deviate)= (yyvsp[-1].deviate);
6704                                       }
6705     break;
6706 
6707   case 492:
6708                                        { YANG_ADDELEM((yyvsp[-1].deviate)->dflt, (yyvsp[-1].deviate)->dflt_size, "defaults");
6709                                          *((const char **)actual) = lydict_insert_zc(trg->ctx, s);
6710                                          s = NULL;
6711                                          actual = (yyvsp[-1].deviate);
6712                                          (yyval.deviate) = (yyvsp[-1].deviate);
6713                                        }
6714     break;
6715 
6716   case 493:
6717                                       { if ((yyvsp[-1].deviate)->flags & LYS_CONFIG_MASK) {
6718                                           LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "config", "deviate");
6719                                           YYABORT;
6720                                         }
6721                                         (yyvsp[-1].deviate)->flags = (yyvsp[0].i);
6722                                         (yyval.deviate) = (yyvsp[-1].deviate);
6723                                       }
6724     break;
6725 
6726   case 494:
6727                                          { if ((yyvsp[-1].deviate)->flags & LYS_MAND_MASK) {
6728                                              LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "mandatory", "deviate");
6729                                              YYABORT;
6730                                            }
6731                                            (yyvsp[-1].deviate)->flags = (yyvsp[0].i);
6732                                            (yyval.deviate) = (yyvsp[-1].deviate);
6733                                          }
6734     break;
6735 
6736   case 495:
6737                                             { if ((yyvsp[-1].deviate)->min_set) {
6738                                                 LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "min-elements", "deviation");
6739                                                 YYABORT;
6740                                               }
6741                                               (yyvsp[-1].deviate)->min = (yyvsp[0].uint);
6742                                               (yyvsp[-1].deviate)->min_set = 1;
6743                                               (yyval.deviate) =  (yyvsp[-1].deviate);
6744                                             }
6745     break;
6746 
6747   case 496:
6748                                             { if ((yyvsp[-1].deviate)->max_set) {
6749                                                 LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "max-elements", "deviation");
6750                                                 YYABORT;
6751                                               }
6752                                               (yyvsp[-1].deviate)->max = (yyvsp[0].uint);
6753                                               (yyvsp[-1].deviate)->max_set = 1;
6754                                               (yyval.deviate) =  (yyvsp[-1].deviate);
6755                                             }
6756     break;
6757 
6758   case 497:
6759                                { (yyval.backup_token).token = actual_type;
6760                                  (yyval.backup_token).actual = actual;
6761                                  if (!(actual = yang_read_deviate(trg->ctx, actual, LY_DEVIATE_DEL))) {
6762                                    YYABORT;
6763                                  }
6764                                  actual_type = DELETE_KEYWORD;
6765                                }
6766     break;
6767 
6768   case 498:
6769                      { actual_type = (yyvsp[-2].backup_token).token;
6770                        actual = (yyvsp[-2].backup_token).actual;
6771                      }
6772     break;
6773 
6774   case 500:
6775           { void *tmp;
6776 
6777             if ((yyvsp[-1].deviate)->must_size) {
6778               tmp = realloc((yyvsp[-1].deviate)->must, (yyvsp[-1].deviate)->must_size * sizeof *(yyvsp[-1].deviate)->must);
6779               if (!tmp) {
6780                 LOGMEM(trg->ctx);
6781                 YYABORT;
6782               }
6783               (yyvsp[-1].deviate)->must = tmp;
6784             }
6785 
6786             if ((yyvsp[-1].deviate)->unique_size) {
6787               tmp = realloc((yyvsp[-1].deviate)->unique, (yyvsp[-1].deviate)->unique_size * sizeof *(yyvsp[-1].deviate)->unique);
6788               if (!tmp) {
6789                 LOGMEM(trg->ctx);
6790                 YYABORT;
6791               }
6792               (yyvsp[-1].deviate)->unique = tmp;
6793             }
6794 
6795             if ((yyvsp[-1].deviate)->dflt_size) {
6796               tmp = realloc((yyvsp[-1].deviate)->dflt, (yyvsp[-1].deviate)->dflt_size * sizeof *(yyvsp[-1].deviate)->dflt);
6797               if (!tmp) {
6798                 LOGMEM(trg->ctx);
6799                 YYABORT;
6800               }
6801               (yyvsp[-1].deviate)->dflt = tmp;
6802             }
6803           }
6804     break;
6805 
6806   case 501:
6807                                 { (yyval.deviate) = actual; }
6808     break;
6809 
6810   case 502:
6811                                         { if (yang_read_units(trg, actual, s, DELETE_KEYWORD)) {
6812                                             YYABORT;
6813                                           }
6814                                           s = NULL;
6815                                           (yyval.deviate) = (yyvsp[-1].deviate);
6816                                         }
6817     break;
6818 
6819   case 504:
6820                                          { YANG_ADDELEM((yyvsp[-1].deviate)->unique, (yyvsp[-1].deviate)->unique_size, "uniques");
6821                                            ((struct lys_unique *)actual)->expr = (const char **)s;
6822                                            s = NULL;
6823                                            actual = (yyvsp[-1].deviate);
6824                                            (yyval.deviate) = (yyvsp[-1].deviate);
6825                                          }
6826     break;
6827 
6828   case 505:
6829                                           { YANG_ADDELEM((yyvsp[-1].deviate)->dflt, (yyvsp[-1].deviate)->dflt_size, "defaults");
6830                                             *((const char **)actual) = lydict_insert_zc(trg->ctx, s);
6831                                             s = NULL;
6832                                             actual = (yyvsp[-1].deviate);
6833                                             (yyval.deviate) = (yyvsp[-1].deviate);
6834                                           }
6835     break;
6836 
6837   case 506:
6838                                  { (yyval.backup_token).token = actual_type;
6839                                    (yyval.backup_token).actual = actual;
6840                                    if (!(actual = yang_read_deviate(trg->ctx, actual, LY_DEVIATE_RPL))) {
6841                                      YYABORT;
6842                                    }
6843                                    actual_type = REPLACE_KEYWORD;
6844                                  }
6845     break;
6846 
6847   case 507:
6848                       { actual_type = (yyvsp[-2].backup_token).token;
6849                         actual = (yyvsp[-2].backup_token).actual;
6850                       }
6851     break;
6852 
6853   case 509:
6854          { void *tmp;
6855 
6856            if ((yyvsp[-1].deviate)->dflt_size) {
6857              tmp = realloc((yyvsp[-1].deviate)->dflt, (yyvsp[-1].deviate)->dflt_size * sizeof *(yyvsp[-1].deviate)->dflt);
6858              if (!tmp) {
6859                LOGMEM(trg->ctx);
6860                YYABORT;
6861              }
6862              (yyvsp[-1].deviate)->dflt = tmp;
6863            }
6864          }
6865     break;
6866 
6867   case 510:
6868                                  { (yyval.deviate) = actual; }
6869     break;
6870 
6871   case 512:
6872                                          { if (yang_read_units(trg, actual, s, DELETE_KEYWORD)) {
6873                                              YYABORT;
6874                                            }
6875                                            s = NULL;
6876                                            (yyval.deviate) = (yyvsp[-1].deviate);
6877                                          }
6878     break;
6879 
6880   case 513:
6881                                            { YANG_ADDELEM((yyvsp[-1].deviate)->dflt, (yyvsp[-1].deviate)->dflt_size, "defaults");
6882                                              *((const char **)actual) = lydict_insert_zc(trg->ctx, s);
6883                                              s = NULL;
6884                                              actual = (yyvsp[-1].deviate);
6885                                              (yyval.deviate) = (yyvsp[-1].deviate);
6886                                            }
6887     break;
6888 
6889   case 514:
6890                                           { if ((yyvsp[-1].deviate)->flags & LYS_CONFIG_MASK) {
6891                                               LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "config", "deviate");
6892                                               YYABORT;
6893                                             }
6894                                             (yyvsp[-1].deviate)->flags = (yyvsp[0].i);
6895                                             (yyval.deviate) = (yyvsp[-1].deviate);
6896                                           }
6897     break;
6898 
6899   case 515:
6900                                              { if ((yyvsp[-1].deviate)->flags & LYS_MAND_MASK) {
6901                                                  LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "mandatory", "deviate");
6902                                                  YYABORT;
6903                                                }
6904                                                (yyvsp[-1].deviate)->flags = (yyvsp[0].i);
6905                                                (yyval.deviate) = (yyvsp[-1].deviate);
6906                                              }
6907     break;
6908 
6909   case 516:
6910                                                 { if ((yyvsp[-1].deviate)->min_set) {
6911                                                     LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "min-elements", "deviation");
6912                                                     YYABORT;
6913                                                   }
6914                                                   (yyvsp[-1].deviate)->min = (yyvsp[0].uint);
6915                                                   (yyvsp[-1].deviate)->min_set = 1;
6916                                                   (yyval.deviate) =  (yyvsp[-1].deviate);
6917                                                 }
6918     break;
6919 
6920   case 517:
6921                                                 { if ((yyvsp[-1].deviate)->max_set) {
6922                                                     LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "max-elements", "deviation");
6923                                                     YYABORT;
6924                                                   }
6925                                                   (yyvsp[-1].deviate)->max = (yyvsp[0].uint);
6926                                                   (yyvsp[-1].deviate)->max_set = 1;
6927                                                   (yyval.deviate) =  (yyvsp[-1].deviate);
6928                                                 }
6929     break;
6930 
6931   case 518:
6932                       { (yyval.backup_token).token = actual_type;
6933                         (yyval.backup_token).actual = actual;
6934                         if (!(actual = yang_read_when(trg, actual, actual_type, s))) {
6935                           YYABORT;
6936                         }
6937                         s = NULL;
6938                         actual_type = WHEN_KEYWORD;
6939                       }
6940     break;
6941 
6942   case 519:
6943            { actual_type = (yyvsp[-1].backup_token).token;
6944              actual = (yyvsp[-1].backup_token).actual;
6945            }
6946     break;
6947 
6948   case 523:
6949                                     { if (yang_read_description(trg, actual, s, "when", NODE)) {
6950                                         YYABORT;
6951                                       }
6952                                       s = NULL;
6953                                     }
6954     break;
6955 
6956   case 524:
6957                                   { if (yang_read_reference(trg, actual, s, "when", NODE)) {
6958                                       YYABORT;
6959                                     }
6960                                     s = NULL;
6961                                   }
6962     break;
6963 
6964   case 525:
6965                            { (yyval.i) = (yyvsp[0].i);
6966                              backup_type = actual_type;
6967                              actual_type = CONFIG_KEYWORD;
6968                            }
6969     break;
6970 
6971   case 526:
6972                                                    { (yyval.i) = (yyvsp[-1].i); }
6973     break;
6974 
6975   case 527:
6976                                     { (yyval.i) = LYS_CONFIG_W | LYS_CONFIG_SET; }
6977     break;
6978 
6979   case 528:
6980                           { (yyval.i) = LYS_CONFIG_R | LYS_CONFIG_SET; }
6981     break;
6982 
6983   case 529:
6984               { if (!strcmp(s, "true")) {
6985                   (yyval.i) = LYS_CONFIG_W | LYS_CONFIG_SET;
6986                 } else if (!strcmp(s, "false")) {
6987                   (yyval.i) = LYS_CONFIG_R | LYS_CONFIG_SET;
6988                 } else {
6989                   LOGVAL(trg->ctx, LYE_INARG, LY_VLOG_NONE, NULL, s, "config");
6990                   free(s);
6991                   YYABORT;
6992                 }
6993                 free(s);
6994                 s = NULL;
6995               }
6996     break;
6997 
6998   case 530:
6999                                  { (yyval.i) = (yyvsp[0].i);
7000                                    backup_type = actual_type;
7001                                    actual_type = MANDATORY_KEYWORD;
7002                                  }
7003     break;
7004 
7005   case 531:
7006                                                             { (yyval.i) = (yyvsp[-1].i); }
7007     break;
7008 
7009   case 532:
7010                                        { (yyval.i) = LYS_MAND_TRUE; }
7011     break;
7012 
7013   case 533:
7014                           { (yyval.i) = LYS_MAND_FALSE; }
7015     break;
7016 
7017   case 534:
7018               { if (!strcmp(s, "true")) {
7019                   (yyval.i) = LYS_MAND_TRUE;
7020                 } else if (!strcmp(s, "false")) {
7021                   (yyval.i) = LYS_MAND_FALSE;
7022                 } else {
7023                   LOGVAL(trg->ctx, LYE_INARG, LY_VLOG_NONE, NULL, s, "mandatory");
7024                   free(s);
7025                   YYABORT;
7026                 }
7027                 free(s);
7028                 s = NULL;
7029               }
7030     break;
7031 
7032   case 535:
7033                      { backup_type = actual_type;
7034                        actual_type = PRESENCE_KEYWORD;
7035                      }
7036     break;
7037 
7038   case 537:
7039                                  { (yyval.uint) = (yyvsp[0].uint);
7040                                    backup_type = actual_type;
7041                                    actual_type = MIN_ELEMENTS_KEYWORD;
7042                                  }
7043     break;
7044 
7045   case 538:
7046                                                                   { (yyval.uint) = (yyvsp[-1].uint); }
7047     break;
7048 
7049   case 539:
7050                                                      { (yyval.uint) = (yyvsp[-1].uint); }
7051     break;
7052 
7053   case 540:
7054               { if (strlen(s) == 1 && s[0] == '0') {
7055                   (yyval.uint) = 0;
7056                 } else {
7057                   /* convert it to uint32_t */
7058                   uint64_t val;
7059                   char *endptr = NULL;
7060                   errno = 0;
7061 
7062                   val = strtoul(s, &endptr, 10);
7063                   if (*endptr || s[0] == '-' || errno || val > UINT32_MAX) {
7064                       LOGVAL(trg->ctx, LYE_INARG, LY_VLOG_NONE, NULL, s, "min-elements");
7065                       free(s);
7066                       YYABORT;
7067                   }
7068                   (yyval.uint) = (uint32_t) val;
7069                 }
7070                 free(s);
7071                 s = NULL;
7072               }
7073     break;
7074 
7075   case 541:
7076                                  { (yyval.uint) = (yyvsp[0].uint);
7077                                    backup_type = actual_type;
7078                                    actual_type = MAX_ELEMENTS_KEYWORD;
7079                                  }
7080     break;
7081 
7082   case 542:
7083                                                                   { (yyval.uint) = (yyvsp[-1].uint); }
7084     break;
7085 
7086   case 543:
7087                                             { (yyval.uint) = 0; }
7088     break;
7089 
7090   case 544:
7091                                    { (yyval.uint) = (yyvsp[-1].uint); }
7092     break;
7093 
7094   case 545:
7095               { if (!strcmp(s, "unbounded")) {
7096                   (yyval.uint) = 0;
7097                 } else {
7098                   /* convert it to uint32_t */
7099                   uint64_t val;
7100                   char *endptr = NULL;
7101                   errno = 0;
7102 
7103                   val = strtoul(s, &endptr, 10);
7104                   if (*endptr || s[0] == '-' || errno || val == 0 || val > UINT32_MAX) {
7105                       LOGVAL(trg->ctx, LYE_INARG, LY_VLOG_NONE, NULL, s, "max-elements");
7106                       free(s);
7107                       YYABORT;
7108                   }
7109                   (yyval.uint) = (uint32_t) val;
7110                 }
7111                 free(s);
7112                 s = NULL;
7113               }
7114     break;
7115 
7116   case 546:
7117                                    { (yyval.i) = (yyvsp[0].i);
7118                                      backup_type = actual_type;
7119                                      actual_type = ORDERED_BY_KEYWORD;
7120                                    }
7121     break;
7122 
7123   case 547:
7124                                                                { (yyval.i) = (yyvsp[-1].i); }
7125     break;
7126 
7127   case 548:
7128                                         { (yyval.i) = LYS_USERORDERED; }
7129     break;
7130 
7131   case 549:
7132                            { (yyval.i) = LYS_SYSTEMORDERED; }
7133     break;
7134 
7135   case 550:
7136               { if (!strcmp(s, "user")) {
7137                   (yyval.i) = LYS_USERORDERED;
7138                 } else if (!strcmp(s, "system")) {
7139                   (yyval.i) = LYS_SYSTEMORDERED;
7140                 } else {
7141                   free(s);
7142                   YYABORT;
7143                 }
7144                 free(s);
7145                 s=NULL;
7146               }
7147     break;
7148 
7149   case 551:
7150                      { (yyval.backup_token).token = actual_type;
7151                        (yyval.backup_token).actual = actual;
7152                        switch (actual_type) {
7153                        case CONTAINER_KEYWORD:
7154                          YANG_ADDELEM(((struct lys_node_container *)actual)->must,
7155                                      ((struct lys_node_container *)actual)->must_size, "musts");
7156                          break;
7157                        case ANYDATA_KEYWORD:
7158                        case ANYXML_KEYWORD:
7159                          YANG_ADDELEM(((struct lys_node_anydata *)actual)->must,
7160                                      ((struct lys_node_anydata *)actual)->must_size, "musts");
7161                          break;
7162                        case LEAF_KEYWORD:
7163                          YANG_ADDELEM(((struct lys_node_leaf *)actual)->must,
7164                                      ((struct lys_node_leaf *)actual)->must_size, "musts");
7165                          break;
7166                        case LEAF_LIST_KEYWORD:
7167                          YANG_ADDELEM(((struct lys_node_leaflist *)actual)->must,
7168                                      ((struct lys_node_leaflist *)actual)->must_size, "musts");
7169                          break;
7170                        case LIST_KEYWORD:
7171                          YANG_ADDELEM(((struct lys_node_list *)actual)->must,
7172                                      ((struct lys_node_list *)actual)->must_size, "musts");
7173                          break;
7174                        case REFINE_KEYWORD:
7175                          YANG_ADDELEM(((struct lys_refine *)actual)->must,
7176                                      ((struct lys_refine *)actual)->must_size, "musts");
7177                          break;
7178                        case ADD_KEYWORD:
7179                        case DELETE_KEYWORD:
7180                          YANG_ADDELEM(((struct lys_deviate *)actual)->must,
7181                                       ((struct lys_deviate *)actual)->must_size, "musts");
7182                          break;
7183                        case NOTIFICATION_KEYWORD:
7184                          if (trg->version < 2) {
7185                            free(s);
7186                            LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_LYS, actual, "must");
7187                            YYABORT;
7188                          }
7189                          YANG_ADDELEM(((struct lys_node_notif *)actual)->must,
7190                                      ((struct lys_node_notif *)actual)->must_size, "musts");
7191                          break;
7192                        case INPUT_KEYWORD:
7193                        case OUTPUT_KEYWORD:
7194                          if (trg->version < 2) {
7195                            free(s);
7196                            LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_LYS, actual, "must");
7197                            YYABORT;
7198                          }
7199                          YANG_ADDELEM(((struct lys_node_inout *)actual)->must,
7200                                      ((struct lys_node_inout *)actual)->must_size, "musts");
7201                          break;
7202                        case EXTENSION_INSTANCE:
7203                          /* must is already allocated */
7204                          break;
7205                        default:
7206                          free(s);
7207                          LOGINT(trg->ctx);
7208                          YYABORT;
7209                        }
7210                        ((struct lys_restr *)actual)->expr = transform_schema2json(trg, s);
7211                        free(s);
7212                        if (!((struct lys_restr *)actual)->expr) {
7213                          YYABORT;
7214                        }
7215                        s = NULL;
7216                        actual_type = MUST_KEYWORD;
7217                      }
7218     break;
7219 
7220   case 552:
7221            { actual_type = (yyvsp[-1].backup_token).token;
7222              actual = (yyvsp[-1].backup_token).actual;
7223            }
7224     break;
7225 
7226   case 555:
7227                            { backup_type = actual_type;
7228                              actual_type = UNIQUE_KEYWORD;
7229                            }
7230     break;
7231 
7232   case 559:
7233                      { backup_type = actual_type;
7234                        actual_type = KEY_KEYWORD;
7235                      }
7236     break;
7237 
7238   case 561:
7239                              { s = strdup(yyget_text(scanner));
7240                                if (!s) {
7241                                  LOGMEM(trg->ctx);
7242                                  YYABORT;
7243                                }
7244                              }
7245     break;
7246 
7247   case 564:
7248                       { (yyval.backup_token).token = actual_type;
7249                         (yyval.backup_token).actual = actual;
7250                         if (!(actual = yang_read_range(trg->ctx, actual, s, is_ext_instance))) {
7251                           YYABORT;
7252                         }
7253                         actual_type = RANGE_KEYWORD;
7254                         s = NULL;
7255                       }
7256     break;
7257 
7258   case 565:
7259                                             { if (s) {
7260                                                 s = ly_realloc(s,strlen(s) + yyget_leng(scanner) + 2);
7261                                                 if (!s) {
7262                                                   LOGMEM(trg->ctx);
7263                                                   YYABORT;
7264                                                 }
7265                                                 strcat(s,"/");
7266                                                 strcat(s, yyget_text(scanner));
7267                                               } else {
7268                                                 s = malloc(yyget_leng(scanner) + 2);
7269                                                 if (!s) {
7270                                                   LOGMEM(trg->ctx);
7271                                                   YYABORT;
7272                                                 }
7273                                                 s[0]='/';
7274                                                 memcpy(s + 1, yyget_text(scanner), yyget_leng(scanner) + 1);
7275                                               }
7276                                             }
7277     break;
7278 
7279   case 569:
7280                                           { if (s) {
7281                                               s = ly_realloc(s,strlen(s) + yyget_leng(scanner) + 1);
7282                                               if (!s) {
7283                                                 LOGMEM(trg->ctx);
7284                                                 YYABORT;
7285                                               }
7286                                               strcat(s, yyget_text(scanner));
7287                                             } else {
7288                                               s = strdup(yyget_text(scanner));
7289                                               if (!s) {
7290                                                 LOGMEM(trg->ctx);
7291                                                 YYABORT;
7292                                               }
7293                                             }
7294                                           }
7295     break;
7296 
7297   case 571:
7298               { tmp_s = yyget_text(scanner); }
7299     break;
7300 
7301   case 572:
7302                                                               { s = strdup(tmp_s);
7303                                                                 if (!s) {
7304                                                                   LOGMEM(trg->ctx);
7305                                                                   YYABORT;
7306                                                                 }
7307                                                                 s[strlen(s) - 1] = '\0';
7308                                                              }
7309     break;
7310 
7311   case 573:
7312      { tmp_s = yyget_text(scanner); }
7313     break;
7314 
7315   case 574:
7316                                                     { s = strdup(tmp_s);
7317                                                       if (!s) {
7318                                                         LOGMEM(trg->ctx);
7319                                                         YYABORT;
7320                                                       }
7321                                                       s[strlen(s) - 1] = '\0';
7322                                                     }
7323     break;
7324 
7325   case 598:
7326                                              { /* convert it to uint32_t */
7327                                                 unsigned long val;
7328 
7329                                                 val = strtoul(yyget_text(scanner), NULL, 10);
7330                                                 if (val > UINT32_MAX) {
7331                                                     LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Converted number is very long.");
7332                                                     YYABORT;
7333                                                 }
7334                                                 (yyval.uint) = (uint32_t) val;
7335                                              }
7336     break;
7337 
7338   case 599:
7339                                  { (yyval.uint) = 0; }
7340     break;
7341 
7342   case 600:
7343                             { (yyval.uint) = (yyvsp[0].uint); }
7344     break;
7345 
7346   case 601:
7347                     { (yyval.i) = 0; }
7348     break;
7349 
7350   case 602:
7351                            { /* convert it to int32_t */
7352                              int64_t val;
7353 
7354                              val = strtoll(yyget_text(scanner), NULL, 10);
7355                              if (val < INT32_MIN || val > INT32_MAX) {
7356                                  LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_NONE, NULL,
7357                                         "The number is not in the correct range (INT32_MIN..INT32_MAX): \"%d\"",val);
7358                                  YYABORT;
7359                              }
7360                              (yyval.i) = (int32_t) val;
7361                            }
7362     break;
7363 
7364   case 608:
7365               { if (lyp_check_identifier(trg->ctx, s, LY_IDENT_SIMPLE, trg, NULL)) {
7366                     free(s);
7367                     YYABORT;
7368                 }
7369               }
7370     break;
7371 
7372   case 613:
7373              { char *tmp;
7374 
7375                if ((tmp = strchr(s, ':'))) {
7376                  *tmp = '\0';
7377                  /* check prefix */
7378                  if (lyp_check_identifier(trg->ctx, s, LY_IDENT_SIMPLE, trg, NULL)) {
7379                    free(s);
7380                    YYABORT;
7381                  }
7382                  /* check identifier */
7383                  if (lyp_check_identifier(trg->ctx, tmp + 1, LY_IDENT_SIMPLE, trg, NULL)) {
7384                    free(s);
7385                    YYABORT;
7386                  }
7387                  *tmp = ':';
7388                } else {
7389                  /* check identifier */
7390                  if (lyp_check_identifier(trg->ctx, s, LY_IDENT_SIMPLE, trg, NULL)) {
7391                    free(s);
7392                    YYABORT;
7393                  }
7394                }
7395              }
7396     break;
7397 
7398   case 614:
7399                            { s = (yyvsp[-1].str); }
7400     break;
7401 
7402   case 615:
7403                                                            { s = (yyvsp[-3].str); }
7404     break;
7405 
7406   case 616:
7407                { actual_type = backup_type;
7408                  backup_type = NODE;
7409                  (yyval.str) = s;
7410                  s = NULL;
7411                }
7412     break;
7413 
7414   case 617:
7415                          { actual_type = backup_type;
7416                            backup_type = NODE;
7417                          }
7418     break;
7419 
7420   case 618:
7421                         { (yyval.str) = s;
7422                           s = NULL;
7423                         }
7424     break;
7425 
7426   case 622:
7427                    { actual_type = (yyvsp[-1].backup_token).token;
7428                      actual = (yyvsp[-1].backup_token).actual;
7429                    }
7430     break;
7431 
7432   case 623:
7433                                               { (yyval.backup_token).token = actual_type;
7434                                                 (yyval.backup_token).actual = actual;
7435                                                 if (!(actual = yang_read_ext(trg, (actual) ? actual : trg, (yyvsp[-1].str), s,
7436                                                                              actual_type, backup_type, is_ext_instance))) {
7437                                                   YYABORT;
7438                                                 }
7439                                                 s = NULL;
7440                                                 actual_type = EXTENSION_INSTANCE;
7441                                               }
7442     break;
7443 
7444   case 624:
7445                          { (yyval.str) = s; s = NULL; }
7446     break;
7447 
7448   case 639:
7449      {  struct yang_ext_substmt *substmt = ((struct lys_ext_instance *)actual)->parent;
7450         int32_t length = 0, old_length = 0;
7451         char *tmp_value;
7452 
7453         if (!substmt) {
7454           substmt = calloc(1, sizeof *substmt);
7455           if (!substmt) {
7456             LOGMEM(trg->ctx);
7457             YYABORT;
7458           }
7459           ((struct lys_ext_instance *)actual)->parent = substmt;
7460         }
7461         length = strlen((yyvsp[-2].str));
7462         old_length = (substmt->ext_substmt) ? strlen(substmt->ext_substmt) + 2 : 2;
7463         tmp_value = realloc(substmt->ext_substmt, old_length + length + 1);
7464         if (!tmp_value) {
7465           LOGMEM(trg->ctx);
7466           YYABORT;
7467         }
7468         substmt->ext_substmt = tmp_value;
7469         tmp_value += old_length - 2;
7470         memcpy(tmp_value, (yyvsp[-2].str), length);
7471         tmp_value[length] = ' ';
7472         tmp_value[length + 1] = '\0';
7473         tmp_value[length + 2] = '\0';
7474       }
7475     break;
7476 
7477   case 640:
7478      {  struct yang_ext_substmt *substmt = ((struct lys_ext_instance *)actual)->parent;
7479         int32_t length;
7480         char *tmp_value, **array;
7481         int i = 0;
7482 
7483         if (!substmt) {
7484           substmt = calloc(1, sizeof *substmt);
7485           if (!substmt) {
7486             LOGMEM(trg->ctx);
7487             YYABORT;
7488           }
7489           ((struct lys_ext_instance *)actual)->parent = substmt;
7490         }
7491         length = strlen((yyvsp[-2].str));
7492         if (!substmt->ext_modules) {
7493           array = malloc(2 * sizeof *substmt->ext_modules);
7494         } else {
7495           for (i = 0; substmt->ext_modules[i]; ++i);
7496           array = realloc(substmt->ext_modules, (i + 2) * sizeof *substmt->ext_modules);
7497         }
7498         if (!array) {
7499           LOGMEM(trg->ctx);
7500           YYABORT;
7501         }
7502         substmt->ext_modules = array;
7503         array[i + 1] = NULL;
7504         tmp_value = malloc(length + 2);
7505         if (!tmp_value) {
7506           LOGMEM(trg->ctx);
7507           YYABORT;
7508         }
7509         array[i] = tmp_value;
7510         memcpy(tmp_value, (yyvsp[-2].str), length);
7511         tmp_value[length] = '\0';
7512         tmp_value[length + 1] = '\0';
7513       }
7514     break;
7515 
7516   case 643:
7517                                         { (yyval.str) = yyget_text(scanner); }
7518     break;
7519 
7520   case 644:
7521                                                { (yyval.str) = yyget_text(scanner); }
7522     break;
7523 
7524   case 656:
7525                 { s = strdup(yyget_text(scanner));
7526                   if (!s) {
7527                     LOGMEM(trg->ctx);
7528                     YYABORT;
7529                   }
7530                 }
7531     break;
7532 
7533   case 749:
7534                         { s = strdup(yyget_text(scanner));
7535                           if (!s) {
7536                             LOGMEM(trg->ctx);
7537                             YYABORT;
7538                           }
7539                         }
7540     break;
7541 
7542   case 750:
7543                                   { s = strdup(yyget_text(scanner));
7544                                     if (!s) {
7545                                       LOGMEM(trg->ctx);
7546                                       YYABORT;
7547                                     }
7548                                   }
7549     break;
7550 
7551   case 751:
7552                        { struct lys_type **type;
7553 
7554                              type = (struct lys_type **)yang_getplace_for_extcomplex_struct(ext_instance, NULL, ext_name,
7555                                                                                             "type", LY_STMT_TYPE);
7556                              if (!type) {
7557                                YYABORT;
7558                              }
7559                              /* allocate type structure */
7560                              (*type) = calloc(1, sizeof **type);
7561                              if (!*type) {
7562                                LOGMEM(trg->ctx);
7563                                YYABORT;
7564                              }
7565 
7566                              /* HACK for unres */
7567                              (*type)->parent = (struct lys_tpdf *)ext_instance;
7568                              (yyval.v) = actual = *type;
7569                              is_ext_instance = 0;
7570                             }
7571     break;
7572 
7573   case 752:
7574                           { struct lys_tpdf **tpdf;
7575 
7576                                 tpdf = (struct lys_tpdf **)yang_getplace_for_extcomplex_struct(ext_instance, NULL, ext_name,
7577                                                                                                "typedef", LY_STMT_TYPEDEF);
7578                                 if (!tpdf) {
7579                                   YYABORT;
7580                                 }
7581                                 /* allocate typedef structure */
7582                                 (*tpdf) = calloc(1, sizeof **tpdf);
7583                                 if (!*tpdf) {
7584                                   LOGMEM(trg->ctx);
7585                                   YYABORT;
7586                                 }
7587 
7588                                 (yyval.v) = actual = *tpdf;
7589                                 is_ext_instance = 0;
7590                               }
7591     break;
7592 
7593   case 753:
7594                             { struct lys_iffeature **iffeature;
7595 
7596                                  iffeature = (struct lys_iffeature **)yang_getplace_for_extcomplex_struct(ext_instance, NULL, ext_name,
7597                                                                                                           "if-feature", LY_STMT_IFFEATURE);
7598                                  if (!iffeature) {
7599                                    YYABORT;
7600                                  }
7601                                  /* allocate typedef structure */
7602                                  (*iffeature) = calloc(1, sizeof **iffeature);
7603                                  if (!*iffeature) {
7604                                    LOGMEM(trg->ctx);
7605                                    YYABORT;
7606                                  }
7607                                  (yyval.v) = actual = *iffeature;
7608                                }
7609     break;
7610 
7611   case 754:
7612                               { struct lys_restr **restr;
7613                                     LY_STMT stmt;
7614 
7615                                     s = yyget_text(scanner);
7616                                     if (!strcmp(s, "must")) {
7617                                       stmt = LY_STMT_MUST;
7618                                     } else if (!strcmp(s, "pattern")) {
7619                                       stmt = LY_STMT_PATTERN;
7620                                     } else if (!strcmp(s, "range")) {
7621                                       stmt = LY_STMT_RANGE;
7622                                     } else {
7623                                       stmt = LY_STMT_LENGTH;
7624                                     }
7625                                     restr = (struct lys_restr **)yang_getplace_for_extcomplex_struct(ext_instance, NULL, ext_name, s, stmt);
7626                                     if (!restr) {
7627                                       YYABORT;
7628                                     }
7629                                     /* allocate structure for must */
7630                                     (*restr) = calloc(1, sizeof(struct lys_restr));
7631                                     if (!*restr) {
7632                                       LOGMEM(trg->ctx);
7633                                       YYABORT;
7634                                     }
7635                                     (yyval.v) = actual = *restr;
7636                                     s = NULL;
7637                                   }
7638     break;
7639 
7640   case 755:
7641                        { actual = yang_getplace_for_extcomplex_struct(ext_instance, NULL, ext_name, "when", LY_STMT_WHEN);
7642                              if (!actual) {
7643                                YYABORT;
7644                              }
7645                              (yyval.v) = actual;
7646                            }
7647     break;
7648 
7649   case 756:
7650                            { struct lys_revision **rev;
7651                                  int i;
7652 
7653                                  rev = (struct lys_revision **)yang_getplace_for_extcomplex_struct(ext_instance, &i, ext_name,
7654                                                                                                    "revision", LY_STMT_REVISION);
7655                                  if (!rev) {
7656                                    YYABORT;
7657                                  }
7658                                  rev[i] = calloc(1, sizeof **rev);
7659                                  if (!rev[i]) {
7660                                    LOGMEM(trg->ctx);
7661                                    YYABORT;
7662                                  }
7663                                  actual = rev[i];
7664                                  (yyval.revisions).revision = rev;
7665                                  (yyval.revisions).index = i;
7666                                }
7667     break;
7668 
7669   case 757:
7670                           { LY_STMT stmt;
7671 
7672                                 s = yyget_text(scanner);
7673                                 if (!strcmp(s, "action")) {
7674                                   stmt = LY_STMT_ACTION;
7675                                 } else if (!strcmp(s, "anydata")) {
7676                                   stmt = LY_STMT_ANYDATA;
7677                                 } else if (!strcmp(s, "anyxml")) {
7678                                   stmt = LY_STMT_ANYXML;
7679                                 } else if (!strcmp(s, "case")) {
7680                                   stmt = LY_STMT_CASE;
7681                                 } else if (!strcmp(s, "choice")) {
7682                                   stmt = LY_STMT_CHOICE;
7683                                 } else if (!strcmp(s, "container")) {
7684                                   stmt = LY_STMT_CONTAINER;
7685                                 } else if (!strcmp(s, "grouping")) {
7686                                   stmt = LY_STMT_GROUPING;
7687                                 } else if (!strcmp(s, "input")) {
7688                                   stmt = LY_STMT_INPUT;
7689                                 } else if (!strcmp(s, "leaf")) {
7690                                   stmt = LY_STMT_LEAF;
7691                                 } else if (!strcmp(s, "leaf-list")) {
7692                                   stmt = LY_STMT_LEAFLIST;
7693                                 } else if (!strcmp(s, "list")) {
7694                                   stmt = LY_STMT_LIST;
7695                                 } else if (!strcmp(s, "notification")) {
7696                                   stmt = LY_STMT_NOTIFICATION;
7697                                 } else if (!strcmp(s, "output")) {
7698                                   stmt = LY_STMT_OUTPUT;
7699                                 } else {
7700                                   stmt = LY_STMT_USES;
7701                                 }
7702                                 if (yang_extcomplex_node(ext_instance, ext_name, s, *param->node, stmt)) {
7703                                   YYABORT;
7704                                 }
7705                                 actual = NULL;
7706                                 s = NULL;
7707                                 is_ext_instance = 0;
7708                               }
7709     break;
7710 
7711   case 758:
7712                                            { LOGERR(trg->ctx, ly_errno, "Extension's substatement \"%s\" not supported.", yyget_text(scanner)); }
7713     break;
7714 
7715   case 790:
7716                           { actual_type = EXTENSION_INSTANCE;
7717                                 actual = ext_instance;
7718                                 if (!is_ext_instance) {
7719                                   LOGVAL(trg->ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, yyget_text(scanner));
7720                                   YYABORT;
7721                                 }
7722                                 (yyval.i) = 0;
7723                               }
7724     break;
7725 
7726   case 792:
7727                                    { if (yang_read_extcomplex_str(trg, ext_instance, "prefix", ext_name, &s,
7728                                                                   0, LY_STMT_PREFIX)) {
7729                                        YYABORT;
7730                                      }
7731                                    }
7732     break;
7733 
7734   case 793:
7735                                         { if (yang_read_extcomplex_str(trg, ext_instance, "description", ext_name, &s,
7736                                                                        0, LY_STMT_DESCRIPTION)) {
7737                                             YYABORT;
7738                                           }
7739                                         }
7740     break;
7741 
7742   case 794:
7743                                       { if (yang_read_extcomplex_str(trg, ext_instance, "reference", ext_name, &s,
7744                                                                      0, LY_STMT_REFERENCE)) {
7745                                           YYABORT;
7746                                         }
7747                                       }
7748     break;
7749 
7750   case 795:
7751                                   { if (yang_read_extcomplex_str(trg, ext_instance, "units", ext_name, &s,
7752                                                                      0, LY_STMT_UNITS)) {
7753                                       YYABORT;
7754                                     }
7755                                   }
7756     break;
7757 
7758   case 796:
7759                                  { if (yang_read_extcomplex_str(trg, ext_instance, "base", ext_name, &s,
7760                                                                 0, LY_STMT_BASE)) {
7761                                      YYABORT;
7762                                    }
7763                                  }
7764     break;
7765 
7766   case 797:
7767                                     { if (yang_read_extcomplex_str(trg, ext_instance, "contact", ext_name, &s,
7768                                                                      0, LY_STMT_CONTACT)) {
7769                                         YYABORT;
7770                                       }
7771                                     }
7772     break;
7773 
7774   case 798:
7775                                     { if (yang_read_extcomplex_str(trg, ext_instance, "default", ext_name, &s,
7776                                                                      0, LY_STMT_DEFAULT)) {
7777                                         YYABORT;
7778                                       }
7779                                     }
7780     break;
7781 
7782   case 799:
7783                                           { if (yang_read_extcomplex_str(trg, ext_instance, "error-message", ext_name, &s,
7784                                                                          0, LY_STMT_ERRMSG)) {
7785                                               YYABORT;
7786                                             }
7787                                           }
7788     break;
7789 
7790   case 800:
7791                                           { if (yang_read_extcomplex_str(trg, ext_instance, "error-app-tag", ext_name, &s,
7792                                                                          0, LY_STMT_ERRTAG)) {
7793                                               YYABORT;
7794                                             }
7795                                           }
7796     break;
7797 
7798   case 801:
7799                                 { if (yang_read_extcomplex_str(trg, ext_instance, "key", ext_name, &s,
7800                                                                0, LY_STMT_KEY)) {
7801                                     YYABORT;
7802                                   }
7803                                 }
7804     break;
7805 
7806   case 802:
7807                                       { if (yang_read_extcomplex_str(trg, ext_instance, "namespace", ext_name, &s,
7808                                                                      0, LY_STMT_NAMESPACE)) {
7809                                           YYABORT;
7810                                         }
7811                                       }
7812     break;
7813 
7814   case 803:
7815                                          { if (yang_read_extcomplex_str(trg, ext_instance, "organization", ext_name, &s,
7816                                                                         0, LY_STMT_ORGANIZATION)) {
7817                                              YYABORT;
7818                                            }
7819                                          }
7820     break;
7821 
7822   case 804:
7823                                  { if (yang_read_extcomplex_str(trg, ext_instance, "path", ext_name, &s,
7824                                                                 0, LY_STMT_PATH)) {
7825                                      YYABORT;
7826                                    }
7827                                  }
7828     break;
7829 
7830   case 805:
7831                                      { if (yang_read_extcomplex_str(trg, ext_instance, "presence", ext_name, &s,
7832                                                                     0, LY_STMT_PRESENCE)) {
7833                                          YYABORT;
7834                                        }
7835                                      }
7836     break;
7837 
7838   case 806:
7839                                           { if (yang_read_extcomplex_str(trg, ext_instance, "revision-date", ext_name, &s,
7840                                                                          0, LY_STMT_REVISIONDATE)) {
7841                                               YYABORT;
7842                                             }
7843                                           }
7844     break;
7845 
7846   case 807:
7847      { struct lys_type *type = (yyvsp[-2].v);
7848 
7849        if (yang_fill_type(trg, type, (struct yang_type *)type->der, ext_instance, param->unres)) {
7850          yang_type_free(trg->ctx, type);
7851          YYABORT;
7852        }
7853        if (unres_schema_add_node(trg, param->unres, type, UNRES_TYPE_DER_EXT, NULL) == -1) {
7854          yang_type_free(trg->ctx, type);
7855          YYABORT;
7856        }
7857        actual = ext_instance;
7858        is_ext_instance = 1;
7859      }
7860     break;
7861 
7862   case 808:
7863      { struct lys_tpdf *tpdf = (yyvsp[-2].v);
7864 
7865        if (yang_fill_type(trg, &tpdf->type, (struct yang_type *)tpdf->type.der, tpdf, param->unres)) {
7866          yang_type_free(trg->ctx, &tpdf->type);
7867        }
7868        if (yang_check_ext_instance(trg, &tpdf->ext, &tpdf->ext_size, tpdf, param->unres)) {
7869          YYABORT;
7870        }
7871        if (unres_schema_add_node(trg, param->unres, &tpdf->type, UNRES_TYPE_DER_TPDF, (struct lys_node *)ext_instance) == -1) {
7872          yang_type_free(trg->ctx, &tpdf->type);
7873          YYABORT;
7874        }
7875        /* check default value*/
7876        if (unres_schema_add_node(trg, param->unres, &tpdf->type, UNRES_TYPE_DFLT, (struct lys_node *)(&tpdf->dflt)) == -1)  {
7877          YYABORT;
7878        }
7879        actual = ext_instance;
7880        is_ext_instance = 1;
7881      }
7882     break;
7883 
7884   case 809:
7885                                    { if (yang_fill_extcomplex_flags(ext_instance, ext_name, "status", LY_STMT_STATUS,
7886                                                                     (yyvsp[0].i), LYS_STATUS_MASK)) {
7887                                        YYABORT;
7888                                      }
7889                                    }
7890     break;
7891 
7892   case 810:
7893                                    { if (yang_fill_extcomplex_flags(ext_instance, ext_name, "config", LY_STMT_CONFIG,
7894                                                                     (yyvsp[0].i), LYS_CONFIG_MASK)) {
7895                                        YYABORT;
7896                                      }
7897                                    }
7898     break;
7899 
7900   case 811:
7901                                       { if (yang_fill_extcomplex_flags(ext_instance, ext_name, "mandatory", LY_STMT_MANDATORY,
7902                                                                        (yyvsp[0].i), LYS_MAND_MASK)) {
7903                                           YYABORT;
7904                                         }
7905                                       }
7906     break;
7907 
7908   case 812:
7909                                        { if ((yyvsp[-1].i) & LYS_ORDERED_MASK) {
7910                                             LOGVAL(trg->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, "ordered by", ext_name);
7911                                             YYABORT;
7912                                          }
7913                                          if ((yyvsp[0].i) & LYS_USERORDERED) {
7914                                            if (yang_fill_extcomplex_flags(ext_instance, ext_name, "ordered-by", LY_STMT_ORDEREDBY,
7915                                                                           (yyvsp[0].i), LYS_USERORDERED)) {
7916                                              YYABORT;
7917                                            }
7918                                          }
7919                                          (yyvsp[-1].i) |= (yyvsp[0].i);
7920                                          (yyval.i) = (yyvsp[-1].i);
7921                                        }
7922     break;
7923 
7924   case 813:
7925                                              { if (yang_fill_extcomplex_uint8(ext_instance, ext_name, "require-instance",
7926                                                                               LY_STMT_REQINSTANCE, (yyvsp[0].i))) {
7927                                                  YYABORT;
7928                                                }
7929                                              }
7930     break;
7931 
7932   case 814:
7933                                      { if (yang_fill_extcomplex_uint8(ext_instance, ext_name, "modifier", LY_STMT_MODIFIER, 0)) {
7934                                          YYABORT;
7935                                        }
7936                                      }
7937     break;
7938 
7939   case 815:
7940      { /* range check */
7941        if ((yyvsp[0].uint) < 1 || (yyvsp[0].uint) > 18) {
7942          LOGVAL(trg->ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Invalid value \"%d\" of \"%s\".", (yyvsp[0].uint), "fraction-digits");
7943          YYABORT;
7944        }
7945        if (yang_fill_extcomplex_uint8(ext_instance, ext_name, "fraction-digits", LY_STMT_DIGITS, (yyvsp[0].uint))) {
7946          YYABORT;
7947        }
7948      }
7949     break;
7950 
7951   case 816:
7952                                          { uint32_t **val;
7953 
7954                                            val = (uint32_t **)yang_getplace_for_extcomplex_struct(ext_instance, NULL, ext_name,
7955                                                                                                   "min-elements", LY_STMT_MIN);
7956                                            if (!val) {
7957                                              YYABORT;
7958                                            }
7959                                            /* store the value */
7960                                            *val = malloc(sizeof(uint32_t));
7961                                            if (!*val) {
7962                                              LOGMEM(trg->ctx);
7963                                              YYABORT;
7964                                            }
7965                                            **val = (yyvsp[0].uint);
7966                                          }
7967     break;
7968 
7969   case 817:
7970                                          { uint32_t **val;
7971 
7972                                            val = (uint32_t **)yang_getplace_for_extcomplex_struct(ext_instance, NULL, ext_name,
7973                                                                                                   "max-elements", LY_STMT_MAX);
7974                                            if (!val) {
7975                                              YYABORT;
7976                                            }
7977                                            /* store the value */
7978                                            *val = malloc(sizeof(uint32_t));
7979                                            if (!*val) {
7980                                              LOGMEM(trg->ctx);
7981                                              YYABORT;
7982                                            }
7983                                            **val = (yyvsp[0].uint);
7984                                          }
7985     break;
7986 
7987   case 818:
7988                                      { uint32_t **val;
7989 
7990                                        val = (uint32_t **)yang_getplace_for_extcomplex_struct(ext_instance, NULL, ext_name,
7991                                                                                               "position", LY_STMT_POSITION);
7992                                        if (!val) {
7993                                          YYABORT;
7994                                        }
7995                                        /* store the value */
7996                                        *val = malloc(sizeof(uint32_t));
7997                                        if (!*val) {
7998                                          LOGMEM(trg->ctx);
7999                                          YYABORT;
8000                                        }
8001                                        **val = (yyvsp[0].uint);
8002                                      }
8003     break;
8004 
8005   case 819:
8006                                   { int32_t **val;
8007 
8008                                     val = (int32_t **)yang_getplace_for_extcomplex_struct(ext_instance, NULL, ext_name,
8009                                                                                           "value", LY_STMT_VALUE);
8010                                     if (!val) {
8011                                       YYABORT;
8012                                     }
8013                                     /* store the value */
8014                                     *val = malloc(sizeof(int32_t));
8015                                     if (!*val) {
8016                                       LOGMEM(trg->ctx);
8017                                       YYABORT;
8018                                     }
8019                                     **val = (yyvsp[0].i);
8020                                   }
8021     break;
8022 
8023   case 820:
8024                                    { struct lys_unique **unique;
8025                                      int rc;
8026 
8027                                      unique = (struct lys_unique **)yang_getplace_for_extcomplex_struct(ext_instance, NULL, ext_name,
8028                                                                                                         "unique", LY_STMT_UNIQUE);
8029                                      if (!unique) {
8030                                        YYABORT;
8031                                      }
8032                                      *unique = calloc(1, sizeof(struct lys_unique));
8033                                      if (!*unique) {
8034                                        LOGMEM(trg->ctx);
8035                                        YYABORT;
8036                                      }
8037                                      rc = yang_fill_unique(trg, (struct lys_node_list *)ext_instance, *unique, s, param->unres);
8038                                      free(s);
8039                                      s = NULL;
8040                                      if (rc) {
8041                                        YYABORT;
8042                                      }
8043                                    }
8044     break;
8045 
8046   case 821:
8047      { struct lys_iffeature *iffeature;
8048 
8049        iffeature = (yyvsp[-2].v);
8050        s = (char *)iffeature->features;
8051        iffeature->features = NULL;
8052        if (yang_fill_iffeature(trg, iffeature, ext_instance, s, param->unres, 0)) {
8053          YYABORT;
8054        }
8055        if (yang_check_ext_instance(trg, &iffeature->ext, &iffeature->ext_size, iffeature, param->unres)) {
8056          YYABORT;
8057        }
8058        s = NULL;
8059        actual = ext_instance;
8060      }
8061     break;
8062 
8063   case 823:
8064      { if (yang_check_ext_instance(trg, &((struct lys_restr *)(yyvsp[-2].v))->ext, &((struct lys_restr *)(yyvsp[-2].v))->ext_size, (yyvsp[-2].v), param->unres)) {
8065          YYABORT;
8066        }
8067        actual = ext_instance;
8068      }
8069     break;
8070 
8071   case 824:
8072      { if (yang_check_ext_instance(trg, &(*(struct lys_when **)(yyvsp[-2].v))->ext, &(*(struct lys_when **)(yyvsp[-2].v))->ext_size,
8073                                    *(struct lys_when **)(yyvsp[-2].v), param->unres)) {
8074          YYABORT;
8075        }
8076        actual = ext_instance;
8077      }
8078     break;
8079 
8080   case 825:
8081      { int i;
8082 
8083        for (i = 0; i < (yyvsp[-2].revisions).index; ++i) {
8084          if (!strcmp((yyvsp[-2].revisions).revision[i]->date, (yyvsp[-2].revisions).revision[(yyvsp[-2].revisions).index]->date)) {
8085            LOGWRN(trg->ctx, "Module's revisions are not unique (%s).", (yyvsp[-2].revisions).revision[i]->date);
8086            break;
8087          }
8088        }
8089        if (yang_check_ext_instance(trg, &(yyvsp[-2].revisions).revision[(yyvsp[-2].revisions).index]->ext, &(yyvsp[-2].revisions).revision[(yyvsp[-2].revisions).index]->ext_size,
8090                                    &(yyvsp[-2].revisions).revision[(yyvsp[-2].revisions).index], param->unres)) {
8091          YYABORT;
8092        }
8093        actual = ext_instance;
8094      }
8095     break;
8096 
8097   case 826:
8098                                                                   { actual = ext_instance;
8099                                                                     is_ext_instance = 1;
8100                                                                   }
8101     break;
8102 
8103 
8104 
8105       default: break;
8106     }
8107   /* User semantic actions sometimes alter yychar, and that requires
8108      that yytoken be updated with the new translation.  We take the
8109      approach of translating immediately before every use of yytoken.
8110      One alternative is translating here after every semantic action,
8111      but that translation would be missed if the semantic action invokes
8112      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
8113      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
8114      incorrect destructor might then be invoked immediately.  In the
8115      case of YYERROR or YYBACKUP, subsequent parser actions might lead
8116      to an incorrect destructor call or verbose syntax error message
8117      before the lookahead is translated.  */
8118   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
8119 
8120   YYPOPSTACK (yylen);
8121   yylen = 0;
8122   YY_STACK_PRINT (yyss, yyssp);
8123 
8124   *++yyvsp = yyval;
8125   *++yylsp = yyloc;
8126 
8127   /* Now 'shift' the result of the reduction.  Determine what state
8128      that goes to, based on the state we popped back to and the rule
8129      number reduced by.  */
8130   {
8131     const int yylhs = yyr1[yyn] - YYNTOKENS;
8132     const int yyi = yypgoto[yylhs] + *yyssp;
8133     yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
8134                ? yytable[yyi]
8135                : yydefgoto[yylhs]);
8136   }
8137 
8138   goto yynewstate;
8139 
8140 
8141 /*--------------------------------------.
8142 | yyerrlab -- here on detecting error.  |
8143 `--------------------------------------*/
8144 yyerrlab:
8145   /* Make sure we have latest lookahead translation.  See comments at
8146      user semantic actions for why this is necessary.  */
8147   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
8148 
8149   /* If not already recovering from an error, report this error.  */
8150   if (!yyerrstatus)
8151     {
8152       ++yynerrs;
8153 #if ! YYERROR_VERBOSE
8154       yyerror (&yylloc, scanner, param, YY_("syntax error"));
8155 #else
8156 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
8157                                         yyssp, yytoken)
8158       {
8159         char const *yymsgp = YY_("syntax error");
8160         int yysyntax_error_status;
8161         yysyntax_error_status = YYSYNTAX_ERROR;
8162         if (yysyntax_error_status == 0)
8163           yymsgp = yymsg;
8164         else if (yysyntax_error_status == 1)
8165           {
8166             if (yymsg != yymsgbuf)
8167               YYSTACK_FREE (yymsg);
8168             yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
8169             if (!yymsg)
8170               {
8171                 yymsg = yymsgbuf;
8172                 yymsg_alloc = sizeof yymsgbuf;
8173                 yysyntax_error_status = 2;
8174               }
8175             else
8176               {
8177                 yysyntax_error_status = YYSYNTAX_ERROR;
8178                 yymsgp = yymsg;
8179               }
8180           }
8181         yyerror (&yylloc, scanner, param, yymsgp);
8182         if (yysyntax_error_status == 2)
8183           goto yyexhaustedlab;
8184       }
8185 # undef YYSYNTAX_ERROR
8186 #endif
8187     }
8188 
8189   yyerror_range[1] = yylloc;
8190 
8191   if (yyerrstatus == 3)
8192     {
8193       /* If just tried and failed to reuse lookahead token after an
8194          error, discard it.  */
8195 
8196       if (yychar <= YYEOF)
8197         {
8198           /* Return failure if at end of input.  */
8199           if (yychar == YYEOF)
8200             YYABORT;
8201         }
8202       else
8203         {
8204           yydestruct ("Error: discarding",
8205                       yytoken, &yylval, &yylloc, scanner, param);
8206           yychar = YYEMPTY;
8207         }
8208     }
8209 
8210   /* Else will try to reuse lookahead token after shifting the error
8211      token.  */
8212   goto yyerrlab1;
8213 
8214 
8215 /*---------------------------------------------------.
8216 | yyerrorlab -- error raised explicitly by YYERROR.  |
8217 `---------------------------------------------------*/
8218 yyerrorlab:
8219   /* Pacify compilers when the user code never invokes YYERROR and the
8220      label yyerrorlab therefore never appears in user code.  */
8221   if (0)
8222     YYERROR;
8223 
8224   /* Do not reclaim the symbols of the rule whose action triggered
8225      this YYERROR.  */
8226   YYPOPSTACK (yylen);
8227   yylen = 0;
8228   YY_STACK_PRINT (yyss, yyssp);
8229   yystate = *yyssp;
8230   goto yyerrlab1;
8231 
8232 
8233 /*-------------------------------------------------------------.
8234 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
8235 `-------------------------------------------------------------*/
8236 yyerrlab1:
8237   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
8238 
8239   for (;;)
8240     {
8241       yyn = yypact[yystate];
8242       if (!yypact_value_is_default (yyn))
8243         {
8244           yyn += YYTERROR;
8245           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
8246             {
8247               yyn = yytable[yyn];
8248               if (0 < yyn)
8249                 break;
8250             }
8251         }
8252 
8253       /* Pop the current state because it cannot handle the error token.  */
8254       if (yyssp == yyss)
8255         YYABORT;
8256 
8257       yyerror_range[1] = *yylsp;
8258       yydestruct ("Error: popping",
8259                   yystos[yystate], yyvsp, yylsp, scanner, param);
8260       YYPOPSTACK (1);
8261       yystate = *yyssp;
8262       YY_STACK_PRINT (yyss, yyssp);
8263     }
8264 
8265   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
8266   *++yyvsp = yylval;
8267   YY_IGNORE_MAYBE_UNINITIALIZED_END
8268 
8269   yyerror_range[2] = yylloc;
8270   /* Using YYLLOC is tempting, but would change the location of
8271      the lookahead.  YYLOC is available though.  */
8272   YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
8273   *++yylsp = yyloc;
8274 
8275   /* Shift the error token.  */
8276   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
8277 
8278   yystate = yyn;
8279   goto yynewstate;
8280 
8281 
8282 /*-------------------------------------.
8283 | yyacceptlab -- YYACCEPT comes here.  |
8284 `-------------------------------------*/
8285 yyacceptlab:
8286   yyresult = 0;
8287   goto yyreturn;
8288 
8289 
8290 /*-----------------------------------.
8291 | yyabortlab -- YYABORT comes here.  |
8292 `-----------------------------------*/
8293 yyabortlab:
8294   yyresult = 1;
8295   goto yyreturn;
8296 
8297 
8298 #if !defined yyoverflow || YYERROR_VERBOSE
8299 /*-------------------------------------------------.
8300 | yyexhaustedlab -- memory exhaustion comes here.  |
8301 `-------------------------------------------------*/
8302 yyexhaustedlab:
8303   yyerror (&yylloc, scanner, param, YY_("memory exhausted"));
8304   yyresult = 2;
8305   /* Fall through.  */
8306 #endif
8307 
8308 
8309 /*-----------------------------------------------------.
8310 | yyreturn -- parsing is finished, return the result.  |
8311 `-----------------------------------------------------*/
8312 yyreturn:
8313   if (yychar != YYEMPTY)
8314     {
8315       /* Make sure we have latest lookahead translation.  See comments at
8316          user semantic actions for why this is necessary.  */
8317       yytoken = YYTRANSLATE (yychar);
8318       yydestruct ("Cleanup: discarding lookahead",
8319                   yytoken, &yylval, &yylloc, scanner, param);
8320     }
8321   /* Do not reclaim the symbols of the rule whose action triggered
8322      this YYABORT or YYACCEPT.  */
8323   YYPOPSTACK (yylen);
8324   YY_STACK_PRINT (yyss, yyssp);
8325   while (yyssp != yyss)
8326     {
8327       yydestruct ("Cleanup: popping",
8328                   yystos[*yyssp], yyvsp, yylsp, scanner, param);
8329       YYPOPSTACK (1);
8330     }
8331 #ifndef yyoverflow
8332   if (yyss != yyssa)
8333     YYSTACK_FREE (yyss);
8334 #endif
8335 #if YYERROR_VERBOSE
8336   if (yymsg != yymsgbuf)
8337     YYSTACK_FREE (yymsg);
8338 #endif
8339   return yyresult;
8340 }
8341 
8342 
8343 void
yyerror(YYLTYPE * yylloc,void * scanner,struct yang_parameter * param,...)8344 yyerror(YYLTYPE *yylloc, void *scanner, struct yang_parameter *param, ...)
8345 {
8346   free(*param->value);
8347   *param->value = NULL;
8348   if (yylloc->first_line != -1) {
8349     if (*param->data_node && (*param->data_node) == (*param->actual_node)) {
8350       LOGVAL(param->module->ctx, LYE_INSTMT, LY_VLOG_LYS, *param->data_node, yyget_text(scanner));
8351     } else {
8352       LOGVAL(param->module->ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, yyget_text(scanner));
8353     }
8354   }
8355 }
8356