1 /* A Bison parser, made by GNU Bison 3.0.4. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
29
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
32
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
35
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
42
43 /* Identify Bison output. */
44 #define YYBISON 1
45
46 /* Bison version. */
47 #define YYBISON_VERSION "3.0.4"
48
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51
52 /* Pure parsers. */
53 #define YYPURE 0
54
55 /* Push parsers. */
56 #define YYPUSH 0
57
58 /* Pull parsers. */
59 #define YYPULL 1
60
61
62
63
64 /* Copy the first part of user declarations. */
65 #line 21 "config_gram.y" /* yacc.c:339 */
66
67
68 #include "ac_cfg.h"
69
70 #include <stdlib.h>
71 #include <string.h>
72 #include <math.h>
73
74 #include "avrdude.h"
75 #include "libavrdude.h"
76 #include "config.h"
77
78 #if defined(WIN32NATIVE)
79 #define strtok_r( _s, _sep, _lasts ) \
80 ( *(_lasts) = strtok( (_s), (_sep) ) )
81 #endif
82
83 #define STRINGIFY(x) #x
84 #define TOSTRING(x) STRINGIFY(x)
85
86 int yylex(void);
87 int yyerror(char * errmsg, ...);
88 int yywarning(char * errmsg, ...);
89
90 static int assign_pin(int pinno, TOKEN * v, int invert);
91 static int assign_pin_list(int invert);
92 static int which_opcode(TOKEN * opcode);
93 static int parse_cmdbits(OPCODE * op);
94
95 static int pin_name;
96
97 #line 98 "config_gram.c" /* yacc.c:339 */
98
99 # ifndef YY_NULLPTR
100 # if defined __cplusplus && 201103L <= __cplusplus
101 # define YY_NULLPTR nullptr
102 # else
103 # define YY_NULLPTR 0
104 # endif
105 # endif
106
107 /* Enabling verbose error messages. */
108 #ifdef YYERROR_VERBOSE
109 # undef YYERROR_VERBOSE
110 # define YYERROR_VERBOSE 1
111 #else
112 # define YYERROR_VERBOSE 0
113 #endif
114
115 /* In a future release of Bison, this section will be replaced
116 by #include "y.tab.h". */
117 #ifndef YY_YY_CONFIG_GRAM_H_INCLUDED
118 # define YY_YY_CONFIG_GRAM_H_INCLUDED
119 /* Debug traces. */
120 #ifndef YYDEBUG
121 # define YYDEBUG 0
122 #endif
123 #if YYDEBUG
124 extern int yydebug;
125 #endif
126
127 /* Token type. */
128 #ifndef YYTOKENTYPE
129 # define YYTOKENTYPE
130 enum yytokentype
131 {
132 K_READ = 258,
133 K_WRITE = 259,
134 K_READ_LO = 260,
135 K_READ_HI = 261,
136 K_WRITE_LO = 262,
137 K_WRITE_HI = 263,
138 K_LOADPAGE_LO = 264,
139 K_LOADPAGE_HI = 265,
140 K_LOAD_EXT_ADDR = 266,
141 K_WRITEPAGE = 267,
142 K_CHIP_ERASE = 268,
143 K_PGM_ENABLE = 269,
144 K_MEMORY = 270,
145 K_PAGE_SIZE = 271,
146 K_PAGED = 272,
147 K_BAUDRATE = 273,
148 K_BS2 = 274,
149 K_BUFF = 275,
150 K_CHIP_ERASE_DELAY = 276,
151 K_CONNTYPE = 277,
152 K_DEDICATED = 278,
153 K_DEFAULT_BITCLOCK = 279,
154 K_DEFAULT_PARALLEL = 280,
155 K_DEFAULT_PROGRAMMER = 281,
156 K_DEFAULT_SAFEMODE = 282,
157 K_DEFAULT_SERIAL = 283,
158 K_DESC = 284,
159 K_DEVICECODE = 285,
160 K_STK500_DEVCODE = 286,
161 K_AVR910_DEVCODE = 287,
162 K_EEPROM = 288,
163 K_ERRLED = 289,
164 K_FLASH = 290,
165 K_ID = 291,
166 K_IO = 292,
167 K_LOADPAGE = 293,
168 K_MAX_WRITE_DELAY = 294,
169 K_MCU_BASE = 295,
170 K_MIN_WRITE_DELAY = 296,
171 K_MISO = 297,
172 K_MOSI = 298,
173 K_NUM_PAGES = 299,
174 K_NVM_BASE = 300,
175 K_OCDREV = 301,
176 K_OFFSET = 302,
177 K_PAGEL = 303,
178 K_PARALLEL = 304,
179 K_PARENT = 305,
180 K_PART = 306,
181 K_PGMLED = 307,
182 K_PROGRAMMER = 308,
183 K_PSEUDO = 309,
184 K_PWROFF_AFTER_WRITE = 310,
185 K_RDYLED = 311,
186 K_READBACK_P1 = 312,
187 K_READBACK_P2 = 313,
188 K_READMEM = 314,
189 K_RESET = 315,
190 K_RETRY_PULSE = 316,
191 K_SERIAL = 317,
192 K_SCK = 318,
193 K_SIGNATURE = 319,
194 K_SIZE = 320,
195 K_USB = 321,
196 K_USBDEV = 322,
197 K_USBSN = 323,
198 K_USBPID = 324,
199 K_USBPRODUCT = 325,
200 K_USBVENDOR = 326,
201 K_USBVID = 327,
202 K_TYPE = 328,
203 K_VCC = 329,
204 K_VFYLED = 330,
205 K_NO = 331,
206 K_YES = 332,
207 K_TIMEOUT = 333,
208 K_STABDELAY = 334,
209 K_CMDEXEDELAY = 335,
210 K_HVSPCMDEXEDELAY = 336,
211 K_SYNCHLOOPS = 337,
212 K_BYTEDELAY = 338,
213 K_POLLVALUE = 339,
214 K_POLLINDEX = 340,
215 K_PREDELAY = 341,
216 K_POSTDELAY = 342,
217 K_POLLMETHOD = 343,
218 K_MODE = 344,
219 K_DELAY = 345,
220 K_BLOCKSIZE = 346,
221 K_READSIZE = 347,
222 K_HVENTERSTABDELAY = 348,
223 K_PROGMODEDELAY = 349,
224 K_LATCHCYCLES = 350,
225 K_TOGGLEVTG = 351,
226 K_POWEROFFDELAY = 352,
227 K_RESETDELAYMS = 353,
228 K_RESETDELAYUS = 354,
229 K_HVLEAVESTABDELAY = 355,
230 K_RESETDELAY = 356,
231 K_SYNCHCYCLES = 357,
232 K_HVCMDEXEDELAY = 358,
233 K_CHIPERASEPULSEWIDTH = 359,
234 K_CHIPERASEPOLLTIMEOUT = 360,
235 K_CHIPERASETIME = 361,
236 K_PROGRAMFUSEPULSEWIDTH = 362,
237 K_PROGRAMFUSEPOLLTIMEOUT = 363,
238 K_PROGRAMLOCKPULSEWIDTH = 364,
239 K_PROGRAMLOCKPOLLTIMEOUT = 365,
240 K_PP_CONTROLSTACK = 366,
241 K_HVSP_CONTROLSTACK = 367,
242 K_ALLOWFULLPAGEBITSTREAM = 368,
243 K_ENABLEPAGEPROGRAMMING = 369,
244 K_HAS_JTAG = 370,
245 K_HAS_DW = 371,
246 K_HAS_PDI = 372,
247 K_HAS_TPI = 373,
248 K_IDR = 374,
249 K_IS_AT90S1200 = 375,
250 K_IS_AVR32 = 376,
251 K_RAMPZ = 377,
252 K_SPMCR = 378,
253 K_EECR = 379,
254 K_FLASH_INSTR = 380,
255 K_EEPROM_INSTR = 381,
256 TKN_COMMA = 382,
257 TKN_EQUAL = 383,
258 TKN_SEMI = 384,
259 TKN_TILDE = 385,
260 TKN_LEFT_PAREN = 386,
261 TKN_RIGHT_PAREN = 387,
262 TKN_NUMBER = 388,
263 TKN_NUMBER_REAL = 389,
264 TKN_STRING = 390
265 };
266 #endif
267 /* Tokens. */
268 #define K_READ 258
269 #define K_WRITE 259
270 #define K_READ_LO 260
271 #define K_READ_HI 261
272 #define K_WRITE_LO 262
273 #define K_WRITE_HI 263
274 #define K_LOADPAGE_LO 264
275 #define K_LOADPAGE_HI 265
276 #define K_LOAD_EXT_ADDR 266
277 #define K_WRITEPAGE 267
278 #define K_CHIP_ERASE 268
279 #define K_PGM_ENABLE 269
280 #define K_MEMORY 270
281 #define K_PAGE_SIZE 271
282 #define K_PAGED 272
283 #define K_BAUDRATE 273
284 #define K_BS2 274
285 #define K_BUFF 275
286 #define K_CHIP_ERASE_DELAY 276
287 #define K_CONNTYPE 277
288 #define K_DEDICATED 278
289 #define K_DEFAULT_BITCLOCK 279
290 #define K_DEFAULT_PARALLEL 280
291 #define K_DEFAULT_PROGRAMMER 281
292 #define K_DEFAULT_SAFEMODE 282
293 #define K_DEFAULT_SERIAL 283
294 #define K_DESC 284
295 #define K_DEVICECODE 285
296 #define K_STK500_DEVCODE 286
297 #define K_AVR910_DEVCODE 287
298 #define K_EEPROM 288
299 #define K_ERRLED 289
300 #define K_FLASH 290
301 #define K_ID 291
302 #define K_IO 292
303 #define K_LOADPAGE 293
304 #define K_MAX_WRITE_DELAY 294
305 #define K_MCU_BASE 295
306 #define K_MIN_WRITE_DELAY 296
307 #define K_MISO 297
308 #define K_MOSI 298
309 #define K_NUM_PAGES 299
310 #define K_NVM_BASE 300
311 #define K_OCDREV 301
312 #define K_OFFSET 302
313 #define K_PAGEL 303
314 #define K_PARALLEL 304
315 #define K_PARENT 305
316 #define K_PART 306
317 #define K_PGMLED 307
318 #define K_PROGRAMMER 308
319 #define K_PSEUDO 309
320 #define K_PWROFF_AFTER_WRITE 310
321 #define K_RDYLED 311
322 #define K_READBACK_P1 312
323 #define K_READBACK_P2 313
324 #define K_READMEM 314
325 #define K_RESET 315
326 #define K_RETRY_PULSE 316
327 #define K_SERIAL 317
328 #define K_SCK 318
329 #define K_SIGNATURE 319
330 #define K_SIZE 320
331 #define K_USB 321
332 #define K_USBDEV 322
333 #define K_USBSN 323
334 #define K_USBPID 324
335 #define K_USBPRODUCT 325
336 #define K_USBVENDOR 326
337 #define K_USBVID 327
338 #define K_TYPE 328
339 #define K_VCC 329
340 #define K_VFYLED 330
341 #define K_NO 331
342 #define K_YES 332
343 #define K_TIMEOUT 333
344 #define K_STABDELAY 334
345 #define K_CMDEXEDELAY 335
346 #define K_HVSPCMDEXEDELAY 336
347 #define K_SYNCHLOOPS 337
348 #define K_BYTEDELAY 338
349 #define K_POLLVALUE 339
350 #define K_POLLINDEX 340
351 #define K_PREDELAY 341
352 #define K_POSTDELAY 342
353 #define K_POLLMETHOD 343
354 #define K_MODE 344
355 #define K_DELAY 345
356 #define K_BLOCKSIZE 346
357 #define K_READSIZE 347
358 #define K_HVENTERSTABDELAY 348
359 #define K_PROGMODEDELAY 349
360 #define K_LATCHCYCLES 350
361 #define K_TOGGLEVTG 351
362 #define K_POWEROFFDELAY 352
363 #define K_RESETDELAYMS 353
364 #define K_RESETDELAYUS 354
365 #define K_HVLEAVESTABDELAY 355
366 #define K_RESETDELAY 356
367 #define K_SYNCHCYCLES 357
368 #define K_HVCMDEXEDELAY 358
369 #define K_CHIPERASEPULSEWIDTH 359
370 #define K_CHIPERASEPOLLTIMEOUT 360
371 #define K_CHIPERASETIME 361
372 #define K_PROGRAMFUSEPULSEWIDTH 362
373 #define K_PROGRAMFUSEPOLLTIMEOUT 363
374 #define K_PROGRAMLOCKPULSEWIDTH 364
375 #define K_PROGRAMLOCKPOLLTIMEOUT 365
376 #define K_PP_CONTROLSTACK 366
377 #define K_HVSP_CONTROLSTACK 367
378 #define K_ALLOWFULLPAGEBITSTREAM 368
379 #define K_ENABLEPAGEPROGRAMMING 369
380 #define K_HAS_JTAG 370
381 #define K_HAS_DW 371
382 #define K_HAS_PDI 372
383 #define K_HAS_TPI 373
384 #define K_IDR 374
385 #define K_IS_AT90S1200 375
386 #define K_IS_AVR32 376
387 #define K_RAMPZ 377
388 #define K_SPMCR 378
389 #define K_EECR 379
390 #define K_FLASH_INSTR 380
391 #define K_EEPROM_INSTR 381
392 #define TKN_COMMA 382
393 #define TKN_EQUAL 383
394 #define TKN_SEMI 384
395 #define TKN_TILDE 385
396 #define TKN_LEFT_PAREN 386
397 #define TKN_RIGHT_PAREN 387
398 #define TKN_NUMBER 388
399 #define TKN_NUMBER_REAL 389
400 #define TKN_STRING 390
401
402 /* Value type. */
403 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
404 typedef int YYSTYPE;
405 # define YYSTYPE_IS_TRIVIAL 1
406 # define YYSTYPE_IS_DECLARED 1
407 #endif
408
409
410 extern YYSTYPE yylval;
411
412 int yyparse (void);
413
414 #endif /* !YY_YY_CONFIG_GRAM_H_INCLUDED */
415
416 /* Copy the second part of user declarations. */
417
418 #line 419 "config_gram.c" /* yacc.c:358 */
419
420 #ifdef short
421 # undef short
422 #endif
423
424 #ifdef YYTYPE_UINT8
425 typedef YYTYPE_UINT8 yytype_uint8;
426 #else
427 typedef unsigned char yytype_uint8;
428 #endif
429
430 #ifdef YYTYPE_INT8
431 typedef YYTYPE_INT8 yytype_int8;
432 #else
433 typedef signed char yytype_int8;
434 #endif
435
436 #ifdef YYTYPE_UINT16
437 typedef YYTYPE_UINT16 yytype_uint16;
438 #else
439 typedef unsigned short int yytype_uint16;
440 #endif
441
442 #ifdef YYTYPE_INT16
443 typedef YYTYPE_INT16 yytype_int16;
444 #else
445 typedef short int yytype_int16;
446 #endif
447
448 #ifndef YYSIZE_T
449 # ifdef __SIZE_TYPE__
450 # define YYSIZE_T __SIZE_TYPE__
451 # elif defined size_t
452 # define YYSIZE_T size_t
453 # elif ! defined YYSIZE_T
454 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
455 # define YYSIZE_T size_t
456 # else
457 # define YYSIZE_T unsigned int
458 # endif
459 #endif
460
461 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
462
463 #ifndef YY_
464 # if defined YYENABLE_NLS && YYENABLE_NLS
465 # if ENABLE_NLS
466 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
467 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
468 # endif
469 # endif
470 # ifndef YY_
471 # define YY_(Msgid) Msgid
472 # endif
473 #endif
474
475 #ifndef YY_ATTRIBUTE
476 # if (defined __GNUC__ \
477 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
478 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
479 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
480 # else
481 # define YY_ATTRIBUTE(Spec) /* empty */
482 # endif
483 #endif
484
485 #ifndef YY_ATTRIBUTE_PURE
486 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
487 #endif
488
489 #ifndef YY_ATTRIBUTE_UNUSED
490 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
491 #endif
492
493 #if !defined _Noreturn \
494 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
495 # if defined _MSC_VER && 1200 <= _MSC_VER
496 # define _Noreturn __declspec (noreturn)
497 # else
498 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
499 # endif
500 #endif
501
502 /* Suppress unused-variable warnings by "using" E. */
503 #if ! defined lint || defined __GNUC__
504 # define YYUSE(E) ((void) (E))
505 #else
506 # define YYUSE(E) /* empty */
507 #endif
508
509 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
510 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
511 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
512 _Pragma ("GCC diagnostic push") \
513 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
514 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
515 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
516 _Pragma ("GCC diagnostic pop")
517 #else
518 # define YY_INITIAL_VALUE(Value) Value
519 #endif
520 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
521 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
522 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
523 #endif
524 #ifndef YY_INITIAL_VALUE
525 # define YY_INITIAL_VALUE(Value) /* Nothing. */
526 #endif
527
528
529 #if ! defined yyoverflow || YYERROR_VERBOSE
530
531 /* The parser invokes alloca or malloc; define the necessary symbols. */
532
533 # ifdef YYSTACK_USE_ALLOCA
534 # if YYSTACK_USE_ALLOCA
535 # ifdef __GNUC__
536 # define YYSTACK_ALLOC __builtin_alloca
537 # elif defined __BUILTIN_VA_ARG_INCR
538 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
539 # elif defined _AIX
540 # define YYSTACK_ALLOC __alloca
541 # elif defined _MSC_VER
542 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
543 # define alloca _alloca
544 # else
545 # define YYSTACK_ALLOC alloca
546 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
547 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
548 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
549 # ifndef EXIT_SUCCESS
550 # define EXIT_SUCCESS 0
551 # endif
552 # endif
553 # endif
554 # endif
555 # endif
556
557 # ifdef YYSTACK_ALLOC
558 /* Pacify GCC's 'empty if-body' warning. */
559 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
560 # ifndef YYSTACK_ALLOC_MAXIMUM
561 /* The OS might guarantee only one guard page at the bottom of the stack,
562 and a page size can be as small as 4096 bytes. So we cannot safely
563 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
564 to allow for a few compiler-allocated temporary stack slots. */
565 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
566 # endif
567 # else
568 # define YYSTACK_ALLOC YYMALLOC
569 # define YYSTACK_FREE YYFREE
570 # ifndef YYSTACK_ALLOC_MAXIMUM
571 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
572 # endif
573 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
574 && ! ((defined YYMALLOC || defined malloc) \
575 && (defined YYFREE || defined free)))
576 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
577 # ifndef EXIT_SUCCESS
578 # define EXIT_SUCCESS 0
579 # endif
580 # endif
581 # ifndef YYMALLOC
582 # define YYMALLOC malloc
583 # if ! defined malloc && ! defined EXIT_SUCCESS
584 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
585 # endif
586 # endif
587 # ifndef YYFREE
588 # define YYFREE free
589 # if ! defined free && ! defined EXIT_SUCCESS
590 void free (void *); /* INFRINGES ON USER NAME SPACE */
591 # endif
592 # endif
593 # endif
594 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
595
596
597 #if (! defined yyoverflow \
598 && (! defined __cplusplus \
599 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
600
601 /* A type that is properly aligned for any stack member. */
602 union yyalloc
603 {
604 yytype_int16 yyss_alloc;
605 YYSTYPE yyvs_alloc;
606 };
607
608 /* The size of the maximum gap between one aligned stack and the next. */
609 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
610
611 /* The size of an array large to enough to hold all stacks, each with
612 N elements. */
613 # define YYSTACK_BYTES(N) \
614 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
615 + YYSTACK_GAP_MAXIMUM)
616
617 # define YYCOPY_NEEDED 1
618
619 /* Relocate STACK from its old location to the new one. The
620 local variables YYSIZE and YYSTACKSIZE give the old and new number of
621 elements in the stack, and YYPTR gives the new location of the
622 stack. Advance YYPTR to a properly aligned location for the next
623 stack. */
624 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
625 do \
626 { \
627 YYSIZE_T yynewbytes; \
628 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
629 Stack = &yyptr->Stack_alloc; \
630 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
631 yyptr += yynewbytes / sizeof (*yyptr); \
632 } \
633 while (0)
634
635 #endif
636
637 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
638 /* Copy COUNT objects from SRC to DST. The source and destination do
639 not overlap. */
640 # ifndef YYCOPY
641 # if defined __GNUC__ && 1 < __GNUC__
642 # define YYCOPY(Dst, Src, Count) \
643 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
644 # else
645 # define YYCOPY(Dst, Src, Count) \
646 do \
647 { \
648 YYSIZE_T yyi; \
649 for (yyi = 0; yyi < (Count); yyi++) \
650 (Dst)[yyi] = (Src)[yyi]; \
651 } \
652 while (0)
653 # endif
654 # endif
655 #endif /* !YYCOPY_NEEDED */
656
657 /* YYFINAL -- State number of the termination state. */
658 #define YYFINAL 22
659 /* YYLAST -- Last index in YYTABLE. */
660 #define YYLAST 401
661
662 /* YYNTOKENS -- Number of terminals. */
663 #define YYNTOKENS 136
664 /* YYNNTS -- Number of nonterminals. */
665 #define YYNNTS 45
666 /* YYNRULES -- Number of rules. */
667 #define YYNRULES 182
668 /* YYNSTATES -- Number of states. */
669 #define YYNSTATES 418
670
671 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
672 by yylex, with out-of-bounds checking. */
673 #define YYUNDEFTOK 2
674 #define YYMAXUTOK 390
675
676 #define YYTRANSLATE(YYX) \
677 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
678
679 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
680 as returned by yylex, without out-of-bounds checking. */
681 static const yytype_uint8 yytranslate[] =
682 {
683 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
684 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
685 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
686 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
687 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
688 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
689 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
690 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
691 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
692 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
693 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
694 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
695 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
696 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
697 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
698 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
699 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
700 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
701 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
702 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
703 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
704 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
705 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
706 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
707 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
708 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
709 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
710 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
711 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
712 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
713 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
714 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
715 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
716 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
717 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
718 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
719 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
720 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
721 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
722 135
723 };
724
725 #if YYDEBUG
726 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
727 static const yytype_uint16 yyrline[] =
728 {
729 0, 211, 211, 217, 221, 222, 226, 227, 232, 234,
730 236, 242, 248, 254, 259, 270, 303, 313, 335, 393,
731 403, 426, 427, 432, 433, 437, 438, 442, 465, 467,
732 469, 471, 473, 478, 487, 491, 501, 509, 513, 514,
733 515, 519, 526, 532, 533, 540, 547, 557, 572, 585,
734 587, 591, 593, 597, 599, 603, 605, 610, 612, 616,
735 616, 617, 617, 618, 618, 619, 619, 620, 620, 621,
736 621, 622, 622, 623, 623, 624, 624, 625, 625, 629,
737 630, 631, 632, 633, 634, 635, 636, 637, 638, 639,
738 640, 645, 646, 651, 651, 655, 655, 659, 659, 663,
739 670, 677, 685, 692, 699, 710, 717, 748, 779, 809,
740 839, 845, 851, 857, 867, 873, 879, 885, 891, 897,
741 903, 909, 915, 921, 927, 933, 939, 945, 951, 957,
742 963, 969, 975, 981, 987, 993, 999, 1005, 1011, 1017,
743 1023, 1029, 1035, 1045, 1055, 1065, 1075, 1085, 1095, 1105,
744 1115, 1121, 1127, 1133, 1139, 1145, 1151, 1157, 1167, 1186,
745 1210, 1209, 1234, 1261, 1261, 1266, 1267, 1272, 1278, 1285,
746 1291, 1297, 1303, 1309, 1315, 1321, 1327, 1334, 1340, 1346,
747 1352, 1358, 1365
748 };
749 #endif
750
751 #if YYDEBUG || YYERROR_VERBOSE || 0
752 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
753 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
754 static const char *const yytname[] =
755 {
756 "$end", "error", "$undefined", "K_READ", "K_WRITE", "K_READ_LO",
757 "K_READ_HI", "K_WRITE_LO", "K_WRITE_HI", "K_LOADPAGE_LO",
758 "K_LOADPAGE_HI", "K_LOAD_EXT_ADDR", "K_WRITEPAGE", "K_CHIP_ERASE",
759 "K_PGM_ENABLE", "K_MEMORY", "K_PAGE_SIZE", "K_PAGED", "K_BAUDRATE",
760 "K_BS2", "K_BUFF", "K_CHIP_ERASE_DELAY", "K_CONNTYPE", "K_DEDICATED",
761 "K_DEFAULT_BITCLOCK", "K_DEFAULT_PARALLEL", "K_DEFAULT_PROGRAMMER",
762 "K_DEFAULT_SAFEMODE", "K_DEFAULT_SERIAL", "K_DESC", "K_DEVICECODE",
763 "K_STK500_DEVCODE", "K_AVR910_DEVCODE", "K_EEPROM", "K_ERRLED",
764 "K_FLASH", "K_ID", "K_IO", "K_LOADPAGE", "K_MAX_WRITE_DELAY",
765 "K_MCU_BASE", "K_MIN_WRITE_DELAY", "K_MISO", "K_MOSI", "K_NUM_PAGES",
766 "K_NVM_BASE", "K_OCDREV", "K_OFFSET", "K_PAGEL", "K_PARALLEL",
767 "K_PARENT", "K_PART", "K_PGMLED", "K_PROGRAMMER", "K_PSEUDO",
768 "K_PWROFF_AFTER_WRITE", "K_RDYLED", "K_READBACK_P1", "K_READBACK_P2",
769 "K_READMEM", "K_RESET", "K_RETRY_PULSE", "K_SERIAL", "K_SCK",
770 "K_SIGNATURE", "K_SIZE", "K_USB", "K_USBDEV", "K_USBSN", "K_USBPID",
771 "K_USBPRODUCT", "K_USBVENDOR", "K_USBVID", "K_TYPE", "K_VCC", "K_VFYLED",
772 "K_NO", "K_YES", "K_TIMEOUT", "K_STABDELAY", "K_CMDEXEDELAY",
773 "K_HVSPCMDEXEDELAY", "K_SYNCHLOOPS", "K_BYTEDELAY", "K_POLLVALUE",
774 "K_POLLINDEX", "K_PREDELAY", "K_POSTDELAY", "K_POLLMETHOD", "K_MODE",
775 "K_DELAY", "K_BLOCKSIZE", "K_READSIZE", "K_HVENTERSTABDELAY",
776 "K_PROGMODEDELAY", "K_LATCHCYCLES", "K_TOGGLEVTG", "K_POWEROFFDELAY",
777 "K_RESETDELAYMS", "K_RESETDELAYUS", "K_HVLEAVESTABDELAY", "K_RESETDELAY",
778 "K_SYNCHCYCLES", "K_HVCMDEXEDELAY", "K_CHIPERASEPULSEWIDTH",
779 "K_CHIPERASEPOLLTIMEOUT", "K_CHIPERASETIME", "K_PROGRAMFUSEPULSEWIDTH",
780 "K_PROGRAMFUSEPOLLTIMEOUT", "K_PROGRAMLOCKPULSEWIDTH",
781 "K_PROGRAMLOCKPOLLTIMEOUT", "K_PP_CONTROLSTACK", "K_HVSP_CONTROLSTACK",
782 "K_ALLOWFULLPAGEBITSTREAM", "K_ENABLEPAGEPROGRAMMING", "K_HAS_JTAG",
783 "K_HAS_DW", "K_HAS_PDI", "K_HAS_TPI", "K_IDR", "K_IS_AT90S1200",
784 "K_IS_AVR32", "K_RAMPZ", "K_SPMCR", "K_EECR", "K_FLASH_INSTR",
785 "K_EEPROM_INSTR", "TKN_COMMA", "TKN_EQUAL", "TKN_SEMI", "TKN_TILDE",
786 "TKN_LEFT_PAREN", "TKN_RIGHT_PAREN", "TKN_NUMBER", "TKN_NUMBER_REAL",
787 "TKN_STRING", "$accept", "number_real", "configuration", "config", "def",
788 "prog_def", "prog_decl", "part_def", "part_decl", "string_list",
789 "num_list", "prog_parms", "prog_parm", "prog_parm_type",
790 "prog_parm_type_id", "prog_parm_conntype", "prog_parm_conntype_id",
791 "prog_parm_usb", "usb_pid_list", "pin_number_non_empty", "pin_number",
792 "pin_list_element", "pin_list_non_empty", "pin_list", "prog_parm_pins",
793 "$@1", "$@2", "$@3", "$@4", "$@5", "$@6", "$@7", "$@8", "$@9", "$@10",
794 "opcode", "part_parms", "reset_disposition", "parallel_modes",
795 "retry_lines", "part_parm", "$@11", "yesno", "mem_specs", "mem_spec", YY_NULLPTR
796 };
797 #endif
798
799 # ifdef YYPRINT
800 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
801 (internal) symbol number NUM (which must be that of a token). */
802 static const yytype_uint16 yytoknum[] =
803 {
804 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
805 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
806 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
807 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
808 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
809 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
810 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
811 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
812 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
813 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
814 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
815 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
816 375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
817 385, 386, 387, 388, 389, 390
818 };
819 # endif
820
821 #define YYPACT_NINF -258
822
823 #define yypact_value_is_default(Yystate) \
824 (!!((Yystate) == (-258)))
825
826 #define YYTABLE_NINF -1
827
828 #define yytable_value_is_error(Yytable_value) \
829 0
830
831 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
832 STATE-NUM. */
833 static const yytype_int16 yypact[] =
834 {
835 23, -119, -83, -82, -68, -50, 2, 31, 82, 23,
836 -258, -39, 55, -37, 166, -99, -42, -41, -63, -40,
837 -35, -34, -258, -258, -258, -43, -32, -26, -20, -19,
838 -18, -15, -14, -12, -11, -9, -8, -7, 3, 5,
839 6, 7, 8, 9, 10, 12, 55, 13, -258, -258,
840 -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,
841 -258, -258, -258, -258, -258, -3, 15, 17, 18, 20,
842 22, 24, 25, 26, 27, 28, 29, 30, 32, 33,
843 34, 35, 37, 38, 39, 54, 56, 58, 60, 61,
844 62, 63, 64, 65, 66, 71, 72, 73, 76, 77,
845 79, 81, 85, 88, 89, 90, 91, 92, 93, 94,
846 95, 96, 97, 101, 103, 104, 105, 106, 108, 109,
847 110, 111, 112, 113, 114, 115, 127, 128, 166, 129,
848 -258, -258, 140, 164, 165, -258, -258, 167, 168, -258,
849 -258, 16, -258, 21, 48, -258, 75, -258, -258, -258,
850 -258, -258, -258, 122, 160, 169, 163, 170, 171, 4,
851 -258, -258, 172, -258, -258, 173, 174, 175, 176, 178,
852 179, 180, 181, 183, 184, 185, -44, 19, -52, -63,
853 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
854 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
855 206, 207, 208, 209, 210, 211, 212, 213, 214, 215,
856 216, 216, -63, -63, -63, -63, -63, -63, 217, -63,
857 -63, 218, 219, 220, 216, 216, 75, 225, -258, -258,
858 -258, -258, -258, -258, -258, -76, -258, -258, -258, -258,
859 -258, -71, -258, 228, -71, -71, -71, -71, -71, -71,
860 -258, -258, -258, 229, -258, -258, -258, -258, -258, -258,
861 -76, -71, -258, 14, -258, -258, -258, -258, -258, -258,
862 -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,
863 -258, -258, -258, -258, -258, 224, -258, -258, -258, -258,
864 -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,
865 -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,
866 -258, -258, -258, -258, -258, -258, 231, 231, -258, -258,
867 -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,
868 231, 231, 228, -258, -45, -258, -258, -258, 232, -258,
869 227, -258, -258, 226, -258, -258, -258, -258, -258, -258,
870 230, -258, -258, 234, 236, 237, 238, 239, 240, 241,
871 242, 243, 244, 245, 246, 247, 248, 249, 250, 14,
872 251, 252, 253, 216, -258, -76, -258, -258, 254, -63,
873 255, 256, 257, 258, -63, 259, 260, 261, 262, 263,
874 264, 265, 266, 75, 271, -258, -258, -258, -120, -258,
875 -258, -258, -258, -258, -258, -258, -258, -258, -258, -258,
876 -258, -258, -258, -258, -258, 228, -258, -258
877 };
878
879 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
880 Performed when YYTABLE does not specify something else to do. Zero
881 means the default is an error. */
882 static const yytype_uint8 yydefact[] =
883 {
884 4, 0, 0, 0, 0, 0, 19, 16, 0, 5,
885 6, 0, 0, 0, 0, 0, 0, 0, 0, 0,
886 0, 0, 1, 7, 8, 0, 0, 0, 0, 0,
887 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
888 0, 0, 0, 0, 0, 0, 15, 0, 28, 31,
889 30, 29, 9, 79, 80, 81, 82, 83, 84, 85,
890 86, 87, 88, 89, 90, 0, 0, 0, 0, 0,
891 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
892 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
893 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
894 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
895 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
896 0, 0, 0, 0, 0, 0, 0, 0, 18, 0,
897 2, 3, 0, 0, 0, 164, 163, 0, 0, 20,
898 17, 0, 61, 0, 0, 71, 0, 69, 67, 75,
899 73, 63, 65, 0, 0, 0, 0, 0, 0, 0,
900 59, 77, 0, 25, 160, 0, 0, 0, 0, 0,
901 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
902 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
903 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
904 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
905 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
906 0, 0, 0, 0, 0, 0, 0, 0, 91, 13,
907 11, 10, 14, 12, 33, 58, 38, 39, 40, 37,
908 32, 52, 21, 27, 52, 52, 52, 52, 52, 52,
909 41, 44, 47, 43, 46, 45, 42, 36, 35, 34,
910 58, 52, 26, 0, 112, 110, 100, 101, 102, 103,
911 99, 154, 155, 156, 111, 96, 158, 95, 93, 94,
912 113, 97, 98, 159, 157, 0, 105, 114, 115, 116,
913 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
914 127, 128, 129, 130, 131, 132, 133, 141, 134, 135,
915 136, 137, 138, 139, 140, 23, 106, 107, 148, 149,
916 142, 143, 144, 145, 150, 146, 147, 151, 152, 153,
917 108, 109, 162, 92, 0, 49, 53, 55, 57, 62,
918 0, 51, 72, 0, 70, 68, 76, 74, 64, 66,
919 0, 60, 78, 0, 0, 0, 0, 0, 0, 0,
920 0, 0, 0, 0, 0, 0, 0, 0, 0, 161,
921 0, 0, 0, 0, 50, 0, 22, 48, 0, 0,
922 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
923 0, 0, 0, 0, 0, 165, 104, 24, 0, 56,
924 169, 167, 173, 172, 170, 171, 174, 175, 176, 168,
925 181, 177, 178, 179, 180, 182, 166, 54
926 };
927
928 /* YYPGOTO[NTERM-NUM]. */
929 static const yytype_int16 yypgoto[] =
930 {
931 -258, -258, -258, -258, 132, -258, -258, -258, -258, -225,
932 -209, -258, 267, -258, -258, -258, -258, -258, -258, -231,
933 -181, -228, -258, -109, -258, -258, -258, -258, -258, -258,
934 -258, -258, -258, -258, -258, -257, -258, -258, -258, -258,
935 273, -258, -176, -258, -210
936 };
937
938 /* YYDEFGOTO[NTERM-NUM]. */
939 static const yytype_int16 yydefgoto[] =
940 {
941 -1, 132, 8, 9, 10, 11, 12, 13, 14, 243,
942 316, 46, 47, 48, 259, 49, 239, 50, 253, 341,
943 342, 337, 338, 339, 51, 260, 235, 248, 249, 245,
944 244, 241, 247, 246, 261, 127, 128, 280, 276, 283,
945 129, 263, 137, 369, 370
946 };
947
948 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
949 positive, shift that token. If negative, reduce the rule whose
950 number is the opposite. If YYTABLE_NINF, syntax error. */
951 static const yytype_uint16 yytable[] =
952 {
953 277, 332, 317, 284, 336, 257, 368, 372, 281, 15,
954 275, 282, 417, 135, 136, 330, 331, 53, 54, 55,
955 56, 57, 58, 59, 60, 61, 62, 63, 64, 336,
956 353, 354, 135, 136, 130, 131, 318, 319, 320, 321,
957 322, 323, 278, 325, 326, 16, 17, 1, 2, 3,
958 4, 5, 20, 355, 334, 356, 279, 335, 357, 340,
959 18, 358, 335, 344, 345, 346, 347, 348, 349, 359,
960 236, 360, 361, 25, 6, 26, 7, 27, 19, 362,
961 352, 21, 22, 237, 28, 141, 373, 238, 374, 29,
962 24, 30, 52, 133, 134, 138, 142, 31, 32, 363,
963 139, 140, 143, 364, 365, 366, 367, 33, 144, 145,
964 146, 34, 368, 147, 148, 35, 149, 150, 36, 151,
965 152, 153, 37, 38, 39, 40, 41, 42, 43, 44,
966 45, 154, 164, 155, 156, 157, 158, 159, 160, 258,
967 161, 23, 163, 165, 336, 166, 167, 399, 168, 234,
968 169, 351, 170, 171, 172, 173, 174, 175, 176, 394,
969 177, 178, 179, 180, 398, 181, 182, 183, 415, 53,
970 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
971 64, 65, 184, 240, 185, 66, 186, 67, 187, 188,
972 189, 190, 191, 192, 193, 68, 69, 70, 71, 194,
973 195, 196, 72, 401, 197, 198, 73, 199, 406, 200,
974 242, 74, 75, 201, 76, 77, 202, 203, 204, 205,
975 206, 207, 208, 209, 210, 211, 78, 79, 80, 212,
976 81, 213, 214, 215, 216, 82, 217, 218, 219, 220,
977 221, 222, 223, 224, 83, 84, 85, 86, 87, 88,
978 89, 90, 91, 92, 93, 225, 226, 250, 228, 94,
979 95, 96, 97, 98, 99, 100, 101, 102, 103, 229,
980 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
981 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
982 124, 125, 126, 230, 231, 251, 232, 233, 254, 0,
983 0, 262, 252, 0, 256, 255, 264, 265, 0, 267,
984 266, 268, 269, 162, 271, 270, 272, 273, 274, 285,
985 286, 287, 288, 289, 290, 291, 292, 293, 294, 295,
986 296, 297, 298, 299, 300, 301, 302, 303, 304, 305,
987 306, 307, 308, 309, 310, 311, 312, 313, 314, 315,
988 324, 327, 328, 329, 333, 343, 350, 371, 372, 375,
989 374, 376, 378, 377, 379, 380, 381, 382, 383, 384,
990 385, 386, 387, 388, 389, 390, 391, 392, 393, 0,
991 395, 0, 0, 0, 0, 396, 397, 400, 402, 403,
992 404, 405, 407, 408, 409, 410, 411, 412, 413, 414,
993 416, 227
994 };
995
996 static const yytype_int16 yycheck[] =
997 {
998 176, 226, 211, 179, 235, 1, 263, 127, 60, 128,
999 54, 63, 132, 76, 77, 224, 225, 3, 4, 5,
1000 6, 7, 8, 9, 10, 11, 12, 13, 14, 260,
1001 16, 17, 76, 77, 133, 134, 212, 213, 214, 215,
1002 216, 217, 23, 219, 220, 128, 128, 24, 25, 26,
1003 27, 28, 50, 39, 130, 41, 37, 133, 44, 130,
1004 128, 47, 133, 244, 245, 246, 247, 248, 249, 55,
1005 49, 57, 58, 18, 51, 20, 53, 22, 128, 65,
1006 261, 50, 0, 62, 29, 128, 131, 66, 133, 34,
1007 129, 36, 129, 135, 135, 135, 128, 42, 43, 85,
1008 135, 135, 128, 89, 90, 91, 92, 52, 128, 128,
1009 128, 56, 369, 128, 128, 60, 128, 128, 63, 128,
1010 128, 128, 67, 68, 69, 70, 71, 72, 73, 74,
1011 75, 128, 135, 128, 128, 128, 128, 128, 128, 135,
1012 128, 9, 129, 128, 375, 128, 128, 375, 128, 133,
1013 128, 260, 128, 128, 128, 128, 128, 128, 128, 369,
1014 128, 128, 128, 128, 373, 128, 128, 128, 393, 3,
1015 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
1016 14, 15, 128, 135, 128, 19, 128, 21, 128, 128,
1017 128, 128, 128, 128, 128, 29, 30, 31, 32, 128,
1018 128, 128, 36, 379, 128, 128, 40, 128, 384, 128,
1019 135, 45, 46, 128, 48, 49, 128, 128, 128, 128,
1020 128, 128, 128, 128, 128, 128, 60, 61, 62, 128,
1021 64, 128, 128, 128, 128, 69, 128, 128, 128, 128,
1022 128, 128, 128, 128, 78, 79, 80, 81, 82, 83,
1023 84, 85, 86, 87, 88, 128, 128, 135, 129, 93,
1024 94, 95, 96, 97, 98, 99, 100, 101, 102, 129,
1025 104, 105, 106, 107, 108, 109, 110, 111, 112, 113,
1026 114, 115, 116, 117, 118, 119, 120, 121, 122, 123,
1027 124, 125, 126, 129, 129, 135, 129, 129, 135, -1,
1028 -1, 129, 133, -1, 133, 135, 133, 133, -1, 133,
1029 135, 133, 133, 46, 133, 135, 133, 133, 133, 133,
1030 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
1031 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
1032 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
1033 133, 133, 133, 133, 129, 127, 127, 133, 127, 127,
1034 133, 135, 128, 133, 128, 128, 128, 128, 128, 128,
1035 128, 128, 128, 128, 128, 128, 128, 128, 128, -1,
1036 129, -1, -1, -1, -1, 133, 133, 133, 133, 133,
1037 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
1038 129, 128
1039 };
1040
1041 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
1042 symbol of state STATE-NUM. */
1043 static const yytype_uint8 yystos[] =
1044 {
1045 0, 24, 25, 26, 27, 28, 51, 53, 138, 139,
1046 140, 141, 142, 143, 144, 128, 128, 128, 128, 128,
1047 50, 50, 0, 140, 129, 18, 20, 22, 29, 34,
1048 36, 42, 43, 52, 56, 60, 63, 67, 68, 69,
1049 70, 71, 72, 73, 74, 75, 147, 148, 149, 151,
1050 153, 160, 129, 3, 4, 5, 6, 7, 8, 9,
1051 10, 11, 12, 13, 14, 15, 19, 21, 29, 30,
1052 31, 32, 36, 40, 45, 46, 48, 49, 60, 61,
1053 62, 64, 69, 78, 79, 80, 81, 82, 83, 84,
1054 85, 86, 87, 88, 93, 94, 95, 96, 97, 98,
1055 99, 100, 101, 102, 104, 105, 106, 107, 108, 109,
1056 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
1057 120, 121, 122, 123, 124, 125, 126, 171, 172, 176,
1058 133, 134, 137, 135, 135, 76, 77, 178, 135, 135,
1059 135, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1060 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1061 128, 128, 148, 129, 135, 128, 128, 128, 128, 128,
1062 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1063 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1064 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1065 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1066 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1067 128, 128, 128, 128, 128, 128, 128, 176, 129, 129,
1068 129, 129, 129, 129, 133, 162, 49, 62, 66, 152,
1069 135, 167, 135, 145, 166, 165, 169, 168, 163, 164,
1070 135, 135, 133, 154, 135, 135, 133, 1, 135, 150,
1071 161, 170, 129, 177, 133, 133, 135, 133, 133, 133,
1072 135, 133, 133, 133, 133, 54, 174, 178, 23, 37,
1073 173, 60, 63, 175, 178, 133, 133, 133, 133, 133,
1074 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
1075 133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
1076 133, 133, 133, 133, 133, 133, 146, 146, 178, 178,
1077 178, 178, 178, 178, 133, 178, 178, 133, 133, 133,
1078 146, 146, 145, 129, 130, 133, 155, 157, 158, 159,
1079 130, 155, 156, 127, 156, 156, 156, 156, 156, 156,
1080 127, 159, 156, 16, 17, 39, 41, 44, 47, 55,
1081 57, 58, 65, 85, 89, 90, 91, 92, 171, 179,
1082 180, 133, 127, 131, 133, 127, 135, 133, 128, 128,
1083 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
1084 128, 128, 128, 128, 180, 129, 133, 133, 146, 157,
1085 133, 178, 133, 133, 133, 133, 178, 133, 133, 133,
1086 133, 133, 133, 133, 133, 145, 129, 132
1087 };
1088
1089 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
1090 static const yytype_uint8 yyr1[] =
1091 {
1092 0, 136, 137, 137, 138, 138, 139, 139, 140, 140,
1093 140, 140, 140, 140, 140, 141, 142, 142, 143, 144,
1094 144, 145, 145, 146, 146, 147, 147, 148, 148, 148,
1095 148, 148, 148, 148, 149, 150, 150, 151, 152, 152,
1096 152, 153, 153, 153, 153, 153, 153, 154, 154, 155,
1097 155, 156, 156, 157, 157, 158, 158, 159, 159, 161,
1098 160, 162, 160, 163, 160, 164, 160, 165, 160, 166,
1099 160, 167, 160, 168, 160, 169, 160, 170, 160, 171,
1100 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
1101 171, 172, 172, 173, 173, 174, 174, 175, 175, 176,
1102 176, 176, 176, 176, 176, 176, 176, 176, 176, 176,
1103 176, 176, 176, 176, 176, 176, 176, 176, 176, 176,
1104 176, 176, 176, 176, 176, 176, 176, 176, 176, 176,
1105 176, 176, 176, 176, 176, 176, 176, 176, 176, 176,
1106 176, 176, 176, 176, 176, 176, 176, 176, 176, 176,
1107 176, 176, 176, 176, 176, 176, 176, 176, 176, 176,
1108 177, 176, 176, 178, 178, 179, 179, 180, 180, 180,
1109 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
1110 180, 180, 180
1111 };
1112
1113 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
1114 static const yytype_uint8 yyr2[] =
1115 {
1116 0, 2, 1, 1, 0, 1, 1, 2, 2, 2,
1117 4, 4, 4, 4, 4, 2, 1, 3, 2, 1,
1118 3, 1, 3, 1, 3, 2, 3, 3, 1, 1,
1119 1, 1, 3, 3, 3, 1, 1, 3, 1, 1,
1120 1, 3, 3, 3, 3, 3, 3, 1, 3, 1,
1121 2, 1, 0, 1, 4, 1, 3, 1, 0, 0,
1122 4, 0, 4, 0, 4, 0, 4, 0, 4, 0,
1123 4, 0, 4, 0, 4, 0, 4, 0, 4, 1,
1124 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1125 1, 2, 3, 1, 1, 1, 1, 1, 1, 3,
1126 3, 3, 3, 3, 5, 3, 3, 3, 3, 3,
1127 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
1128 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
1129 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
1130 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
1131 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
1132 0, 4, 3, 1, 1, 2, 3, 3, 3, 3,
1133 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
1134 3, 3, 3
1135 };
1136
1137
1138 #define yyerrok (yyerrstatus = 0)
1139 #define yyclearin (yychar = YYEMPTY)
1140 #define YYEMPTY (-2)
1141 #define YYEOF 0
1142
1143 #define YYACCEPT goto yyacceptlab
1144 #define YYABORT goto yyabortlab
1145 #define YYERROR goto yyerrorlab
1146
1147
1148 #define YYRECOVERING() (!!yyerrstatus)
1149
1150 #define YYBACKUP(Token, Value) \
1151 do \
1152 if (yychar == YYEMPTY) \
1153 { \
1154 yychar = (Token); \
1155 yylval = (Value); \
1156 YYPOPSTACK (yylen); \
1157 yystate = *yyssp; \
1158 goto yybackup; \
1159 } \
1160 else \
1161 { \
1162 yyerror (YY_("syntax error: cannot back up")); \
1163 YYERROR; \
1164 } \
1165 while (0)
1166
1167 /* Error token number */
1168 #define YYTERROR 1
1169 #define YYERRCODE 256
1170
1171
1172
1173 /* Enable debugging if requested. */
1174 #if YYDEBUG
1175
1176 # ifndef YYFPRINTF
1177 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
1178 # define YYFPRINTF fprintf
1179 # endif
1180
1181 # define YYDPRINTF(Args) \
1182 do { \
1183 if (yydebug) \
1184 YYFPRINTF Args; \
1185 } while (0)
1186
1187 /* This macro is provided for backward compatibility. */
1188 #ifndef YY_LOCATION_PRINT
1189 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1190 #endif
1191
1192
1193 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1194 do { \
1195 if (yydebug) \
1196 { \
1197 YYFPRINTF (stderr, "%s ", Title); \
1198 yy_symbol_print (stderr, \
1199 Type, Value); \
1200 YYFPRINTF (stderr, "\n"); \
1201 } \
1202 } while (0)
1203
1204
1205 /*----------------------------------------.
1206 | Print this symbol's value on YYOUTPUT. |
1207 `----------------------------------------*/
1208
1209 static void
yy_symbol_value_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)1210 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1211 {
1212 FILE *yyo = yyoutput;
1213 YYUSE (yyo);
1214 if (!yyvaluep)
1215 return;
1216 # ifdef YYPRINT
1217 if (yytype < YYNTOKENS)
1218 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
1219 # endif
1220 YYUSE (yytype);
1221 }
1222
1223
1224 /*--------------------------------.
1225 | Print this symbol on YYOUTPUT. |
1226 `--------------------------------*/
1227
1228 static void
yy_symbol_print(FILE * yyoutput,int yytype,YYSTYPE const * const yyvaluep)1229 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
1230 {
1231 YYFPRINTF (yyoutput, "%s %s (",
1232 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
1233
1234 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
1235 YYFPRINTF (yyoutput, ")");
1236 }
1237
1238 /*------------------------------------------------------------------.
1239 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1240 | TOP (included). |
1241 `------------------------------------------------------------------*/
1242
1243 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)1244 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
1245 {
1246 YYFPRINTF (stderr, "Stack now");
1247 for (; yybottom <= yytop; yybottom++)
1248 {
1249 int yybot = *yybottom;
1250 YYFPRINTF (stderr, " %d", yybot);
1251 }
1252 YYFPRINTF (stderr, "\n");
1253 }
1254
1255 # define YY_STACK_PRINT(Bottom, Top) \
1256 do { \
1257 if (yydebug) \
1258 yy_stack_print ((Bottom), (Top)); \
1259 } while (0)
1260
1261
1262 /*------------------------------------------------.
1263 | Report that the YYRULE is going to be reduced. |
1264 `------------------------------------------------*/
1265
1266 static void
yy_reduce_print(yytype_int16 * yyssp,YYSTYPE * yyvsp,int yyrule)1267 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
1268 {
1269 unsigned long int yylno = yyrline[yyrule];
1270 int yynrhs = yyr2[yyrule];
1271 int yyi;
1272 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
1273 yyrule - 1, yylno);
1274 /* The symbols being reduced. */
1275 for (yyi = 0; yyi < yynrhs; yyi++)
1276 {
1277 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1278 yy_symbol_print (stderr,
1279 yystos[yyssp[yyi + 1 - yynrhs]],
1280 &(yyvsp[(yyi + 1) - (yynrhs)])
1281 );
1282 YYFPRINTF (stderr, "\n");
1283 }
1284 }
1285
1286 # define YY_REDUCE_PRINT(Rule) \
1287 do { \
1288 if (yydebug) \
1289 yy_reduce_print (yyssp, yyvsp, Rule); \
1290 } while (0)
1291
1292 /* Nonzero means print parse trace. It is left uninitialized so that
1293 multiple parsers can coexist. */
1294 int yydebug;
1295 #else /* !YYDEBUG */
1296 # define YYDPRINTF(Args)
1297 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1298 # define YY_STACK_PRINT(Bottom, Top)
1299 # define YY_REDUCE_PRINT(Rule)
1300 #endif /* !YYDEBUG */
1301
1302
1303 /* YYINITDEPTH -- initial size of the parser's stacks. */
1304 #ifndef YYINITDEPTH
1305 # define YYINITDEPTH 200
1306 #endif
1307
1308 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1309 if the built-in stack extension method is used).
1310
1311 Do not make this value too large; the results are undefined if
1312 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1313 evaluated with infinite-precision integer arithmetic. */
1314
1315 #ifndef YYMAXDEPTH
1316 # define YYMAXDEPTH 10000
1317 #endif
1318
1319
1320 #if YYERROR_VERBOSE
1321
1322 # ifndef yystrlen
1323 # if defined __GLIBC__ && defined _STRING_H
1324 # define yystrlen strlen
1325 # else
1326 /* Return the length of YYSTR. */
1327 static YYSIZE_T
yystrlen(const char * yystr)1328 yystrlen (const char *yystr)
1329 {
1330 YYSIZE_T yylen;
1331 for (yylen = 0; yystr[yylen]; yylen++)
1332 continue;
1333 return yylen;
1334 }
1335 # endif
1336 # endif
1337
1338 # ifndef yystpcpy
1339 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1340 # define yystpcpy stpcpy
1341 # else
1342 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1343 YYDEST. */
1344 static char *
yystpcpy(char * yydest,const char * yysrc)1345 yystpcpy (char *yydest, const char *yysrc)
1346 {
1347 char *yyd = yydest;
1348 const char *yys = yysrc;
1349
1350 while ((*yyd++ = *yys++) != '\0')
1351 continue;
1352
1353 return yyd - 1;
1354 }
1355 # endif
1356 # endif
1357
1358 # ifndef yytnamerr
1359 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1360 quotes and backslashes, so that it's suitable for yyerror. The
1361 heuristic is that double-quoting is unnecessary unless the string
1362 contains an apostrophe, a comma, or backslash (other than
1363 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1364 null, do not copy; instead, return the length of what the result
1365 would have been. */
1366 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)1367 yytnamerr (char *yyres, const char *yystr)
1368 {
1369 if (*yystr == '"')
1370 {
1371 YYSIZE_T yyn = 0;
1372 char const *yyp = yystr;
1373
1374 for (;;)
1375 switch (*++yyp)
1376 {
1377 case '\'':
1378 case ',':
1379 goto do_not_strip_quotes;
1380
1381 case '\\':
1382 if (*++yyp != '\\')
1383 goto do_not_strip_quotes;
1384 /* Fall through. */
1385 default:
1386 if (yyres)
1387 yyres[yyn] = *yyp;
1388 yyn++;
1389 break;
1390
1391 case '"':
1392 if (yyres)
1393 yyres[yyn] = '\0';
1394 return yyn;
1395 }
1396 do_not_strip_quotes: ;
1397 }
1398
1399 if (! yyres)
1400 return yystrlen (yystr);
1401
1402 return yystpcpy (yyres, yystr) - yyres;
1403 }
1404 # endif
1405
1406 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1407 about the unexpected token YYTOKEN for the state stack whose top is
1408 YYSSP.
1409
1410 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1411 not large enough to hold the message. In that case, also set
1412 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1413 required number of bytes is too large to store. */
1414 static int
yysyntax_error(YYSIZE_T * yymsg_alloc,char ** yymsg,yytype_int16 * yyssp,int yytoken)1415 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1416 yytype_int16 *yyssp, int yytoken)
1417 {
1418 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1419 YYSIZE_T yysize = yysize0;
1420 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1421 /* Internationalized format string. */
1422 const char *yyformat = YY_NULLPTR;
1423 /* Arguments of yyformat. */
1424 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1425 /* Number of reported tokens (one for the "unexpected", one per
1426 "expected"). */
1427 int yycount = 0;
1428
1429 /* There are many possibilities here to consider:
1430 - If this state is a consistent state with a default action, then
1431 the only way this function was invoked is if the default action
1432 is an error action. In that case, don't check for expected
1433 tokens because there are none.
1434 - The only way there can be no lookahead present (in yychar) is if
1435 this state is a consistent state with a default action. Thus,
1436 detecting the absence of a lookahead is sufficient to determine
1437 that there is no unexpected or expected token to report. In that
1438 case, just report a simple "syntax error".
1439 - Don't assume there isn't a lookahead just because this state is a
1440 consistent state with a default action. There might have been a
1441 previous inconsistent state, consistent state with a non-default
1442 action, or user semantic action that manipulated yychar.
1443 - Of course, the expected token list depends on states to have
1444 correct lookahead information, and it depends on the parser not
1445 to perform extra reductions after fetching a lookahead from the
1446 scanner and before detecting a syntax error. Thus, state merging
1447 (from LALR or IELR) and default reductions corrupt the expected
1448 token list. However, the list is correct for canonical LR with
1449 one exception: it will still contain any token that will not be
1450 accepted due to an error action in a later state.
1451 */
1452 if (yytoken != YYEMPTY)
1453 {
1454 int yyn = yypact[*yyssp];
1455 yyarg[yycount++] = yytname[yytoken];
1456 if (!yypact_value_is_default (yyn))
1457 {
1458 /* Start YYX at -YYN if negative to avoid negative indexes in
1459 YYCHECK. In other words, skip the first -YYN actions for
1460 this state because they are default actions. */
1461 int yyxbegin = yyn < 0 ? -yyn : 0;
1462 /* Stay within bounds of both yycheck and yytname. */
1463 int yychecklim = YYLAST - yyn + 1;
1464 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1465 int yyx;
1466
1467 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1468 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1469 && !yytable_value_is_error (yytable[yyx + yyn]))
1470 {
1471 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1472 {
1473 yycount = 1;
1474 yysize = yysize0;
1475 break;
1476 }
1477 yyarg[yycount++] = yytname[yyx];
1478 {
1479 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1480 if (! (yysize <= yysize1
1481 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1482 return 2;
1483 yysize = yysize1;
1484 }
1485 }
1486 }
1487 }
1488
1489 switch (yycount)
1490 {
1491 # define YYCASE_(N, S) \
1492 case N: \
1493 yyformat = S; \
1494 break
1495 YYCASE_(0, YY_("syntax error"));
1496 YYCASE_(1, YY_("syntax error, unexpected %s"));
1497 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1498 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1499 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1500 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1501 # undef YYCASE_
1502 }
1503
1504 {
1505 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1506 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1507 return 2;
1508 yysize = yysize1;
1509 }
1510
1511 if (*yymsg_alloc < yysize)
1512 {
1513 *yymsg_alloc = 2 * yysize;
1514 if (! (yysize <= *yymsg_alloc
1515 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1516 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1517 return 1;
1518 }
1519
1520 /* Avoid sprintf, as that infringes on the user's name space.
1521 Don't have undefined behavior even if the translation
1522 produced a string with the wrong number of "%s"s. */
1523 {
1524 char *yyp = *yymsg;
1525 int yyi = 0;
1526 while ((*yyp = *yyformat) != '\0')
1527 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1528 {
1529 yyp += yytnamerr (yyp, yyarg[yyi++]);
1530 yyformat += 2;
1531 }
1532 else
1533 {
1534 yyp++;
1535 yyformat++;
1536 }
1537 }
1538 return 0;
1539 }
1540 #endif /* YYERROR_VERBOSE */
1541
1542 /*-----------------------------------------------.
1543 | Release the memory associated to this symbol. |
1544 `-----------------------------------------------*/
1545
1546 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep)1547 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1548 {
1549 YYUSE (yyvaluep);
1550 if (!yymsg)
1551 yymsg = "Deleting";
1552 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1553
1554 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1555 YYUSE (yytype);
1556 YY_IGNORE_MAYBE_UNINITIALIZED_END
1557 }
1558
1559
1560
1561
1562 /* The lookahead symbol. */
1563 int yychar;
1564
1565 /* The semantic value of the lookahead symbol. */
1566 YYSTYPE yylval;
1567 /* Number of syntax errors so far. */
1568 int yynerrs;
1569
1570
1571 /*----------.
1572 | yyparse. |
1573 `----------*/
1574
1575 int
yyparse(void)1576 yyparse (void)
1577 {
1578 int yystate;
1579 /* Number of tokens to shift before error messages enabled. */
1580 int yyerrstatus;
1581
1582 /* The stacks and their tools:
1583 'yyss': related to states.
1584 'yyvs': related to semantic values.
1585
1586 Refer to the stacks through separate pointers, to allow yyoverflow
1587 to reallocate them elsewhere. */
1588
1589 /* The state stack. */
1590 yytype_int16 yyssa[YYINITDEPTH];
1591 yytype_int16 *yyss;
1592 yytype_int16 *yyssp;
1593
1594 /* The semantic value stack. */
1595 YYSTYPE yyvsa[YYINITDEPTH];
1596 YYSTYPE *yyvs;
1597 YYSTYPE *yyvsp;
1598
1599 YYSIZE_T yystacksize;
1600
1601 int yyn;
1602 int yyresult;
1603 /* Lookahead token as an internal (translated) token number. */
1604 int yytoken = 0;
1605 /* The variables used to return semantic value and location from the
1606 action routines. */
1607 YYSTYPE yyval;
1608
1609 #if YYERROR_VERBOSE
1610 /* Buffer for error messages, and its allocated size. */
1611 char yymsgbuf[128];
1612 char *yymsg = yymsgbuf;
1613 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1614 #endif
1615
1616 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1617
1618 /* The number of symbols on the RHS of the reduced rule.
1619 Keep to zero when no symbol should be popped. */
1620 int yylen = 0;
1621
1622 yyssp = yyss = yyssa;
1623 yyvsp = yyvs = yyvsa;
1624 yystacksize = YYINITDEPTH;
1625
1626 YYDPRINTF ((stderr, "Starting parse\n"));
1627
1628 yystate = 0;
1629 yyerrstatus = 0;
1630 yynerrs = 0;
1631 yychar = YYEMPTY; /* Cause a token to be read. */
1632 goto yysetstate;
1633
1634 /*------------------------------------------------------------.
1635 | yynewstate -- Push a new state, which is found in yystate. |
1636 `------------------------------------------------------------*/
1637 yynewstate:
1638 /* In all cases, when you get here, the value and location stacks
1639 have just been pushed. So pushing a state here evens the stacks. */
1640 yyssp++;
1641
1642 yysetstate:
1643 *yyssp = yystate;
1644
1645 if (yyss + yystacksize - 1 <= yyssp)
1646 {
1647 /* Get the current used size of the three stacks, in elements. */
1648 YYSIZE_T yysize = yyssp - yyss + 1;
1649
1650 #ifdef yyoverflow
1651 {
1652 /* Give user a chance to reallocate the stack. Use copies of
1653 these so that the &'s don't force the real ones into
1654 memory. */
1655 YYSTYPE *yyvs1 = yyvs;
1656 yytype_int16 *yyss1 = yyss;
1657
1658 /* Each stack pointer address is followed by the size of the
1659 data in use in that stack, in bytes. This used to be a
1660 conditional around just the two extra args, but that might
1661 be undefined if yyoverflow is a macro. */
1662 yyoverflow (YY_("memory exhausted"),
1663 &yyss1, yysize * sizeof (*yyssp),
1664 &yyvs1, yysize * sizeof (*yyvsp),
1665 &yystacksize);
1666
1667 yyss = yyss1;
1668 yyvs = yyvs1;
1669 }
1670 #else /* no yyoverflow */
1671 # ifndef YYSTACK_RELOCATE
1672 goto yyexhaustedlab;
1673 # else
1674 /* Extend the stack our own way. */
1675 if (YYMAXDEPTH <= yystacksize)
1676 goto yyexhaustedlab;
1677 yystacksize *= 2;
1678 if (YYMAXDEPTH < yystacksize)
1679 yystacksize = YYMAXDEPTH;
1680
1681 {
1682 yytype_int16 *yyss1 = yyss;
1683 union yyalloc *yyptr =
1684 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1685 if (! yyptr)
1686 goto yyexhaustedlab;
1687 YYSTACK_RELOCATE (yyss_alloc, yyss);
1688 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1689 # undef YYSTACK_RELOCATE
1690 if (yyss1 != yyssa)
1691 YYSTACK_FREE (yyss1);
1692 }
1693 # endif
1694 #endif /* no yyoverflow */
1695
1696 yyssp = yyss + yysize - 1;
1697 yyvsp = yyvs + yysize - 1;
1698
1699 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1700 (unsigned long int) yystacksize));
1701
1702 if (yyss + yystacksize - 1 <= yyssp)
1703 YYABORT;
1704 }
1705
1706 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1707
1708 if (yystate == YYFINAL)
1709 YYACCEPT;
1710
1711 goto yybackup;
1712
1713 /*-----------.
1714 | yybackup. |
1715 `-----------*/
1716 yybackup:
1717
1718 /* Do appropriate processing given the current state. Read a
1719 lookahead token if we need one and don't already have one. */
1720
1721 /* First try to decide what to do without reference to lookahead token. */
1722 yyn = yypact[yystate];
1723 if (yypact_value_is_default (yyn))
1724 goto yydefault;
1725
1726 /* Not known => get a lookahead token if don't already have one. */
1727
1728 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1729 if (yychar == YYEMPTY)
1730 {
1731 YYDPRINTF ((stderr, "Reading a token: "));
1732 yychar = yylex ();
1733 }
1734
1735 if (yychar <= YYEOF)
1736 {
1737 yychar = yytoken = YYEOF;
1738 YYDPRINTF ((stderr, "Now at end of input.\n"));
1739 }
1740 else
1741 {
1742 yytoken = YYTRANSLATE (yychar);
1743 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1744 }
1745
1746 /* If the proper action on seeing token YYTOKEN is to reduce or to
1747 detect an error, take that action. */
1748 yyn += yytoken;
1749 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1750 goto yydefault;
1751 yyn = yytable[yyn];
1752 if (yyn <= 0)
1753 {
1754 if (yytable_value_is_error (yyn))
1755 goto yyerrlab;
1756 yyn = -yyn;
1757 goto yyreduce;
1758 }
1759
1760 /* Count tokens shifted since error; after three, turn off error
1761 status. */
1762 if (yyerrstatus)
1763 yyerrstatus--;
1764
1765 /* Shift the lookahead token. */
1766 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1767
1768 /* Discard the shifted token. */
1769 yychar = YYEMPTY;
1770
1771 yystate = yyn;
1772 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1773 *++yyvsp = yylval;
1774 YY_IGNORE_MAYBE_UNINITIALIZED_END
1775
1776 goto yynewstate;
1777
1778
1779 /*-----------------------------------------------------------.
1780 | yydefault -- do the default action for the current state. |
1781 `-----------------------------------------------------------*/
1782 yydefault:
1783 yyn = yydefact[yystate];
1784 if (yyn == 0)
1785 goto yyerrlab;
1786 goto yyreduce;
1787
1788
1789 /*-----------------------------.
1790 | yyreduce -- Do a reduction. |
1791 `-----------------------------*/
1792 yyreduce:
1793 /* yyn is the number of a rule to reduce with. */
1794 yylen = yyr2[yyn];
1795
1796 /* If YYLEN is nonzero, implement the default value of the action:
1797 '$$ = $1'.
1798
1799 Otherwise, the following line sets YYVAL to garbage.
1800 This behavior is undocumented and Bison
1801 users should not rely upon it. Assigning to YYVAL
1802 unconditionally makes the parser a bit smaller, and it avoids a
1803 GCC warning that YYVAL may be used uninitialized. */
1804 yyval = yyvsp[1-yylen];
1805
1806
1807 YY_REDUCE_PRINT (yyn);
1808 switch (yyn)
1809 {
1810 case 2:
1811 #line 211 "config_gram.y" /* yacc.c:1646 */
1812 {
1813 (yyval) = (yyvsp[0]);
1814 /* convert value to real */
1815 (yyval)->value.number_real = (yyval)->value.number;
1816 (yyval)->value.type = V_NUM_REAL;
1817 }
1818 #line 1819 "config_gram.c" /* yacc.c:1646 */
1819 break;
1820
1821 case 3:
1822 #line 217 "config_gram.y" /* yacc.c:1646 */
1823 {
1824 (yyval) = (yyvsp[0]);
1825 }
1826 #line 1827 "config_gram.c" /* yacc.c:1646 */
1827 break;
1828
1829 case 10:
1830 #line 236 "config_gram.y" /* yacc.c:1646 */
1831 {
1832 strncpy(default_programmer, (yyvsp[-1])->value.string, MAX_STR_CONST);
1833 default_programmer[MAX_STR_CONST-1] = 0;
1834 free_token((yyvsp[-1]));
1835 }
1836 #line 1837 "config_gram.c" /* yacc.c:1646 */
1837 break;
1838
1839 case 11:
1840 #line 242 "config_gram.y" /* yacc.c:1646 */
1841 {
1842 strncpy(default_parallel, (yyvsp[-1])->value.string, PATH_MAX);
1843 default_parallel[PATH_MAX-1] = 0;
1844 free_token((yyvsp[-1]));
1845 }
1846 #line 1847 "config_gram.c" /* yacc.c:1646 */
1847 break;
1848
1849 case 12:
1850 #line 248 "config_gram.y" /* yacc.c:1646 */
1851 {
1852 strncpy(default_serial, (yyvsp[-1])->value.string, PATH_MAX);
1853 default_serial[PATH_MAX-1] = 0;
1854 free_token((yyvsp[-1]));
1855 }
1856 #line 1857 "config_gram.c" /* yacc.c:1646 */
1857 break;
1858
1859 case 13:
1860 #line 254 "config_gram.y" /* yacc.c:1646 */
1861 {
1862 default_bitclock = (yyvsp[-1])->value.number_real;
1863 free_token((yyvsp[-1]));
1864 }
1865 #line 1866 "config_gram.c" /* yacc.c:1646 */
1866 break;
1867
1868 case 14:
1869 #line 259 "config_gram.y" /* yacc.c:1646 */
1870 {
1871 if ((yyvsp[-1])->primary == K_YES)
1872 default_safemode = 1;
1873 else if ((yyvsp[-1])->primary == K_NO)
1874 default_safemode = 0;
1875 free_token((yyvsp[-1]));
1876 }
1877 #line 1878 "config_gram.c" /* yacc.c:1646 */
1878 break;
1879
1880 case 15:
1881 #line 271 "config_gram.y" /* yacc.c:1646 */
1882 {
1883 PROGRAMMER * existing_prog;
1884 char * id;
1885 if (lsize(current_prog->id) == 0) {
1886 yyerror("required parameter id not specified");
1887 YYABORT;
1888 }
1889 if (current_prog->initpgm == NULL) {
1890 yyerror("programmer type not specified");
1891 YYABORT;
1892 }
1893 id = ldata(lfirst(current_prog->id));
1894 existing_prog = locate_programmer(programmers, id);
1895 if (existing_prog) {
1896 { /* temporarly set lineno to lineno of programmer start */
1897 int temp = lineno; lineno = current_prog->lineno;
1898 yywarning("programmer %s overwrites previous definition %s:%d.",
1899 id, existing_prog->config_file, existing_prog->lineno);
1900 lineno = temp;
1901 }
1902 lrmv_d(programmers, existing_prog);
1903 pgm_free(existing_prog);
1904 }
1905 PUSH(programmers, current_prog);
1906 // pgm_fill_old_pins(current_prog); // TODO to be removed if old pin data no longer needed
1907 // pgm_display_generic(current_prog, id);
1908 current_prog = NULL;
1909 }
1910 #line 1911 "config_gram.c" /* yacc.c:1646 */
1911 break;
1912
1913 case 16:
1914 #line 304 "config_gram.y" /* yacc.c:1646 */
1915 { current_prog = pgm_new();
1916 if (current_prog == NULL) {
1917 yyerror("could not create pgm instance");
1918 YYABORT;
1919 }
1920 strcpy(current_prog->config_file, infile);
1921 current_prog->lineno = lineno;
1922 }
1923 #line 1924 "config_gram.c" /* yacc.c:1646 */
1924 break;
1925
1926 case 17:
1927 #line 314 "config_gram.y" /* yacc.c:1646 */
1928 {
1929 struct programmer_t * pgm = locate_programmer(programmers, (yyvsp[0])->value.string);
1930 if (pgm == NULL) {
1931 yyerror("parent programmer %s not found", (yyvsp[0])->value.string);
1932 free_token((yyvsp[0]));
1933 YYABORT;
1934 }
1935 current_prog = pgm_dup(pgm);
1936 if (current_prog == NULL) {
1937 yyerror("could not duplicate pgm instance");
1938 free_token((yyvsp[0]));
1939 YYABORT;
1940 }
1941 strcpy(current_prog->config_file, infile);
1942 current_prog->lineno = lineno;
1943 free_token((yyvsp[0]));
1944 }
1945 #line 1946 "config_gram.c" /* yacc.c:1646 */
1946 break;
1947
1948 case 18:
1949 #line 336 "config_gram.y" /* yacc.c:1646 */
1950 {
1951 LNODEID ln;
1952 AVRMEM * m;
1953 AVRPART * existing_part;
1954
1955 if (current_part->id[0] == 0) {
1956 yyerror("required parameter id not specified");
1957 YYABORT;
1958 }
1959
1960 /*
1961 * perform some sanity checking, and compute the number of bits
1962 * to shift a page for constructing the page address for
1963 * page-addressed memories.
1964 */
1965 for (ln=lfirst(current_part->mem); ln; ln=lnext(ln)) {
1966 m = ldata(ln);
1967 if (m->paged) {
1968 if (m->page_size == 0) {
1969 yyerror("must specify page_size for paged memory");
1970 YYABORT;
1971 }
1972 if (m->num_pages == 0) {
1973 yyerror("must specify num_pages for paged memory");
1974 YYABORT;
1975 }
1976 if (m->size != m->page_size * m->num_pages) {
1977 yyerror("page size (%u) * num_pages (%u) = "
1978 "%u does not match memory size (%u)",
1979 m->page_size,
1980 m->num_pages,
1981 m->page_size * m->num_pages,
1982 m->size);
1983 YYABORT;
1984 }
1985
1986 }
1987 }
1988
1989 existing_part = locate_part(part_list, current_part->id);
1990 if (existing_part) {
1991 { /* temporarly set lineno to lineno of part start */
1992 int temp = lineno; lineno = current_part->lineno;
1993 yywarning("part %s overwrites previous definition %s:%d.",
1994 current_part->id,
1995 existing_part->config_file, existing_part->lineno);
1996 lineno = temp;
1997 }
1998 lrmv_d(part_list, existing_part);
1999 avr_free_part(existing_part);
2000 }
2001 PUSH(part_list, current_part);
2002 current_part = NULL;
2003 }
2004 #line 2005 "config_gram.c" /* yacc.c:1646 */
2005 break;
2006
2007 case 19:
2008 #line 394 "config_gram.y" /* yacc.c:1646 */
2009 {
2010 current_part = avr_new_part();
2011 if (current_part == NULL) {
2012 yyerror("could not create part instance");
2013 YYABORT;
2014 }
2015 strcpy(current_part->config_file, infile);
2016 current_part->lineno = lineno;
2017 }
2018 #line 2019 "config_gram.c" /* yacc.c:1646 */
2019 break;
2020
2021 case 20:
2022 #line 404 "config_gram.y" /* yacc.c:1646 */
2023 {
2024 AVRPART * parent_part = locate_part(part_list, (yyvsp[0])->value.string);
2025 if (parent_part == NULL) {
2026 yyerror("can't find parent part");
2027 free_token((yyvsp[0]));
2028 YYABORT;
2029 }
2030
2031 current_part = avr_dup_part(parent_part);
2032 if (current_part == NULL) {
2033 yyerror("could not duplicate part instance");
2034 free_token((yyvsp[0]));
2035 YYABORT;
2036 }
2037 strcpy(current_part->config_file, infile);
2038 current_part->lineno = lineno;
2039
2040 free_token((yyvsp[0]));
2041 }
2042 #line 2043 "config_gram.c" /* yacc.c:1646 */
2043 break;
2044
2045 case 21:
2046 #line 426 "config_gram.y" /* yacc.c:1646 */
2047 { ladd(string_list, (yyvsp[0])); }
2048 #line 2049 "config_gram.c" /* yacc.c:1646 */
2049 break;
2050
2051 case 22:
2052 #line 427 "config_gram.y" /* yacc.c:1646 */
2053 { ladd(string_list, (yyvsp[0])); }
2054 #line 2055 "config_gram.c" /* yacc.c:1646 */
2055 break;
2056
2057 case 23:
2058 #line 432 "config_gram.y" /* yacc.c:1646 */
2059 { ladd(number_list, (yyvsp[0])); }
2060 #line 2061 "config_gram.c" /* yacc.c:1646 */
2061 break;
2062
2063 case 24:
2064 #line 433 "config_gram.y" /* yacc.c:1646 */
2065 { ladd(number_list, (yyvsp[0])); }
2066 #line 2067 "config_gram.c" /* yacc.c:1646 */
2067 break;
2068
2069 case 27:
2070 #line 442 "config_gram.y" /* yacc.c:1646 */
2071 {
2072 {
2073 TOKEN * t;
2074 char *s;
2075 int do_yyabort = 0;
2076 while (lsize(string_list)) {
2077 t = lrmv_n(string_list, 1);
2078 if (!do_yyabort) {
2079 s = dup_string(t->value.string);
2080 if (s == NULL) {
2081 do_yyabort = 1;
2082 } else {
2083 ladd(current_prog->id, s);
2084 }
2085 }
2086 /* if do_yyabort == 1 just make the list empty */
2087 free_token(t);
2088 }
2089 if (do_yyabort) {
2090 YYABORT;
2091 }
2092 }
2093 }
2094 #line 2095 "config_gram.c" /* yacc.c:1646 */
2095 break;
2096
2097 case 32:
2098 #line 473 "config_gram.y" /* yacc.c:1646 */
2099 {
2100 strncpy(current_prog->desc, (yyvsp[0])->value.string, PGM_DESCLEN);
2101 current_prog->desc[PGM_DESCLEN-1] = 0;
2102 free_token((yyvsp[0]));
2103 }
2104 #line 2105 "config_gram.c" /* yacc.c:1646 */
2105 break;
2106
2107 case 33:
2108 #line 478 "config_gram.y" /* yacc.c:1646 */
2109 {
2110 {
2111 current_prog->baudrate = (yyvsp[0])->value.number;
2112 free_token((yyvsp[0]));
2113 }
2114 }
2115 #line 2116 "config_gram.c" /* yacc.c:1646 */
2116 break;
2117
2118 case 35:
2119 #line 491 "config_gram.y" /* yacc.c:1646 */
2120 {
2121 const struct programmer_type_t * pgm_type = locate_programmer_type((yyvsp[0])->value.string);
2122 if (pgm_type == NULL) {
2123 yyerror("programmer type %s not found", (yyvsp[0])->value.string);
2124 free_token((yyvsp[0]));
2125 YYABORT;
2126 }
2127 current_prog->initpgm = pgm_type->initpgm;
2128 free_token((yyvsp[0]));
2129 }
2130 #line 2131 "config_gram.c" /* yacc.c:1646 */
2131 break;
2132
2133 case 36:
2134 #line 502 "config_gram.y" /* yacc.c:1646 */
2135 {
2136 yyerror("programmer type must be written as \"id_type\"");
2137 YYABORT;
2138 }
2139 #line 2140 "config_gram.c" /* yacc.c:1646 */
2140 break;
2141
2142 case 38:
2143 #line 513 "config_gram.y" /* yacc.c:1646 */
2144 { current_prog->conntype = CONNTYPE_PARALLEL; }
2145 #line 2146 "config_gram.c" /* yacc.c:1646 */
2146 break;
2147
2148 case 39:
2149 #line 514 "config_gram.y" /* yacc.c:1646 */
2150 { current_prog->conntype = CONNTYPE_SERIAL; }
2151 #line 2152 "config_gram.c" /* yacc.c:1646 */
2152 break;
2153
2154 case 40:
2155 #line 515 "config_gram.y" /* yacc.c:1646 */
2156 { current_prog->conntype = CONNTYPE_USB; }
2157 #line 2158 "config_gram.c" /* yacc.c:1646 */
2158 break;
2159
2160 case 41:
2161 #line 519 "config_gram.y" /* yacc.c:1646 */
2162 {
2163 {
2164 strncpy(current_prog->usbdev, (yyvsp[0])->value.string, PGM_USBSTRINGLEN);
2165 current_prog->usbdev[PGM_USBSTRINGLEN-1] = 0;
2166 free_token((yyvsp[0]));
2167 }
2168 }
2169 #line 2170 "config_gram.c" /* yacc.c:1646 */
2170 break;
2171
2172 case 42:
2173 #line 526 "config_gram.y" /* yacc.c:1646 */
2174 {
2175 {
2176 current_prog->usbvid = (yyvsp[0])->value.number;
2177 free_token((yyvsp[0]));
2178 }
2179 }
2180 #line 2181 "config_gram.c" /* yacc.c:1646 */
2181 break;
2182
2183 case 44:
2184 #line 533 "config_gram.y" /* yacc.c:1646 */
2185 {
2186 {
2187 strncpy(current_prog->usbsn, (yyvsp[0])->value.string, PGM_USBSTRINGLEN);
2188 current_prog->usbsn[PGM_USBSTRINGLEN-1] = 0;
2189 free_token((yyvsp[0]));
2190 }
2191 }
2192 #line 2193 "config_gram.c" /* yacc.c:1646 */
2193 break;
2194
2195 case 45:
2196 #line 540 "config_gram.y" /* yacc.c:1646 */
2197 {
2198 {
2199 strncpy(current_prog->usbvendor, (yyvsp[0])->value.string, PGM_USBSTRINGLEN);
2200 current_prog->usbvendor[PGM_USBSTRINGLEN-1] = 0;
2201 free_token((yyvsp[0]));
2202 }
2203 }
2204 #line 2205 "config_gram.c" /* yacc.c:1646 */
2205 break;
2206
2207 case 46:
2208 #line 547 "config_gram.y" /* yacc.c:1646 */
2209 {
2210 {
2211 strncpy(current_prog->usbproduct, (yyvsp[0])->value.string, PGM_USBSTRINGLEN);
2212 current_prog->usbproduct[PGM_USBSTRINGLEN-1] = 0;
2213 free_token((yyvsp[0]));
2214 }
2215 }
2216 #line 2217 "config_gram.c" /* yacc.c:1646 */
2217 break;
2218
2219 case 47:
2220 #line 557 "config_gram.y" /* yacc.c:1646 */
2221 {
2222 {
2223 /* overwrite pids, so clear the existing entries */
2224 ldestroy_cb(current_prog->usbpid, free);
2225 current_prog->usbpid = lcreat(NULL, 0);
2226 }
2227 {
2228 int *ip = malloc(sizeof(int));
2229 if (ip) {
2230 *ip = (yyvsp[0])->value.number;
2231 ladd(current_prog->usbpid, ip);
2232 }
2233 free_token((yyvsp[0]));
2234 }
2235 }
2236 #line 2237 "config_gram.c" /* yacc.c:1646 */
2237 break;
2238
2239 case 48:
2240 #line 572 "config_gram.y" /* yacc.c:1646 */
2241 {
2242 {
2243 int *ip = malloc(sizeof(int));
2244 if (ip) {
2245 *ip = (yyvsp[0])->value.number;
2246 ladd(current_prog->usbpid, ip);
2247 }
2248 free_token((yyvsp[0]));
2249 }
2250 }
2251 #line 2252 "config_gram.c" /* yacc.c:1646 */
2252 break;
2253
2254 case 49:
2255 #line 585 "config_gram.y" /* yacc.c:1646 */
2256 { if(0 != assign_pin(pin_name, (yyvsp[0]), 0)) YYABORT; }
2257 #line 2258 "config_gram.c" /* yacc.c:1646 */
2258 break;
2259
2260 case 50:
2261 #line 587 "config_gram.y" /* yacc.c:1646 */
2262 { if(0 != assign_pin(pin_name, (yyvsp[0]), 1)) YYABORT; }
2263 #line 2264 "config_gram.c" /* yacc.c:1646 */
2264 break;
2265
2266 case 52:
2267 #line 593 "config_gram.y" /* yacc.c:1646 */
2268 { pin_clear_all(&(current_prog->pin[pin_name])); }
2269 #line 2270 "config_gram.c" /* yacc.c:1646 */
2270 break;
2271
2272 case 54:
2273 #line 599 "config_gram.y" /* yacc.c:1646 */
2274 { if(0 != assign_pin_list(1)) YYABORT; }
2275 #line 2276 "config_gram.c" /* yacc.c:1646 */
2276 break;
2277
2278 case 58:
2279 #line 612 "config_gram.y" /* yacc.c:1646 */
2280 { pin_clear_all(&(current_prog->pin[pin_name])); }
2281 #line 2282 "config_gram.c" /* yacc.c:1646 */
2282 break;
2283
2284 case 59:
2285 #line 616 "config_gram.y" /* yacc.c:1646 */
2286 {pin_name = PPI_AVR_VCC; }
2287 #line 2288 "config_gram.c" /* yacc.c:1646 */
2288 break;
2289
2290 case 61:
2291 #line 617 "config_gram.y" /* yacc.c:1646 */
2292 {pin_name = PPI_AVR_BUFF; }
2293 #line 2294 "config_gram.c" /* yacc.c:1646 */
2294 break;
2295
2296 case 63:
2297 #line 618 "config_gram.y" /* yacc.c:1646 */
2298 {pin_name = PIN_AVR_RESET;}
2299 #line 2300 "config_gram.c" /* yacc.c:1646 */
2300 break;
2301
2302 case 64:
2303 #line 618 "config_gram.y" /* yacc.c:1646 */
2304 { free_token((yyvsp[-3])); }
2305 #line 2306 "config_gram.c" /* yacc.c:1646 */
2306 break;
2307
2308 case 65:
2309 #line 619 "config_gram.y" /* yacc.c:1646 */
2310 {pin_name = PIN_AVR_SCK; }
2311 #line 2312 "config_gram.c" /* yacc.c:1646 */
2312 break;
2313
2314 case 66:
2315 #line 619 "config_gram.y" /* yacc.c:1646 */
2316 { free_token((yyvsp[-3])); }
2317 #line 2318 "config_gram.c" /* yacc.c:1646 */
2318 break;
2319
2320 case 67:
2321 #line 620 "config_gram.y" /* yacc.c:1646 */
2322 {pin_name = PIN_AVR_MOSI; }
2323 #line 2324 "config_gram.c" /* yacc.c:1646 */
2324 break;
2325
2326 case 69:
2327 #line 621 "config_gram.y" /* yacc.c:1646 */
2328 {pin_name = PIN_AVR_MISO; }
2329 #line 2330 "config_gram.c" /* yacc.c:1646 */
2330 break;
2331
2332 case 71:
2333 #line 622 "config_gram.y" /* yacc.c:1646 */
2334 {pin_name = PIN_LED_ERR; }
2335 #line 2336 "config_gram.c" /* yacc.c:1646 */
2336 break;
2337
2338 case 73:
2339 #line 623 "config_gram.y" /* yacc.c:1646 */
2340 {pin_name = PIN_LED_RDY; }
2341 #line 2342 "config_gram.c" /* yacc.c:1646 */
2342 break;
2343
2344 case 75:
2345 #line 624 "config_gram.y" /* yacc.c:1646 */
2346 {pin_name = PIN_LED_PGM; }
2347 #line 2348 "config_gram.c" /* yacc.c:1646 */
2348 break;
2349
2350 case 77:
2351 #line 625 "config_gram.y" /* yacc.c:1646 */
2352 {pin_name = PIN_LED_VFY; }
2353 #line 2354 "config_gram.c" /* yacc.c:1646 */
2354 break;
2355
2356 case 99:
2357 #line 664 "config_gram.y" /* yacc.c:1646 */
2358 {
2359 strncpy(current_part->id, (yyvsp[0])->value.string, AVR_IDLEN);
2360 current_part->id[AVR_IDLEN-1] = 0;
2361 free_token((yyvsp[0]));
2362 }
2363 #line 2364 "config_gram.c" /* yacc.c:1646 */
2364 break;
2365
2366 case 100:
2367 #line 671 "config_gram.y" /* yacc.c:1646 */
2368 {
2369 strncpy(current_part->desc, (yyvsp[0])->value.string, AVR_DESCLEN);
2370 current_part->desc[AVR_DESCLEN-1] = 0;
2371 free_token((yyvsp[0]));
2372 }
2373 #line 2374 "config_gram.c" /* yacc.c:1646 */
2374 break;
2375
2376 case 101:
2377 #line 677 "config_gram.y" /* yacc.c:1646 */
2378 {
2379 {
2380 yyerror("devicecode is deprecated, use "
2381 "stk500_devcode instead");
2382 YYABORT;
2383 }
2384 }
2385 #line 2386 "config_gram.c" /* yacc.c:1646 */
2386 break;
2387
2388 case 102:
2389 #line 685 "config_gram.y" /* yacc.c:1646 */
2390 {
2391 {
2392 current_part->stk500_devcode = (yyvsp[0])->value.number;
2393 free_token((yyvsp[0]));
2394 }
2395 }
2396 #line 2397 "config_gram.c" /* yacc.c:1646 */
2397 break;
2398
2399 case 103:
2400 #line 692 "config_gram.y" /* yacc.c:1646 */
2401 {
2402 {
2403 current_part->avr910_devcode = (yyvsp[0])->value.number;
2404 free_token((yyvsp[0]));
2405 }
2406 }
2407 #line 2408 "config_gram.c" /* yacc.c:1646 */
2408 break;
2409
2410 case 104:
2411 #line 699 "config_gram.y" /* yacc.c:1646 */
2412 {
2413 {
2414 current_part->signature[0] = (yyvsp[-2])->value.number;
2415 current_part->signature[1] = (yyvsp[-1])->value.number;
2416 current_part->signature[2] = (yyvsp[0])->value.number;
2417 free_token((yyvsp[-2]));
2418 free_token((yyvsp[-1]));
2419 free_token((yyvsp[0]));
2420 }
2421 }
2422 #line 2423 "config_gram.c" /* yacc.c:1646 */
2423 break;
2424
2425 case 105:
2426 #line 710 "config_gram.y" /* yacc.c:1646 */
2427 {
2428 {
2429 current_part->usbpid = (yyvsp[0])->value.number;
2430 free_token((yyvsp[0]));
2431 }
2432 }
2433 #line 2434 "config_gram.c" /* yacc.c:1646 */
2434 break;
2435
2436 case 106:
2437 #line 717 "config_gram.y" /* yacc.c:1646 */
2438 {
2439 {
2440 TOKEN * t;
2441 unsigned nbytes;
2442 int ok;
2443
2444 current_part->ctl_stack_type = CTL_STACK_PP;
2445 nbytes = 0;
2446 ok = 1;
2447
2448 memset(current_part->controlstack, 0, CTL_STACK_SIZE);
2449 while (lsize(number_list)) {
2450 t = lrmv_n(number_list, 1);
2451 if (nbytes < CTL_STACK_SIZE)
2452 {
2453 current_part->controlstack[nbytes] = t->value.number;
2454 nbytes++;
2455 }
2456 else
2457 {
2458 ok = 0;
2459 }
2460 free_token(t);
2461 }
2462 if (!ok)
2463 {
2464 yywarning("too many bytes in control stack");
2465 }
2466 }
2467 }
2468 #line 2469 "config_gram.c" /* yacc.c:1646 */
2469 break;
2470
2471 case 107:
2472 #line 748 "config_gram.y" /* yacc.c:1646 */
2473 {
2474 {
2475 TOKEN * t;
2476 unsigned nbytes;
2477 int ok;
2478
2479 current_part->ctl_stack_type = CTL_STACK_HVSP;
2480 nbytes = 0;
2481 ok = 1;
2482
2483 memset(current_part->controlstack, 0, CTL_STACK_SIZE);
2484 while (lsize(number_list)) {
2485 t = lrmv_n(number_list, 1);
2486 if (nbytes < CTL_STACK_SIZE)
2487 {
2488 current_part->controlstack[nbytes] = t->value.number;
2489 nbytes++;
2490 }
2491 else
2492 {
2493 ok = 0;
2494 }
2495 free_token(t);
2496 }
2497 if (!ok)
2498 {
2499 yywarning("too many bytes in control stack");
2500 }
2501 }
2502 }
2503 #line 2504 "config_gram.c" /* yacc.c:1646 */
2504 break;
2505
2506 case 108:
2507 #line 779 "config_gram.y" /* yacc.c:1646 */
2508 {
2509 {
2510 TOKEN * t;
2511 unsigned nbytes;
2512 int ok;
2513
2514 nbytes = 0;
2515 ok = 1;
2516
2517 memset(current_part->flash_instr, 0, FLASH_INSTR_SIZE);
2518 while (lsize(number_list)) {
2519 t = lrmv_n(number_list, 1);
2520 if (nbytes < FLASH_INSTR_SIZE)
2521 {
2522 current_part->flash_instr[nbytes] = t->value.number;
2523 nbytes++;
2524 }
2525 else
2526 {
2527 ok = 0;
2528 }
2529 free_token(t);
2530 }
2531 if (!ok)
2532 {
2533 yywarning("too many bytes in flash instructions");
2534 }
2535 }
2536 }
2537 #line 2538 "config_gram.c" /* yacc.c:1646 */
2538 break;
2539
2540 case 109:
2541 #line 809 "config_gram.y" /* yacc.c:1646 */
2542 {
2543 {
2544 TOKEN * t;
2545 unsigned nbytes;
2546 int ok;
2547
2548 nbytes = 0;
2549 ok = 1;
2550
2551 memset(current_part->eeprom_instr, 0, EEPROM_INSTR_SIZE);
2552 while (lsize(number_list)) {
2553 t = lrmv_n(number_list, 1);
2554 if (nbytes < EEPROM_INSTR_SIZE)
2555 {
2556 current_part->eeprom_instr[nbytes] = t->value.number;
2557 nbytes++;
2558 }
2559 else
2560 {
2561 ok = 0;
2562 }
2563 free_token(t);
2564 }
2565 if (!ok)
2566 {
2567 yywarning("too many bytes in EEPROM instructions");
2568 }
2569 }
2570 }
2571 #line 2572 "config_gram.c" /* yacc.c:1646 */
2572 break;
2573
2574 case 110:
2575 #line 840 "config_gram.y" /* yacc.c:1646 */
2576 {
2577 current_part->chip_erase_delay = (yyvsp[0])->value.number;
2578 free_token((yyvsp[0]));
2579 }
2580 #line 2581 "config_gram.c" /* yacc.c:1646 */
2581 break;
2582
2583 case 111:
2584 #line 846 "config_gram.y" /* yacc.c:1646 */
2585 {
2586 current_part->pagel = (yyvsp[0])->value.number;
2587 free_token((yyvsp[0]));
2588 }
2589 #line 2590 "config_gram.c" /* yacc.c:1646 */
2590 break;
2591
2592 case 112:
2593 #line 852 "config_gram.y" /* yacc.c:1646 */
2594 {
2595 current_part->bs2 = (yyvsp[0])->value.number;
2596 free_token((yyvsp[0]));
2597 }
2598 #line 2599 "config_gram.c" /* yacc.c:1646 */
2599 break;
2600
2601 case 113:
2602 #line 858 "config_gram.y" /* yacc.c:1646 */
2603 {
2604 if ((yyvsp[0])->primary == K_DEDICATED)
2605 current_part->reset_disposition = RESET_DEDICATED;
2606 else if ((yyvsp[0])->primary == K_IO)
2607 current_part->reset_disposition = RESET_IO;
2608
2609 free_tokens(2, (yyvsp[-2]), (yyvsp[0]));
2610 }
2611 #line 2612 "config_gram.c" /* yacc.c:1646 */
2612 break;
2613
2614 case 114:
2615 #line 868 "config_gram.y" /* yacc.c:1646 */
2616 {
2617 current_part->timeout = (yyvsp[0])->value.number;
2618 free_token((yyvsp[0]));
2619 }
2620 #line 2621 "config_gram.c" /* yacc.c:1646 */
2621 break;
2622
2623 case 115:
2624 #line 874 "config_gram.y" /* yacc.c:1646 */
2625 {
2626 current_part->stabdelay = (yyvsp[0])->value.number;
2627 free_token((yyvsp[0]));
2628 }
2629 #line 2630 "config_gram.c" /* yacc.c:1646 */
2630 break;
2631
2632 case 116:
2633 #line 880 "config_gram.y" /* yacc.c:1646 */
2634 {
2635 current_part->cmdexedelay = (yyvsp[0])->value.number;
2636 free_token((yyvsp[0]));
2637 }
2638 #line 2639 "config_gram.c" /* yacc.c:1646 */
2639 break;
2640
2641 case 117:
2642 #line 886 "config_gram.y" /* yacc.c:1646 */
2643 {
2644 current_part->hvspcmdexedelay = (yyvsp[0])->value.number;
2645 free_token((yyvsp[0]));
2646 }
2647 #line 2648 "config_gram.c" /* yacc.c:1646 */
2648 break;
2649
2650 case 118:
2651 #line 892 "config_gram.y" /* yacc.c:1646 */
2652 {
2653 current_part->synchloops = (yyvsp[0])->value.number;
2654 free_token((yyvsp[0]));
2655 }
2656 #line 2657 "config_gram.c" /* yacc.c:1646 */
2657 break;
2658
2659 case 119:
2660 #line 898 "config_gram.y" /* yacc.c:1646 */
2661 {
2662 current_part->bytedelay = (yyvsp[0])->value.number;
2663 free_token((yyvsp[0]));
2664 }
2665 #line 2666 "config_gram.c" /* yacc.c:1646 */
2666 break;
2667
2668 case 120:
2669 #line 904 "config_gram.y" /* yacc.c:1646 */
2670 {
2671 current_part->pollvalue = (yyvsp[0])->value.number;
2672 free_token((yyvsp[0]));
2673 }
2674 #line 2675 "config_gram.c" /* yacc.c:1646 */
2675 break;
2676
2677 case 121:
2678 #line 910 "config_gram.y" /* yacc.c:1646 */
2679 {
2680 current_part->pollindex = (yyvsp[0])->value.number;
2681 free_token((yyvsp[0]));
2682 }
2683 #line 2684 "config_gram.c" /* yacc.c:1646 */
2684 break;
2685
2686 case 122:
2687 #line 916 "config_gram.y" /* yacc.c:1646 */
2688 {
2689 current_part->predelay = (yyvsp[0])->value.number;
2690 free_token((yyvsp[0]));
2691 }
2692 #line 2693 "config_gram.c" /* yacc.c:1646 */
2693 break;
2694
2695 case 123:
2696 #line 922 "config_gram.y" /* yacc.c:1646 */
2697 {
2698 current_part->postdelay = (yyvsp[0])->value.number;
2699 free_token((yyvsp[0]));
2700 }
2701 #line 2702 "config_gram.c" /* yacc.c:1646 */
2702 break;
2703
2704 case 124:
2705 #line 928 "config_gram.y" /* yacc.c:1646 */
2706 {
2707 current_part->pollmethod = (yyvsp[0])->value.number;
2708 free_token((yyvsp[0]));
2709 }
2710 #line 2711 "config_gram.c" /* yacc.c:1646 */
2711 break;
2712
2713 case 125:
2714 #line 934 "config_gram.y" /* yacc.c:1646 */
2715 {
2716 current_part->hventerstabdelay = (yyvsp[0])->value.number;
2717 free_token((yyvsp[0]));
2718 }
2719 #line 2720 "config_gram.c" /* yacc.c:1646 */
2720 break;
2721
2722 case 126:
2723 #line 940 "config_gram.y" /* yacc.c:1646 */
2724 {
2725 current_part->progmodedelay = (yyvsp[0])->value.number;
2726 free_token((yyvsp[0]));
2727 }
2728 #line 2729 "config_gram.c" /* yacc.c:1646 */
2729 break;
2730
2731 case 127:
2732 #line 946 "config_gram.y" /* yacc.c:1646 */
2733 {
2734 current_part->latchcycles = (yyvsp[0])->value.number;
2735 free_token((yyvsp[0]));
2736 }
2737 #line 2738 "config_gram.c" /* yacc.c:1646 */
2738 break;
2739
2740 case 128:
2741 #line 952 "config_gram.y" /* yacc.c:1646 */
2742 {
2743 current_part->togglevtg = (yyvsp[0])->value.number;
2744 free_token((yyvsp[0]));
2745 }
2746 #line 2747 "config_gram.c" /* yacc.c:1646 */
2747 break;
2748
2749 case 129:
2750 #line 958 "config_gram.y" /* yacc.c:1646 */
2751 {
2752 current_part->poweroffdelay = (yyvsp[0])->value.number;
2753 free_token((yyvsp[0]));
2754 }
2755 #line 2756 "config_gram.c" /* yacc.c:1646 */
2756 break;
2757
2758 case 130:
2759 #line 964 "config_gram.y" /* yacc.c:1646 */
2760 {
2761 current_part->resetdelayms = (yyvsp[0])->value.number;
2762 free_token((yyvsp[0]));
2763 }
2764 #line 2765 "config_gram.c" /* yacc.c:1646 */
2765 break;
2766
2767 case 131:
2768 #line 970 "config_gram.y" /* yacc.c:1646 */
2769 {
2770 current_part->resetdelayus = (yyvsp[0])->value.number;
2771 free_token((yyvsp[0]));
2772 }
2773 #line 2774 "config_gram.c" /* yacc.c:1646 */
2774 break;
2775
2776 case 132:
2777 #line 976 "config_gram.y" /* yacc.c:1646 */
2778 {
2779 current_part->hvleavestabdelay = (yyvsp[0])->value.number;
2780 free_token((yyvsp[0]));
2781 }
2782 #line 2783 "config_gram.c" /* yacc.c:1646 */
2783 break;
2784
2785 case 133:
2786 #line 982 "config_gram.y" /* yacc.c:1646 */
2787 {
2788 current_part->resetdelay = (yyvsp[0])->value.number;
2789 free_token((yyvsp[0]));
2790 }
2791 #line 2792 "config_gram.c" /* yacc.c:1646 */
2792 break;
2793
2794 case 134:
2795 #line 988 "config_gram.y" /* yacc.c:1646 */
2796 {
2797 current_part->chiperasepulsewidth = (yyvsp[0])->value.number;
2798 free_token((yyvsp[0]));
2799 }
2800 #line 2801 "config_gram.c" /* yacc.c:1646 */
2801 break;
2802
2803 case 135:
2804 #line 994 "config_gram.y" /* yacc.c:1646 */
2805 {
2806 current_part->chiperasepolltimeout = (yyvsp[0])->value.number;
2807 free_token((yyvsp[0]));
2808 }
2809 #line 2810 "config_gram.c" /* yacc.c:1646 */
2810 break;
2811
2812 case 136:
2813 #line 1000 "config_gram.y" /* yacc.c:1646 */
2814 {
2815 current_part->chiperasetime = (yyvsp[0])->value.number;
2816 free_token((yyvsp[0]));
2817 }
2818 #line 2819 "config_gram.c" /* yacc.c:1646 */
2819 break;
2820
2821 case 137:
2822 #line 1006 "config_gram.y" /* yacc.c:1646 */
2823 {
2824 current_part->programfusepulsewidth = (yyvsp[0])->value.number;
2825 free_token((yyvsp[0]));
2826 }
2827 #line 2828 "config_gram.c" /* yacc.c:1646 */
2828 break;
2829
2830 case 138:
2831 #line 1012 "config_gram.y" /* yacc.c:1646 */
2832 {
2833 current_part->programfusepolltimeout = (yyvsp[0])->value.number;
2834 free_token((yyvsp[0]));
2835 }
2836 #line 2837 "config_gram.c" /* yacc.c:1646 */
2837 break;
2838
2839 case 139:
2840 #line 1018 "config_gram.y" /* yacc.c:1646 */
2841 {
2842 current_part->programlockpulsewidth = (yyvsp[0])->value.number;
2843 free_token((yyvsp[0]));
2844 }
2845 #line 2846 "config_gram.c" /* yacc.c:1646 */
2846 break;
2847
2848 case 140:
2849 #line 1024 "config_gram.y" /* yacc.c:1646 */
2850 {
2851 current_part->programlockpolltimeout = (yyvsp[0])->value.number;
2852 free_token((yyvsp[0]));
2853 }
2854 #line 2855 "config_gram.c" /* yacc.c:1646 */
2855 break;
2856
2857 case 141:
2858 #line 1030 "config_gram.y" /* yacc.c:1646 */
2859 {
2860 current_part->synchcycles = (yyvsp[0])->value.number;
2861 free_token((yyvsp[0]));
2862 }
2863 #line 2864 "config_gram.c" /* yacc.c:1646 */
2864 break;
2865
2866 case 142:
2867 #line 1036 "config_gram.y" /* yacc.c:1646 */
2868 {
2869 if ((yyvsp[0])->primary == K_YES)
2870 current_part->flags |= AVRPART_HAS_JTAG;
2871 else if ((yyvsp[0])->primary == K_NO)
2872 current_part->flags &= ~AVRPART_HAS_JTAG;
2873
2874 free_token((yyvsp[0]));
2875 }
2876 #line 2877 "config_gram.c" /* yacc.c:1646 */
2877 break;
2878
2879 case 143:
2880 #line 1046 "config_gram.y" /* yacc.c:1646 */
2881 {
2882 if ((yyvsp[0])->primary == K_YES)
2883 current_part->flags |= AVRPART_HAS_DW;
2884 else if ((yyvsp[0])->primary == K_NO)
2885 current_part->flags &= ~AVRPART_HAS_DW;
2886
2887 free_token((yyvsp[0]));
2888 }
2889 #line 2890 "config_gram.c" /* yacc.c:1646 */
2890 break;
2891
2892 case 144:
2893 #line 1056 "config_gram.y" /* yacc.c:1646 */
2894 {
2895 if ((yyvsp[0])->primary == K_YES)
2896 current_part->flags |= AVRPART_HAS_PDI;
2897 else if ((yyvsp[0])->primary == K_NO)
2898 current_part->flags &= ~AVRPART_HAS_PDI;
2899
2900 free_token((yyvsp[0]));
2901 }
2902 #line 2903 "config_gram.c" /* yacc.c:1646 */
2903 break;
2904
2905 case 145:
2906 #line 1066 "config_gram.y" /* yacc.c:1646 */
2907 {
2908 if ((yyvsp[0])->primary == K_YES)
2909 current_part->flags |= AVRPART_HAS_TPI;
2910 else if ((yyvsp[0])->primary == K_NO)
2911 current_part->flags &= ~AVRPART_HAS_TPI;
2912
2913 free_token((yyvsp[0]));
2914 }
2915 #line 2916 "config_gram.c" /* yacc.c:1646 */
2916 break;
2917
2918 case 146:
2919 #line 1076 "config_gram.y" /* yacc.c:1646 */
2920 {
2921 if ((yyvsp[0])->primary == K_YES)
2922 current_part->flags |= AVRPART_IS_AT90S1200;
2923 else if ((yyvsp[0])->primary == K_NO)
2924 current_part->flags &= ~AVRPART_IS_AT90S1200;
2925
2926 free_token((yyvsp[0]));
2927 }
2928 #line 2929 "config_gram.c" /* yacc.c:1646 */
2929 break;
2930
2931 case 147:
2932 #line 1086 "config_gram.y" /* yacc.c:1646 */
2933 {
2934 if ((yyvsp[0])->primary == K_YES)
2935 current_part->flags |= AVRPART_AVR32;
2936 else if ((yyvsp[0])->primary == K_NO)
2937 current_part->flags &= ~AVRPART_AVR32;
2938
2939 free_token((yyvsp[0]));
2940 }
2941 #line 2942 "config_gram.c" /* yacc.c:1646 */
2942 break;
2943
2944 case 148:
2945 #line 1096 "config_gram.y" /* yacc.c:1646 */
2946 {
2947 if ((yyvsp[0])->primary == K_YES)
2948 current_part->flags |= AVRPART_ALLOWFULLPAGEBITSTREAM;
2949 else if ((yyvsp[0])->primary == K_NO)
2950 current_part->flags &= ~AVRPART_ALLOWFULLPAGEBITSTREAM;
2951
2952 free_token((yyvsp[0]));
2953 }
2954 #line 2955 "config_gram.c" /* yacc.c:1646 */
2955 break;
2956
2957 case 149:
2958 #line 1106 "config_gram.y" /* yacc.c:1646 */
2959 {
2960 if ((yyvsp[0])->primary == K_YES)
2961 current_part->flags |= AVRPART_ENABLEPAGEPROGRAMMING;
2962 else if ((yyvsp[0])->primary == K_NO)
2963 current_part->flags &= ~AVRPART_ENABLEPAGEPROGRAMMING;
2964
2965 free_token((yyvsp[0]));
2966 }
2967 #line 2968 "config_gram.c" /* yacc.c:1646 */
2968 break;
2969
2970 case 150:
2971 #line 1116 "config_gram.y" /* yacc.c:1646 */
2972 {
2973 current_part->idr = (yyvsp[0])->value.number;
2974 free_token((yyvsp[0]));
2975 }
2976 #line 2977 "config_gram.c" /* yacc.c:1646 */
2977 break;
2978
2979 case 151:
2980 #line 1122 "config_gram.y" /* yacc.c:1646 */
2981 {
2982 current_part->rampz = (yyvsp[0])->value.number;
2983 free_token((yyvsp[0]));
2984 }
2985 #line 2986 "config_gram.c" /* yacc.c:1646 */
2986 break;
2987
2988 case 152:
2989 #line 1128 "config_gram.y" /* yacc.c:1646 */
2990 {
2991 current_part->spmcr = (yyvsp[0])->value.number;
2992 free_token((yyvsp[0]));
2993 }
2994 #line 2995 "config_gram.c" /* yacc.c:1646 */
2995 break;
2996
2997 case 153:
2998 #line 1134 "config_gram.y" /* yacc.c:1646 */
2999 {
3000 current_part->eecr = (yyvsp[0])->value.number;
3001 free_token((yyvsp[0]));
3002 }
3003 #line 3004 "config_gram.c" /* yacc.c:1646 */
3004 break;
3005
3006 case 154:
3007 #line 1140 "config_gram.y" /* yacc.c:1646 */
3008 {
3009 current_part->mcu_base = (yyvsp[0])->value.number;
3010 free_token((yyvsp[0]));
3011 }
3012 #line 3013 "config_gram.c" /* yacc.c:1646 */
3013 break;
3014
3015 case 155:
3016 #line 1146 "config_gram.y" /* yacc.c:1646 */
3017 {
3018 current_part->nvm_base = (yyvsp[0])->value.number;
3019 free_token((yyvsp[0]));
3020 }
3021 #line 3022 "config_gram.c" /* yacc.c:1646 */
3022 break;
3023
3024 case 156:
3025 #line 1152 "config_gram.y" /* yacc.c:1646 */
3026 {
3027 current_part->ocdrev = (yyvsp[0])->value.number;
3028 free_token((yyvsp[0]));
3029 }
3030 #line 3031 "config_gram.c" /* yacc.c:1646 */
3031 break;
3032
3033 case 157:
3034 #line 1158 "config_gram.y" /* yacc.c:1646 */
3035 {
3036 if ((yyvsp[0])->primary == K_YES)
3037 current_part->flags |= AVRPART_SERIALOK;
3038 else if ((yyvsp[0])->primary == K_NO)
3039 current_part->flags &= ~AVRPART_SERIALOK;
3040
3041 free_token((yyvsp[0]));
3042 }
3043 #line 3044 "config_gram.c" /* yacc.c:1646 */
3044 break;
3045
3046 case 158:
3047 #line 1168 "config_gram.y" /* yacc.c:1646 */
3048 {
3049 if ((yyvsp[0])->primary == K_YES) {
3050 current_part->flags |= AVRPART_PARALLELOK;
3051 current_part->flags &= ~AVRPART_PSEUDOPARALLEL;
3052 }
3053 else if ((yyvsp[0])->primary == K_NO) {
3054 current_part->flags &= ~AVRPART_PARALLELOK;
3055 current_part->flags &= ~AVRPART_PSEUDOPARALLEL;
3056 }
3057 else if ((yyvsp[0])->primary == K_PSEUDO) {
3058 current_part->flags |= AVRPART_PARALLELOK;
3059 current_part->flags |= AVRPART_PSEUDOPARALLEL;
3060 }
3061
3062
3063 free_token((yyvsp[0]));
3064 }
3065 #line 3066 "config_gram.c" /* yacc.c:1646 */
3066 break;
3067
3068 case 159:
3069 #line 1187 "config_gram.y" /* yacc.c:1646 */
3070 {
3071 switch ((yyvsp[0])->primary) {
3072 case K_RESET :
3073 current_part->retry_pulse = PIN_AVR_RESET;
3074 break;
3075 case K_SCK :
3076 current_part->retry_pulse = PIN_AVR_SCK;
3077 break;
3078 }
3079
3080 free_token((yyvsp[-2]));
3081 }
3082 #line 3083 "config_gram.c" /* yacc.c:1646 */
3083 break;
3084
3085 case 160:
3086 #line 1210 "config_gram.y" /* yacc.c:1646 */
3087 {
3088 current_mem = avr_new_memtype();
3089 if (current_mem == NULL) {
3090 yyerror("could not create mem instance");
3091 free_token((yyvsp[0]));
3092 YYABORT;
3093 }
3094 strncpy(current_mem->desc, (yyvsp[0])->value.string, AVR_MEMDESCLEN);
3095 current_mem->desc[AVR_MEMDESCLEN-1] = 0;
3096 free_token((yyvsp[0]));
3097 }
3098 #line 3099 "config_gram.c" /* yacc.c:1646 */
3099 break;
3100
3101 case 161:
3102 #line 1222 "config_gram.y" /* yacc.c:1646 */
3103 {
3104 AVRMEM * existing_mem;
3105
3106 existing_mem = avr_locate_mem(current_part, current_mem->desc);
3107 if (existing_mem != NULL) {
3108 lrmv_d(current_part->mem, existing_mem);
3109 avr_free_mem(existing_mem);
3110 }
3111 ladd(current_part->mem, current_mem);
3112 current_mem = NULL;
3113 }
3114 #line 3115 "config_gram.c" /* yacc.c:1646 */
3115 break;
3116
3117 case 162:
3118 #line 1234 "config_gram.y" /* yacc.c:1646 */
3119 {
3120 {
3121 int opnum;
3122 OPCODE * op;
3123
3124 opnum = which_opcode((yyvsp[-2]));
3125 if (opnum < 0) YYABORT;
3126 op = avr_new_opcode();
3127 if (op == NULL) {
3128 yyerror("could not create opcode instance");
3129 free_token((yyvsp[-2]));
3130 YYABORT;
3131 }
3132 if(0 != parse_cmdbits(op)) YYABORT;
3133 if (current_part->op[opnum] != NULL) {
3134 /*yywarning("operation redefined");*/
3135 avr_free_opcode(current_part->op[opnum]);
3136 }
3137 current_part->op[opnum] = op;
3138
3139 free_token((yyvsp[-2]));
3140 }
3141 }
3142 #line 3143 "config_gram.c" /* yacc.c:1646 */
3143 break;
3144
3145 case 167:
3146 #line 1273 "config_gram.y" /* yacc.c:1646 */
3147 {
3148 current_mem->paged = (yyvsp[0])->primary == K_YES ? 1 : 0;
3149 free_token((yyvsp[0]));
3150 }
3151 #line 3152 "config_gram.c" /* yacc.c:1646 */
3152 break;
3153
3154 case 168:
3155 #line 1279 "config_gram.y" /* yacc.c:1646 */
3156 {
3157 current_mem->size = (yyvsp[0])->value.number;
3158 free_token((yyvsp[0]));
3159 }
3160 #line 3161 "config_gram.c" /* yacc.c:1646 */
3161 break;
3162
3163 case 169:
3164 #line 1286 "config_gram.y" /* yacc.c:1646 */
3165 {
3166 current_mem->page_size = (yyvsp[0])->value.number;
3167 free_token((yyvsp[0]));
3168 }
3169 #line 3170 "config_gram.c" /* yacc.c:1646 */
3170 break;
3171
3172 case 170:
3173 #line 1292 "config_gram.y" /* yacc.c:1646 */
3174 {
3175 current_mem->num_pages = (yyvsp[0])->value.number;
3176 free_token((yyvsp[0]));
3177 }
3178 #line 3179 "config_gram.c" /* yacc.c:1646 */
3179 break;
3180
3181 case 171:
3182 #line 1298 "config_gram.y" /* yacc.c:1646 */
3183 {
3184 current_mem->offset = (yyvsp[0])->value.number;
3185 free_token((yyvsp[0]));
3186 }
3187 #line 3188 "config_gram.c" /* yacc.c:1646 */
3188 break;
3189
3190 case 172:
3191 #line 1304 "config_gram.y" /* yacc.c:1646 */
3192 {
3193 current_mem->min_write_delay = (yyvsp[0])->value.number;
3194 free_token((yyvsp[0]));
3195 }
3196 #line 3197 "config_gram.c" /* yacc.c:1646 */
3197 break;
3198
3199 case 173:
3200 #line 1310 "config_gram.y" /* yacc.c:1646 */
3201 {
3202 current_mem->max_write_delay = (yyvsp[0])->value.number;
3203 free_token((yyvsp[0]));
3204 }
3205 #line 3206 "config_gram.c" /* yacc.c:1646 */
3206 break;
3207
3208 case 174:
3209 #line 1316 "config_gram.y" /* yacc.c:1646 */
3210 {
3211 current_mem->pwroff_after_write = (yyvsp[0])->primary == K_YES ? 1 : 0;
3212 free_token((yyvsp[0]));
3213 }
3214 #line 3215 "config_gram.c" /* yacc.c:1646 */
3215 break;
3216
3217 case 175:
3218 #line 1322 "config_gram.y" /* yacc.c:1646 */
3219 {
3220 current_mem->readback[0] = (yyvsp[0])->value.number;
3221 free_token((yyvsp[0]));
3222 }
3223 #line 3224 "config_gram.c" /* yacc.c:1646 */
3224 break;
3225
3226 case 176:
3227 #line 1328 "config_gram.y" /* yacc.c:1646 */
3228 {
3229 current_mem->readback[1] = (yyvsp[0])->value.number;
3230 free_token((yyvsp[0]));
3231 }
3232 #line 3233 "config_gram.c" /* yacc.c:1646 */
3233 break;
3234
3235 case 177:
3236 #line 1335 "config_gram.y" /* yacc.c:1646 */
3237 {
3238 current_mem->mode = (yyvsp[0])->value.number;
3239 free_token((yyvsp[0]));
3240 }
3241 #line 3242 "config_gram.c" /* yacc.c:1646 */
3242 break;
3243
3244 case 178:
3245 #line 1341 "config_gram.y" /* yacc.c:1646 */
3246 {
3247 current_mem->delay = (yyvsp[0])->value.number;
3248 free_token((yyvsp[0]));
3249 }
3250 #line 3251 "config_gram.c" /* yacc.c:1646 */
3251 break;
3252
3253 case 179:
3254 #line 1347 "config_gram.y" /* yacc.c:1646 */
3255 {
3256 current_mem->blocksize = (yyvsp[0])->value.number;
3257 free_token((yyvsp[0]));
3258 }
3259 #line 3260 "config_gram.c" /* yacc.c:1646 */
3260 break;
3261
3262 case 180:
3263 #line 1353 "config_gram.y" /* yacc.c:1646 */
3264 {
3265 current_mem->readsize = (yyvsp[0])->value.number;
3266 free_token((yyvsp[0]));
3267 }
3268 #line 3269 "config_gram.c" /* yacc.c:1646 */
3269 break;
3270
3271 case 181:
3272 #line 1359 "config_gram.y" /* yacc.c:1646 */
3273 {
3274 current_mem->pollindex = (yyvsp[0])->value.number;
3275 free_token((yyvsp[0]));
3276 }
3277 #line 3278 "config_gram.c" /* yacc.c:1646 */
3278 break;
3279
3280 case 182:
3281 #line 1365 "config_gram.y" /* yacc.c:1646 */
3282 {
3283 {
3284 int opnum;
3285 OPCODE * op;
3286
3287 opnum = which_opcode((yyvsp[-2]));
3288 if (opnum < 0) YYABORT;
3289 op = avr_new_opcode();
3290 if (op == NULL) {
3291 yyerror("could not create opcode instance");
3292 free_token((yyvsp[-2]));
3293 YYABORT;
3294 }
3295 if(0 != parse_cmdbits(op)) YYABORT;
3296 if (current_mem->op[opnum] != NULL) {
3297 /*yywarning("operation redefined");*/
3298 avr_free_opcode(current_mem->op[opnum]);
3299 }
3300 current_mem->op[opnum] = op;
3301
3302 free_token((yyvsp[-2]));
3303 }
3304 }
3305 #line 3306 "config_gram.c" /* yacc.c:1646 */
3306 break;
3307
3308
3309 #line 3310 "config_gram.c" /* yacc.c:1646 */
3310 default: break;
3311 }
3312 /* User semantic actions sometimes alter yychar, and that requires
3313 that yytoken be updated with the new translation. We take the
3314 approach of translating immediately before every use of yytoken.
3315 One alternative is translating here after every semantic action,
3316 but that translation would be missed if the semantic action invokes
3317 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
3318 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
3319 incorrect destructor might then be invoked immediately. In the
3320 case of YYERROR or YYBACKUP, subsequent parser actions might lead
3321 to an incorrect destructor call or verbose syntax error message
3322 before the lookahead is translated. */
3323 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
3324
3325 YYPOPSTACK (yylen);
3326 yylen = 0;
3327 YY_STACK_PRINT (yyss, yyssp);
3328
3329 *++yyvsp = yyval;
3330
3331 /* Now 'shift' the result of the reduction. Determine what state
3332 that goes to, based on the state we popped back to and the rule
3333 number reduced by. */
3334
3335 yyn = yyr1[yyn];
3336
3337 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
3338 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
3339 yystate = yytable[yystate];
3340 else
3341 yystate = yydefgoto[yyn - YYNTOKENS];
3342
3343 goto yynewstate;
3344
3345
3346 /*--------------------------------------.
3347 | yyerrlab -- here on detecting error. |
3348 `--------------------------------------*/
3349 yyerrlab:
3350 /* Make sure we have latest lookahead translation. See comments at
3351 user semantic actions for why this is necessary. */
3352 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
3353
3354 /* If not already recovering from an error, report this error. */
3355 if (!yyerrstatus)
3356 {
3357 ++yynerrs;
3358 #if ! YYERROR_VERBOSE
3359 yyerror (YY_("syntax error"));
3360 #else
3361 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
3362 yyssp, yytoken)
3363 {
3364 char const *yymsgp = YY_("syntax error");
3365 int yysyntax_error_status;
3366 yysyntax_error_status = YYSYNTAX_ERROR;
3367 if (yysyntax_error_status == 0)
3368 yymsgp = yymsg;
3369 else if (yysyntax_error_status == 1)
3370 {
3371 if (yymsg != yymsgbuf)
3372 YYSTACK_FREE (yymsg);
3373 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
3374 if (!yymsg)
3375 {
3376 yymsg = yymsgbuf;
3377 yymsg_alloc = sizeof yymsgbuf;
3378 yysyntax_error_status = 2;
3379 }
3380 else
3381 {
3382 yysyntax_error_status = YYSYNTAX_ERROR;
3383 yymsgp = yymsg;
3384 }
3385 }
3386 yyerror (yymsgp);
3387 if (yysyntax_error_status == 2)
3388 goto yyexhaustedlab;
3389 }
3390 # undef YYSYNTAX_ERROR
3391 #endif
3392 }
3393
3394
3395
3396 if (yyerrstatus == 3)
3397 {
3398 /* If just tried and failed to reuse lookahead token after an
3399 error, discard it. */
3400
3401 if (yychar <= YYEOF)
3402 {
3403 /* Return failure if at end of input. */
3404 if (yychar == YYEOF)
3405 YYABORT;
3406 }
3407 else
3408 {
3409 yydestruct ("Error: discarding",
3410 yytoken, &yylval);
3411 yychar = YYEMPTY;
3412 }
3413 }
3414
3415 /* Else will try to reuse lookahead token after shifting the error
3416 token. */
3417 goto yyerrlab1;
3418
3419
3420 /*---------------------------------------------------.
3421 | yyerrorlab -- error raised explicitly by YYERROR. |
3422 `---------------------------------------------------*/
3423 yyerrorlab:
3424
3425 /* Pacify compilers like GCC when the user code never invokes
3426 YYERROR and the label yyerrorlab therefore never appears in user
3427 code. */
3428 if (/*CONSTCOND*/ 0)
3429 goto yyerrorlab;
3430
3431 /* Do not reclaim the symbols of the rule whose action triggered
3432 this YYERROR. */
3433 YYPOPSTACK (yylen);
3434 yylen = 0;
3435 YY_STACK_PRINT (yyss, yyssp);
3436 yystate = *yyssp;
3437 goto yyerrlab1;
3438
3439
3440 /*-------------------------------------------------------------.
3441 | yyerrlab1 -- common code for both syntax error and YYERROR. |
3442 `-------------------------------------------------------------*/
3443 yyerrlab1:
3444 yyerrstatus = 3; /* Each real token shifted decrements this. */
3445
3446 for (;;)
3447 {
3448 yyn = yypact[yystate];
3449 if (!yypact_value_is_default (yyn))
3450 {
3451 yyn += YYTERROR;
3452 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
3453 {
3454 yyn = yytable[yyn];
3455 if (0 < yyn)
3456 break;
3457 }
3458 }
3459
3460 /* Pop the current state because it cannot handle the error token. */
3461 if (yyssp == yyss)
3462 YYABORT;
3463
3464
3465 yydestruct ("Error: popping",
3466 yystos[yystate], yyvsp);
3467 YYPOPSTACK (1);
3468 yystate = *yyssp;
3469 YY_STACK_PRINT (yyss, yyssp);
3470 }
3471
3472 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
3473 *++yyvsp = yylval;
3474 YY_IGNORE_MAYBE_UNINITIALIZED_END
3475
3476
3477 /* Shift the error token. */
3478 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
3479
3480 yystate = yyn;
3481 goto yynewstate;
3482
3483
3484 /*-------------------------------------.
3485 | yyacceptlab -- YYACCEPT comes here. |
3486 `-------------------------------------*/
3487 yyacceptlab:
3488 yyresult = 0;
3489 goto yyreturn;
3490
3491 /*-----------------------------------.
3492 | yyabortlab -- YYABORT comes here. |
3493 `-----------------------------------*/
3494 yyabortlab:
3495 yyresult = 1;
3496 goto yyreturn;
3497
3498 #if !defined yyoverflow || YYERROR_VERBOSE
3499 /*-------------------------------------------------.
3500 | yyexhaustedlab -- memory exhaustion comes here. |
3501 `-------------------------------------------------*/
3502 yyexhaustedlab:
3503 yyerror (YY_("memory exhausted"));
3504 yyresult = 2;
3505 /* Fall through. */
3506 #endif
3507
3508 yyreturn:
3509 if (yychar != YYEMPTY)
3510 {
3511 /* Make sure we have latest lookahead translation. See comments at
3512 user semantic actions for why this is necessary. */
3513 yytoken = YYTRANSLATE (yychar);
3514 yydestruct ("Cleanup: discarding lookahead",
3515 yytoken, &yylval);
3516 }
3517 /* Do not reclaim the symbols of the rule whose action triggered
3518 this YYABORT or YYACCEPT. */
3519 YYPOPSTACK (yylen);
3520 YY_STACK_PRINT (yyss, yyssp);
3521 while (yyssp != yyss)
3522 {
3523 yydestruct ("Cleanup: popping",
3524 yystos[*yyssp], yyvsp);
3525 YYPOPSTACK (1);
3526 }
3527 #ifndef yyoverflow
3528 if (yyss != yyssa)
3529 YYSTACK_FREE (yyss);
3530 #endif
3531 #if YYERROR_VERBOSE
3532 if (yymsg != yymsgbuf)
3533 YYSTACK_FREE (yymsg);
3534 #endif
3535 return yyresult;
3536 }
3537 #line 1391 "config_gram.y" /* yacc.c:1906 */
3538
3539
3540 #if 0
3541 static char * vtypestr(int type)
3542 {
3543 switch (type) {
3544 case V_NUM : return "INTEGER";
3545 case V_NUM_REAL: return "REAL";
3546 case V_STR : return "STRING";
3547 default:
3548 return "<UNKNOWN>";
3549 }
3550 }
3551 #endif
3552
3553
assign_pin(int pinno,TOKEN * v,int invert)3554 static int assign_pin(int pinno, TOKEN * v, int invert)
3555 {
3556 int value;
3557
3558 value = v->value.number;
3559 free_token(v);
3560
3561 if ((value < PIN_MIN) || (value > PIN_MAX)) {
3562 yyerror("pin must be in the range " TOSTRING(PIN_MIN) "-" TOSTRING(PIN_MAX));
3563 return -1;
3564 }
3565
3566 pin_set_value(&(current_prog->pin[pinno]), value, invert);
3567
3568 return 0;
3569 }
3570
assign_pin_list(int invert)3571 static int assign_pin_list(int invert)
3572 {
3573 TOKEN * t;
3574 int pin;
3575 int rv = 0;
3576
3577 current_prog->pinno[pin_name] = 0;
3578 while (lsize(number_list)) {
3579 t = lrmv_n(number_list, 1);
3580 if (rv == 0) {
3581 pin = t->value.number;
3582 if ((pin < PIN_MIN) || (pin > PIN_MAX)) {
3583 yyerror("pin must be in the range " TOSTRING(PIN_MIN) "-" TOSTRING(PIN_MAX));
3584 rv = -1;
3585 /* loop clears list and frees tokens */
3586 }
3587 pin_set_value(&(current_prog->pin[pin_name]), pin, invert);
3588 }
3589 free_token(t);
3590 }
3591 return rv;
3592 }
3593
which_opcode(TOKEN * opcode)3594 static int which_opcode(TOKEN * opcode)
3595 {
3596 switch (opcode->primary) {
3597 case K_READ : return AVR_OP_READ; break;
3598 case K_WRITE : return AVR_OP_WRITE; break;
3599 case K_READ_LO : return AVR_OP_READ_LO; break;
3600 case K_READ_HI : return AVR_OP_READ_HI; break;
3601 case K_WRITE_LO : return AVR_OP_WRITE_LO; break;
3602 case K_WRITE_HI : return AVR_OP_WRITE_HI; break;
3603 case K_LOADPAGE_LO : return AVR_OP_LOADPAGE_LO; break;
3604 case K_LOADPAGE_HI : return AVR_OP_LOADPAGE_HI; break;
3605 case K_LOAD_EXT_ADDR : return AVR_OP_LOAD_EXT_ADDR; break;
3606 case K_WRITEPAGE : return AVR_OP_WRITEPAGE; break;
3607 case K_CHIP_ERASE : return AVR_OP_CHIP_ERASE; break;
3608 case K_PGM_ENABLE : return AVR_OP_PGM_ENABLE; break;
3609 default :
3610 yyerror("invalid opcode");
3611 return -1;
3612 break;
3613 }
3614 }
3615
3616
parse_cmdbits(OPCODE * op)3617 static int parse_cmdbits(OPCODE * op)
3618 {
3619 TOKEN * t;
3620 int bitno;
3621 char ch;
3622 char * e;
3623 char * q;
3624 int len;
3625 char * s, *brkt = NULL;
3626 int rv = 0;
3627
3628 bitno = 32;
3629 while (lsize(string_list)) {
3630
3631 t = lrmv_n(string_list, 1);
3632
3633 s = strtok_r(t->value.string, " ", &brkt);
3634 while (rv == 0 && s != NULL) {
3635
3636 bitno--;
3637 if (bitno < 0) {
3638 yyerror("too many opcode bits for instruction");
3639 rv = -1;
3640 break;
3641 }
3642
3643 len = (int)strlen(s);
3644
3645 if (len == 0) {
3646 yyerror("invalid bit specifier \"\"");
3647 rv = -1;
3648 break;
3649 }
3650
3651 ch = s[0];
3652
3653 if (len == 1) {
3654 switch (ch) {
3655 case '1':
3656 op->bit[bitno].type = AVR_CMDBIT_VALUE;
3657 op->bit[bitno].value = 1;
3658 op->bit[bitno].bitno = bitno % 8;
3659 break;
3660 case '0':
3661 op->bit[bitno].type = AVR_CMDBIT_VALUE;
3662 op->bit[bitno].value = 0;
3663 op->bit[bitno].bitno = bitno % 8;
3664 break;
3665 case 'x':
3666 op->bit[bitno].type = AVR_CMDBIT_IGNORE;
3667 op->bit[bitno].value = 0;
3668 op->bit[bitno].bitno = bitno % 8;
3669 break;
3670 case 'a':
3671 op->bit[bitno].type = AVR_CMDBIT_ADDRESS;
3672 op->bit[bitno].value = 0;
3673 op->bit[bitno].bitno = 8*(bitno/8) + bitno % 8;
3674 break;
3675 case 'i':
3676 op->bit[bitno].type = AVR_CMDBIT_INPUT;
3677 op->bit[bitno].value = 0;
3678 op->bit[bitno].bitno = bitno % 8;
3679 break;
3680 case 'o':
3681 op->bit[bitno].type = AVR_CMDBIT_OUTPUT;
3682 op->bit[bitno].value = 0;
3683 op->bit[bitno].bitno = bitno % 8;
3684 break;
3685 default :
3686 yyerror("invalid bit specifier '%c'", ch);
3687 rv = -1;
3688 break;
3689 }
3690 }
3691 else {
3692 if (ch == 'a') {
3693 q = &s[1];
3694 op->bit[bitno].bitno = strtol(q, &e, 0);
3695 if ((e == q)||(*e != 0)) {
3696 yyerror("can't parse bit number from \"%s\"", q);
3697 rv = -1;
3698 break;
3699 }
3700 op->bit[bitno].type = AVR_CMDBIT_ADDRESS;
3701 op->bit[bitno].value = 0;
3702 }
3703 else {
3704 yyerror("invalid bit specifier \"%s\"", s);
3705 rv = -1;
3706 break;
3707 }
3708 }
3709
3710 s = strtok_r(NULL, " ", &brkt);
3711 } /* while */
3712
3713 free_token(t);
3714
3715 } /* while */
3716
3717 return rv;
3718 }
3719