Debian Codegraph @

tools/kate_parser.c

raw
1 /* A Bison parser, made by GNU Bison 3.8.2. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
6 Inc.
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <https://www.gnu.org/licenses/>. */
20
21 /* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
30
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
33
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
36
37 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38 especially those whose name start with YY_ or yy_. They are
39 private implementation details that can be changed or removed. */
40
41 /* All symbols defined below should begin with yy or YY, to avoid
42 infringing on user name space. This should be done even for local
43 variables, as they might otherwise be expanded by user macros.
44 There are some unavoidable exceptions within include files to
45 define necessary library symbols; they are noted "INFRINGES ON
46 USER NAME SPACE" below. */
47
48 /* Identify Bison output, and Bison version. */
49 #define YYBISON 30802
50
51 /* Bison version string. */
52 #define YYBISON_VERSION "3.8.2"
53
54 /* Skeleton name. */
55 #define YYSKELETON_NAME "yacc.c"
56
57 /* Pure parsers. */
58 #define YYPURE 1
59
60 /* Push parsers. */
61 #define YYPUSH 0
62
63 /* Pull parsers. */
64 #define YYPULL 1
65
66
67 /* Substitute the variable and function names. */
68 #define yyparse katedesc_parse
69 #define yylex katedesc_lex
70 #define yyerror katedesc_error
71 #define yydebug katedesc_debug
72 #define yynerrs katedesc_nerrs
73
74 /* First part of user prologue. */
75 #line 10 "kate_parser.y"
76
77
78 #define KATE_INTERNAL
79 #include "kate_internal.h"
80
81 #include <limits.h>
82 #include <stdio.h>
83 #include <stdlib.h>
84 #include <stdarg.h>
85 #ifdef HAVE_STRING_H
86 #include <string.h>
87 #endif
88 #include <ctype.h>
89 #include "kate/oggkate.h"
90 #ifdef HAVE_PNG
91 #include "kpng.h"
92 #endif
93 #include "katedesc.h"
94 #include "kate_parser.h"
95
96 #define CHECK_KATE_API_ERROR(statement) \
97 do { \
98 int ret=(statement); \
99 if (ret<0) { \
100 yyerror("error in #statement"); \
101 exit(-1); \
102 } \
103 } while(0)
104
105 int nerrors=0;
106 int nwarnings=0;
107
108 static char *temp_macro_name=NULL;
109 static kate_float timebase = (kate_float)0;
110
111 typedef kate_style kd_style;
112 typedef kate_region kd_region;
113
114 typedef struct kd_curve {
115 size_t idx;
116 kate_curve *curve;
117 } kd_curve;
118
119 typedef struct kd_motion {
120 size_t idx;
121 kate_motion *motion;
122 } kd_motion;
123
124 typedef struct kd_palette {
125 kate_palette *palette;
126 } kd_palette;
127
128 typedef struct kd_bitmap {
129 kate_bitmap *bitmap;
130 } kd_bitmap;
131
132 static kate_style kstyle;
133 static kate_region kregion;
134 static kd_palette kpalette;
135 static kd_bitmap kbitmap;
136 static kd_curve kcurve;
137 static kate_font_range *krange=NULL;
138 static kate_font_mapping *kmapping=NULL;
139
140 static size_t nkmotions=0;
141 static kd_motion *kmotions=NULL;
142 static kate_motion *kmotion=NULL;
143
144 static char **style_names=NULL;
145 static char **region_names=NULL;
146 static char **palette_names=NULL;
147 static char **bitmap_names=NULL;
148 static char **curve_names=NULL;
149 static char **motion_names=NULL;
150 static char **font_range_names=NULL;
151 static char **font_mapping_names=NULL;
152
153 static size_t n_local_bitmaps=0;
154 static char **local_bitmap_names=NULL;
155 static kate_bitmap **local_bitmaps=NULL;
156
157 static int open_ended_curve=0;
158 static int n_curve_pts=-1;
159 static int n_palette_colors=-1;
160 static int n_bitmap_pixels=-1;
161 static size_t n_bytes_in_stream=0;
162 static char *byte_stream=NULL;
163 static size_t byte_stream_size=0;
164
165 static kate_float karaoke_base_height=(kate_float)0;
166 static kate_float karaoke_top_height=(kate_float)0;
167
168 typedef struct kd_event {
169 kate_float t0;
170 kate_float t1;
171 kate_float duration;
172 char *text;
173 kate_markup_type text_markup_type;
174 int region_index;
175 const kate_region *region;
176 int style_index;
177 const kate_style *style;
178 int secondary_style_index;
179 const kate_style *secondary_style;
180 int palette_index;
181 const kate_palette *palette;
182 int bitmap_index;
183 const kate_bitmap *bitmap;
184 } kd_event;
185 static kd_event kevent;
186
187 static void katedesc_trace(const char *msg,...)
188 {
189 va_list ap;
190 va_start(ap,msg);
191 vfprintf(stderr,msg,ap);
192 va_end(ap);
193 }
194 /* #define KDTRACE(msg,args...) katedesc_trace(msg, ##args) */
195 #define KDTRACE katedesc_trace
196
197 int yyerror(const char *s)
198 {
199 (void)s;
200 KDTRACE("Error line %d: %s (token %s)\n",nlines,s,katedesc_text);
201 nerrors++;
202 return 1;
203 }
204
205 int yyerrorf(const char *msg,...)
206 {
207 static char buffer[4096];
208 va_list ap;
209 va_start(ap,msg);
210 vsnprintf(buffer,sizeof(buffer),msg,ap);
211 buffer[sizeof(buffer)-1]=0;
212 va_end(ap);
213 return yyerror(buffer);
214 }
215
216 int yywarning(const char *s)
217 {
218 (void)s;
219 KDTRACE("Warning line %d: %s (token %s)\n",nlines,s,katedesc_text);
220 nwarnings++;
221 return 1;
222 }
223
224 static void add_meta(kate_meta **km,const char *tag,const char *value)
225 {
226 if (!*km) {
227 CHECK_KATE_API_ERROR(kate_meta_create(km));
228 }
229 CHECK_KATE_API_ERROR(kate_meta_add_string(*km,tag,value));
230 }
231
232 static void add_meta_byte_stream(kate_meta **km,const char *tag)
233 {
234 if (!*km) {
235 CHECK_KATE_API_ERROR(kate_meta_create(km));
236 }
237 CHECK_KATE_API_ERROR(kate_meta_add(*km,tag,byte_stream,byte_stream_size));
238
239 kate_free(byte_stream);
240 byte_stream=NULL;
241 n_bytes_in_stream=0;
242 byte_stream_size=0;
243 }
244
245 static char *catstrings(char *s1,const char *s2)
246 {
247 size_t len;
248 char *s;
249
250 if (!s2) { yyerror("internal error: no string to append"); exit(-1); }
251 len=(s1?strlen(s1):0)+strlen(s2)+1;
252 s=(char*)kate_realloc(s1,len);
253 if (!s) { yyerror("out of memory"); exit(-1); }
254 if (s1) strcat(s,s2); else strcpy(s,s2);
255
256 return s;
257 }
258
259 static char *dupstring(const char *s)
260 {
261 size_t len;
262 char *news;
263
264 if (!s) { yyerror("internal error: no string"); exit(-1); }
265
266 len=strlen(s);
267 news=(char*)kate_malloc(len+1);
268 if (!news) { yyerror("out of memory"); exit(-1); }
269 memcpy(news,s,len+1);
270 return news;
271 }
272
273 static int find_item(const char *name,size_t nnames,char **names)
274 {
275 size_t n;
276 for (n=0;n<nnames;++n) {
277 if (names[n] && !strcmp(names[n],name)) return n;
278 }
279 yyerrorf("Named item not found: %s",name);
280 return 0;
281 }
282
283 static void init_palette(void)
284 {
285 kpalette.palette=(kate_palette*)kate_malloc(sizeof(kate_palette));
286 if (!kpalette.palette) { yyerror("out of memory"); exit(-1); }
287 if (kate_palette_init(kpalette.palette)<0) {
288 yyerror("palette init failed");
289 exit(-1);
290 }
291 }
292
293 static void generate_full_filename(char *full_filename,size_t size,const char *filename)
294 {
295 if (filename[0]=='/' || filename[0]=='\\') {
296 strcpy(full_filename,filename);
297 }
298 else {
299 snprintf(full_filename,size,"%s%s",base_path,filename);
300 full_filename[size-1]=0;
301 }
302 }
303
304 static void load_palette(const char *filename)
305 {
306 #ifdef HAVE_PNG
307 int ncolors;
308 kate_color *palette=NULL;
309 static char full_filename[4096];
310
311 generate_full_filename(full_filename,sizeof(full_filename),filename);
312 if (kd_read_png8(full_filename,NULL,NULL,NULL,&palette,&ncolors,NULL)) {
313 yyerrorf("failed to load %s",filename);
314 return;
315 }
316
317 kpalette.palette->ncolors=ncolors;
318 kpalette.palette->colors=palette;
319 #else
320 yyerrorf("PNG support not compiled in: cannot load %s",filename);
321 exit(-1);
322 #endif
323 }
324
325 static void check_palette(const kate_palette *kp)
326 {
327 if (!kp) { yyerror("internal error: no palette"); exit(-1); }
328 }
329
330 static void add_palette(kate_info *ki,const char *name,kate_palette *kp)
331 {
332 int ret;
333
334 check_palette(kp);
335
336 ret=kate_info_add_palette(ki,kp);
337 if (ret<0) {
338 yyerrorf("Failed to register palette: %d",ret);
339 }
340 else {
341 palette_names=(char**)kate_realloc(palette_names,ki->npalettes*sizeof(char*));
342 if (!palette_names) {
343 yyerror("Out of memory");
344 exit(-1);
345 }
346 palette_names[ki->npalettes-1]=name?dupstring(name):NULL;
347 }
348 }
349
350 static int find_palette(const kate_info *ki,const char *name)
351 {
352 return find_item(name,ki->npalettes,palette_names);
353 }
354
355 static void init_bitmap(void)
356 {
357 kbitmap.bitmap=(kate_bitmap*)kate_malloc(sizeof(kate_bitmap));
358 if (!kbitmap.bitmap) { yyerror("out of memory"); exit(-1); }
359 if (kate_bitmap_init_new(kbitmap.bitmap)<0) {
360 yyerror("bitmap init failed");
361 exit(-1);
362 }
363 }
364
365 static int compute_bitmap_x_offset(kate_float percent)
366 {
367 if (kbitmap.bitmap->width) {
368 return (int)(kbitmap.bitmap->width*percent/100+0.5);
369 }
370 else {
371 yyerror("Bitmap width must be known before specifying offset as a percentage");
372 return 0;
373 }
374 }
375
376 static int compute_bitmap_y_offset(kate_float percent)
377 {
378 if (kbitmap.bitmap->height) {
379 return (int)(kbitmap.bitmap->height*percent/100+0.5);
380 }
381 else {
382 yyerror("Bitmap height must be known before specifying offset as a percentage");
383 return 0;
384 }
385 }
386
387 static void load_bitmap(const char *filename,int paletted)
388 {
389 #ifdef HAVE_PNG
390 int w,h;
391 unsigned char *pixels=NULL;
392
393 if (paletted) {
394 int bpp;
395 static char full_filename[4096];
396
397 generate_full_filename(full_filename,sizeof(full_filename),filename);
398 if (kd_read_png8(full_filename,&w,&h,&bpp,NULL,NULL,&pixels)) {
399 yyerrorf("failed to load %s",filename);
400 return;
401 }
402
403 kbitmap.bitmap->type=kate_bitmap_type_paletted;
404 kbitmap.bitmap->width=w;
405 kbitmap.bitmap->height=h;
406 kbitmap.bitmap->bpp=bpp;
407 kbitmap.bitmap->pixels=pixels;
408 kbitmap.bitmap->size=0;
409 }
410 else {
411 size_t size;
412 static char full_filename[4096];
413
414 generate_full_filename(full_filename,sizeof(full_filename),filename);
415 if (kd_read_png(full_filename,&w,&h,&pixels,&size)) {
416 yyerrorf("failed to load %s",filename);
417 return;
418 }
419
420 kbitmap.bitmap->type=kate_bitmap_type_png;
421 kbitmap.bitmap->width=w;
422 kbitmap.bitmap->height=h;
423 kbitmap.bitmap->bpp=0;
424 kbitmap.bitmap->pixels=pixels;
425 kbitmap.bitmap->size=size;
426 }
427
428 kbitmap.bitmap->palette=-1;
429 #else
430 (void)paletted;
431 yyerrorf("PNG support not compiled in: cannot load %s",filename);
432 exit(-1);
433 #endif
434 }
435
436 static void check_bitmap(const kate_bitmap *kb)
437 {
438 if (!kb) { yyerror("internal error: no bitmap"); exit(-1); }
439 }
440
441 static void add_bitmap(kate_info *ki,const char *name,kate_bitmap *kb)
442 {
443 int ret;
444
445 check_bitmap(kb);
446
447 ret=kate_info_add_bitmap(ki,kb);
448 if (ret<0) {
449 yyerrorf("Failed to register bitmap: %d",ret);
450 }
451 else {
452 bitmap_names=(char**)kate_realloc(bitmap_names,ki->nbitmaps*sizeof(char*));
453 if (!bitmap_names) {
454 yyerror("Out of memory");
455 exit(-1);
456 }
457 bitmap_names[ki->nbitmaps-1]=name?dupstring(name):NULL;
458 }
459 }
460
461 static void add_local_bitmap(kate_state *k,const char *name,kate_bitmap *kb)
462 {
463 int ret;
464
465 check_bitmap(kb);
466
467 ret=kate_encode_add_bitmap(k,kb);
468 if (ret<0) {
469 yyerrorf("Failed to register bitmap: %d",ret);
470 }
471 else {
472 ++n_local_bitmaps;
473 local_bitmap_names=(char**)kate_realloc(local_bitmap_names,n_local_bitmaps*sizeof(char*));
474 if (!local_bitmap_names) {
475 yyerror("Out of memory");
476 exit(-1);
477 }
478 local_bitmap_names[n_local_bitmaps-1]=name?dupstring(name):NULL;
479 local_bitmaps=(kate_bitmap**)kate_realloc(local_bitmaps,n_local_bitmaps*sizeof(kate_bitmap*));
480 if (!local_bitmaps) {
481 yyerror("Out of memory");
482 exit(-1);
483 }
484 local_bitmaps[n_local_bitmaps-1]=kb;
485 }
486 }
487
488 static void add_local_bitmap_index(kate_state *k,const char *name,size_t idx)
489 {
490 int ret;
491
492 ret=kate_encode_add_bitmap_index(k,idx);
493 if (ret<0) {
494 yyerrorf("Failed to register bitmap: %d",ret);
495 }
496 else {
497 ++n_local_bitmaps;
498 local_bitmap_names=(char**)kate_realloc(local_bitmap_names,n_local_bitmaps*sizeof(char*));
499 if (!local_bitmap_names) {
500 yyerror("Out of memory");
501 exit(-1);
502 }
503 local_bitmap_names[n_local_bitmaps-1]=name?dupstring(name):NULL;
504 local_bitmaps=(kate_bitmap**)kate_realloc(local_bitmaps,n_local_bitmaps*sizeof(kate_bitmap*));
505 if (!local_bitmaps) {
506 yyerror("Out of memory");
507 exit(-1);
508 }
509 local_bitmaps[n_local_bitmaps-1]=NULL;
510 }
511 }
512
513 static int find_bitmap(const kate_info *ki,const char *name)
514 {
515 int ret=find_item(name,ki->nbitmaps,bitmap_names);
516 if (ret>=0) return ret;
517 ret=find_item(name,n_local_bitmaps,local_bitmap_names);
518 if (ret>=0) return ret+ki->nbitmaps;
519 return ret;
520 }
521
522 static void check_style(const kate_style *ks)
523 {
524 if (!ks) { yyerror("internal error: no style"); exit(-1); }
525 }
526
527 static void add_style(kate_info *ki,const char *name,const kate_style *ks)
528 {
529 int ret;
530 kate_style *ks2;
531
532 check_style(ks);
533
534 ks2=(kate_style*)kate_malloc(sizeof(*ks2));
535 if (!ks2) {
536 yyerrorf("Out of memory");
537 exit(-1);
538 }
539 memcpy(ks2,ks,sizeof(*ks2));
540
541 ret=kate_info_add_style(ki,ks2);
542 if (ret<0) {
543 yyerrorf("Failed to register style: %d",ret);
544 }
545 else {
546 style_names=(char**)kate_realloc(style_names,ki->nstyles*sizeof(char*));
547 if (!style_names) {
548 yyerror("Out of memory");
549 exit(-1);
550 }
551 style_names[ki->nstyles-1]=name?dupstring(name):NULL;
552 }
553 }
554
555 static int find_style(const kate_info *ki,const char *name)
556 {
557 return find_item(name,ki->nstyles,style_names);
558 }
559
560 static void check_region(const kate_region *kr)
561 {
562 if (!kr) { yyerror("internal error: no region"); exit(-1); }
563 if (kr->w<0) yyerrorf("Region width (%d) must be non negative",kr->w);
564 if (kr->h<0) yyerrorf("Region height (%d) must be non negative",kr->h);
565 }
566
567 static void add_region(kate_info *ki,const char *name,const kate_region *kr)
568 {
569 int ret;
570 kate_region *kr2;
571
572 check_region(kr);
573
574 kr2=(kate_region*)kate_malloc(sizeof(*kr2));
575 if (!kr2) {
576 yyerrorf("Out of memory");
577 exit(-1);
578 }
579 memcpy(kr2,kr,sizeof(*kr2));
580
581 ret=kate_info_add_region(ki,kr2);
582 if (ret<0) {
583 yyerrorf("Failed to register region: %d",ret);
584 }
585 else {
586 region_names=(char**)kate_realloc(region_names,ki->nregions*sizeof(char*));
587 if (!region_names) {
588 yyerror("Out of memory");
589 exit(-1);
590 }
591 region_names[ki->nregions-1]=name?dupstring(name):NULL;
592 }
593 }
594
595 static int find_region(const kate_info *ki,const char *name)
596 {
597 return find_item(name,ki->nregions,region_names);
598 }
599
600 static void check_curve(const kate_curve *kc)
601 {
602 size_t minpts=0,maxpts=INT_MAX;
603 if (!kc) { yyerror("internal error: no curve"); exit(-1); }
604 switch (kc->type) {
605 case kate_curve_none: minpts=0; maxpts=0; break;
606 case kate_curve_static: minpts=1; maxpts=1; break;
607 case kate_curve_linear: minpts=2; maxpts=INT_MAX; break;
608 case kate_curve_catmull_rom_spline: minpts=2; maxpts=INT_MAX; break;
609 case kate_curve_bezier_cubic_spline: minpts=3; maxpts=INT_MAX; break;
610 case kate_curve_bspline: minpts=2; maxpts=INT_MAX; break;
611 }
612 if (kc->npts<minpts) yyerrorf("Curve does not have enough points for this type (has %d, min pts %d)",kc->npts,minpts);
613 if (kc->npts>maxpts) yyerrorf("Curve has too many points for this type (has %d, max pts %d)",kc->npts,maxpts);
614 if (kc->type==kate_curve_bezier_cubic_spline) {
615 if ((kc->npts-1)%3) yyerrorf("Cubic Bezier splines should have 1+3n points");
616 }
617 }
618
619 static void add_curve(kate_info *ki,const char *name,kate_curve *kc)
620 {
621 int ret;
622
623 check_curve(kc);
624
625 ret=kate_info_add_curve(ki,kc);
626 if (ret<0) {
627 yyerrorf("Failed to register curve: %d",ret);
628 }
629 else {
630 curve_names=(char**)kate_realloc(curve_names,ki->ncurves*sizeof(char*));
631 if (!curve_names) {
632 yyerror("Out of memory");
633 exit(-1);
634 }
635 curve_names[ki->ncurves-1]=name?dupstring(name):NULL;
636 }
637 }
638
639 static int find_curve(const kate_info *ki,const char *name)
640 {
641 return find_item(name,ki->ncurves,curve_names);
642 }
643
644 static void clear_motions(void)
645 {
646 kate_free(kmotions);
647 kmotions=NULL;
648 kmotion=NULL;
649 nkmotions=0;
650 }
651
652 static void check_motion(kate_motion *kmotion)
653 {
654 if (!kmotion) { yyerror("internal error: no motion"); exit(-1); }
655
656 if (kmotion->ncurves==0) { yyerror("motion must have at least one curve"); return; }
657 if (kmotion->semantics==(kate_motion_semantics)-1) { yyerror("motion semantics is not defined"); return; }
658 }
659
660 static void add_motion(kate_info *ki,const char *name,kate_motion *km)
661 {
662 int ret;
663
664 check_motion(km);
665
666 ret=kate_info_add_motion(ki,km);
667 if (ret<0) {
668 yyerrorf("Failed to register motion: %d",ret);
669 }
670 else {
671 motion_names=(char**)kate_realloc(motion_names,ki->nmotions*sizeof(char*));
672 if (!motion_names) {
673 yyerror("Out of memory");
674 exit(-1);
675 }
676 motion_names[ki->nmotions-1]=name?dupstring(name):NULL;
677 }
678
679 clear_motions();
680 }
681
682 static int find_motion(const kate_info *ki,const char *name)
683 {
684 return find_item(name,ki->nmotions,motion_names);
685 }
686
687 static void init_style(kd_style *style)
688 {
689 int ret=kate_style_init(style);
690 if (ret<0) {
691 yyerrorf("Error initializing style: %d\n",ret);
692 exit(1);
693 }
694 }
695
696 static void set_font_width(kd_style *style,kate_float s,kate_space_metric metric)
697 {
698 if (style->font_width>=0) {
699 yyerror("Font width already set");
700 }
701 if (style->font_height>=0 && style->font_metric!=metric) {
702 yyerror("All font size metrics must be the same");
703 }
704 style->font_width=s;
705 style->font_metric=metric;
706 }
707
708 static void set_font_height(kd_style *style,kate_float s,kate_space_metric metric)
709 {
710 if (style->font_height>=0) {
711 yyerror("Font height already set");
712 }
713 if (style->font_width>=0 && style->font_metric!=metric) {
714 yyerror("All font size metrics must be the same");
715 }
716 style->font_height=s;
717 style->font_metric=metric;
718 }
719
720 static void set_font(kd_style *style,const char *font)
721 {
722 size_t len;
723 if (!font) {
724 yyerror("Internal error: no font");
725 exit(-1);
726 }
727 len=strlen(font);
728 if (style->font) {
729 yyerror("Font already set");
730 }
731 style->font=(char*)kate_malloc(len+1);
732 if (!style->font) {
733 yyerror("out of memory");
734 exit(-1);
735 }
736 strcpy(style->font,font);
737 }
738
739 static void set_font_size(kd_style *style,kate_float s,kate_space_metric metric)
740 {
741 if (style->font_height>=0 || style->font_width>=0) {
742 yyerror("Font width and/or height already set");
743 }
744 style->font_width=s;
745 style->font_height=s;
746 style->font_metric=metric;
747 }
748
749 static void set_margin(kd_style *style,kate_float *margin,kate_float m,kate_space_metric metric)
750 {
751 int metric_already_set=0;
752 if (&style->left_margin!=margin && style->left_margin!=0) metric_already_set=1;
753 if (&style->top_margin!=margin && style->top_margin!=0) metric_already_set=1;
754 if (&style->right_margin!=margin && style->right_margin!=0) metric_already_set=1;
755 if (&style->bottom_margin!=margin && style->bottom_margin!=0) metric_already_set=1;
756 if (metric_already_set && metric!=style->margin_metric) {
757 yyerror("Metric must be the same for all margins");
758 return;
759 }
760 *margin=m;
761 style->margin_metric=metric;
762 }
763
764 static void set_margins(kd_style *style,
765 kate_float left,kate_space_metric left_metric,
766 kate_float top,kate_space_metric top_metric,
767 kate_float right,kate_space_metric right_metric,
768 kate_float bottom,kate_space_metric bottom_metric)
769 {
770 if (left_metric!=right_metric || left_metric!=top_metric || left_metric!=bottom_metric) {
771 yyerror("Metric must be the same for all margins");
772 return;
773 }
774 style->left_margin=left;
775 style->top_margin=top;
776 style->right_margin=right;
777 style->bottom_margin=bottom;
778 style->margin_metric=left_metric;
779 }
780
781 static void init_style_from(int idx)
782 {
783 const kate_style *from=ki.styles[idx];
784 init_style(&kstyle);
785 memcpy(&kstyle,from,sizeof(kate_style));
786 }
787
788 static void init_region(kd_region *region)
789 {
790 int ret=kate_region_init(region);
791 if (ret<0) {
792 yyerrorf("Error initializing region: %d\n",ret);
793 exit(1);
794 }
795 }
796
797 static void init_region_from(int idx)
798 {
799 const kate_region *from=ki.regions[idx];
800 init_region(&kregion);
801 memcpy(&kregion,from,sizeof(kate_region));
802 }
803
804 static void reference_curve_from(int idx)
805 {
806 kcurve.idx=idx;
807 kcurve.curve=NULL;
808 }
809
810 static void init_curve(void)
811 {
812 kcurve.idx=0;
813 kcurve.curve=(kate_curve*)kate_malloc(sizeof(kate_curve));
814 if (!kcurve.curve) { yyerror("out of memory"); exit(-1); }
815 if (kate_curve_init(kcurve.curve)<0) {
816 yyerror("error initializing curve");
817 exit(-1);
818 }
819 }
820
821 static void init_curve_from(int idx)
822 {
823 const kate_curve *from=ki.curves[idx];
824 if (!from || !from->pts) {
825 yyerror("invalid curve to init from");
826 exit(-1);
827 }
828 init_curve();
829 memcpy(kcurve.curve,from,sizeof(kate_curve));
830 kcurve.curve->pts=(kate_float*)kate_malloc(kcurve.curve->npts*2*sizeof(kate_float));
831 if (!kcurve.curve->pts) {
832 yyerror("out of memory");
833 exit(-1);
834 }
835 memcpy(kcurve.curve->pts,from->pts,kcurve.curve->npts*2*sizeof(kate_float));
836 }
837
838 static void init_curve_points(int npts)
839 {
840 if (!kcurve.curve) { yyerror("internal error: curve not initialized"); exit(-1); }
841 if (n_curve_pts<0) { katedesc_error("Curve type must be specified before the points"); exit(-1); }
842 if (npts<=0) { katedesc_error("Number of points cannot be negative or zero"); exit(-1); }
843 kcurve.curve->npts=npts;
844 kcurve.curve->pts=(kate_float*)kate_malloc(npts*2*sizeof(kate_float));
845 if (!kcurve.curve->pts) {
846 yyerror("Out of memory");
847 exit(-1);
848 }
849 open_ended_curve=0;
850 }
851
852 static void init_open_ended_curve_points(void)
853 {
854 if (!kcurve.curve) { yyerror("internal error: curve not initialized"); exit(-1); }
855 if (n_curve_pts<0) katedesc_error("Curve type must be specified before the points");
856 kcurve.curve->npts=0;
857 kcurve.curve->pts=NULL;
858 open_ended_curve=1;
859 }
860
861 static void add_open_ended_curve_point(kate_float pt)
862 {
863 if (!kcurve.curve) { yyerror("internal error: curve not initialized"); exit(-1); }
864 ++n_curve_pts;
865 kcurve.curve->npts=(n_curve_pts+1)/2;
866 kcurve.curve->pts=(kate_float*)kate_realloc(kcurve.curve->pts,kcurve.curve->npts*2*sizeof(kate_float));
867 if (!kcurve.curve->pts) {
868 yyerror("Out of memory");
869 exit(-1);
870 }
871 kcurve.curve->pts[n_curve_pts-1]=pt;
872 }
873
874 static void init_palette_colors(int ncolors)
875 {
876 if (!kpalette.palette) { yyerror("internal error: palette not initialized"); exit(-1); }
877 kpalette.palette->ncolors=ncolors;
878 kpalette.palette->colors=(kate_color*)kate_malloc(ncolors*sizeof(kate_color));
879 if (!kpalette.palette->colors) {
880 yyerror("Out of memory");
881 exit(-1);
882 }
883 n_palette_colors=0;
884 }
885
886 static void init_bitmap_pixels(int width,int height,int bpp)
887 {
888 if (!kbitmap.bitmap) { yyerror("internal error: bitmap not initialized"); exit(-1); }
889 if (width<=0 || height<=0) yyerror("Bitmap dimensions must be positive");
890 if (bpp<=0) yyerror("Bitmap bit depth must be positive");
891 if (bpp>8) yyerrorf("Bitmap bit depth must not be more than 8 (is %d)",bpp);
892 kbitmap.bitmap->type=kate_bitmap_type_paletted;
893 kbitmap.bitmap->width=width;
894 kbitmap.bitmap->height=height;
895 kbitmap.bitmap->bpp=bpp;
896 kbitmap.bitmap->pixels=(unsigned char*)kate_malloc(width*height*sizeof(unsigned char));
897 if (!kbitmap.bitmap->pixels) {
898 yyerror("Out of memory");
899 exit(-1);
900 }
901 kbitmap.bitmap->size=0;
902 n_bitmap_pixels=0;
903 }
904
905 static void init_png_bitmap_pixels(int width,int height,int size)
906 {
907 if (!kbitmap.bitmap) { yyerror("internal error: bitmap not initialized"); exit(-1); }
908 if (width<=0 || height<=0) yyerror("Bitmap dimensions must be positive");
909 kbitmap.bitmap->type=kate_bitmap_type_png;
910 kbitmap.bitmap->width=width;
911 kbitmap.bitmap->height=height;
912 kbitmap.bitmap->bpp=0;
913 kbitmap.bitmap->pixels=(unsigned char*)kate_malloc(size);
914 if (!kbitmap.bitmap->pixels) {
915 yyerror("Out of memory");
916 exit(-1);
917 }
918 kbitmap.bitmap->size=size;
919 n_bitmap_pixels=0;
920 }
921
922 static void init_byte_stream(int nbytes)
923 {
924 if (nbytes<0) { yyerror("internal error: negative number of bytes"); exit(-1); }
925 byte_stream=(char*)kate_malloc(nbytes);
926 if (!byte_stream) {
927 yyerror("Out of memory");
928 exit(-1);
929 }
930 n_bytes_in_stream=0;
931 byte_stream_size=nbytes;
932 }
933
934 static void set_color(kate_color *kc,uint32_t c)
935 {
936 int r=(c>>24)&0xff;
937 int g=(c>>16)&0xff;
938 int b=(c>>8)&0xff;
939 int a=(c>>0)&0xff;
940 if (!kc) {
941 yyerror("Internal error: null color");
942 exit(-1);
943 }
944 if (r<0 || r>255) yyerrorf("red component (%d) must be between 0 and 255",r);
945 if (g<0 || g>255) yyerrorf("green component (%d) must be between 0 and 255",g);
946 if (b<0 || b>255) yyerrorf("blue component (%d) must be between 0 and 255",b);
947 if (a<0 || a>255) yyerrorf("alpha component (%d) must be between 0 and 255",a);
948 kc->r=r;
949 kc->g=g;
950 kc->b=b;
951 kc->a=a;
952 }
953
954 static void init_event(kd_event *ev)
955 {
956 if (!ev) {
957 yyerror("Internal error: null event");
958 exit(-1);
959 }
960 ev->t0=ev->t1=ev->duration=(kate_float)-1.0;
961 ev->text=NULL;
962 ev->text_markup_type=kate_markup_none;
963 ev->region_index=ev->style_index=ev->secondary_style_index=-1;
964 ev->region=NULL;
965 ev->style=NULL;
966 ev->secondary_style=NULL;
967 ev->palette_index=ev->bitmap_index=-1;
968 ev->palette=NULL;
969 ev->bitmap=NULL;
970 }
971
972 static void kd_encode_set_id(kate_state *kstate,unsigned int id)
973 {
974 if (id&0x80000000) yyerrorf("ID %d (hex %x) out of range, must fit on 31 bits",id,id);
975
976 /* unused at the moment - will need to map an autogenerated id to this user id */
977 (void)kstate;
978 (void)id;
979 }
980
981 static int add_entity(const char *entity,char **text,size_t *wlen0)
982 {
983 int count=0;
984
985 if (!entity || !text || !wlen0) {
986 yyerror("internal error: add_entity passed null parameter");
987 exit(-1);
988 }
989
990 /* write out the entity */
991 while (*entity) {
992 int ret=kate_text_set_character(kate_utf8,*entity,text,wlen0);
993 if (ret<0) return ret;
994 count+=ret;
995 ++entity;
996 }
997 return count;
998 }
999
1000 static char *expand_numeric_entities(const char *text)
1001 {
1002 enum {
1003 s_text,
1004 s_amp,
1005 s_code,
1006 s_named
1007 } state=s_text;
1008 int c,code=0,code_from_numeric,base=-1;
1009 size_t len=strlen(text),len0=len+1,rlen0=len0,wlen0=len0,allocated=len0;
1010 /* we might need to replace "&#00;" with "&amp;" - we can't use more characters, so we needn't allocate more */
1011 /* this might change if we even can replace a numeric entity with a named one that is longer as a string */
1012 char *newtext=(char*)kate_malloc(allocated),*newtextptr=newtext;
1013
1014 if (!newtext) { yyerror("out of memory"); exit(-1); }
1015
1016 while (1) {
1017 int ret=kate_text_get_character(kate_utf8,&text,&rlen0);
1018 if (ret<0) {
1019 yyerrorf("failed to read character: %d",ret);
1020 kate_free(newtext);
1021 return NULL;
1022 }
1023 c=ret;
1024
1025 code_from_numeric=0;
1026 switch (state) {
1027 case s_text:
1028 if (c=='&') {
1029 state=s_amp;
1030 code=0;
1031 }
1032 break;
1033 case s_amp:
1034 if (c=='#') {
1035 state=s_code;
1036 base=-1; /* unknown yet */
1037 }
1038 else {
1039 state=s_named;
1040
1041 /* we've encountered a named entity, and we've discarded the & already,
1042 so we need to add it now before the newly read character */
1043 ret=kate_text_set_character(kate_utf8,'&',&newtextptr,&wlen0);
1044 if (ret<0) {
1045 yyerrorf("failed to write character: %d",ret);
1046 kate_free(newtext);
1047 return NULL;
1048 }
1049 }
1050 break;
1051 case s_code:
1052 if (c==';') {
1053 if (base<0) {
1054 /* no code given */
1055 yyerrorf("no code given in numeric entity");
1056 c=0;
1057 code_from_numeric=1;
1058 state=s_text;
1059 }
1060 else {
1061 c=code; /* this will be written below */
1062 code_from_numeric=1;
1063 state=s_text;
1064 }
1065 }
1066 else {
1067 /* if first character, determine if this is decimal or hexadecimal */
1068 if (base<0) {
1069 if (c=='x' || c=='X') {
1070 base=16;
1071 break; /* the code starts next character */
1072 }
1073 else {
1074 base=10;
1075 /* fall through */
1076 }
1077 }
1078
1079 code*=base;
1080 if (isdigit(c)) code+=(c-'0');
1081 else if (base==16 && isxdigit(c)) code+=(tolower(c)-'a'+10);
1082 else yyerrorf("invalid character in numeric entity (only numeric entities are supported), got %d",c);
1083 }
1084 break;
1085 case s_named:
1086 if (c==';') {
1087 state=s_text;
1088 }
1089 break;
1090 }
1091
1092 if (state==s_text || state==s_named) {
1093 /* we don't want to expand characters in "<&>" as they would then be wrongly interpreted,
1094 so we insert here as entities - note that we don't want to expand them and do another
1095 pass to reencode them, as we then might pick up others that *were* in the text verbatim */
1096 if (code_from_numeric && (c&~0xff)==0 && strchr("<&>",c)) {
1097 switch (c) {
1098 case '<': ret=add_entity("&lt;",&newtextptr,&wlen0); break;
1099 case '&': ret=add_entity("&amp;",&newtextptr,&wlen0); break;
1100 case '>': ret=add_entity("&gt;",&newtextptr,&wlen0); break;
1101 }
1102 }
1103 else {
1104 ret=kate_text_set_character(kate_utf8,c,&newtextptr,&wlen0);
1105 }
1106 if (ret<0) {
1107 yyerrorf("failed to write character: %d",ret);
1108 kate_free(newtext);
1109 return NULL;
1110 }
1111 }
1112 if (c==0) break;
1113 }
1114 return newtext;
1115 }
1116
1117 static char *getrawline(const char **text)
1118 {
1119 size_t rlen0;
1120 int newline,in_newline=0;
1121 const char *start_of_line;
1122 int c;
1123
1124 if (!text || !*text) {
1125 yyerror("error: getrawline passed invalid text pointer");
1126 exit(-1);
1127 }
1128
1129 rlen0=strlen(*text)+1;
1130 start_of_line=*text;
1131
1132 while (1) {
1133 const char *ptr=*text;
1134 int ret=kate_text_get_character(kate_utf8,text,&rlen0);
1135 if (ret<0) {
1136 yyerrorf("failed to read character: %d",ret);
1137 return NULL;
1138 }
1139 c=ret;
1140 if (c==0) {
1141 /* end of the string, return everything */
1142 size_t len=strlen(start_of_line);
1143 char *line=(char*)kate_malloc(len+1);
1144 memcpy(line,start_of_line,len+1);
1145 *text=ptr; /* do not push past the start of the new line */
1146 return line;
1147 }
1148 newline=(c=='\r' || c=='\n');
1149 if (!newline && in_newline) {
1150 /* we are at the start of a new line */
1151 char *line=(char*)kate_malloc(ptr-start_of_line+1);
1152 memcpy(line,start_of_line,ptr-start_of_line);
1153 line[ptr-start_of_line]=0;
1154 *text=ptr; /* do not push past the start of the new line */
1155 return line;
1156 }
1157 in_newline=newline;
1158 }
1159 }
1160
1161 static void trimend(char *line,size_t rlen0,int *eol)
1162 {
1163 int ret;
1164 int c;
1165 int ws;
1166 char *text=line;
1167
1168 if (!line) return;
1169
1170 ret=kate_text_get_character(kate_utf8,(const char**)&text,&rlen0);
1171 if (ret<0) {
1172 yyerrorf("failed to read character: %d",ret);
1173 return;
1174 }
1175 c=ret;
1176 if (c==0) {
1177 *eol=1;
1178 return;
1179 }
1180
1181 trimend(text,rlen0,eol);
1182
1183 ws=((c<=0xff) && (strchr(" \t\n\r",c)!=NULL));
1184 if (*eol && ws) *line=0;
1185 if (!ws) *eol=0;
1186 }
1187
1188 static char *trimline(const char *line)
1189 {
1190 char *trimmed;
1191 size_t rlen0;
1192 int c;
1193 int eol=0;
1194
1195 if (!line) {
1196 yyerror("error: trimline passed null line");
1197 exit(-1);
1198 }
1199
1200 rlen0=strlen(line)+1;
1201
1202 /* first seek to the first non whitespace character in the line */
1203 while (1) {
1204 const char *ptr=line;
1205 int ret=kate_text_get_character(kate_utf8,&ptr,&rlen0);
1206 if (ret<0) {
1207 yyerrorf("failed to read character: %d",ret);
1208 return NULL;
1209 }
1210 c=ret;
1211 if (!c || (c!=' ' && c!='\t')) {
1212 /* we found a non whitespace, or an end of line, stop */
1213 break;
1214 }
1215 /* we can advance the start of the line */
1216 line=ptr;
1217 }
1218
1219 rlen0=strlen(line)+1;
1220 trimmed=(char*)kate_malloc(rlen0);
1221 memcpy(trimmed,line,rlen0);
1222 trimend(trimmed,strlen(trimmed)+1,&eol);
1223 return trimmed;
1224 }
1225
1226 static char *trimtext(const char *text)
1227 {
1228 char *newtext=(char*)kate_malloc(1);
1229 *newtext=0;
1230 while (text && *text) {
1231 char *line=getrawline(&text);
1232 char *trimmed=trimline(line);
1233 kate_free(line);
1234 if (*trimmed && strcmp(trimmed,"\n")) {
1235 /* ignore empty lines */
1236 if (newtext && *newtext) {
1237 /* add a newline between lines (eg, not before the first line) */
1238 newtext=catstrings(newtext,"\n");
1239 }
1240 newtext=catstrings(newtext,trimmed);
1241 }
1242 kate_free(trimmed);
1243 }
1244 return newtext;
1245 }
1246
1247 static char *trimtext_pre(const char *text)
1248 {
1249 /* in pre, we just kill a new line at start and one at the end, if any */
1250 size_t len;
1251 char *newtext;
1252
1253 if (!text) {
1254 yyerror("error: trimtext_pre passed null text");
1255 exit(-1);
1256 }
1257
1258 len=strlen(text);
1259 newtext=(char*)kate_malloc(len+1);
1260
1261 /* start */
1262 if (*text=='\n') {
1263 memcpy(newtext,text+1,len);
1264 --len;
1265 }
1266 else {
1267 memcpy(newtext,text,len+1);
1268 }
1269
1270 /* end */
1271 if (len>0 && newtext[len-1]=='\n') {
1272 newtext[len-1]=0;
1273 }
1274
1275 return newtext;
1276 }
1277
1278 static void backslash_n_to_newline(char *text)
1279 {
1280 char *ptr=text;
1281 while (ptr && (ptr=strstr(ptr,"\\n"))) {
1282 *ptr='\n';
1283 memmove(ptr+1,ptr+2,strlen(ptr+2)+1);
1284 }
1285 }
1286
1287 static void set_event_text(kd_event *ev,const char *text,int pre,int markup)
1288 {
1289 char *newtext,*expanded;
1290 size_t len;
1291
1292 if (ev->text) {
1293 yyerrorf("text already set (to %s, trying to set to %s)",ev->text,text);
1294 return;
1295 }
1296 if (!text) {
1297 yyerror("null text");
1298 return;
1299 }
1300
1301 len=strlen(text);
1302 newtext=(char*)kate_malloc(len+1);
1303 memcpy(newtext,text,len+1);
1304 backslash_n_to_newline(newtext);
1305
1306 expanded=expand_numeric_entities(newtext);
1307 kate_free(newtext);
1308 newtext=expanded;
1309
1310 if (!pre) {
1311 char *trimmed_newtext=trimtext(newtext);
1312 kate_free(newtext);
1313 newtext=trimmed_newtext;
1314 }
1315 else {
1316 char *trimmed_newtext=trimtext_pre(newtext);
1317 kate_free(newtext);
1318 newtext=trimmed_newtext;
1319 }
1320
1321 if (markup) {
1322 ev->text_markup_type=kate_markup_simple;
1323 }
1324 else {
1325 ev->text_markup_type=kate_markup_none;
1326 }
1327
1328 ev->text=newtext;
1329 }
1330
1331 static void set_event_text_from(kd_event *ev,const char *source,int pre,int markup)
1332 {
1333 FILE *f;
1334 char *text=NULL;
1335 char s[4096],*sret;
1336
1337 f=fopen(source,"rt");
1338 if (!f) {
1339 yyerrorf("Failed to open file %s\n",source);
1340 exit(-1);
1341 }
1342 sret=fgets(s,sizeof(s),f);
1343 if (!sret) {
1344 yyerrorf("Failed to read from file %s\n",source);
1345 exit(-1);
1346 }
1347 while (!feof(f)) {
1348 /* This implicitely forbids embedded zeros - could this be a problem ? */
1349 text=catstrings(text,s);
1350 sret=fgets(s,sizeof(s),f);
1351 if (!sret) {
1352 yyerrorf("Failed to read from file %s\n",source);
1353 exit(-1);
1354 }
1355 }
1356 fclose(f);
1357
1358 if (text) {
1359 set_event_text(ev,text,pre,markup);
1360 kate_free(text);
1361 }
1362 }
1363
1364 static void set_event_t0_t1(kd_event *ev,kate_float t0,kate_float t1)
1365 {
1366 if (ev->t0>=0) { yyerror("start time already set"); return; }
1367 if (ev->t1>=0) { yyerror("end time already set"); return; }
1368 ev->t0=t0;
1369 ev->t1=t1;
1370 }
1371
1372 static void set_event_t0(kd_event *ev,kate_float v)
1373 {
1374 if (ev->t0>=0) { yyerror("start time already set"); return; }
1375 ev->t0=v;
1376 }
1377
1378 static void set_event_t1(kd_event *ev,kate_float v)
1379 {
1380 if (ev->t1>=0) { yyerror("end time already set"); return; }
1381 ev->t1=v;
1382 }
1383
1384 static void set_event_duration(kd_event *ev,kate_float v)
1385 {
1386 if (ev->duration>=0) { yyerror("duration already set"); return; }
1387 ev->duration=v;
1388 }
1389
1390 static void set_event_region_index(kd_event *ev,int r)
1391 {
1392 int ret;
1393 if (ev->region_index>=0 || ev->region) { yyerror("region already set"); return; }
1394 ev->region_index=r;
1395 ret=kate_encode_set_region_index(&k,r);
1396 if (ret<0) yyerrorf("failed to set region index: %d",ret);
1397 }
1398
1399 static void set_event_region(kd_event *ev,kate_region *kr)
1400 {
1401 int ret;
1402 check_region(kr);
1403 if (ev->region_index>=0 || ev->region) { yyerror("region already set"); return; }
1404 ev->region=kr;
1405 ret=kate_encode_set_region(&k,kr);
1406 if (ret<0) yyerrorf("failed to set region: %d",ret);
1407 }
1408
1409 static void set_event_style_index(kd_event *ev,int s)
1410 {
1411 int ret;
1412 if (ev->style_index>=0 || ev->style) { yyerror("style already set"); return; }
1413 ev->style_index=s;
1414 ret=kate_encode_set_style_index(&k,s);
1415 if (ret<0) yyerrorf("failed to set style index: %d",ret);
1416 }
1417
1418 static void set_event_secondary_style_index(kd_event *ev,int s)
1419 {
1420 int ret;
1421 if (ev->secondary_style_index>=0 || ev->secondary_style) { yyerror("secondary style already set"); return; }
1422 ev->secondary_style_index=s;
1423 ret=kate_encode_set_secondary_style_index(&k,s);
1424 if (ret<0) yyerrorf("failed to set secondary style index: %d",ret);
1425 }
1426
1427 static void set_event_style(kd_event *ev,kate_style *ks)
1428 {
1429 int ret;
1430 check_style(ks);
1431 if (ev->style_index>=0 || ev->style) { yyerror("style already set"); return; }
1432 ev->style=ks;
1433 ret=kate_encode_set_style(&k,ks);
1434 if (ret<0) yyerrorf("failed to set style: %d",ret);
1435 }
1436
1437 static void set_event_secondary_style(kd_event *ev,kate_style *ks)
1438 {
1439 int ret;
1440 check_style(ks);
1441 if (ev->secondary_style_index>=0 || ev->secondary_style) { yyerror("secondary style already set"); return; }
1442 ev->secondary_style=ks;
1443 ret=kate_encode_set_secondary_style(&k,ks);
1444 if (ret<0) yyerrorf("failed to set secondary style: %d",ret);
1445 }
1446
1447 static void set_event_palette_index(kd_event *ev,int p)
1448 {
1449 int ret;
1450 if (ev->palette_index>=0 || ev->palette) { yyerror("palette already set"); return; }
1451 ev->palette_index=p;
1452 ret=kate_encode_set_palette_index(&k,p);
1453 if (ret<0) yyerrorf("failed to set palette index: %d",ret);
1454 }
1455
1456 static void set_event_palette(kd_event *ev,kate_palette *kp)
1457 {
1458 int ret;
1459 check_palette(kp);
1460 if (ev->palette_index>=0 || ev->palette) { yyerror("palette already set"); return; }
1461 ev->palette=kp;
1462 ret=kate_encode_set_palette(&k,kp);
1463 if (ret<0) yyerrorf("failed to set palette: %d",ret);
1464 }
1465
1466 static void set_event_bitmap_index(kd_event *ev,int b)
1467 {
1468 int ret;
1469 if (ev->bitmap_index>=0 || ev->bitmap) { yyerror("bitmap already set"); return; }
1470 ev->bitmap_index=b;
1471 ret=kate_encode_set_bitmap_index(&k,b);
1472 if (ret<0) yyerrorf("failed to set bitmap index: %d",ret);
1473 }
1474
1475 static void set_event_bitmap(kd_event *ev,kate_bitmap *kb)
1476 {
1477 int ret;
1478 check_bitmap(kb);
1479 if (ev->bitmap_index>=0 || ev->bitmap) { yyerror("bitmap already set"); return; }
1480 ev->bitmap=kb;
1481 ret=kate_encode_set_bitmap(&k,kb);
1482 if (ret<0) yyerrorf("failed to set bitmap: %d",ret);
1483 }
1484
1485 static void kd_add_event_meta(const char *tag,const char *value)
1486 {
1487 kate_meta *meta;
1488 int ret;
1489
1490 ret=kate_meta_create(&meta);
1491 if (ret>=0) {
1492 ret=kate_meta_add_string(meta,tag,value);
1493 if (ret>=0) {
1494 ret=kate_encode_merge_meta(&k,meta);
1495 if (ret<0) {
1496 kate_meta_destroy(meta);
1497 }
1498 }
1499 else {
1500 kate_meta_destroy(meta);
1501 }
1502 }
1503 if (ret<0) yyerrorf("failed to add metadata: %d",ret);
1504 }
1505
1506 static void kd_add_event_meta_byte_stream(const char *tag)
1507 {
1508 kate_meta *meta;
1509 int ret;
1510
1511 ret=kate_meta_create(&meta);
1512 if (ret>=0) {
1513 ret=kate_meta_add(meta,tag,byte_stream,byte_stream_size);
1514 if (ret>=0) {
1515 ret=kate_encode_merge_meta(&k,meta);
1516 if (ret<0) {
1517 kate_meta_destroy(meta);
1518 }
1519 }
1520 else {
1521 kate_meta_destroy(meta);
1522 }
1523 }
1524 if (ret<0) yyerrorf("failed to add metadata: %d",ret);
1525
1526 kate_free(byte_stream);
1527 byte_stream=NULL;
1528 n_bytes_in_stream=0;
1529 byte_stream_size=0;
1530 }
1531
1532 static kd_event *check_event(kd_event *ev)
1533 {
1534 /* we can set:
1535 start and end
1536 start and duration
1537 duration and end
1538 */
1539 int sets=0;
1540 if (ev->t0>=(kate_float)0.0) ++sets;
1541 if (ev->t1>=(kate_float)0.0) ++sets;
1542 if (ev->duration>=(kate_float)0.0) ++sets;
1543 if (sets<2) { yyerror("start/end times underspecified"); return NULL; }
1544 if (sets>2) { yyerror("start/end times overspecified"); return NULL; }
1545
1546 if (ev->t0<(kate_float)0.0) ev->t0=ev->t1-ev->duration;
1547 if (ev->t1<(kate_float)0.0) ev->t1=ev->t0+ev->duration;
1548
1549 return ev;
1550 }
1551
1552 static void init_motion(void)
1553 {
1554 kmotions=(kd_motion*)kate_realloc(kmotions,(nkmotions+1)*sizeof(kd_motion));
1555 if (!kmotions) { yyerror("out of memory"); exit(-1); }
1556 ++nkmotions;
1557 kmotions[nkmotions-1].idx=0;
1558 kmotions[nkmotions-1].motion=kate_malloc(sizeof(kate_motion));
1559 kmotion=kmotions[nkmotions-1].motion;
1560 if (!kmotion) { yyerror("out of memory"); exit(-1); }
1561
1562 if (kate_motion_init(kmotion)<0) {
1563 yyerror("failed to init motion");
1564 exit(-1);
1565 }
1566 kmotion->semantics=(kate_motion_semantics)-1;
1567 }
1568
1569 static void add_curve_to_motion(kate_motion *kmotion,kate_float duration)
1570 {
1571 kmotion->ncurves++;
1572 kmotion->curves=(kate_curve**)kate_realloc(kmotion->curves,kmotion->ncurves*sizeof(kate_curve*));
1573 if (!kmotion->curves) { yyerror("out of memory"); exit(-1); }
1574 kmotion->durations=(kate_float*)kate_realloc(kmotion->durations,kmotion->ncurves*sizeof(kate_float));
1575 if (!kmotion->durations) { yyerror("out of memory"); exit(-1); }
1576
1577 if (kcurve.curve) {
1578 check_curve(kcurve.curve);
1579 kmotion->curves[kmotion->ncurves-1]=kcurve.curve;
1580 kcurve.curve=NULL;
1581 }
1582 else {
1583 if (kcurve.idx>=ki.ncurves) {
1584 yyerror("Internal error: curve index out of range");
1585 exit(-1);
1586 }
1587 kmotion->curves[kmotion->ncurves-1]=ki.curves[kcurve.idx];
1588 }
1589
1590 kmotion->durations[kmotion->ncurves-1]=duration;
1591 }
1592
1593 static size_t get_num_glyphs(const char *text)
1594 {
1595 size_t len0;
1596 size_t nglyphs=0;
1597 int intag=0,c;
1598
1599 if (!text) { yyerror("Internal error: get_num_glyphs got NULL text"); exit(-1); }
1600
1601 len0=strlen(text)+1;
1602 while ((c=kate_text_get_character(kate_utf8,&text,&len0))>0) {
1603 if (c=='<') intag++;
1604 if (!intag) ++nglyphs;
1605 if (c=='>') intag--;
1606 }
1607 return nglyphs;
1608 }
1609
1610 static void init_simple_glyph_pointer_motion(void)
1611 {
1612 init_motion();
1613 kmotion->semantics=kate_motion_semantics_glyph_pointer_1;
1614 karaoke_base_height=(kate_float)0;
1615 karaoke_top_height=(kate_float)0;
1616 }
1617
1618 static int get_glyph_pointer_offset(unsigned int pointer_id)
1619 {
1620 if (pointer_id<1 || pointer_id>4) {
1621 yyerrorf("Only glyph pointers 1-4 are available (trying to set %d)",pointer_id);
1622 exit(-1);
1623 }
1624 return (kate_motion_semantics)(kate_motion_semantics_glyph_pointer_1+pointer_id-1);
1625 }
1626
1627 static kate_float get_last_glyph_x(const kate_motion *km)
1628 {
1629 const kate_curve *kc;
1630 if (!km) { yyerror("internal error: no motion"); exit(-1); }
1631 if (km->ncurves==0) return (kate_float)-0.5; /* by default, center of the glyph before the first one (eg, marks nothing yet) */
1632 kc=km->curves[km->ncurves-1];
1633 if (kc->npts<1) yyerror("internal error: no points in last curve");
1634 return kc->pts[kc->npts*2-2]; /* -1 would be y */
1635 }
1636
1637 static kate_float compute_karaoke_height(float y)
1638 {
1639 /* turn height (bottom to top) to screen coordinates (top to bottom): negate */
1640 return -(karaoke_base_height*(1-y)+karaoke_top_height*y);
1641 }
1642
1643 static void add_glyph_pause(kate_float dt,kate_float y)
1644 {
1645 init_curve();
1646 kcurve.curve->type=kate_curve_static;
1647 kcurve.curve->npts=1;
1648 kcurve.curve->pts=(kate_float*)kate_malloc(kcurve.curve->npts*2*sizeof(kate_float));
1649 if (!kcurve.curve->pts) { yyerror("out of memory"); exit(-1); }
1650 kcurve.curve->pts[0]=get_last_glyph_x(kmotion);
1651 kcurve.curve->pts[1]=compute_karaoke_height(y);
1652 add_curve_to_motion(kmotion,dt);
1653 }
1654
1655 static void add_glyph_transition(unsigned int glyph,kate_float dt,kate_float ystart,kate_float ytop,int absolute,kate_float pause_fraction)
1656 {
1657 /* get the last glyph position and the new one */
1658 kate_float x0=get_last_glyph_x(kmotion);
1659 kate_float x1=glyph+(kate_float)0.5;
1660 size_t n;
1661
1662 /* convert absolute to relative */
1663 if (absolute) {
1664 for (n=0;n<kmotion->ncurves;++n) dt-=kmotion->durations[n];
1665 }
1666
1667 if (dt<(kate_float)0.0) {
1668 yyerrorf("duration (%f) must not be negative\n",dt);
1669 exit(-1);
1670 }
1671
1672 /* add a pause before the next jump */
1673 if (pause_fraction>(kate_float)0.0) {
1674 kate_float delay=dt*pause_fraction;
1675 add_glyph_pause(delay,ystart);
1676 dt-=delay;
1677 if (dt<(kate_float)0.0) dt=(kate_float)0.0;
1678 x0=get_last_glyph_x(kmotion);
1679 }
1680
1681 init_curve();
1682
1683 if (dt==(kate_float)0.0) {
1684 /* if zero duration, just add static point at the end point */
1685 kcurve.curve->type=kate_curve_static;
1686 kcurve.curve->npts=1;
1687 kcurve.curve->pts=(kate_float*)kate_malloc(kcurve.curve->npts*2*sizeof(kate_float));
1688 if (!kcurve.curve->pts) { yyerror("out of memory"); exit(-1); }
1689 /* directly at the end position */
1690 kcurve.curve->pts[0]=x1;
1691 kcurve.curve->pts[1]=compute_karaoke_height(ystart);
1692 }
1693 else {
1694 kcurve.curve->type=kate_curve_catmull_rom_spline;
1695 kcurve.curve->npts=3+2; /* the two end points are duplicated */
1696 kcurve.curve->pts=(kate_float*)kate_malloc(kcurve.curve->npts*2*sizeof(kate_float));
1697 if (!kcurve.curve->pts) { yyerror("out of memory"); exit(-1); }
1698
1699 /* start position */
1700 kcurve.curve->pts[0]=kcurve.curve->pts[2]=x0;
1701 kcurve.curve->pts[1]=kcurve.curve->pts[3]=compute_karaoke_height(ystart);
1702
1703 /* the interpolated points */
1704 for (n=2;n<kcurve.curve->npts-2;++n) {
1705 kate_float t=(n-1)/(kate_float)(kcurve.curve->npts-2-1);
1706 kcurve.curve->pts[n*2]=kcurve.curve->pts[n*2+2]=x1*t+x0*((kate_float)1.0-t);
1707 kcurve.curve->pts[n*2+1]=kcurve.curve->pts[n*2+3]=compute_karaoke_height(ytop);
1708 }
1709
1710 /* end position */
1711 kcurve.curve->pts[kcurve.curve->npts*2-4]=kcurve.curve->pts[kcurve.curve->npts*2-2]=x1;
1712 kcurve.curve->pts[kcurve.curve->npts*2-3]=kcurve.curve->pts[kcurve.curve->npts*2-1]=compute_karaoke_height(ystart);
1713 }
1714
1715 add_curve_to_motion(kmotion,dt);
1716 }
1717
1718 static void add_glyph_transition_to_text(const char *text,kate_float dt,kate_float ystart,kate_float ytop,int absolute,kate_float pause_fraction)
1719 {
1720 char *newtext;
1721
1722 if (!text) {
1723 yyerror("null text");
1724 return;
1725 }
1726
1727 if (kevent.text) {
1728 char *text2=(char*)kate_realloc(kevent.text,strlen(kevent.text)+strlen(text)+1);
1729 if (!text2) {
1730 yyerror("out of memory");
1731 return;
1732 }
1733 strcat(text2,text);
1734 kevent.text=text2;
1735 }
1736 else {
1737 char *text2=(char*)kate_malloc(strlen(text)+1);
1738 if (!text2) {
1739 yyerror("out of memory");
1740 return;
1741 }
1742 strcpy(text2,text);
1743 kevent.text=text2;
1744 }
1745
1746 backslash_n_to_newline(kevent.text);
1747 newtext=expand_numeric_entities(kevent.text);
1748 if (!newtext) return;
1749 kate_free(kevent.text);
1750 kevent.text=newtext;
1751
1752 add_glyph_transition(get_num_glyphs(kevent.text)-1,dt,ystart,ytop,absolute,pause_fraction);
1753 }
1754
1755 static void set_style_morph(kd_event *ev,int from,int to)
1756 {
1757 int ret;
1758
1759 if (!ev) {
1760 yyerror("internal error: no event");
1761 exit(-1);
1762 }
1763 if (from<0 || to<0) {
1764 yyerror("error: style index cannot be negative");
1765 exit(-1);
1766 }
1767
1768 if (ev->style_index>=0 || ev->style) { yyerror("style already set"); return; }
1769 ev->style_index=from;
1770 ret=kate_encode_set_style_index(&k,from);
1771 if (ret<0) yyerrorf("failed to set style index: %d",ret);
1772
1773 if (ev->secondary_style_index>=0 || ev->secondary_style) { yyerror("secondary style already set"); return; }
1774 ev->secondary_style_index=to;
1775 ret=kate_encode_set_secondary_style_index(&k,to);
1776 if (ret<0) yyerrorf("failed to set secondary_style index: %d",ret);
1777 }
1778
1779 static void clear_local_bitmaps(void)
1780 {
1781 size_t n;
1782
1783 if (local_bitmap_names) {
1784 for (n=0;n<n_local_bitmaps;++n) {
1785 if (local_bitmap_names[n]) kate_free(local_bitmap_names[n]);
1786 if (local_bitmaps[n]) {
1787 if(local_bitmaps[n]->meta) kate_meta_destroy(local_bitmaps[n]->meta);
1788 kate_free(local_bitmaps[n]->pixels);
1789 kate_free(local_bitmaps[n]);
1790 }
1791 }
1792 kate_free(local_bitmap_names);
1793 local_bitmap_names=NULL;
1794 kate_free(local_bitmaps);
1795 local_bitmaps=NULL;
1796 }
1797 n_local_bitmaps=0;
1798 }
1799
1800 static void clear_event(kd_event *ev)
1801 {
1802 if (!ev) {
1803 yyerror("internal error: no event");
1804 exit(-1);
1805 }
1806 if (ev->text) {
1807 kate_free(ev->text);
1808 ev->text=NULL;
1809 }
1810 clear_motions();
1811 clear_local_bitmaps();
1812 }
1813
1814 static void kd_finalize_simple_timed_glyph_motion(kate_motion *kmotion)
1815 {
1816 const kd_event *ev=&kevent;
1817 kate_float duration=ev->duration;
1818 kate_float t0=ev->t0,t1=ev->t1;
1819 kate_float duration_so_far;
1820 size_t n;
1821 int sets;
1822
1823 if (!kmotion) {
1824 yyerror("internal error: kd_finalize_simple_timed_glyph_motion passed NULL motion");
1825 exit(-1);
1826 }
1827
1828 /* for this helper motion, we require the timing of the event to be known in advance */
1829 sets=0;
1830 if (t0>=(kate_float)0.0) ++sets;
1831 if (t1>=(kate_float)0.0) ++sets;
1832 if (duration>=(kate_float)0.0) ++sets;
1833 if (sets<2) { yyerror("start/end times must be specified before timed glyph marker motion setup"); return; }
1834 if (sets>2) { yyerror("start/end times overspecified"); return; }
1835
1836 if (t0<(kate_float)0.0) t0=t1-duration;
1837 if (t1<(kate_float)0.0) t1=t0+duration;
1838 duration=t1-t0;
1839
1840 /* add a pause to take us to the end time */
1841 duration_so_far=(kate_float)0.0;
1842 for (n=0;n<kmotion->ncurves;++n) duration_so_far+=kmotion->durations[n];
1843 if (duration_so_far>duration) {
1844 yyerrorf("Simple timed glyph motion lasts longer than its event (motion %f, event %f)",duration_so_far,duration);
1845 exit(-1);
1846 }
1847 add_glyph_pause(duration-duration_so_far,(kate_float)1.0);
1848 }
1849
1850 static void set_motion_mapping(kate_motion *kmotion,kate_motion_mapping x_mapping,kate_motion_mapping y_mapping)
1851 {
1852 if (!kmotion) {
1853 yyerror("internal error: set_motion_mapping passed NULL motion");
1854 exit(-1);
1855 }
1856
1857 kmotion->x_mapping=x_mapping;
1858 kmotion->y_mapping=y_mapping;
1859 }
1860
1861 static void set_motion_semantics(kate_motion *kmotion,kate_motion_semantics semantics)
1862 {
1863 if (!kmotion) {
1864 yyerror("internal error: set_motion_semantics passed NULL motion");
1865 exit(-1);
1866 }
1867
1868 if (kmotion->semantics!=(kate_motion_semantics)-1) { yyerror("semantics is already defined"); return; }
1869 kmotion->semantics=semantics;
1870 }
1871
1872 static kate_motion_semantics kd_get_marker_position_semantics(int n)
1873 {
1874 switch (n) {
1875 case 1: return kate_motion_semantics_marker1_position;
1876 case 2: return kate_motion_semantics_marker2_position;
1877 case 3: return kate_motion_semantics_marker3_position;
1878 case 4: return kate_motion_semantics_marker4_position;
1879 default: yyerrorf("Invalid marker number: %d (only 1-4 are supported)",n); exit(-1);
1880 }
1881 return kate_motion_semantics_marker4_position;
1882 }
1883
1884 static kate_motion_semantics kd_get_marker_bitmap_semantics(int n)
1885 {
1886 switch (n) {
1887 case 1: return kate_motion_semantics_marker1_bitmap;
1888 case 2: return kate_motion_semantics_marker2_bitmap;
1889 case 3: return kate_motion_semantics_marker3_bitmap;
1890 case 4: return kate_motion_semantics_marker4_bitmap;
1891 default: yyerrorf("Invalid marker number: %d (only 1-4 are supported)",n); exit(-1);
1892 }
1893 return kate_motion_semantics_marker4_bitmap;
1894 }
1895
1896 static kate_motion_semantics kd_get_glyph_pointer_semantics(int n)
1897 {
1898 switch (n) {
1899 case 1: return kate_motion_semantics_glyph_pointer_1;
1900 case 2: return kate_motion_semantics_glyph_pointer_2;
1901 case 3: return kate_motion_semantics_glyph_pointer_3;
1902 case 4: return kate_motion_semantics_glyph_pointer_4;
1903 default: yyerrorf("Invalid glyph pointer number: %d (only 1-4 are supported)",n); exit(-1);
1904 }
1905 return kate_motion_semantics_glyph_pointer_4;
1906 }
1907
1908 static kate_motion_semantics kd_get_glyph_pointer_bitmap_semantics(int n)
1909 {
1910 switch (n) {
1911 case 1: return kate_motion_semantics_glyph_pointer_1_bitmap;
1912 case 2: return kate_motion_semantics_glyph_pointer_2_bitmap;
1913 case 3: return kate_motion_semantics_glyph_pointer_3_bitmap;
1914 case 4: return kate_motion_semantics_glyph_pointer_4_bitmap;
1915 default: yyerrorf("Invalid glyph pointer number: %d (only 1-4 are supported)",n); exit(-1);
1916 }
1917 return kate_motion_semantics_glyph_pointer_4_bitmap;
1918 }
1919
1920 static void kd_add_event_motion(kate_motion *kmotion)
1921 {
1922 int ret;
1923
1924 if (!kmotion) {
1925 yyerror("internal error: kd_add_event_motion passed NULL motion");
1926 exit(-1);
1927 }
1928
1929 check_motion(kmotion);
1930 ret=kate_encode_add_motion(&k,kmotion,1);
1931 if (ret<0) {
1932 yyerrorf("failed to add motion: %d",ret);
1933 exit(-1);
1934 }
1935 clear_motions();
1936 }
1937
1938 static void kd_add_event_motion_index(size_t idx)
1939 {
1940 int ret;
1941
1942 if (idx>=ki.nmotions) { yyerrorf("Motion index %u out of range (%u motions available)",idx,ki.nmotions); exit(-1); }
1943
1944 ret=kate_encode_add_motion_index(&k,idx);
1945 if (ret<0) {
1946 yyerrorf("failed to add motion: %d",ret);
1947 exit(-1);
1948 }
1949 clear_motions();
1950 }
1951
1952 static void init_font_range(void)
1953 {
1954 krange=(kate_font_range*)kate_malloc(sizeof(kate_font_range));
1955 if (!krange) { yyerror("out of memory"); exit(-1); }
1956 krange->first_code_point=-1;
1957 krange->last_code_point=-1;
1958 krange->first_bitmap=-1;
1959 }
1960
1961 static void set_font_range_code_point_string(int *cp,const char *s)
1962 {
1963 size_t len0;
1964 int ret,c;
1965
1966 if (!cp) { yyerror("internal error: no code point pointer"); exit(-1); }
1967 if (!s) { yyerror("internal error: no string"); exit(-1); }
1968 len0=strlen(s)+1;
1969 ret=kate_text_get_character(kate_utf8,&s,&len0);
1970 if (ret<0) {
1971 yyerrorf("failed to get character from string: %d",ret);
1972 return;
1973 }
1974 c=ret;
1975 ret=kate_text_get_character(kate_utf8,&s,&len0);
1976 if (ret<0) {
1977 yyerrorf("failed to get character from string: %d",ret);
1978 return;
1979 }
1980 if (ret) {
1981 yyerror("code point string should contain only one character");
1982 return;
1983 }
1984 *cp=c;
1985 }
1986
1987 static void set_font_range_first_code_point_string(const char *s)
1988 {
1989 if (!s) { yyerror("internal error: no string"); exit(-1); }
1990 if (!krange) { yyerror("internal error: no font range"); exit(-1); }
1991 set_font_range_code_point_string(&krange->first_code_point,s);
1992 }
1993
1994 static void set_font_range_last_code_point_string(const char *s)
1995 {
1996 if (!s) { yyerror("internal error: no string"); exit(-1); }
1997 if (!krange) { yyerror("internal error: no font range"); exit(-1); }
1998 set_font_range_code_point_string(&krange->last_code_point,s);
1999 }
2000
2001 static void set_font_range_first_code_point(int idx)
2002 {
2003 if (!krange) { yyerror("internal error: no font range"); exit(-1); }
2004 krange->first_code_point=idx;
2005 }
2006
2007 static void set_font_range_last_code_point(int idx)
2008 {
2009 if (!krange) { yyerror("internal error: no font range"); exit(-1); }
2010 krange->last_code_point=idx;
2011 }
2012
2013 static void set_font_range_first_bitmap(int idx)
2014 {
2015 if (!krange) { yyerror("internal error: no font range"); exit(-1); }
2016 krange->first_bitmap=idx;
2017 }
2018
2019 static void add_font_range(kate_info *ki,const char *name,kate_font_range *kfr)
2020 {
2021 int ret;
2022 if (!ki || !kfr) { yyerror("internal error: no kate_info or kate_font_range"); exit(-1); }
2023 if (!krange) { yyerror("internal error: no font range"); exit(-1); }
2024 if (krange->first_code_point<0) yyerror("first code point not set");
2025 if (krange->last_code_point<0) yyerror("last code point not set");
2026 if (krange->last_code_point<krange->first_code_point) yyerror("last code point cannnot be less than first code point");
2027 if (krange->first_bitmap<0) yyerror("bitmap index not set");
2028 ret=kate_info_add_font_range(ki,kfr);
2029 if (ret<0) {
2030 yyerrorf("failed to add font range: %d",ret);
2031 }
2032 else {
2033 font_range_names=(char**)kate_realloc(font_range_names,ki->nfont_ranges*sizeof(char*));
2034 if (!font_range_names) {
2035 yyerror("Out of memory");
2036 exit(-1);
2037 }
2038 font_range_names[ki->nfont_ranges-1]=name?dupstring(name):NULL;
2039 }
2040 }
2041
2042 static int find_font_range(const kate_info *ki,const char *name)
2043 {
2044 return find_item(name,ki->nfont_ranges,font_range_names);
2045 }
2046
2047 static void init_font_mapping(void)
2048 {
2049 kmapping=(kate_font_mapping*)kate_malloc(sizeof(kate_font_mapping));
2050 if (!kmapping) { yyerror("out of memory"); exit(-1); }
2051 kmapping->nranges=0;
2052 kmapping->ranges=NULL;
2053 }
2054
2055 static int check_font_overlap(const kate_font_range *kfr0,const kate_font_range *kfr1)
2056 {
2057 if (!kfr0 || !kfr1) return KATE_E_INVALID_PARAMETER;
2058
2059 if (kfr0->last_code_point<kfr1->first_code_point) return 0;
2060 if (kfr1->last_code_point<kfr0->first_code_point) return 0;
2061
2062 return KATE_E_INIT;
2063 }
2064
2065 static int check_font_ranges(const kate_font_mapping *kfm)
2066 {
2067 size_t n,l;
2068
2069 if (!kfm) return KATE_E_INVALID_PARAMETER;
2070
2071 for (n=0;n<kfm->nranges;++n) {
2072 const kate_font_range *kfr=kfm->ranges[n];
2073 if (!kfr) return KATE_E_INIT;
2074 if (kfr->last_code_point<kfr->first_code_point) return KATE_E_INIT;
2075 for (l=n+1;l<kfm->nranges;++l) {
2076 int ret=check_font_overlap(kfr,kfm->ranges[l]);
2077 if (ret<0) return ret;
2078 }
2079 }
2080
2081 return 0;
2082 }
2083
2084 static void add_font_range_to_mapping(void)
2085 {
2086 int ret;
2087
2088 if (!krange) { yyerror("internal error: no font range"); exit(-1); }
2089 if (!kmapping) { yyerror("internal error: no font mapping"); exit(-1); }
2090
2091 kmapping->ranges=(kate_font_range**)kate_realloc(kmapping->ranges,(kmapping->nranges+1)*sizeof(kate_font_range*));
2092 if (!kmapping->ranges) {
2093 yyerror("error: out of memory");
2094 exit(-1);
2095 }
2096 kmapping->ranges[kmapping->nranges]=krange;
2097 ++kmapping->nranges;
2098
2099 ret=check_font_ranges(kmapping);
2100 if (ret<0) yyerror("font mapping ranges overlap");
2101
2102 krange=NULL;
2103 }
2104
2105 static void add_font_mapping(kate_info *ki,const char *name,kate_font_mapping *kfm)
2106 {
2107 int ret;
2108 if (!ki) { yyerror("internal error: no kate_info"); exit(-1); }
2109 if (!kfm) { yyerror("internal error: no font mapping"); exit(-1); }
2110 if (kfm->nranges==0) yyerror("font mapping has no ranges");
2111 ret=kate_info_add_font_mapping(ki,kfm);
2112 if (ret<0) {
2113 yyerrorf("failed to add font mapping: %d",ret);
2114 }
2115 else {
2116 font_mapping_names=(char**)kate_realloc(font_mapping_names,ki->nfont_mappings*sizeof(char*));
2117 if (!font_mapping_names) {
2118 yyerror("Out of memory");
2119 exit(-1);
2120 }
2121 font_mapping_names[ki->nfont_mappings-1]=name?dupstring(name):NULL;
2122 }
2123 }
2124
2125 static int find_font_mapping(const kate_info *ki,const char *name)
2126 {
2127 return find_item(name,ki->nfont_mappings,font_mapping_names);
2128 }
2129
2130 static void kd_write_headers(void)
2131 {
2132 int ret=write_headers(katedesc_out);
2133 if (ret<0) {
2134 yyerrorf("Failed to write headers: %d\n",ret);
2135 exit(-1);
2136 }
2137 }
2138
2139 static void kd_encode_text(kate_state *kstate,kd_event *ev)
2140 {
2141 int ret;
2142 ogg_packet op;
2143
2144 if (!ev) { yyerror("internal error: no event"); exit(-1); }
2145 ret=kate_encode_set_markup_type(kstate,ev->text_markup_type);
2146 if (ret<0) {
2147 yyerrorf("failed to set text markup type: %d",ret);
2148 return;
2149 }
2150 update_stream_time(kstate,katedesc_out,kate_duration_granule(kstate->ki,timebase+ev->t0));
2151 ret=kate_ogg_encode_text(kstate,timebase+ev->t0,timebase+ev->t1,ev->text?ev->text:"",ev->text?strlen(ev->text):0,&op);
2152 if (ret<0) {
2153 yyerrorf("failed to encode text %s: %d",ev->text?ev->text:"<none>",ret);
2154 return;
2155 }
2156 ret=send_packet(katedesc_out,&op,kate_duration_granule(kstate->ki,timebase+ev->t0));
2157 if (ret<0) {
2158 yyerrorf("failed to send text packet: %d",ret);
2159 }
2160 }
2161
2162 static void kd_encode_set_language(kate_state *kstate,const char *s)
2163 {
2164 int ret;
2165 if (!s) { yyerror("internal error: no language string"); exit(-1); }
2166 ret=kate_encode_set_language(kstate,s);
2167 if (ret<0) yyerrorf("failed to set event language override: %d",ret);
2168 }
2169
2170 static uint32_t make_color(uint32_t r,uint32_t g,uint32_t b,uint32_t a)
2171 {
2172 return (r<<24)|(g<<16)|(b<<8)|a;
2173 }
2174
2175 static uint32_t make_color_alpha(uint32_t c,uint32_t a)
2176 {
2177 return (c&0xffffff00)|a;
2178 }
2179
2180 static void record_macro_name(const char *name)
2181 {
2182 size_t len;
2183 if (!name) { yyerror("internal error: no macro name"); exit(-1); }
2184 len=strlen(name);
2185 if (temp_macro_name) kate_free(temp_macro_name);
2186 temp_macro_name=kate_malloc(len+1);
2187 if (!temp_macro_name) { yyerror("out of memory"); exit(-1); }
2188 strcpy(temp_macro_name,name);
2189 }
2190
2191 static void add_temp_macro(const char *body)
2192 {
2193 if (!body) { yyerror("internal error: no macro body"); exit(-1); }
2194 if (!temp_macro_name) { yyerror("internal error - unknown macro name"); return; }
2195 add_macro(temp_macro_name,body);
2196 kate_free(temp_macro_name);
2197 temp_macro_name=NULL;
2198 }
2199
2200 static void set_granule_rate(unsigned int numerator,unsigned int denominator)
2201 {
2202 ki.gps_numerator=numerator;
2203 ki.gps_denominator=denominator;
2204 }
2205
2206 static void set_granule_shift(unsigned int granule_shift)
2207 {
2208 if (granule_shift>=64) yyerror("granule shift out of range (0-64)\n");
2209 ki.granule_shift=granule_shift;
2210 }
2211
2212 static void set_canvas_size(unsigned int width,unsigned int height)
2213 {
2214 int ret=kate_info_set_original_canvas_size(&ki,width,height);
2215 if (ret<0) {
2216 yyerror("failed to set original canvas size");
2217 exit(-1);
2218 }
2219 }
2220
2221 static void add_comment(kate_comment *kc,const char *s)
2222 {
2223 /* check for "ENCODER=," as kateenc now sets it and we don't want cycles
2224 of decode/encode to duplicate them, and we want the new one to replace
2225 any existing one */
2226 int different=0;
2227 const char *encoder="ENCODER=",*sptr=s;
2228 while (*encoder) if ((*encoder++|32)!=(*sptr++|32)) {
2229 different=1;
2230 break;
2231 }
2232 if (different) {
2233 CHECK_KATE_API_ERROR(kate_comment_add(kc,s));
2234 }
2235 }
2236
2237 static void cleanup_names(char **names,size_t count)
2238 {
2239 size_t n;
2240 if (names) {
2241 for (n=0;n<count;++n) if (names[n]) kate_free(names[n]);
2242 kate_free(names);
2243 }
2244 }
2245
2246 static void cleanup_memory(void)
2247 {
2248 cleanup_names(style_names,ki.nstyles);
2249 cleanup_names(region_names,ki.nregions);
2250 cleanup_names(curve_names,ki.ncurves);
2251 cleanup_names(motion_names,ki.nmotions);
2252 cleanup_names(bitmap_names,ki.nbitmaps);
2253 cleanup_names(palette_names,ki.npalettes);
2254 cleanup_names(font_range_names,ki.nfont_ranges);
2255 cleanup_names(font_mapping_names,ki.nfont_mappings);
2256 cleanup_names(local_bitmap_names,n_local_bitmaps);
2257
2258 free_macros();
2259 }
2260
2261
2262
2263 #line 2264 "kate_parser.c"
2264
2265 # ifndef YY_CAST
2266 # ifdef __cplusplus
2267 # define YY_CAST(Type, Val) static_cast<Type> (Val)
2268 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
2269 # else
2270 # define YY_CAST(Type, Val) ((Type) (Val))
2271 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
2272 # endif
2273 # endif
2274 # ifndef YY_NULLPTR
2275 # if defined __cplusplus
2276 # if 201103L <= __cplusplus
2277 # define YY_NULLPTR nullptr
2278 # else
2279 # define YY_NULLPTR 0
2280 # endif
2281 # else
2282 # define YY_NULLPTR ((void*)0)
2283 # endif
2284 # endif
2285
2286 /* Use api.header.include to #include this header
2287 instead of duplicating it here. */
2288 #ifndef YY_KATEDESC_KATE_PARSER_H_INCLUDED
2289 # define YY_KATEDESC_KATE_PARSER_H_INCLUDED
2290 /* Debug traces. */
2291 #ifndef YYDEBUG
2292 # define YYDEBUG 0
2293 #endif
2294 #if YYDEBUG
2295 extern int katedesc_debug;
2296 #endif
2297
2298 /* Token kinds. */
2299 #ifndef YYTOKENTYPE
2300 # define YYTOKENTYPE
2301 enum yytokentype
2302 {
2303 YYEMPTY = -2,
2304 YYEOF = 0, /* "end of file" */
2305 YYerror = 256, /* error */
2306 YYUNDEF = 257, /* "invalid token" */
2307 KATE = 258, /* KATE */
2308 DEFS = 259, /* DEFS */
2309 LANGUAGE = 260, /* LANGUAGE */
2310 COMMENT = 261, /* COMMENT */
2311 CATEGORY = 262, /* CATEGORY */
2312 DEFINE = 263, /* DEFINE */
2313 MACRO = 264, /* MACRO */
2314 STYLE = 265, /* STYLE */
2315 REGION = 266, /* REGION */
2316 CURVE = 267, /* CURVE */
2317 TEXT = 268, /* TEXT */
2318 BACKGROUND = 269, /* BACKGROUND */
2319 COLOR = 270, /* COLOR */
2320 POSITION = 271, /* POSITION */
2321 SIZE = 272, /* SIZE */
2322 DEFAULT = 273, /* DEFAULT */
2323 METRIC = 274, /* METRIC */
2324 HALIGN = 275, /* HALIGN */
2325 VALIGN = 276, /* VALIGN */
2326 HLEFT = 277, /* HLEFT */
2327 HCENTER = 278, /* HCENTER */
2328 HRIGHT = 279, /* HRIGHT */
2329 VTOP = 280, /* VTOP */
2330 VCENTER = 281, /* VCENTER */
2331 VBOTTOM = 282, /* VBOTTOM */
2332 POINTS = 283, /* POINTS */
2333 EVENT = 284, /* EVENT */
2334 STARTS = 285, /* STARTS */
2335 ENDS = 286, /* ENDS */
2336 AT = 287, /* AT */
2337 START = 288, /* START */
2338 END = 289, /* END */
2339 TIME = 290, /* TIME */
2340 DURATION = 291, /* DURATION */
2341 ARROW = 292, /* ARROW */
2342 FROM = 293, /* FROM */
2343 TO = 294, /* TO */
2344 MAPPING = 295, /* MAPPING */
2345 NONE = 296, /* NONE */
2346 FRAME = 297, /* FRAME */
2347 MOTION = 298, /* MOTION */
2348 BEZIER_CUBIC = 299, /* BEZIER_CUBIC */
2349 LINEAR = 300, /* LINEAR */
2350 CATMULL_ROM = 301, /* CATMULL_ROM */
2351 BSPLINE = 302, /* BSPLINE */
2352 STATIC = 303, /* STATIC */
2353 SEMANTICS = 304, /* SEMANTICS */
2354 EXTERNAL = 305, /* EXTERNAL */
2355 INTERNAL = 306, /* INTERNAL */
2356 ALIGNMENT = 307, /* ALIGNMENT */
2357 RG = 308, /* RG */
2358 BA = 309, /* BA */
2359 FOR = 310, /* FOR */
2360 ALPHA = 311, /* ALPHA */
2361 TIMEBASE = 312, /* TIMEBASE */
2362 MARKER = 313, /* MARKER */
2363 POINTER = 314, /* POINTER */
2364 SIMPLE_TIMED_GLYPH_MARKER = 315, /* SIMPLE_TIMED_GLYPH_MARKER */
2365 SIMPLE_TIMED_GLYPH_STYLE_MORPH = 316, /* SIMPLE_TIMED_GLYPH_STYLE_MORPH */
2366 GLYPH = 317, /* GLYPH */
2367 PAUSE = 318, /* PAUSE */
2368 IN = 319, /* IN */
2369 MORPH = 320, /* MORPH */
2370 SECONDARY = 321, /* SECONDARY */
2371 PATH = 322, /* PATH */
2372 SECTION = 323, /* SECTION */
2373 PERIODIC = 324, /* PERIODIC */
2374 DIRECTIONALITY = 325, /* DIRECTIONALITY */
2375 L2R_T2B = 326, /* L2R_T2B */
2376 R2L_T2B = 327, /* R2L_T2B */
2377 T2B_R2L = 328, /* T2B_R2L */
2378 T2B_L2R = 329, /* T2B_L2R */
2379 BITMAP = 330, /* BITMAP */
2380 PALETTE = 331, /* PALETTE */
2381 COLORS = 332, /* COLORS */
2382 FONT = 333, /* FONT */
2383 RANGE = 334, /* RANGE */
2384 FIRST = 335, /* FIRST */
2385 LAST = 336, /* LAST */
2386 CODE = 337, /* CODE */
2387 POINT = 338, /* POINT */
2388 USER = 339, /* USER */
2389 SOURCE = 340, /* SOURCE */
2390 PNG = 341, /* PNG */
2391 DRAW = 342, /* DRAW */
2392 VISIBLE = 343, /* VISIBLE */
2393 ID = 344, /* ID */
2394 BOLD = 345, /* BOLD */
2395 ITALICS = 346, /* ITALICS */
2396 UNDERLINE = 347, /* UNDERLINE */
2397 STRIKE = 348, /* STRIKE */
2398 JUSTIFY = 349, /* JUSTIFY */
2399 BASE = 350, /* BASE */
2400 OFFSET = 351, /* OFFSET */
2401 GRANULE = 352, /* GRANULE */
2402 RATE = 353, /* RATE */
2403 SHIFT = 354, /* SHIFT */
2404 WIDTH = 355, /* WIDTH */
2405 HEIGHT = 356, /* HEIGHT */
2406 CANVAS = 357, /* CANVAS */
2407 LEFT = 358, /* LEFT */
2408 TOP = 359, /* TOP */
2409 RIGHT = 360, /* RIGHT */
2410 BOTTOM = 361, /* BOTTOM */
2411 MARGIN = 362, /* MARGIN */
2412 MARGINS = 363, /* MARGINS */
2413 HORIZONTAL = 364, /* HORIZONTAL */
2414 VERTICAL = 365, /* VERTICAL */
2415 CLIP = 366, /* CLIP */
2416 PRE = 367, /* PRE */
2417 MARKUP = 368, /* MARKUP */
2418 LOCAL = 369, /* LOCAL */
2419 WRAP = 370, /* WRAP */
2420 WORD = 371, /* WORD */
2421 META = 372, /* META */
2422 NUMBER = 373, /* NUMBER */
2423 UNUMBER = 374, /* UNUMBER */
2424 STRING = 375, /* STRING */
2425 FLOAT = 376, /* FLOAT */
2426 COLORSPEC = 377, /* COLORSPEC */
2427 IDENTIFIER = 378, /* IDENTIFIER */
2428 MACRO_BODY = 379 /* MACRO_BODY */
2429 };
2430 typedef enum yytokentype yytoken_kind_t;
2431 #endif
2432 /* Token kinds. */
2433 #define YYEMPTY -2
2434 #define YYEOF 0
2435 #define YYerror 256
2436 #define YYUNDEF 257
2437 #define KATE 258
2438 #define DEFS 259
2439 #define LANGUAGE 260
2440 #define COMMENT 261
2441 #define CATEGORY 262
2442 #define DEFINE 263
2443 #define MACRO 264
2444 #define STYLE 265
2445 #define REGION 266
2446 #define CURVE 267
2447 #define TEXT 268
2448 #define BACKGROUND 269
2449 #define COLOR 270
2450 #define POSITION 271
2451 #define SIZE 272
2452 #define DEFAULT 273
2453 #define METRIC 274
2454 #define HALIGN 275
2455 #define VALIGN 276
2456 #define HLEFT 277
2457 #define HCENTER 278
2458 #define HRIGHT 279
2459 #define VTOP 280
2460 #define VCENTER 281
2461 #define VBOTTOM 282
2462 #define POINTS 283
2463 #define EVENT 284
2464 #define STARTS 285
2465 #define ENDS 286
2466 #define AT 287
2467 #define START 288
2468 #define END 289
2469 #define TIME 290
2470 #define DURATION 291
2471 #define ARROW 292
2472 #define FROM 293
2473 #define TO 294
2474 #define MAPPING 295
2475 #define NONE 296
2476 #define FRAME 297
2477 #define MOTION 298
2478 #define BEZIER_CUBIC 299
2479 #define LINEAR 300
2480 #define CATMULL_ROM 301
2481 #define BSPLINE 302
2482 #define STATIC 303
2483 #define SEMANTICS 304
2484 #define EXTERNAL 305
2485 #define INTERNAL 306
2486 #define ALIGNMENT 307
2487 #define RG 308
2488 #define BA 309
2489 #define FOR 310
2490 #define ALPHA 311
2491 #define TIMEBASE 312
2492 #define MARKER 313
2493 #define POINTER 314
2494 #define SIMPLE_TIMED_GLYPH_MARKER 315
2495 #define SIMPLE_TIMED_GLYPH_STYLE_MORPH 316
2496 #define GLYPH 317
2497 #define PAUSE 318
2498 #define IN 319
2499 #define MORPH 320
2500 #define SECONDARY 321
2501 #define PATH 322
2502 #define SECTION 323
2503 #define PERIODIC 324
2504 #define DIRECTIONALITY 325
2505 #define L2R_T2B 326
2506 #define R2L_T2B 327
2507 #define T2B_R2L 328
2508 #define T2B_L2R 329
2509 #define BITMAP 330
2510 #define PALETTE 331
2511 #define COLORS 332
2512 #define FONT 333
2513 #define RANGE 334
2514 #define FIRST 335
2515 #define LAST 336
2516 #define CODE 337
2517 #define POINT 338
2518 #define USER 339
2519 #define SOURCE 340
2520 #define PNG 341
2521 #define DRAW 342
2522 #define VISIBLE 343
2523 #define ID 344
2524 #define BOLD 345
2525 #define ITALICS 346
2526 #define UNDERLINE 347
2527 #define STRIKE 348
2528 #define JUSTIFY 349
2529 #define BASE 350
2530 #define OFFSET 351
2531 #define GRANULE 352
2532 #define RATE 353
2533 #define SHIFT 354
2534 #define WIDTH 355
2535 #define HEIGHT 356
2536 #define CANVAS 357
2537 #define LEFT 358
2538 #define TOP 359
2539 #define RIGHT 360
2540 #define BOTTOM 361
2541 #define MARGIN 362
2542 #define MARGINS 363
2543 #define HORIZONTAL 364
2544 #define VERTICAL 365
2545 #define CLIP 366
2546 #define PRE 367
2547 #define MARKUP 368
2548 #define LOCAL 369
2549 #define WRAP 370
2550 #define WORD 371
2551 #define META 372
2552 #define NUMBER 373
2553 #define UNUMBER 374
2554 #define STRING 375
2555 #define FLOAT 376
2556 #define COLORSPEC 377
2557 #define IDENTIFIER 378
2558 #define MACRO_BODY 379
2559
2560 /* Value type. */
2561 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
2562 union YYSTYPE
2563 {
2564 #line 2200 "kate_parser.y"
2565
2566 int number;
2567 unsigned int unumber;
2568 kate_float fp;
2569 const char *string;
2570 char *dynstring;
2571 kate_style *style;
2572 kate_region *region;
2573 kate_curve *curve;
2574 uint32_t color;
2575
2576 #line 2577 "kate_parser.c"
2577
2578 };
2579 typedef union YYSTYPE YYSTYPE;
2580 # define YYSTYPE_IS_TRIVIAL 1
2581 # define YYSTYPE_IS_DECLARED 1
2582 #endif
2583
2584
2585
2586
2587 int katedesc_parse (void);
2588
2589
2590 #endif /* !YY_KATEDESC_KATE_PARSER_H_INCLUDED */
2591 /* Symbol kind. */
2592 enum yysymbol_kind_t
2593 {
2594 YYSYMBOL_YYEMPTY = -2,
2595 YYSYMBOL_YYEOF = 0, /* "end of file" */
2596 YYSYMBOL_YYerror = 1, /* error */
2597 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
2598 YYSYMBOL_KATE = 3, /* KATE */
2599 YYSYMBOL_DEFS = 4, /* DEFS */
2600 YYSYMBOL_LANGUAGE = 5, /* LANGUAGE */
2601 YYSYMBOL_COMMENT = 6, /* COMMENT */
2602 YYSYMBOL_CATEGORY = 7, /* CATEGORY */
2603 YYSYMBOL_DEFINE = 8, /* DEFINE */
2604 YYSYMBOL_MACRO = 9, /* MACRO */
2605 YYSYMBOL_STYLE = 10, /* STYLE */
2606 YYSYMBOL_REGION = 11, /* REGION */
2607 YYSYMBOL_CURVE = 12, /* CURVE */
2608 YYSYMBOL_TEXT = 13, /* TEXT */
2609 YYSYMBOL_BACKGROUND = 14, /* BACKGROUND */
2610 YYSYMBOL_COLOR = 15, /* COLOR */
2611 YYSYMBOL_POSITION = 16, /* POSITION */
2612 YYSYMBOL_SIZE = 17, /* SIZE */
2613 YYSYMBOL_DEFAULT = 18, /* DEFAULT */
2614 YYSYMBOL_METRIC = 19, /* METRIC */
2615 YYSYMBOL_HALIGN = 20, /* HALIGN */
2616 YYSYMBOL_VALIGN = 21, /* VALIGN */
2617 YYSYMBOL_HLEFT = 22, /* HLEFT */
2618 YYSYMBOL_HCENTER = 23, /* HCENTER */
2619 YYSYMBOL_HRIGHT = 24, /* HRIGHT */
2620 YYSYMBOL_VTOP = 25, /* VTOP */
2621 YYSYMBOL_VCENTER = 26, /* VCENTER */
2622 YYSYMBOL_VBOTTOM = 27, /* VBOTTOM */
2623 YYSYMBOL_POINTS = 28, /* POINTS */
2624 YYSYMBOL_EVENT = 29, /* EVENT */
2625 YYSYMBOL_STARTS = 30, /* STARTS */
2626 YYSYMBOL_ENDS = 31, /* ENDS */
2627 YYSYMBOL_AT = 32, /* AT */
2628 YYSYMBOL_START = 33, /* START */
2629 YYSYMBOL_END = 34, /* END */
2630 YYSYMBOL_TIME = 35, /* TIME */
2631 YYSYMBOL_DURATION = 36, /* DURATION */
2632 YYSYMBOL_ARROW = 37, /* ARROW */
2633 YYSYMBOL_FROM = 38, /* FROM */
2634 YYSYMBOL_TO = 39, /* TO */
2635 YYSYMBOL_MAPPING = 40, /* MAPPING */
2636 YYSYMBOL_NONE = 41, /* NONE */
2637 YYSYMBOL_FRAME = 42, /* FRAME */
2638 YYSYMBOL_MOTION = 43, /* MOTION */
2639 YYSYMBOL_BEZIER_CUBIC = 44, /* BEZIER_CUBIC */
2640 YYSYMBOL_LINEAR = 45, /* LINEAR */
2641 YYSYMBOL_CATMULL_ROM = 46, /* CATMULL_ROM */
2642 YYSYMBOL_BSPLINE = 47, /* BSPLINE */
2643 YYSYMBOL_STATIC = 48, /* STATIC */
2644 YYSYMBOL_SEMANTICS = 49, /* SEMANTICS */
2645 YYSYMBOL_EXTERNAL = 50, /* EXTERNAL */
2646 YYSYMBOL_INTERNAL = 51, /* INTERNAL */
2647 YYSYMBOL_ALIGNMENT = 52, /* ALIGNMENT */
2648 YYSYMBOL_RG = 53, /* RG */
2649 YYSYMBOL_BA = 54, /* BA */
2650 YYSYMBOL_FOR = 55, /* FOR */
2651 YYSYMBOL_ALPHA = 56, /* ALPHA */
2652 YYSYMBOL_TIMEBASE = 57, /* TIMEBASE */
2653 YYSYMBOL_MARKER = 58, /* MARKER */
2654 YYSYMBOL_POINTER = 59, /* POINTER */
2655 YYSYMBOL_SIMPLE_TIMED_GLYPH_MARKER = 60, /* SIMPLE_TIMED_GLYPH_MARKER */
2656 YYSYMBOL_SIMPLE_TIMED_GLYPH_STYLE_MORPH = 61, /* SIMPLE_TIMED_GLYPH_STYLE_MORPH */
2657 YYSYMBOL_GLYPH = 62, /* GLYPH */
2658 YYSYMBOL_PAUSE = 63, /* PAUSE */
2659 YYSYMBOL_IN = 64, /* IN */
2660 YYSYMBOL_MORPH = 65, /* MORPH */
2661 YYSYMBOL_SECONDARY = 66, /* SECONDARY */
2662 YYSYMBOL_PATH = 67, /* PATH */
2663 YYSYMBOL_SECTION = 68, /* SECTION */
2664 YYSYMBOL_PERIODIC = 69, /* PERIODIC */
2665 YYSYMBOL_DIRECTIONALITY = 70, /* DIRECTIONALITY */
2666 YYSYMBOL_L2R_T2B = 71, /* L2R_T2B */
2667 YYSYMBOL_R2L_T2B = 72, /* R2L_T2B */
2668 YYSYMBOL_T2B_R2L = 73, /* T2B_R2L */
2669 YYSYMBOL_T2B_L2R = 74, /* T2B_L2R */
2670 YYSYMBOL_BITMAP = 75, /* BITMAP */
2671 YYSYMBOL_PALETTE = 76, /* PALETTE */
2672 YYSYMBOL_COLORS = 77, /* COLORS */
2673 YYSYMBOL_FONT = 78, /* FONT */
2674 YYSYMBOL_RANGE = 79, /* RANGE */
2675 YYSYMBOL_FIRST = 80, /* FIRST */
2676 YYSYMBOL_LAST = 81, /* LAST */
2677 YYSYMBOL_CODE = 82, /* CODE */
2678 YYSYMBOL_POINT = 83, /* POINT */
2679 YYSYMBOL_USER = 84, /* USER */
2680 YYSYMBOL_SOURCE = 85, /* SOURCE */
2681 YYSYMBOL_PNG = 86, /* PNG */
2682 YYSYMBOL_DRAW = 87, /* DRAW */
2683 YYSYMBOL_VISIBLE = 88, /* VISIBLE */
2684 YYSYMBOL_ID = 89, /* ID */
2685 YYSYMBOL_BOLD = 90, /* BOLD */
2686 YYSYMBOL_ITALICS = 91, /* ITALICS */
2687 YYSYMBOL_UNDERLINE = 92, /* UNDERLINE */
2688 YYSYMBOL_STRIKE = 93, /* STRIKE */
2689 YYSYMBOL_JUSTIFY = 94, /* JUSTIFY */
2690 YYSYMBOL_BASE = 95, /* BASE */
2691 YYSYMBOL_OFFSET = 96, /* OFFSET */
2692 YYSYMBOL_GRANULE = 97, /* GRANULE */
2693 YYSYMBOL_RATE = 98, /* RATE */
2694 YYSYMBOL_SHIFT = 99, /* SHIFT */
2695 YYSYMBOL_WIDTH = 100, /* WIDTH */
2696 YYSYMBOL_HEIGHT = 101, /* HEIGHT */
2697 YYSYMBOL_CANVAS = 102, /* CANVAS */
2698 YYSYMBOL_LEFT = 103, /* LEFT */
2699 YYSYMBOL_TOP = 104, /* TOP */
2700 YYSYMBOL_RIGHT = 105, /* RIGHT */
2701 YYSYMBOL_BOTTOM = 106, /* BOTTOM */
2702 YYSYMBOL_MARGIN = 107, /* MARGIN */
2703 YYSYMBOL_MARGINS = 108, /* MARGINS */
2704 YYSYMBOL_HORIZONTAL = 109, /* HORIZONTAL */
2705 YYSYMBOL_VERTICAL = 110, /* VERTICAL */
2706 YYSYMBOL_CLIP = 111, /* CLIP */
2707 YYSYMBOL_PRE = 112, /* PRE */
2708 YYSYMBOL_MARKUP = 113, /* MARKUP */
2709 YYSYMBOL_LOCAL = 114, /* LOCAL */
2710 YYSYMBOL_WRAP = 115, /* WRAP */
2711 YYSYMBOL_WORD = 116, /* WORD */
2712 YYSYMBOL_META = 117, /* META */
2713 YYSYMBOL_NUMBER = 118, /* NUMBER */
2714 YYSYMBOL_UNUMBER = 119, /* UNUMBER */
2715 YYSYMBOL_STRING = 120, /* STRING */
2716 YYSYMBOL_FLOAT = 121, /* FLOAT */
2717 YYSYMBOL_COLORSPEC = 122, /* COLORSPEC */
2718 YYSYMBOL_IDENTIFIER = 123, /* IDENTIFIER */
2719 YYSYMBOL_MACRO_BODY = 124, /* MACRO_BODY */
2720 YYSYMBOL_125_ = 125, /* '{' */
2721 YYSYMBOL_126_ = 126, /* '}' */
2722 YYSYMBOL_127_ = 127, /* '/' */
2723 YYSYMBOL_128_ = 128, /* '=' */
2724 YYSYMBOL_129_ = 129, /* '%' */
2725 YYSYMBOL_130_m_ = 130, /* 'm' */
2726 YYSYMBOL_131_x_ = 131, /* 'x' */
2727 YYSYMBOL_132_ = 132, /* ':' */
2728 YYSYMBOL_133_ = 133, /* '+' */
2729 YYSYMBOL_134_z_ = 134, /* 'z' */
2730 YYSYMBOL_135_Y_ = 135, /* 'Y' */
2731 YYSYMBOL_136_ = 136, /* ',' */
2732 YYSYMBOL_YYACCEPT = 137, /* $accept */
2733 YYSYMBOL_kd_kate = 138, /* kd_kate */
2734 YYSYMBOL_139_1 = 139, /* $@1 */
2735 YYSYMBOL_140_2 = 140, /* $@2 */
2736 YYSYMBOL_kd_opt_defs = 141, /* kd_opt_defs */
2737 YYSYMBOL_kd_defs = 142, /* kd_defs */
2738 YYSYMBOL_kd_def = 143, /* kd_def */
2739 YYSYMBOL_144_3 = 144, /* $@3 */
2740 YYSYMBOL_145_4 = 145, /* $@4 */
2741 YYSYMBOL_146_5 = 146, /* $@5 */
2742 YYSYMBOL_147_6 = 147, /* $@6 */
2743 YYSYMBOL_148_7 = 148, /* $@7 */
2744 YYSYMBOL_149_8 = 149, /* $@8 */
2745 YYSYMBOL_150_9 = 150, /* $@9 */
2746 YYSYMBOL_151_10 = 151, /* $@10 */
2747 YYSYMBOL_152_11 = 152, /* $@11 */
2748 YYSYMBOL_153_12 = 153, /* $@12 */
2749 YYSYMBOL_kd_style_defs = 154, /* kd_style_defs */
2750 YYSYMBOL_kd_style_def = 155, /* kd_style_def */
2751 YYSYMBOL_156_13 = 156, /* $@13 */
2752 YYSYMBOL_kd_opt_space_metric = 157, /* kd_opt_space_metric */
2753 YYSYMBOL_kd_region_defs = 158, /* kd_region_defs */
2754 YYSYMBOL_kd_region_def = 159, /* kd_region_def */
2755 YYSYMBOL_160_14 = 160, /* $@14 */
2756 YYSYMBOL_kd_curve_defs = 161, /* kd_curve_defs */
2757 YYSYMBOL_kd_curve_def = 162, /* kd_curve_def */
2758 YYSYMBOL_163_15 = 163, /* $@15 */
2759 YYSYMBOL_164_16 = 164, /* $@16 */
2760 YYSYMBOL_kd_palette_defs = 165, /* kd_palette_defs */
2761 YYSYMBOL_kd_palette_def = 166, /* kd_palette_def */
2762 YYSYMBOL_167_17 = 167, /* $@17 */
2763 YYSYMBOL_kd_bitmap_defs = 168, /* kd_bitmap_defs */
2764 YYSYMBOL_kd_bitmap_def = 169, /* kd_bitmap_def */
2765 YYSYMBOL_170_18 = 170, /* $@18 */
2766 YYSYMBOL_171_19 = 171, /* $@19 */
2767 YYSYMBOL_172_20 = 172, /* $@20 */
2768 YYSYMBOL_kd_color = 173, /* kd_color */
2769 YYSYMBOL_kd_wrap_mode = 174, /* kd_wrap_mode */
2770 YYSYMBOL_kd_curvetype = 175, /* kd_curvetype */
2771 YYSYMBOL_kd_curve_points = 176, /* kd_curve_points */
2772 YYSYMBOL_kd_palette_colors = 177, /* kd_palette_colors */
2773 YYSYMBOL_kd_bitmap_pixels = 178, /* kd_bitmap_pixels */
2774 YYSYMBOL_kd_png_bitmap_pixels = 179, /* kd_png_bitmap_pixels */
2775 YYSYMBOL_kd_byte_stream = 180, /* kd_byte_stream */
2776 YYSYMBOL_kd_opt_name = 181, /* kd_opt_name */
2777 YYSYMBOL_kd_style_name_or_index = 182, /* kd_style_name_or_index */
2778 YYSYMBOL_kd_region_name_or_index = 183, /* kd_region_name_or_index */
2779 YYSYMBOL_kd_curve_name_or_index = 184, /* kd_curve_name_or_index */
2780 YYSYMBOL_kd_motion_name_or_index = 185, /* kd_motion_name_or_index */
2781 YYSYMBOL_kd_palette_name_or_index = 186, /* kd_palette_name_or_index */
2782 YYSYMBOL_kd_bitmap_name_or_index = 187, /* kd_bitmap_name_or_index */
2783 YYSYMBOL_kd_font_range_name_or_index = 188, /* kd_font_range_name_or_index */
2784 YYSYMBOL_kd_font_mapping_name_or_index = 189, /* kd_font_mapping_name_or_index */
2785 YYSYMBOL_kd_curve_def_name_or_index = 190, /* kd_curve_def_name_or_index */
2786 YYSYMBOL_191_21 = 191, /* $@21 */
2787 YYSYMBOL_192_22 = 192, /* $@22 */
2788 YYSYMBOL_float = 193, /* float */
2789 YYSYMBOL_bitmap_x_offset = 194, /* bitmap_x_offset */
2790 YYSYMBOL_bitmap_y_offset = 195, /* bitmap_y_offset */
2791 YYSYMBOL_timespec = 196, /* timespec */
2792 YYSYMBOL_kd_events = 197, /* kd_events */
2793 YYSYMBOL_kd_event = 198, /* kd_event */
2794 YYSYMBOL_199_23 = 199, /* $@23 */
2795 YYSYMBOL_200_24 = 200, /* $@24 */
2796 YYSYMBOL_kd_event_defs = 201, /* kd_event_defs */
2797 YYSYMBOL_kd_event_def = 202, /* kd_event_def */
2798 YYSYMBOL_203_25 = 203, /* $@25 */
2799 YYSYMBOL_204_26 = 204, /* $@26 */
2800 YYSYMBOL_205_27 = 205, /* $@27 */
2801 YYSYMBOL_206_28 = 206, /* $@28 */
2802 YYSYMBOL_207_29 = 207, /* $@29 */
2803 YYSYMBOL_208_30 = 208, /* $@30 */
2804 YYSYMBOL_209_31 = 209, /* $@31 */
2805 YYSYMBOL_210_32 = 210, /* $@32 */
2806 YYSYMBOL_211_33 = 211, /* $@33 */
2807 YYSYMBOL_212_34 = 212, /* $@34 */
2808 YYSYMBOL_kd_meta_byte_stream_def = 213, /* kd_meta_byte_stream_def */
2809 YYSYMBOL_214_35 = 214, /* $@35 */
2810 YYSYMBOL_kd_optional_secondary = 215, /* kd_optional_secondary */
2811 YYSYMBOL_strings = 216, /* strings */
2812 YYSYMBOL_kd_motion_defs = 217, /* kd_motion_defs */
2813 YYSYMBOL_kd_motion_def = 218, /* kd_motion_def */
2814 YYSYMBOL_kd_optional_curve_duration = 219, /* kd_optional_curve_duration */
2815 YYSYMBOL_kd_motion_mapping = 220, /* kd_motion_mapping */
2816 YYSYMBOL_kd_motion_semantics = 221, /* kd_motion_semantics */
2817 YYSYMBOL_kd_simple_timed_glyph_marker_defs = 222, /* kd_simple_timed_glyph_marker_defs */
2818 YYSYMBOL_kd_simple_timed_glyph_marker_def = 223, /* kd_simple_timed_glyph_marker_def */
2819 YYSYMBOL_kd_simple_timed_glyph_style_morph_defs = 224, /* kd_simple_timed_glyph_style_morph_defs */
2820 YYSYMBOL_kd_simple_timed_glyph_style_morph_def = 225, /* kd_simple_timed_glyph_style_morph_def */
2821 YYSYMBOL_unumber60 = 226, /* unumber60 */
2822 YYSYMBOL_227_36 = 227, /* $@36 */
2823 YYSYMBOL_float60 = 228, /* float60 */
2824 YYSYMBOL_229_37 = 229, /* $@37 */
2825 YYSYMBOL_kd_opt_comma = 230, /* kd_opt_comma */
2826 YYSYMBOL_directionality = 231, /* directionality */
2827 YYSYMBOL_kd_font_range_defs = 232, /* kd_font_range_defs */
2828 YYSYMBOL_kd_font_range_def = 233, /* kd_font_range_def */
2829 YYSYMBOL_kd_font_mapping_defs = 234, /* kd_font_mapping_defs */
2830 YYSYMBOL_kd_font_mapping_def = 235, /* kd_font_mapping_def */
2831 YYSYMBOL_236_38 = 236 /* $@38 */
2832 };
2833 typedef enum yysymbol_kind_t yysymbol_kind_t;
2834
2835
2836
2837
2838 #ifdef short
2839 # undef short
2840 #endif
2841
2842 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
2843 <limits.h> and (if available) <stdint.h> are included
2844 so that the code can choose integer types of a good width. */
2845
2846 #ifndef __PTRDIFF_MAX__
2847 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
2848 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
2849 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
2850 # define YY_STDINT_H
2851 # endif
2852 #endif
2853
2854 /* Narrow types that promote to a signed type and that can represent a
2855 signed or unsigned integer of at least N bits. In tables they can
2856 save space and decrease cache pressure. Promoting to a signed type
2857 helps avoid bugs in integer arithmetic. */
2858
2859 #ifdef __INT_LEAST8_MAX__
2860 typedef __INT_LEAST8_TYPE__ yytype_int8;
2861 #elif defined YY_STDINT_H
2862 typedef int_least8_t yytype_int8;
2863 #else
2864 typedef signed char yytype_int8;
2865 #endif
2866
2867 #ifdef __INT_LEAST16_MAX__
2868 typedef __INT_LEAST16_TYPE__ yytype_int16;
2869 #elif defined YY_STDINT_H
2870 typedef int_least16_t yytype_int16;
2871 #else
2872 typedef short yytype_int16;
2873 #endif
2874
2875 /* Work around bug in HP-UX 11.23, which defines these macros
2876 incorrectly for preprocessor constants. This workaround can likely
2877 be removed in 2023, as HPE has promised support for HP-UX 11.23
2878 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
2879 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
2880 #ifdef __hpux
2881 # undef UINT_LEAST8_MAX
2882 # undef UINT_LEAST16_MAX
2883 # define UINT_LEAST8_MAX 255
2884 # define UINT_LEAST16_MAX 65535
2885 #endif
2886
2887 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
2888 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
2889 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
2890 && UINT_LEAST8_MAX <= INT_MAX)
2891 typedef uint_least8_t yytype_uint8;
2892 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
2893 typedef unsigned char yytype_uint8;
2894 #else
2895 typedef short yytype_uint8;
2896 #endif
2897
2898 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
2899 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
2900 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
2901 && UINT_LEAST16_MAX <= INT_MAX)
2902 typedef uint_least16_t yytype_uint16;
2903 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
2904 typedef unsigned short yytype_uint16;
2905 #else
2906 typedef int yytype_uint16;
2907 #endif
2908
2909 #ifndef YYPTRDIFF_T
2910 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
2911 # define YYPTRDIFF_T __PTRDIFF_TYPE__
2912 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
2913 # elif defined PTRDIFF_MAX
2914 # ifndef ptrdiff_t
2915 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
2916 # endif
2917 # define YYPTRDIFF_T ptrdiff_t
2918 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
2919 # else
2920 # define YYPTRDIFF_T long
2921 # define YYPTRDIFF_MAXIMUM LONG_MAX
2922 # endif
2923 #endif
2924
2925 #ifndef YYSIZE_T
2926 # ifdef __SIZE_TYPE__
2927 # define YYSIZE_T __SIZE_TYPE__
2928 # elif defined size_t
2929 # define YYSIZE_T size_t
2930 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
2931 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
2932 # define YYSIZE_T size_t
2933 # else
2934 # define YYSIZE_T unsigned
2935 # endif
2936 #endif
2937
2938 #define YYSIZE_MAXIMUM \
2939 YY_CAST (YYPTRDIFF_T, \
2940 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
2941 ? YYPTRDIFF_MAXIMUM \
2942 : YY_CAST (YYSIZE_T, -1)))
2943
2944 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
2945
2946
2947 /* Stored state numbers (used for stacks). */
2948 typedef yytype_int16 yy_state_t;
2949
2950 /* State numbers in computations. */
2951 typedef int yy_state_fast_t;
2952
2953 #ifndef YY_
2954 # if defined YYENABLE_NLS && YYENABLE_NLS
2955 # if ENABLE_NLS
2956 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
2957 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
2958 # endif
2959 # endif
2960 # ifndef YY_
2961 # define YY_(Msgid) Msgid
2962 # endif
2963 #endif
2964
2965
2966 #ifndef YY_ATTRIBUTE_PURE
2967 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
2968 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
2969 # else
2970 # define YY_ATTRIBUTE_PURE
2971 # endif
2972 #endif
2973
2974 #ifndef YY_ATTRIBUTE_UNUSED
2975 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
2976 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
2977 # else
2978 # define YY_ATTRIBUTE_UNUSED
2979 # endif
2980 #endif
2981
2982 /* Suppress unused-variable warnings by "using" E. */
2983 #if ! defined lint || defined __GNUC__
2984 # define YY_USE(E) ((void) (E))
2985 #else
2986 # define YY_USE(E) /* empty */
2987 #endif
2988
2989 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
2990 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
2991 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
2992 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
2993 _Pragma ("GCC diagnostic push") \
2994 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
2995 # else
2996 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
2997 _Pragma ("GCC diagnostic push") \
2998 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
2999 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
3000 # endif
3001 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
3002 _Pragma ("GCC diagnostic pop")
3003 #else
3004 # define YY_INITIAL_VALUE(Value) Value
3005 #endif
3006 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
3007 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
3008 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
3009 #endif
3010 #ifndef YY_INITIAL_VALUE
3011 # define YY_INITIAL_VALUE(Value) /* Nothing. */
3012 #endif
3013
3014 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
3015 # define YY_IGNORE_USELESS_CAST_BEGIN \
3016 _Pragma ("GCC diagnostic push") \
3017 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
3018 # define YY_IGNORE_USELESS_CAST_END \
3019 _Pragma ("GCC diagnostic pop")
3020 #endif
3021 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
3022 # define YY_IGNORE_USELESS_CAST_BEGIN
3023 # define YY_IGNORE_USELESS_CAST_END
3024 #endif
3025
3026
3027 #define YY_ASSERT(E) ((void) (0 && (E)))
3028
3029 #if !defined yyoverflow
3030
3031 /* The parser invokes alloca or malloc; define the necessary symbols. */
3032
3033 # ifdef YYSTACK_USE_ALLOCA
3034 # if YYSTACK_USE_ALLOCA
3035 # ifdef __GNUC__
3036 # define YYSTACK_ALLOC __builtin_alloca
3037 # elif defined __BUILTIN_VA_ARG_INCR
3038 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
3039 # elif defined _AIX
3040 # define YYSTACK_ALLOC __alloca
3041 # elif defined _MSC_VER
3042 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
3043 # define alloca _alloca
3044 # else
3045 # define YYSTACK_ALLOC alloca
3046 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
3047 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
3048 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
3049 # ifndef EXIT_SUCCESS
3050 # define EXIT_SUCCESS 0
3051 # endif
3052 # endif
3053 # endif
3054 # endif
3055 # endif
3056
3057 # ifdef YYSTACK_ALLOC
3058 /* Pacify GCC's 'empty if-body' warning. */
3059 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
3060 # ifndef YYSTACK_ALLOC_MAXIMUM
3061 /* The OS might guarantee only one guard page at the bottom of the stack,
3062 and a page size can be as small as 4096 bytes. So we cannot safely
3063 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
3064 to allow for a few compiler-allocated temporary stack slots. */
3065 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
3066 # endif
3067 # else
3068 # define YYSTACK_ALLOC YYMALLOC
3069 # define YYSTACK_FREE YYFREE
3070 # ifndef YYSTACK_ALLOC_MAXIMUM
3071 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
3072 # endif
3073 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
3074 && ! ((defined YYMALLOC || defined malloc) \
3075 && (defined YYFREE || defined free)))
3076 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
3077 # ifndef EXIT_SUCCESS
3078 # define EXIT_SUCCESS 0
3079 # endif
3080 # endif
3081 # ifndef YYMALLOC
3082 # define YYMALLOC malloc
3083 # if ! defined malloc && ! defined EXIT_SUCCESS
3084 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
3085 # endif
3086 # endif
3087 # ifndef YYFREE
3088 # define YYFREE free
3089 # if ! defined free && ! defined EXIT_SUCCESS
3090 void free (void *); /* INFRINGES ON USER NAME SPACE */
3091 # endif
3092 # endif
3093 # endif
3094 #endif /* !defined yyoverflow */
3095
3096 #if (! defined yyoverflow \
3097 && (! defined __cplusplus \
3098 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
3099
3100 /* A type that is properly aligned for any stack member. */
3101 union yyalloc
3102 {
3103 yy_state_t yyss_alloc;
3104 YYSTYPE yyvs_alloc;
3105 };
3106
3107 /* The size of the maximum gap between one aligned stack and the next. */
3108 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
3109
3110 /* The size of an array large to enough to hold all stacks, each with
3111 N elements. */
3112 # define YYSTACK_BYTES(N) \
3113 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
3114 + YYSTACK_GAP_MAXIMUM)
3115
3116 # define YYCOPY_NEEDED 1
3117
3118 /* Relocate STACK from its old location to the new one. The
3119 local variables YYSIZE and YYSTACKSIZE give the old and new number of
3120 elements in the stack, and YYPTR gives the new location of the
3121 stack. Advance YYPTR to a properly aligned location for the next
3122 stack. */
3123 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
3124 do \
3125 { \
3126 YYPTRDIFF_T yynewbytes; \
3127 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
3128 Stack = &yyptr->Stack_alloc; \
3129 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
3130 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
3131 } \
3132 while (0)
3133
3134 #endif
3135
3136 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
3137 /* Copy COUNT objects from SRC to DST. The source and destination do
3138 not overlap. */
3139 # ifndef YYCOPY
3140 # if defined __GNUC__ && 1 < __GNUC__
3141 # define YYCOPY(Dst, Src, Count) \
3142 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
3143 # else
3144 # define YYCOPY(Dst, Src, Count) \
3145 do \
3146 { \
3147 YYPTRDIFF_T yyi; \
3148 for (yyi = 0; yyi < (Count); yyi++) \
3149 (Dst)[yyi] = (Src)[yyi]; \
3150 } \
3151 while (0)
3152 # endif
3153 # endif
3154 #endif /* !YYCOPY_NEEDED */
3155
3156 /* YYFINAL -- State number of the termination state. */
3157 #define YYFINAL 3
3158 /* YYLAST -- Last index in YYTABLE. */
3159 #define YYLAST 641
3160
3161 /* YYNTOKENS -- Number of terminals. */
3162 #define YYNTOKENS 137
3163 /* YYNNTS -- Number of nonterminals. */
3164 #define YYNNTS 100
3165 /* YYNRULES -- Number of rules. */
3166 #define YYNRULES 309
3167 /* YYNSTATES -- Number of states. */
3168 #define YYNSTATES 588
3169
3170 /* YYMAXUTOK -- Last valid token kind. */
3171 #define YYMAXUTOK 379
3172
3173
3174 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
3175 as returned by yylex, with out-of-bounds checking. */
3176 #define YYTRANSLATE(YYX) \
3177 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
3178 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
3179 : YYSYMBOL_YYUNDEF)
3180
3181 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
3182 as returned by yylex. */
3183 static const yytype_uint8 yytranslate[] =
3184 {
3185 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3186 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3187 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3188 2, 2, 2, 2, 2, 2, 2, 129, 2, 2,
3189 2, 2, 2, 133, 136, 2, 2, 127, 2, 2,
3190 2, 2, 2, 2, 2, 2, 2, 2, 132, 2,
3191 2, 128, 2, 2, 2, 2, 2, 2, 2, 2,
3192 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3193 2, 2, 2, 2, 2, 2, 2, 2, 2, 135,
3194 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3195 2, 2, 2, 2, 2, 2, 2, 2, 2, 130,
3196 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3197 131, 2, 134, 125, 2, 126, 2, 2, 2, 2,
3198 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3199 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3200 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3201 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3202 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3203 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3204 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3205 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3206 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3207 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3208 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3209 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3210 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
3211 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
3212 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
3213 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
3214 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
3215 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
3216 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
3217 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
3218 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
3219 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
3220 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
3221 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
3222 115, 116, 117, 118, 119, 120, 121, 122, 123, 124
3223 };
3224
3225 #if YYDEBUG
3226 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
3227 static const yytype_int16 yyrline[] =
3228 {
3229 0, 2286, 2286, 2286, 2286, 2289, 2290, 2293, 2294, 2297,
3230 2298, 2299, 2300, 2301, 2301, 2301, 2303, 2303, 2304, 2304,
3231 2305, 2305, 2306, 2306, 2307, 2307, 2308, 2308, 2309, 2309,
3232 2310, 2310, 2311, 2312, 2313, 2314, 2317, 2318, 2321, 2322,
3233 2323, 2324, 2325, 2326, 2327, 2328, 2329, 2330, 2331, 2332,
3234 2333, 2334, 2335, 2336, 2337, 2338, 2339, 2340, 2341, 2342,
3235 2343, 2344, 2345, 2346, 2348, 2349, 2349, 2352, 2353, 2354,
3236 2357, 2358, 2361, 2362, 2363, 2364, 2365, 2366, 2367, 2367,
3237 2370, 2371, 2374, 2375, 2375, 2378, 2378, 2381, 2382, 2385,
3238 2385, 2390, 2393, 2394, 2397, 2397, 2402, 2402, 2407, 2408,
3239 2409, 2410, 2411, 2411, 2414, 2415, 2416, 2417, 2420, 2421,
3240 2424, 2425, 2426, 2427, 2428, 2429, 2432, 2441, 2444, 2448,
3241 2451, 2464, 2467, 2475, 2478, 2486, 2489, 2490, 2493, 2494,
3242 2497, 2498, 2501, 2502, 2505, 2506, 2509, 2510, 2513, 2514,
3243 2517, 2518, 2521, 2522, 2525, 2526, 2526, 2527, 2527, 2531,
3244 2532, 2533, 2536, 2537, 2538, 2541, 2542, 2543, 2546, 2547,
3245 2548, 2551, 2552, 2555, 2555, 2558, 2558, 2563, 2564, 2567,
3246 2568, 2569, 2570, 2571, 2572, 2573, 2574, 2575, 2576, 2577,
3247 2578, 2579, 2579, 2581, 2581, 2582, 2584, 2584, 2586, 2586,
3248 2588, 2589, 2590, 2591, 2592, 2593, 2594, 2595, 2596, 2597,
3249 2597, 2598, 2599, 2599, 2601, 2601, 2603, 2604, 2605, 2605,
3250 2606, 2607, 2607, 2608, 2608, 2609, 2610, 2611, 2614, 2614,
3251 2617, 2618, 2621, 2622, 2625, 2626, 2629, 2630, 2631, 2632,
3252 2633, 2636, 2637, 2638, 2639, 2642, 2643, 2644, 2645, 2646,
3253 2647, 2653, 2654, 2655, 2656, 2657, 2658, 2659, 2660, 2661,
3254 2662, 2663, 2664, 2665, 2666, 2667, 2668, 2669, 2670, 2671,
3255 2672, 2673, 2674, 2675, 2676, 2677, 2678, 2679, 2680, 2681,
3256 2682, 2688, 2689, 2692, 2693, 2694, 2695, 2696, 2697, 2700,
3257 2701, 2704, 2705, 2707, 2708, 2709, 2710, 2711, 2714, 2714,
3258 2717, 2717, 2720, 2721, 2724, 2725, 2726, 2727, 2730, 2731,
3259 2734, 2735, 2736, 2737, 2738, 2741, 2742, 2745, 2745, 2746
3260 };
3261 #endif
3262
3263 /** Accessing symbol of state STATE. */
3264 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
3265
3266 #if YYDEBUG || 0
3267 /* The user-facing name of the symbol whose (internal) number is
3268 YYSYMBOL. No bounds checking. */
3269 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
3270
3271 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
3272 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
3273 static const char *const yytname[] =
3274 {
3275 "\"end of file\"", "error", "\"invalid token\"", "KATE", "DEFS",
3276 "LANGUAGE", "COMMENT", "CATEGORY", "DEFINE", "MACRO", "STYLE", "REGION",
3277 "CURVE", "TEXT", "BACKGROUND", "COLOR", "POSITION", "SIZE", "DEFAULT",
3278 "METRIC", "HALIGN", "VALIGN", "HLEFT", "HCENTER", "HRIGHT", "VTOP",
3279 "VCENTER", "VBOTTOM", "POINTS", "EVENT", "STARTS", "ENDS", "AT", "START",
3280 "END", "TIME", "DURATION", "ARROW", "FROM", "TO", "MAPPING", "NONE",
3281 "FRAME", "MOTION", "BEZIER_CUBIC", "LINEAR", "CATMULL_ROM", "BSPLINE",
3282 "STATIC", "SEMANTICS", "EXTERNAL", "INTERNAL", "ALIGNMENT", "RG", "BA",
3283 "FOR", "ALPHA", "TIMEBASE", "MARKER", "POINTER",
3284 "SIMPLE_TIMED_GLYPH_MARKER", "SIMPLE_TIMED_GLYPH_STYLE_MORPH", "GLYPH",
3285 "PAUSE", "IN", "MORPH", "SECONDARY", "PATH", "SECTION", "PERIODIC",
3286 "DIRECTIONALITY", "L2R_T2B", "R2L_T2B", "T2B_R2L", "T2B_L2R", "BITMAP",
3287 "PALETTE", "COLORS", "FONT", "RANGE", "FIRST", "LAST", "CODE", "POINT",
3288 "USER", "SOURCE", "PNG", "DRAW", "VISIBLE", "ID", "BOLD", "ITALICS",
3289 "UNDERLINE", "STRIKE", "JUSTIFY", "BASE", "OFFSET", "GRANULE", "RATE",
3290 "SHIFT", "WIDTH", "HEIGHT", "CANVAS", "LEFT", "TOP", "RIGHT", "BOTTOM",
3291 "MARGIN", "MARGINS", "HORIZONTAL", "VERTICAL", "CLIP", "PRE", "MARKUP",
3292 "LOCAL", "WRAP", "WORD", "META", "NUMBER", "UNUMBER", "STRING", "FLOAT",
3293 "COLORSPEC", "IDENTIFIER", "MACRO_BODY", "'{'", "'}'", "'/'", "'='",
3294 "'%'", "'m'", "'x'", "':'", "'+'", "'z'", "'Y'", "','", "$accept",
3295 "kd_kate", "$@1", "$@2", "kd_opt_defs", "kd_defs", "kd_def", "$@3",
3296 "$@4", "$@5", "$@6", "$@7", "$@8", "$@9", "$@10", "$@11", "$@12",
3297 "kd_style_defs", "kd_style_def", "$@13", "kd_opt_space_metric",
3298 "kd_region_defs", "kd_region_def", "$@14", "kd_curve_defs",
3299 "kd_curve_def", "$@15", "$@16", "kd_palette_defs", "kd_palette_def",
3300 "$@17", "kd_bitmap_defs", "kd_bitmap_def", "$@18", "$@19", "$@20",
3301 "kd_color", "kd_wrap_mode", "kd_curvetype", "kd_curve_points",
3302 "kd_palette_colors", "kd_bitmap_pixels", "kd_png_bitmap_pixels",
3303 "kd_byte_stream", "kd_opt_name", "kd_style_name_or_index",
3304 "kd_region_name_or_index", "kd_curve_name_or_index",
3305 "kd_motion_name_or_index", "kd_palette_name_or_index",
3306 "kd_bitmap_name_or_index", "kd_font_range_name_or_index",
3307 "kd_font_mapping_name_or_index", "kd_curve_def_name_or_index", "$@21",
3308 "$@22", "float", "bitmap_x_offset", "bitmap_y_offset", "timespec",
3309 "kd_events", "kd_event", "$@23", "$@24", "kd_event_defs", "kd_event_def",
3310 "$@25", "$@26", "$@27", "$@28", "$@29", "$@30", "$@31", "$@32", "$@33",
3311 "$@34", "kd_meta_byte_stream_def", "$@35", "kd_optional_secondary",
3312 "strings", "kd_motion_defs", "kd_motion_def",
3313 "kd_optional_curve_duration", "kd_motion_mapping", "kd_motion_semantics",
3314 "kd_simple_timed_glyph_marker_defs", "kd_simple_timed_glyph_marker_def",
3315 "kd_simple_timed_glyph_style_morph_defs",
3316 "kd_simple_timed_glyph_style_morph_def", "unumber60", "$@36", "float60",
3317 "$@37", "kd_opt_comma", "directionality", "kd_font_range_defs",
3318 "kd_font_range_def", "kd_font_mapping_defs", "kd_font_mapping_def",
3319 "$@38", YY_NULLPTR
3320 };
3321
3322 static const char *
3323 yysymbol_name (yysymbol_kind_t yysymbol)
3324 {
3325 return yytname[yysymbol];
3326 }
3327 #endif
3328
3329 #define YYPACT_NINF (-375)
3330
3331 #define yypact_value_is_default(Yyn) \
3332 ((Yyn) == YYPACT_NINF)
3333
3334 #define YYTABLE_NINF (-289)
3335
3336 #define yytable_value_is_error(Yyn) \
3337 0
3338
3339 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
3340 STATE-NUM. */
3341 static const yytype_int16 yypact[] =
3342 {
3343 -375, 43, 56, -375, -37, 120, 26, -375, -375, -375,
3344 30, -1, 67, 69, 80, 278, 289, 319, -24, 146,
3345 -375, -375, 48, -375, -375, -375, -375, -375, -375, 96,
3346 96, 96, 96, 96, 96, 27, -375, 71, -375, -375,
3347 -375, -375, -375, -375, -375, -375, -375, 121, 123, 139,
3348 87, -375, 105, -375, -375, -375, -375, -375, -375, -375,
3349 96, 96, 294, -375, 145, -375, 159, -375, 266, -375,
3350 166, 170, 189, 194, 200, 206, -375, -375, 154, 191,
3351 -375, 226, -375, 147, 242, 260, 161, -19, 362, 373,
3352 374, 379, 289, 289, 220, -375, -375, -375, 319, 232,
3353 257, 378, 301, 8, 77, 307, -375, 388, -375, 436,
3354 318, 334, -375, -375, -375, -375, -375, -375, 352, 357,
3355 -375, 298, -375, -375, -375, 385, -375, -375, 366, 387,
3356 401, 318, 289, 289, 289, 289, -375, 18, -375, -375,
3357 -375, 397, 399, 400, -375, -375, -375, -375, 402, -375,
3358 -375, -375, 403, 262, -375, 141, 164, 406, 318, 395,
3359 289, 323, 409, -375, 344, 23, 186, 11, 9, 83,
3360 -375, -375, -375, -375, 96, 405, -375, -375, -375, -375,
3361 -375, -375, 289, 289, -375, -375, -375, -375, -375, -375,
3362 -375, -375, 411, 318, 412, 318, -375, 325, -375, -375,
3363 -375, 408, 410, -375, 519, 521, 298, 298, -375, -375,
3364 -375, -375, -375, -375, 45, 522, -375, -375, -375, -375,
3365 -375, 431, 432, 434, 435, 298, 17, 420, -375, -375,
3366 298, 298, 533, -375, -375, 424, -375, -375, -375, -375,
3367 -375, -375, -375, -375, -375, 517, -375, -375, -375, 335,
3368 210, 20, -375, -375, -375, 470, 427, 305, 428, 418,
3369 -375, -375, 430, 474, -375, -375, -47, 89, 425, -375,
3370 31, -375, -375, 53, 181, 109, 65, 184, -375, -375,
3371 -375, -375, -375, 429, -375, -58, -58, -375, -375, 298,
3372 298, 298, -375, -58, 298, 298, 298, 298, 327, -375,
3373 -375, -375, 437, 298, 298, 323, 438, 439, -375, -375,
3374 -375, 442, 497, 443, -375, 520, -375, -375, 538, 441,
3375 210, 492, 447, 231, 543, -375, 546, 548, 444, 510,
3376 455, 451, 41, 504, 465, 471, -375, -375, 257, -375,
3377 452, 453, 454, 311, 456, 461, -375, -375, 354, -375,
3378 -375, 119, 503, -375, -375, 232, 466, 93, -375, -375,
3379 -5, 531, 555, -375, 554, -375, 585, 4, 541, 49,
3380 -375, -375, -375, -375, 472, -375, 375, 479, 544, -375,
3381 -375, 327, 327, 327, -375, 327, 327, 327, 327, -375,
3382 -375, 298, 356, -375, -375, -375, 365, -375, 477, 478,
3383 298, -375, -375, -375, -375, -375, -375, -375, -375, -375,
3384 433, -375, -375, -375, 536, 440, 553, 556, 28, 487,
3385 -375, -375, -375, 446, -375, -375, -375, -375, -375, -375,
3386 452, 453, 480, -375, 383, -62, 482, -375, -375, -375,
3387 486, 232, 529, 530, -375, -375, -375, 495, 142, 289,
3388 298, 210, 323, 496, 156, 289, 289, 289, -375, 484,
3389 -375, 498, 499, -375, -375, -375, -375, -375, -375, -375,
3390 327, -375, -375, -375, -375, 254, -375, -375, 384, 209,
3391 -375, -375, -375, -375, -375, -375, -375, -375, -375, 545,
3392 -375, -375, -375, -375, -375, 500, 502, -375, -375, -375,
3393 396, 398, 79, -375, 289, 289, -375, 577, -375, 583,
3394 -375, 289, 289, -375, -375, -375, 92, -375, 505, -375,
3395 298, 501, 506, -375, -375, 285, 302, -375, -375, -375,
3396 -375, 507, -375, -375, 394, 112, -375, -375, -375, -375,
3397 -375, -375, -375, 298, 613, -375, -375, 489, -375, -375,
3398 327, -375, -375, -375, -375, -375, 508, 509, -58, -375,
3399 -375, -375, 323, -375, -375, 298, 182, 187, 192, -375,
3400 -375, 511, -375, 327, -375, -375, -375, 198, 203, 489,
3401 -375, 489, -375, 489, -375, -375, -375, -375
3402 };
3403
3404 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
3405 Performed when YYTABLE does not specify something else to do. Zero
3406 means the default is an error. */
3407 static const yytype_int16 yydefact[] =
3408 {
3409 2, 0, 0, 1, 0, 6, 0, 3, 8, 162,
3410 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3411 5, 7, 165, 4, 161, 9, 12, 10, 13, 127,
3412 127, 127, 127, 127, 127, 0, 151, 150, 149, 290,
3413 32, 160, 294, 295, 296, 297, 11, 0, 0, 0,
3414 0, 168, 0, 126, 16, 18, 20, 22, 26, 24,
3415 127, 127, 0, 291, 0, 34, 0, 168, 166, 14,
3416 0, 0, 0, 0, 0, 0, 30, 28, 150, 0,
3417 159, 0, 35, 221, 0, 0, 183, 0, 0, 0,
3418 0, 0, 0, 0, 199, 202, 204, 220, 0, 211,
3419 208, 0, 0, 0, 0, 0, 223, 0, 167, 0,
3420 198, 0, 37, 71, 81, 225, 93, 88, 0, 0,
3421 289, 0, 33, 164, 170, 0, 131, 130, 180, 0,
3422 0, 190, 0, 0, 0, 0, 177, 0, 135, 134,
3423 201, 0, 0, 0, 171, 139, 138, 210, 0, 137,
3424 136, 207, 0, 0, 169, 0, 0, 0, 192, 0,
3425 0, 188, 0, 15, 0, 0, 0, 0, 0, 0,
3426 306, 299, 150, 158, 127, 0, 71, 194, 172, 173,
3427 174, 175, 0, 0, 225, 272, 280, 93, 88, 143,
3428 142, 206, 0, 191, 0, 193, 196, 0, 179, 129,
3429 128, 185, 0, 222, 0, 0, 0, 0, 40, 41,
3430 42, 43, 44, 45, 0, 0, 49, 50, 51, 52,
3431 53, 0, 0, 0, 0, 0, 0, 0, 17, 36,
3432 0, 0, 0, 72, 75, 0, 19, 70, 85, 110,
3433 114, 112, 113, 115, 111, 0, 21, 80, 82, 145,
3434 0, 0, 230, 23, 224, 0, 0, 0, 0, 0,
3435 27, 92, 0, 0, 25, 87, 0, 0, 213, 71,
3436 0, 176, 178, 0, 0, 0, 0, 0, 195, 197,
3437 218, 216, 217, 0, 37, 0, 0, 38, 39, 0,
3438 0, 0, 55, 0, 0, 0, 0, 0, 69, 108,
3439 109, 54, 0, 0, 0, 0, 0, 0, 83, 133,
3440 132, 144, 234, 0, 237, 0, 235, 236, 0, 0,
3441 226, 0, 0, 0, 0, 241, 0, 0, 0, 0,
3442 0, 0, 260, 0, 0, 0, 262, 228, 0, 98,
3443 153, 152, 0, 0, 0, 0, 91, 89, 307, 31,
3444 305, 0, 0, 29, 298, 0, 0, 0, 184, 200,
3445 0, 0, 0, 203, 0, 271, 0, 0, 0, 0,
3446 205, 279, 212, 209, 0, 37, 0, 0, 106, 46,
3447 47, 69, 69, 69, 48, 69, 69, 69, 69, 67,
3448 68, 0, 0, 73, 74, 76, 0, 117, 0, 0,
3449 0, 229, 81, 238, 239, 240, 227, 257, 242, 243,
3450 0, 247, 248, 244, 258, 0, 0, 0, 0, 0,
3451 265, 266, 270, 0, 269, 261, 263, 264, 99, 154,
3452 156, 155, 0, 100, 0, 0, 0, 141, 140, 309,
3453 0, 0, 0, 0, 215, 93, 182, 0, 0, 0,
3454 0, 0, 0, 0, 0, 0, 0, 0, 125, 0,
3455 189, 0, 0, 56, 57, 58, 59, 60, 61, 62,
3456 69, 65, 64, 78, 77, 0, 117, 81, 231, 0,
3457 251, 252, 259, 253, 254, 246, 245, 249, 267, 250,
3458 255, 256, 157, 102, 101, 0, 0, 119, 299, 304,
3459 0, 0, 0, 273, 0, 0, 276, 0, 274, 0,
3460 281, 0, 0, 283, 287, 286, 0, 187, 104, 107,
3461 0, 0, 0, 86, 116, 0, 0, 232, 233, 146,
3462 268, 0, 96, 94, 0, 0, 301, 300, 303, 302,
3463 214, 278, 277, 0, 0, 285, 284, 293, 219, 105,
3464 69, 125, 125, 84, 148, 125, 0, 0, 0, 90,
3465 308, 275, 0, 292, 124, 0, 0, 0, 0, 123,
3466 121, 0, 282, 69, 66, 79, 103, 0, 0, 293,
3467 63, 293, 97, 293, 95, 118, 122, 120
3468 };
3469
3470 /* YYPGOTO[NTERM-NUM]. */
3471 static const yytype_int16 yypgoto[] =
3472 {
3473 -375, -375, -375, -375, -375, -375, -375, -375, -375, -375,
3474 -375, -375, -375, -375, -375, -375, -375, -255, -375, -375,
3475 -374, -154, -375, -375, -334, -375, -375, -375, 448, -375,
3476 -375, -183, -375, -375, -375, -375, -283, -375, -375, 151,
3477 -375, -375, -375, -218, -15, -299, -375, -375, -375, 290,
3478 -302, -375, -375, -375, -375, -375, -205, -375, -375, -16,
3479 -375, -375, -375, -375, 562, -375, -375, -375, -375, -375,
3480 -375, -375, -375, -375, -375, -375, -375, -375, -375, 137,
3481 457, -375, -375, -315, -375, -375, -375, -375, -375, -375,
3482 -375, 10, -375, -220, 532, 140, -375, -375, -375, -375
3483 };
3484
3485 /* YYDEFGOTO[NTERM-NUM]. */
3486 static const yytype_int16 yydefgoto[] =
3487 {
3488 0, 1, 2, 9, 7, 10, 21, 52, 111, 70,
3489 71, 72, 73, 75, 74, 119, 118, 164, 229, 521,
3490 391, 165, 237, 522, 166, 247, 398, 307, 169, 265,
3491 436, 168, 261, 557, 556, 531, 379, 301, 248, 475,
3492 534, 578, 577, 516, 54, 201, 128, 311, 140, 151,
3493 147, 439, 191, 312, 313, 399, 39, 343, 433, 107,
3494 11, 24, 50, 51, 68, 108, 175, 129, 283, 202,
3495 141, 142, 143, 152, 148, 356, 282, 374, 109, 110,
3496 167, 254, 401, 320, 337, 274, 365, 275, 371, 79,
3497 120, 41, 63, 564, 46, 267, 354, 266, 350, 440
3498 };
3499
3500 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
3501 positive, shift that token. If negative, reduce the rule whose
3502 number is the opposite. If YYTABLE_NINF, syntax error. */
3503 static const yytype_int16 yytable[] =
3504 {
3505 40, 287, 288, 380, 276, 406, 395, 463, 464, 465,
3506 384, 466, 467, 468, 469, 55, 56, 57, 58, 59,
3507 298, 155, 270, 249, 495, 303, 304, 255, 22, 376,
3508 321, 322, 348, 323, 324, 12, 13, 14, 15, 230,
3509 231, 232, 233, 3, 487, 76, 77, 230, 231, 232,
3510 233, 250, 342, 444, 447, 325, 423, 182, 299, 4,
3511 251, 377, 289, 453, 378, 249, 130, 60, 479, 496,
3512 326, 327, 80, 183, 47, 48, 136, 137, 328, 349,
3513 252, 456, 329, 255, 381, 382, 383, 16, 5, 385,
3514 386, 387, 388, 250, 256, 330, 520, 255, 393, 394,
3515 17, 106, 251, 488, 331, 257, 61, 332, 333, 230,
3516 231, 232, 233, 457, 448, 357, 178, 179, 180, 181,
3517 459, 156, 252, 454, 6, 23, 258, 18, 259, 334,
3518 335, 173, 19, 300, 234, 260, 508, 253, 432, 499,
3519 235, 424, 234, 526, 198, 290, 291, 366, 235, 236,
3520 256, 8, 84, 509, 336, 85, 20, 358, 86, 268,
3521 87, 257, 157, 49, 256, 292, 271, 272, 262, 351,
3522 352, 367, 368, -163, 504, 257, 565, 88, 89, 359,
3523 90, 91, 258, 92, 259, 93, 470, 25, 511, 26,
3524 94, 372, 351, 352, 441, 478, 258, 106, 259, 580,
3525 27, 442, 263, 62, 234, 540, 505, 95, 96, 264,
3526 235, 547, 67, 97, 238, 353, 53, 98, 548, 446,
3527 512, 314, 99, 100, 131, 101, 192, 239, 69, 369,
3528 240, 241, 242, 243, 244, 370, 102, 238, 560, 315,
3529 64, 158, 65, 360, 361, 507, 410, 411, 412, 194,
3530 239, 316, 317, 240, 241, 242, 243, 244, 66, 103,
3531 104, 106, 502, 572, 105, 36, 37, 106, 38, 262,
3532 524, 84, 81, 123, 85, 571, -221, 86, 82, 87,
3533 126, 127, 362, 413, 106, 318, -288, 28, 29, 30,
3534 31, 112, 193, 195, 319, 113, 88, 89, 414, 90,
3535 91, 547, 92, 263, 93, 245, 547, 363, 574, 94,
3536 373, 547, 246, 575, 114, 550, 364, 581, 576, 115,
3537 524, 32, 583, 121, 582, 116, 95, 96, 245, 584,
3538 238, 117, 97, 566, 567, 529, 98, 568, 561, 138,
3539 139, 99, 100, 239, 101, 122, 240, 241, 242, 243,
3540 244, 145, 146, 33, 34, 102, 35, 204, 205, 585,
3541 573, 586, 124, 587, 206, 207, 208, 209, 210, 211,
3542 212, 213, 36, 172, 125, 38, 149, 150, 103, 104,
3543 523, 189, 190, 105, 36, 37, 106, 38, 204, 205,
3544 42, 43, 44, 45, 132, 206, 207, 208, 209, 210,
3545 211, 212, 213, 36, 172, 133, 38, 36, 37, 134,
3546 38, 553, 36, 78, 135, 38, 36, 172, 153, 38,
3547 154, 245, 214, 340, 341, 160, 38, 159, 554, 430,
3548 431, 215, 38, 506, 216, 217, 218, 219, 220, 513,
3549 514, 515, 199, 200, 280, 281, 161, 221, 222, 223,
3550 224, 162, 225, 214, 309, 310, 389, 390, 163, 226,
3551 174, 227, 215, 408, 409, 216, 217, 218, 219, 220,
3552 228, 420, 421, 437, 438, 471, 472, 170, 221, 222,
3553 223, 224, 171, 225, 473, 474, 480, 481, 541, 542,
3554 226, -181, 227, 483, 484, 545, 546, 204, 205, 490,
3555 491, 460, 493, 494, 206, 207, 208, 209, 210, 211,
3556 212, 213, 176, 527, 528, 536, 537, 538, 539, 558,
3557 559, 177, 184, 197, 185, 186, 196, 187, 188, 203,
3558 269, 278, 279, -186, 285, 284, 286, 293, 294, 295,
3559 302, 296, 297, 305, 306, 308, 338, 339, 344, 345,
3560 346, 347, 400, 355, 375, 404, 403, 407, 415, 416,
3561 405, 417, 214, 418, 397, 392, 396, -147, 402, 419,
3562 422, 215, 425, 426, 216, 217, 218, 219, 220, 427,
3563 435, -151, -150, 429, 434, 443, 449, 221, 222, 223,
3564 224, 445, 225, 450, 451, 452, 455, 458, 461, 226,
3565 462, 227, 476, 477, 482, 485, 489, 497, 486, 492,
3566 517, 498, 500, 501, 503, 510, 543, 518, 519, 532,
3567 530, 533, 544, 562, 549, 563, 551, 525, 428, 83,
3568 144, 552, 555, 569, 570, 0, 277, 579, 535, 0,
3569 0, 273
3570 };
3571
3572 static const yytype_int16 yycheck[] =
3573 {
3574 16, 206, 207, 286, 187, 320, 305, 381, 382, 383,
3575 293, 385, 386, 387, 388, 30, 31, 32, 33, 34,
3576 225, 13, 176, 12, 86, 230, 231, 18, 29, 284,
3577 10, 11, 79, 13, 14, 5, 6, 7, 8, 16,
3578 17, 18, 19, 0, 16, 60, 61, 16, 17, 18,
3579 19, 40, 257, 355, 59, 35, 15, 39, 41, 3,
3580 49, 119, 17, 59, 122, 12, 85, 40, 402, 131,
3581 50, 51, 62, 55, 98, 99, 92, 93, 58, 126,
3582 69, 32, 62, 18, 289, 290, 291, 57, 125, 294,
3583 295, 296, 297, 40, 85, 75, 470, 18, 303, 304,
3584 70, 120, 49, 75, 84, 96, 79, 87, 88, 16,
3585 17, 18, 19, 64, 119, 269, 132, 133, 134, 135,
3586 375, 113, 69, 119, 4, 126, 117, 97, 119, 109,
3587 110, 121, 102, 116, 111, 126, 451, 126, 343, 441,
3588 117, 100, 111, 477, 160, 100, 101, 38, 117, 126,
3589 85, 125, 5, 452, 134, 8, 126, 126, 11, 174,
3590 13, 96, 85, 17, 85, 120, 182, 183, 85, 80,
3591 81, 62, 63, 125, 32, 96, 550, 30, 31, 126,
3592 33, 34, 117, 36, 119, 38, 391, 120, 32, 120,
3593 43, 126, 80, 81, 75, 400, 117, 120, 119, 573,
3594 120, 82, 119, 132, 111, 126, 64, 60, 61, 126,
3595 117, 119, 125, 66, 28, 126, 120, 70, 126, 126,
3596 64, 11, 75, 76, 87, 78, 85, 41, 123, 120,
3597 44, 45, 46, 47, 48, 126, 89, 28, 126, 29,
3598 119, 104, 119, 62, 63, 450, 15, 16, 17, 85,
3599 41, 41, 42, 44, 45, 46, 47, 48, 119, 112,
3600 113, 120, 445, 562, 117, 118, 119, 120, 121, 85,
3601 475, 5, 127, 126, 8, 558, 10, 11, 119, 13,
3602 119, 120, 101, 52, 120, 75, 132, 9, 10, 11,
3603 12, 125, 155, 156, 84, 125, 30, 31, 67, 33,
3604 34, 119, 36, 119, 38, 119, 119, 126, 126, 43,
3605 126, 119, 126, 126, 125, 520, 135, 119, 126, 125,
3606 525, 43, 119, 132, 126, 125, 60, 61, 119, 126,
3607 28, 125, 66, 551, 552, 126, 70, 555, 543, 119,
3608 120, 75, 76, 41, 78, 119, 44, 45, 46, 47,
3609 48, 119, 120, 75, 76, 89, 78, 13, 14, 579,
3610 565, 581, 120, 583, 20, 21, 22, 23, 24, 25,
3611 26, 27, 118, 119, 114, 121, 119, 120, 112, 113,
3612 126, 119, 120, 117, 118, 119, 120, 121, 13, 14,
3613 71, 72, 73, 74, 32, 20, 21, 22, 23, 24,
3614 25, 26, 27, 118, 119, 32, 121, 118, 119, 35,
3615 121, 126, 118, 119, 35, 121, 118, 119, 40, 121,
3616 119, 119, 78, 118, 119, 37, 121, 120, 126, 118,
3617 119, 87, 121, 449, 90, 91, 92, 93, 94, 455,
3618 456, 457, 119, 120, 119, 120, 10, 103, 104, 105,
3619 106, 133, 108, 78, 119, 120, 129, 130, 124, 115,
3620 75, 117, 87, 16, 17, 90, 91, 92, 93, 94,
3621 126, 16, 17, 119, 120, 119, 120, 125, 103, 104,
3622 105, 106, 125, 108, 119, 120, 53, 54, 504, 505,
3623 115, 125, 117, 53, 54, 511, 512, 13, 14, 53,
3624 54, 126, 119, 120, 20, 21, 22, 23, 24, 25,
3625 26, 27, 125, 129, 130, 119, 120, 119, 120, 125,
3626 126, 120, 125, 128, 125, 125, 120, 125, 125, 120,
3627 125, 120, 120, 125, 15, 125, 15, 15, 107, 107,
3628 120, 107, 107, 10, 120, 28, 76, 120, 120, 131,
3629 120, 77, 55, 128, 125, 17, 36, 65, 15, 13,
3630 119, 13, 78, 119, 125, 128, 128, 125, 125, 59,
3631 119, 87, 68, 108, 90, 91, 92, 93, 94, 108,
3632 119, 129, 129, 129, 128, 82, 55, 103, 104, 105,
3633 106, 125, 108, 38, 40, 10, 55, 125, 119, 115,
3634 56, 117, 125, 125, 68, 52, 119, 125, 52, 129,
3635 126, 125, 83, 83, 119, 119, 39, 119, 119, 119,
3636 75, 119, 39, 10, 119, 136, 125, 476, 338, 67,
3637 98, 125, 125, 125, 125, -1, 188, 126, 498, -1,
3638 -1, 184
3639 };
3640
3641 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
3642 state STATE-NUM. */
3643 static const yytype_uint8 yystos[] =
3644 {
3645 0, 138, 139, 0, 3, 125, 4, 141, 125, 140,
3646 142, 197, 5, 6, 7, 8, 57, 70, 97, 102,
3647 126, 143, 29, 126, 198, 120, 120, 120, 9, 10,
3648 11, 12, 43, 75, 76, 78, 118, 119, 121, 193,
3649 196, 228, 71, 72, 73, 74, 231, 98, 99, 17,
3650 199, 200, 144, 120, 181, 181, 181, 181, 181, 181,
3651 40, 79, 132, 229, 119, 119, 119, 125, 201, 123,
3652 146, 147, 148, 149, 151, 150, 181, 181, 119, 226,
3653 228, 127, 119, 201, 5, 8, 11, 13, 30, 31,
3654 33, 34, 36, 38, 43, 60, 61, 66, 70, 75,
3655 76, 78, 89, 112, 113, 117, 120, 196, 202, 215,
3656 216, 145, 125, 125, 125, 125, 125, 125, 153, 152,
3657 227, 132, 119, 126, 120, 114, 119, 120, 183, 204,
3658 85, 216, 32, 32, 35, 35, 196, 196, 119, 120,
3659 185, 207, 208, 209, 231, 119, 120, 187, 211, 119,
3660 120, 186, 210, 40, 119, 13, 113, 85, 216, 120,
3661 37, 10, 133, 124, 154, 158, 161, 217, 168, 165,
3662 125, 125, 119, 228, 75, 203, 125, 120, 196, 196,
3663 196, 196, 39, 55, 125, 125, 125, 125, 125, 119,
3664 120, 189, 85, 216, 85, 216, 120, 128, 196, 119,
3665 120, 182, 206, 120, 13, 14, 20, 21, 22, 23,
3666 24, 25, 26, 27, 78, 87, 90, 91, 92, 93,
3667 94, 103, 104, 105, 106, 108, 115, 117, 126, 155,
3668 16, 17, 18, 19, 111, 117, 126, 159, 28, 41,
3669 44, 45, 46, 47, 48, 119, 126, 162, 175, 12,
3670 40, 49, 69, 126, 218, 18, 85, 96, 117, 119,
3671 126, 169, 85, 119, 126, 166, 234, 232, 181, 125,
3672 158, 196, 196, 217, 222, 224, 168, 165, 120, 120,
3673 119, 120, 213, 205, 125, 15, 15, 193, 193, 17,
3674 100, 101, 120, 15, 107, 107, 107, 107, 193, 41,
3675 116, 174, 120, 193, 193, 10, 120, 164, 28, 119,
3676 120, 184, 190, 191, 11, 29, 41, 42, 75, 84,
3677 220, 10, 11, 13, 14, 35, 50, 51, 58, 62,
3678 75, 84, 87, 88, 109, 110, 134, 221, 76, 120,
3679 118, 119, 193, 194, 120, 131, 120, 77, 79, 126,
3680 235, 80, 81, 126, 233, 128, 212, 158, 126, 126,
3681 62, 63, 101, 126, 135, 223, 38, 62, 63, 120,
3682 126, 225, 126, 126, 214, 125, 154, 119, 122, 173,
3683 173, 193, 193, 193, 173, 193, 193, 193, 193, 129,
3684 130, 157, 128, 193, 193, 182, 128, 125, 163, 192,
3685 55, 219, 125, 36, 17, 119, 220, 65, 16, 17,
3686 15, 16, 17, 52, 67, 15, 13, 13, 119, 59,
3687 16, 17, 119, 15, 100, 68, 108, 108, 186, 129,
3688 118, 119, 193, 195, 128, 119, 167, 119, 120, 188,
3689 236, 75, 82, 82, 187, 125, 126, 59, 119, 55,
3690 38, 40, 10, 59, 119, 55, 32, 64, 125, 154,
3691 126, 119, 56, 157, 157, 157, 157, 157, 157, 157,
3692 193, 119, 120, 119, 120, 176, 125, 125, 193, 161,
3693 53, 54, 68, 53, 54, 52, 52, 16, 75, 119,
3694 53, 54, 129, 119, 120, 86, 131, 125, 125, 187,
3695 83, 83, 168, 119, 32, 64, 196, 193, 220, 182,
3696 119, 32, 64, 196, 196, 196, 180, 126, 119, 119,
3697 157, 156, 160, 126, 193, 176, 161, 129, 130, 126,
3698 75, 172, 119, 119, 177, 232, 119, 120, 119, 120,
3699 126, 196, 196, 39, 39, 196, 196, 119, 126, 119,
3700 193, 125, 125, 126, 126, 125, 171, 170, 125, 126,
3701 126, 193, 10, 136, 230, 157, 180, 180, 180, 125,
3702 125, 173, 182, 193, 126, 126, 126, 179, 178, 126,
3703 157, 119, 126, 119, 126, 230, 230, 230
3704 };
3705
3706 /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
3707 static const yytype_uint8 yyr1[] =
3708 {
3709 0, 137, 139, 140, 138, 141, 141, 142, 142, 143,
3710 143, 143, 143, 144, 145, 143, 146, 143, 147, 143,
3711 148, 143, 149, 143, 150, 143, 151, 143, 152, 143,
3712 153, 143, 143, 143, 143, 143, 154, 154, 155, 155,
3713 155, 155, 155, 155, 155, 155, 155, 155, 155, 155,
3714 155, 155, 155, 155, 155, 155, 155, 155, 155, 155,
3715 155, 155, 155, 155, 155, 156, 155, 157, 157, 157,
3716 158, 158, 159, 159, 159, 159, 159, 159, 160, 159,
3717 161, 161, 162, 163, 162, 164, 162, 165, 165, 167,
3718 166, 166, 168, 168, 170, 169, 171, 169, 169, 169,
3719 169, 169, 172, 169, 173, 173, 173, 173, 174, 174,
3720 175, 175, 175, 175, 175, 175, 176, 176, 177, 177,
3721 178, 178, 179, 179, 180, 180, 181, 181, 182, 182,
3722 183, 183, 184, 184, 185, 185, 186, 186, 187, 187,
3723 188, 188, 189, 189, 190, 191, 190, 192, 190, 193,
3724 193, 193, 194, 194, 194, 195, 195, 195, 196, 196,
3725 196, 197, 197, 199, 198, 200, 198, 201, 201, 202,
3726 202, 202, 202, 202, 202, 202, 202, 202, 202, 202,
3727 202, 203, 202, 204, 202, 202, 205, 202, 206, 202,
3728 202, 202, 202, 202, 202, 202, 202, 202, 202, 207,
3729 202, 202, 208, 202, 209, 202, 202, 202, 210, 202,
3730 202, 211, 202, 212, 202, 202, 202, 202, 214, 213,
3731 215, 215, 216, 216, 217, 217, 218, 218, 218, 218,
3732 218, 219, 219, 219, 219, 220, 220, 220, 220, 220,
3733 220, 221, 221, 221, 221, 221, 221, 221, 221, 221,
3734 221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
3735 221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
3736 221, 222, 222, 223, 223, 223, 223, 223, 223, 224,
3737 224, 225, 225, 225, 225, 225, 225, 225, 227, 226,
3738 229, 228, 230, 230, 231, 231, 231, 231, 232, 232,
3739 233, 233, 233, 233, 233, 234, 234, 236, 235, 235
3740 };
3741
3742 /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
3743 static const yytype_int8 yyr2[] =
3744 {
3745 0, 2, 0, 0, 7, 4, 0, 2, 0, 2,
3746 2, 2, 2, 0, 0, 6, 0, 7, 0, 7,
3747 0, 7, 0, 7, 0, 7, 0, 7, 0, 8,
3748 0, 8, 2, 5, 3, 4, 2, 0, 2, 2,
3749 1, 1, 1, 1, 1, 1, 3, 3, 3, 1,
3750 1, 1, 1, 1, 2, 2, 4, 4, 4, 4,
3751 4, 4, 4, 9, 4, 0, 8, 1, 1, 0,
3752 2, 0, 1, 3, 3, 1, 3, 4, 0, 8,
3753 2, 0, 1, 0, 6, 0, 5, 2, 0, 0,
3754 6, 2, 2, 0, 0, 9, 0, 9, 2, 3,
3755 3, 4, 0, 8, 3, 4, 1, 3, 1, 1,
3756 1, 1, 1, 1, 1, 1, 2, 0, 5, 0,
3757 3, 0, 3, 0, 3, 0, 1, 0, 1, 1,
3758 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
3759 1, 1, 1, 1, 1, 0, 4, 0, 5, 1,
3760 1, 1, 1, 1, 2, 1, 1, 2, 5, 3,
3761 1, 2, 0, 0, 5, 0, 3, 2, 0, 2,
3762 2, 2, 3, 3, 3, 3, 4, 2, 4, 3,
3763 2, 0, 6, 0, 5, 3, 0, 7, 0, 6,
3764 2, 3, 2, 3, 3, 4, 3, 4, 1, 0,
3765 5, 2, 0, 5, 0, 5, 3, 2, 0, 5,
3766 2, 0, 5, 0, 8, 6, 4, 4, 0, 5,
3767 1, 0, 3, 1, 2, 0, 2, 3, 2, 3,
3768 1, 2, 3, 3, 0, 1, 1, 1, 2, 2,
3769 2, 1, 2, 2, 2, 3, 3, 2, 2, 3,
3770 3, 3, 3, 3, 3, 3, 3, 2, 2, 3,
3771 1, 2, 1, 2, 2, 2, 2, 3, 4, 2,
3772 2, 2, 0, 3, 3, 5, 3, 4, 4, 2,
3773 0, 3, 6, 3, 4, 4, 3, 3, 0, 2,
3774 0, 2, 1, 0, 1, 1, 1, 1, 2, 0,
3775 4, 4, 4, 4, 3, 2, 0, 0, 5, 2
3776 };
3777
3778
3779 enum { YYENOMEM = -2 };
3780
3781 #define yyerrok (yyerrstatus = 0)
3782 #define yyclearin (yychar = YYEMPTY)
3783
3784 #define YYACCEPT goto yyacceptlab
3785 #define YYABORT goto yyabortlab
3786 #define YYERROR goto yyerrorlab
3787 #define YYNOMEM goto yyexhaustedlab
3788
3789
3790 #define YYRECOVERING() (!!yyerrstatus)
3791
3792 #define YYBACKUP(Token, Value) \
3793 do \
3794 if (yychar == YYEMPTY) \
3795 { \
3796 yychar = (Token); \
3797 yylval = (Value); \
3798 YYPOPSTACK (yylen); \
3799 yystate = *yyssp; \
3800 goto yybackup; \
3801 } \
3802 else \
3803 { \
3804 yyerror (YY_("syntax error: cannot back up")); \
3805 YYERROR; \
3806 } \
3807 while (0)
3808
3809 /* Backward compatibility with an undocumented macro.
3810 Use YYerror or YYUNDEF. */
3811 #define YYERRCODE YYUNDEF
3812
3813
3814 /* Enable debugging if requested. */
3815 #if YYDEBUG
3816
3817 # ifndef YYFPRINTF
3818 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
3819 # define YYFPRINTF fprintf
3820 # endif
3821
3822 # define YYDPRINTF(Args) \
3823 do { \
3824 if (yydebug) \
3825 YYFPRINTF Args; \
3826 } while (0)
3827
3828
3829
3830
3831 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
3832 do { \
3833 if (yydebug) \
3834 { \
3835 YYFPRINTF (stderr, "%s ", Title); \
3836 yy_symbol_print (stderr, \
3837 Kind, Value); \
3838 YYFPRINTF (stderr, "\n"); \
3839 } \
3840 } while (0)
3841
3842
3843 /*-----------------------------------.
3844 | Print this symbol's value on YYO. |
3845 `-----------------------------------*/
3846
3847 static void
3848 yy_symbol_value_print (FILE *yyo,
3849 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
3850 {
3851 FILE *yyoutput = yyo;
3852 YY_USE (yyoutput);
3853 if (!yyvaluep)
3854 return;
3855 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
3856 YY_USE (yykind);
3857 YY_IGNORE_MAYBE_UNINITIALIZED_END
3858 }
3859
3860
3861 /*---------------------------.
3862 | Print this symbol on YYO. |
3863 `---------------------------*/
3864
3865 static void
3866 yy_symbol_print (FILE *yyo,
3867 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
3868 {
3869 YYFPRINTF (yyo, "%s %s (",
3870 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
3871
3872 yy_symbol_value_print (yyo, yykind, yyvaluep);
3873 YYFPRINTF (yyo, ")");
3874 }
3875
3876 /*------------------------------------------------------------------.
3877 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
3878 | TOP (included). |
3879 `------------------------------------------------------------------*/
3880
3881 static void
3882 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
3883 {
3884 YYFPRINTF (stderr, "Stack now");
3885 for (; yybottom <= yytop; yybottom++)
3886 {
3887 int yybot = *yybottom;
3888 YYFPRINTF (stderr, " %d", yybot);
3889 }
3890 YYFPRINTF (stderr, "\n");
3891 }
3892
3893 # define YY_STACK_PRINT(Bottom, Top) \
3894 do { \
3895 if (yydebug) \
3896 yy_stack_print ((Bottom), (Top)); \
3897 } while (0)
3898
3899
3900 /*------------------------------------------------.
3901 | Report that the YYRULE is going to be reduced. |
3902 `------------------------------------------------*/
3903
3904 static void
3905 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
3906 int yyrule)
3907 {
3908 int yylno = yyrline[yyrule];
3909 int yynrhs = yyr2[yyrule];
3910 int yyi;
3911 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
3912 yyrule - 1, yylno);
3913 /* The symbols being reduced. */
3914 for (yyi = 0; yyi < yynrhs; yyi++)
3915 {
3916 YYFPRINTF (stderr, " $%d = ", yyi + 1);
3917 yy_symbol_print (stderr,
3918 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
3919 &yyvsp[(yyi + 1) - (yynrhs)]);
3920 YYFPRINTF (stderr, "\n");
3921 }
3922 }
3923
3924 # define YY_REDUCE_PRINT(Rule) \
3925 do { \
3926 if (yydebug) \
3927 yy_reduce_print (yyssp, yyvsp, Rule); \
3928 } while (0)
3929
3930 /* Nonzero means print parse trace. It is left uninitialized so that
3931 multiple parsers can coexist. */
3932 int yydebug;
3933 #else /* !YYDEBUG */
3934 # define YYDPRINTF(Args) ((void) 0)
3935 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
3936 # define YY_STACK_PRINT(Bottom, Top)
3937 # define YY_REDUCE_PRINT(Rule)
3938 #endif /* !YYDEBUG */
3939
3940
3941 /* YYINITDEPTH -- initial size of the parser's stacks. */
3942 #ifndef YYINITDEPTH
3943 # define YYINITDEPTH 200
3944 #endif
3945
3946 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
3947 if the built-in stack extension method is used).
3948
3949 Do not make this value too large; the results are undefined if
3950 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
3951 evaluated with infinite-precision integer arithmetic. */
3952
3953 #ifndef YYMAXDEPTH
3954 # define YYMAXDEPTH 10000
3955 #endif
3956
3957
3958
3959
3960
3961
3962 /*-----------------------------------------------.
3963 | Release the memory associated to this symbol. |
3964 `-----------------------------------------------*/
3965
3966 static void
3967 yydestruct (const char *yymsg,
3968 yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
3969 {
3970 YY_USE (yyvaluep);
3971 if (!yymsg)
3972 yymsg = "Deleting";
3973 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
3974
3975 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
3976 YY_USE (yykind);
3977 YY_IGNORE_MAYBE_UNINITIALIZED_END
3978 }
3979
3980
3981
3982
3983
3984
3985 /*----------.
3986 | yyparse. |
3987 `----------*/
3988
3989 int
3990 yyparse (void)
3991 {
3992 /* Lookahead token kind. */
3993 int yychar;
3994
3995
3996 /* The semantic value of the lookahead symbol. */
3997 /* Default value used for initialization, for pacifying older GCCs
3998 or non-GCC compilers. */
3999 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
4000 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
4001
4002 /* Number of syntax errors so far. */
4003 int yynerrs = 0;
4004
4005 yy_state_fast_t yystate = 0;
4006 /* Number of tokens to shift before error messages enabled. */
4007 int yyerrstatus = 0;
4008
4009 /* Refer to the stacks through separate pointers, to allow yyoverflow
4010 to reallocate them elsewhere. */
4011
4012 /* Their size. */
4013 YYPTRDIFF_T yystacksize = YYINITDEPTH;
4014
4015 /* The state stack: array, bottom, top. */
4016 yy_state_t yyssa[YYINITDEPTH];
4017 yy_state_t *yyss = yyssa;
4018 yy_state_t *yyssp = yyss;
4019
4020 /* The semantic value stack: array, bottom, top. */
4021 YYSTYPE yyvsa[YYINITDEPTH];
4022 YYSTYPE *yyvs = yyvsa;
4023 YYSTYPE *yyvsp = yyvs;
4024
4025 int yyn;
4026 /* The return value of yyparse. */
4027 int yyresult;
4028 /* Lookahead symbol kind. */
4029 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
4030 /* The variables used to return semantic value and location from the
4031 action routines. */
4032 YYSTYPE yyval;
4033
4034
4035
4036 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
4037
4038 /* The number of symbols on the RHS of the reduced rule.
4039 Keep to zero when no symbol should be popped. */
4040 int yylen = 0;
4041
4042 YYDPRINTF ((stderr, "Starting parse\n"));
4043
4044 yychar = YYEMPTY; /* Cause a token to be read. */
4045
4046 goto yysetstate;
4047
4048
4049 /*------------------------------------------------------------.
4050 | yynewstate -- push a new state, which is found in yystate. |
4051 `------------------------------------------------------------*/
4052 yynewstate:
4053 /* In all cases, when you get here, the value and location stacks
4054 have just been pushed. So pushing a state here evens the stacks. */
4055 yyssp++;
4056
4057
4058 /*--------------------------------------------------------------------.
4059 | yysetstate -- set current state (the top of the stack) to yystate. |
4060 `--------------------------------------------------------------------*/
4061 yysetstate:
4062 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
4063 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
4064 YY_IGNORE_USELESS_CAST_BEGIN
4065 *yyssp = YY_CAST (yy_state_t, yystate);
4066 YY_IGNORE_USELESS_CAST_END
4067 YY_STACK_PRINT (yyss, yyssp);
4068
4069 if (yyss + yystacksize - 1 <= yyssp)
4070 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
4071 YYNOMEM;
4072 #else
4073 {
4074 /* Get the current used size of the three stacks, in elements. */
4075 YYPTRDIFF_T yysize = yyssp - yyss + 1;
4076
4077 # if defined yyoverflow
4078 {
4079 /* Give user a chance to reallocate the stack. Use copies of
4080 these so that the &'s don't force the real ones into
4081 memory. */
4082 yy_state_t *yyss1 = yyss;
4083 YYSTYPE *yyvs1 = yyvs;
4084
4085 /* Each stack pointer address is followed by the size of the
4086 data in use in that stack, in bytes. This used to be a
4087 conditional around just the two extra args, but that might
4088 be undefined if yyoverflow is a macro. */
4089 yyoverflow (YY_("memory exhausted"),
4090 &yyss1, yysize * YYSIZEOF (*yyssp),
4091 &yyvs1, yysize * YYSIZEOF (*yyvsp),
4092 &yystacksize);
4093 yyss = yyss1;
4094 yyvs = yyvs1;
4095 }
4096 # else /* defined YYSTACK_RELOCATE */
4097 /* Extend the stack our own way. */
4098 if (YYMAXDEPTH <= yystacksize)
4099 YYNOMEM;
4100 yystacksize *= 2;
4101 if (YYMAXDEPTH < yystacksize)
4102 yystacksize = YYMAXDEPTH;
4103
4104 {
4105 yy_state_t *yyss1 = yyss;
4106 union yyalloc *yyptr =
4107 YY_CAST (union yyalloc *,
4108 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
4109 if (! yyptr)
4110 YYNOMEM;
4111 YYSTACK_RELOCATE (yyss_alloc, yyss);
4112 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
4113 # undef YYSTACK_RELOCATE
4114 if (yyss1 != yyssa)
4115 YYSTACK_FREE (yyss1);
4116 }
4117 # endif
4118
4119 yyssp = yyss + yysize - 1;
4120 yyvsp = yyvs + yysize - 1;
4121
4122 YY_IGNORE_USELESS_CAST_BEGIN
4123 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
4124 YY_CAST (long, yystacksize)));
4125 YY_IGNORE_USELESS_CAST_END
4126
4127 if (yyss + yystacksize - 1 <= yyssp)
4128 YYABORT;
4129 }
4130 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
4131
4132
4133 if (yystate == YYFINAL)
4134 YYACCEPT;
4135
4136 goto yybackup;
4137
4138
4139 /*-----------.
4140 | yybackup. |
4141 `-----------*/
4142 yybackup:
4143 /* Do appropriate processing given the current state. Read a
4144 lookahead token if we need one and don't already have one. */
4145
4146 /* First try to decide what to do without reference to lookahead token. */
4147 yyn = yypact[yystate];
4148 if (yypact_value_is_default (yyn))
4149 goto yydefault;
4150
4151 /* Not known => get a lookahead token if don't already have one. */
4152
4153 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
4154 if (yychar == YYEMPTY)
4155 {
4156 YYDPRINTF ((stderr, "Reading a token\n"));
4157 yychar = yylex (&yylval);
4158 }
4159
4160 if (yychar <= YYEOF)
4161 {
4162 yychar = YYEOF;
4163 yytoken = YYSYMBOL_YYEOF;
4164 YYDPRINTF ((stderr, "Now at end of input.\n"));
4165 }
4166 else if (yychar == YYerror)
4167 {
4168 /* The scanner already issued an error message, process directly
4169 to error recovery. But do not keep the error token as
4170 lookahead, it is too special and may lead us to an endless
4171 loop in error recovery. */
4172 yychar = YYUNDEF;
4173 yytoken = YYSYMBOL_YYerror;
4174 goto yyerrlab1;
4175 }
4176 else
4177 {
4178 yytoken = YYTRANSLATE (yychar);
4179 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
4180 }
4181
4182 /* If the proper action on seeing token YYTOKEN is to reduce or to
4183 detect an error, take that action. */
4184 yyn += yytoken;
4185 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
4186 goto yydefault;
4187 yyn = yytable[yyn];
4188 if (yyn <= 0)
4189 {
4190 if (yytable_value_is_error (yyn))
4191 goto yyerrlab;
4192 yyn = -yyn;
4193 goto yyreduce;
4194 }
4195
4196 /* Count tokens shifted since error; after three, turn off error
4197 status. */
4198 if (yyerrstatus)
4199 yyerrstatus--;
4200
4201 /* Shift the lookahead token. */
4202 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
4203 yystate = yyn;
4204 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
4205 *++yyvsp = yylval;
4206 YY_IGNORE_MAYBE_UNINITIALIZED_END
4207
4208 /* Discard the shifted token. */
4209 yychar = YYEMPTY;
4210 goto yynewstate;
4211
4212
4213 /*-----------------------------------------------------------.
4214 | yydefault -- do the default action for the current state. |
4215 `-----------------------------------------------------------*/
4216 yydefault:
4217 yyn = yydefact[yystate];
4218 if (yyn == 0)
4219 goto yyerrlab;
4220 goto yyreduce;
4221
4222
4223 /*-----------------------------.
4224 | yyreduce -- do a reduction. |
4225 `-----------------------------*/
4226 yyreduce:
4227 /* yyn is the number of a rule to reduce with. */
4228 yylen = yyr2[yyn];
4229
4230 /* If YYLEN is nonzero, implement the default value of the action:
4231 '$$ = $1'.
4232
4233 Otherwise, the following line sets YYVAL to garbage.
4234 This behavior is undocumented and Bison
4235 users should not rely upon it. Assigning to YYVAL
4236 unconditionally makes the parser a bit smaller, and it avoids a
4237 GCC warning that YYVAL may be used uninitialized. */
4238 yyval = yyvsp[1-yylen];
4239
4240
4241 YY_REDUCE_PRINT (yyn);
4242 switch (yyn)
4243 {
4244 case 2: /* $@1: %empty */
4245 #line 2286 "kate_parser.y"
4246 {nlines=1;}
4247 #line 4248 "kate_parser.c"
4248 break;
4249
4250 case 3: /* $@2: %empty */
4251 #line 2286 "kate_parser.y"
4252 { kd_write_headers(); }
4253 #line 4254 "kate_parser.c"
4254 break;
4255
4256 case 4: /* kd_kate: $@1 KATE '{' kd_opt_defs $@2 kd_events '}' */
4257 #line 2286 "kate_parser.y"
4258 { cleanup_memory(); }
4259 #line 4260 "kate_parser.c"
4260 break;
4261
4262 case 6: /* kd_opt_defs: %empty */
4263 #line 2290 "kate_parser.y"
4264 {}
4265 #line 4266 "kate_parser.c"
4266 break;
4267
4268 case 8: /* kd_defs: %empty */
4269 #line 2294 "kate_parser.y"
4270 {}
4271 #line 4272 "kate_parser.c"
4272 break;
4273
4274 case 9: /* kd_def: LANGUAGE STRING */
4275 #line 2297 "kate_parser.y"
4276 { CHECK_KATE_API_ERROR(kate_info_set_language(&ki,(yyvsp[0].string))); }
4277 #line 4278 "kate_parser.c"
4278 break;
4279
4280 case 10: /* kd_def: CATEGORY STRING */
4281 #line 2298 "kate_parser.y"
4282 { CHECK_KATE_API_ERROR(kate_info_set_category(&ki,(yyvsp[0].string))); }
4283 #line 4284 "kate_parser.c"
4284 break;
4285
4286 case 11: /* kd_def: DIRECTIONALITY directionality */
4287 #line 2299 "kate_parser.y"
4288 { CHECK_KATE_API_ERROR(kate_info_set_text_directionality(&ki,(yyvsp[0].number))); }
4289 #line 4290 "kate_parser.c"
4290 break;
4291
4292 case 12: /* kd_def: COMMENT STRING */
4293 #line 2300 "kate_parser.y"
4294 { add_comment(&kc,(yyvsp[0].string)); }
4295 #line 4296 "kate_parser.c"
4296 break;
4297
4298 case 13: /* $@3: %empty */
4299 #line 2301 "kate_parser.y"
4300 {set_macro_mode();}
4301 #line 4302 "kate_parser.c"
4302 break;
4303
4304 case 14: /* $@4: %empty */
4305 #line 2301 "kate_parser.y"
4306 {record_macro_name((yyvsp[0].string));}
4307 #line 4308 "kate_parser.c"
4308 break;
4309
4310 case 15: /* kd_def: DEFINE MACRO $@3 IDENTIFIER $@4 MACRO_BODY */
4311 #line 2302 "kate_parser.y"
4312 { add_temp_macro((yyvsp[0].string)); unset_macro_mode(); }
4313 #line 4314 "kate_parser.c"
4314 break;
4315
4316 case 16: /* $@5: %empty */
4317 #line 2303 "kate_parser.y"
4318 {init_style(&kstyle);}
4319 #line 4320 "kate_parser.c"
4320 break;
4321
4322 case 17: /* kd_def: DEFINE STYLE kd_opt_name $@5 '{' kd_style_defs '}' */
4323 #line 2303 "kate_parser.y"
4324 { add_style(&ki,(yyvsp[-4].string),&kstyle); }
4325 #line 4326 "kate_parser.c"
4326 break;
4327
4328 case 18: /* $@6: %empty */
4329 #line 2304 "kate_parser.y"
4330 {init_region(&kregion);}
4331 #line 4332 "kate_parser.c"
4332 break;
4333
4334 case 19: /* kd_def: DEFINE REGION kd_opt_name $@6 '{' kd_region_defs '}' */
4335 #line 2304 "kate_parser.y"
4336 { add_region(&ki,(yyvsp[-4].string),&kregion); }
4337 #line 4338 "kate_parser.c"
4338 break;
4339
4340 case 20: /* $@7: %empty */
4341 #line 2305 "kate_parser.y"
4342 {init_curve();}
4343 #line 4344 "kate_parser.c"
4344 break;
4345
4346 case 21: /* kd_def: DEFINE CURVE kd_opt_name $@7 '{' kd_curve_defs '}' */
4347 #line 2305 "kate_parser.y"
4348 { add_curve(&ki,(yyvsp[-4].string),kcurve.curve); }
4349 #line 4350 "kate_parser.c"
4350 break;
4351
4352 case 22: /* $@8: %empty */
4353 #line 2306 "kate_parser.y"
4354 {init_motion();}
4355 #line 4356 "kate_parser.c"
4356 break;
4357
4358 case 23: /* kd_def: DEFINE MOTION kd_opt_name $@8 '{' kd_motion_defs '}' */
4359 #line 2306 "kate_parser.y"
4360 { add_motion(&ki,(yyvsp[-4].string),kmotion); }
4361 #line 4362 "kate_parser.c"
4362 break;
4363
4364 case 24: /* $@9: %empty */
4365 #line 2307 "kate_parser.y"
4366 {init_palette();}
4367 #line 4368 "kate_parser.c"
4368 break;
4369
4370 case 25: /* kd_def: DEFINE PALETTE kd_opt_name $@9 '{' kd_palette_defs '}' */
4371 #line 2307 "kate_parser.y"
4372 { add_palette(&ki,(yyvsp[-4].string),kpalette.palette); }
4373 #line 4374 "kate_parser.c"
4374 break;
4375
4376 case 26: /* $@10: %empty */
4377 #line 2308 "kate_parser.y"
4378 {init_bitmap();}
4379 #line 4380 "kate_parser.c"
4380 break;
4381
4382 case 27: /* kd_def: DEFINE BITMAP kd_opt_name $@10 '{' kd_bitmap_defs '}' */
4383 #line 2308 "kate_parser.y"
4384 { add_bitmap(&ki,(yyvsp[-4].string),kbitmap.bitmap); }
4385 #line 4386 "kate_parser.c"
4386 break;
4387
4388 case 28: /* $@11: %empty */
4389 #line 2309 "kate_parser.y"
4390 {init_font_range();}
4391 #line 4392 "kate_parser.c"
4392 break;
4393
4394 case 29: /* kd_def: DEFINE FONT RANGE kd_opt_name $@11 '{' kd_font_range_defs '}' */
4395 #line 2309 "kate_parser.y"
4396 { add_font_range(&ki,(yyvsp[-4].string),krange); }
4397 #line 4398 "kate_parser.c"
4398 break;
4399
4400 case 30: /* $@12: %empty */
4401 #line 2310 "kate_parser.y"
4402 {init_font_mapping();}
4403 #line 4404 "kate_parser.c"
4404 break;
4405
4406 case 31: /* kd_def: DEFINE FONT MAPPING kd_opt_name $@12 '{' kd_font_mapping_defs '}' */
4407 #line 2310 "kate_parser.y"
4408 { add_font_mapping(&ki,(yyvsp[-4].string),kmapping); }
4409 #line 4410 "kate_parser.c"
4410 break;
4411
4412 case 32: /* kd_def: TIMEBASE timespec */
4413 #line 2311 "kate_parser.y"
4414 { timebase=(yyvsp[0].fp); }
4415 #line 4416 "kate_parser.c"
4416 break;
4417
4418 case 33: /* kd_def: GRANULE RATE UNUMBER '/' UNUMBER */
4419 #line 2312 "kate_parser.y"
4420 {set_granule_rate((yyvsp[-2].unumber),(yyvsp[0].unumber));}
4421 #line 4422 "kate_parser.c"
4422 break;
4423
4424 case 34: /* kd_def: GRANULE SHIFT UNUMBER */
4425 #line 2313 "kate_parser.y"
4426 {set_granule_shift((yyvsp[0].unumber));}
4427 #line 4428 "kate_parser.c"
4428 break;
4429
4430 case 35: /* kd_def: CANVAS SIZE UNUMBER UNUMBER */
4431 #line 2314 "kate_parser.y"
4432 {set_canvas_size((yyvsp[-1].unumber),(yyvsp[0].unumber));}
4433 #line 4434 "kate_parser.c"
4434 break;
4435
4436 case 37: /* kd_style_defs: %empty */
4437 #line 2318 "kate_parser.y"
4438 {}
4439 #line 4440 "kate_parser.c"
4440 break;
4441
4442 case 38: /* kd_style_def: HALIGN float */
4443 #line 2321 "kate_parser.y"
4444 { kstyle.halign=(yyvsp[0].fp); }
4445 #line 4446 "kate_parser.c"
4446 break;
4447
4448 case 39: /* kd_style_def: VALIGN float */
4449 #line 2322 "kate_parser.y"
4450 { kstyle.valign=(yyvsp[0].fp); }
4451 #line 4452 "kate_parser.c"
4452 break;
4453
4454 case 40: /* kd_style_def: HLEFT */
4455 #line 2323 "kate_parser.y"
4456 { kstyle.halign=(kate_float)-1.0; }
4457 #line 4458 "kate_parser.c"
4458 break;
4459
4460 case 41: /* kd_style_def: HCENTER */
4461 #line 2324 "kate_parser.y"
4462 { kstyle.halign=(kate_float)0.0; }
4463 #line 4464 "kate_parser.c"
4464 break;
4465
4466 case 42: /* kd_style_def: HRIGHT */
4467 #line 2325 "kate_parser.y"
4468 { kstyle.halign=(kate_float)1.0; }
4469 #line 4470 "kate_parser.c"
4470 break;
4471
4472 case 43: /* kd_style_def: VTOP */
4473 #line 2326 "kate_parser.y"
4474 { kstyle.valign=(kate_float)-1.0; }
4475 #line 4476 "kate_parser.c"
4476 break;
4477
4478 case 44: /* kd_style_def: VCENTER */
4479 #line 2327 "kate_parser.y"
4480 { kstyle.valign=(kate_float)0.0; }
4481 #line 4482 "kate_parser.c"
4482 break;
4483
4484 case 45: /* kd_style_def: VBOTTOM */
4485 #line 2328 "kate_parser.y"
4486 { kstyle.valign=(kate_float)1.0; }
4487 #line 4488 "kate_parser.c"
4488 break;
4489
4490 case 46: /* kd_style_def: TEXT COLOR kd_color */
4491 #line 2329 "kate_parser.y"
4492 { set_color(&kstyle.text_color,(yyvsp[0].color)); }
4493 #line 4494 "kate_parser.c"
4494 break;
4495
4496 case 47: /* kd_style_def: BACKGROUND COLOR kd_color */
4497 #line 2330 "kate_parser.y"
4498 { set_color(&kstyle.background_color,(yyvsp[0].color)); }
4499 #line 4500 "kate_parser.c"
4500 break;
4501
4502 case 48: /* kd_style_def: DRAW COLOR kd_color */
4503 #line 2331 "kate_parser.y"
4504 { set_color(&kstyle.draw_color,(yyvsp[0].color)); }
4505 #line 4506 "kate_parser.c"
4506 break;
4507
4508 case 49: /* kd_style_def: BOLD */
4509 #line 2332 "kate_parser.y"
4510 { kstyle.bold=1; }
4511 #line 4512 "kate_parser.c"
4512 break;
4513
4514 case 50: /* kd_style_def: ITALICS */
4515 #line 2333 "kate_parser.y"
4516 { kstyle.italics=1; }
4517 #line 4518 "kate_parser.c"
4518 break;
4519
4520 case 51: /* kd_style_def: UNDERLINE */
4521 #line 2334 "kate_parser.y"
4522 { kstyle.underline=1; }
4523 #line 4524 "kate_parser.c"
4524 break;
4525
4526 case 52: /* kd_style_def: STRIKE */
4527 #line 2335 "kate_parser.y"
4528 { kstyle.strike=1; }
4529 #line 4530 "kate_parser.c"
4530 break;
4531
4532 case 53: /* kd_style_def: JUSTIFY */
4533 #line 2336 "kate_parser.y"
4534 { kstyle.justify=1; }
4535 #line 4536 "kate_parser.c"
4536 break;
4537
4538 case 54: /* kd_style_def: WRAP kd_wrap_mode */
4539 #line 2337 "kate_parser.y"
4540 { kstyle.wrap_mode=(yyvsp[0].number); }
4541 #line 4542 "kate_parser.c"
4542 break;
4543
4544 case 55: /* kd_style_def: FONT STRING */
4545 #line 2338 "kate_parser.y"
4546 { set_font(&kstyle,(yyvsp[0].string)); }
4547 #line 4548 "kate_parser.c"
4548 break;
4549
4550 case 56: /* kd_style_def: FONT SIZE float kd_opt_space_metric */
4551 #line 2339 "kate_parser.y"
4552 { set_font_size(&kstyle,(yyvsp[-1].fp),(yyvsp[0].number)); }
4553 #line 4554 "kate_parser.c"
4554 break;
4555
4556 case 57: /* kd_style_def: FONT WIDTH float kd_opt_space_metric */
4557 #line 2340 "kate_parser.y"
4558 { set_font_width(&kstyle,(yyvsp[-1].fp),(yyvsp[0].number)); }
4559 #line 4560 "kate_parser.c"
4560 break;
4561
4562 case 58: /* kd_style_def: FONT HEIGHT float kd_opt_space_metric */
4563 #line 2341 "kate_parser.y"
4564 { set_font_height(&kstyle,(yyvsp[-1].fp),(yyvsp[0].number)); }
4565 #line 4566 "kate_parser.c"
4566 break;
4567
4568 case 59: /* kd_style_def: LEFT MARGIN float kd_opt_space_metric */
4569 #line 2342 "kate_parser.y"
4570 { set_margin(&kstyle,&kstyle.left_margin,(yyvsp[-1].fp),(yyvsp[0].number)); }
4571 #line 4572 "kate_parser.c"
4572 break;
4573
4574 case 60: /* kd_style_def: TOP MARGIN float kd_opt_space_metric */
4575 #line 2343 "kate_parser.y"
4576 { set_margin(&kstyle,&kstyle.top_margin,(yyvsp[-1].fp),(yyvsp[0].number)); }
4577 #line 4578 "kate_parser.c"
4578 break;
4579
4580 case 61: /* kd_style_def: RIGHT MARGIN float kd_opt_space_metric */
4581 #line 2344 "kate_parser.y"
4582 { set_margin(&kstyle,&kstyle.right_margin,(yyvsp[-1].fp),(yyvsp[0].number)); }
4583 #line 4584 "kate_parser.c"
4584 break;
4585
4586 case 62: /* kd_style_def: BOTTOM MARGIN float kd_opt_space_metric */
4587 #line 2345 "kate_parser.y"
4588 { set_margin(&kstyle,&kstyle.bottom_margin,(yyvsp[-1].fp),(yyvsp[0].number)); }
4589 #line 4590 "kate_parser.c"
4590 break;
4591
4592 case 63: /* kd_style_def: MARGINS float kd_opt_space_metric float kd_opt_space_metric float kd_opt_space_metric float kd_opt_space_metric */
4593 #line 2347 "kate_parser.y"
4594 { set_margins(&kstyle,(yyvsp[-7].fp),(yyvsp[-6].number),(yyvsp[-5].fp),(yyvsp[-4].number),(yyvsp[-3].fp),(yyvsp[-2].number),(yyvsp[-1].fp),(yyvsp[0].number)); }
4595 #line 4596 "kate_parser.c"
4596 break;
4597
4598 case 64: /* kd_style_def: META STRING '=' STRING */
4599 #line 2348 "kate_parser.y"
4600 { add_meta(&kstyle.meta,(yyvsp[-2].string),(yyvsp[0].string)); }
4601 #line 4602 "kate_parser.c"
4602 break;
4603
4604 case 65: /* $@13: %empty */
4605 #line 2349 "kate_parser.y"
4606 {init_byte_stream((yyvsp[0].unumber));}
4607 #line 4608 "kate_parser.c"
4608 break;
4609
4610 case 66: /* kd_style_def: META STRING '=' UNUMBER $@13 '{' kd_byte_stream '}' */
4611 #line 2349 "kate_parser.y"
4612 { add_meta_byte_stream(&kstyle.meta,(yyvsp[-6].string)); }
4613 #line 4614 "kate_parser.c"
4614 break;
4615
4616 case 67: /* kd_opt_space_metric: '%' */
4617 #line 2352 "kate_parser.y"
4618 { (yyval.number)=kate_percentage; }
4619 #line 4620 "kate_parser.c"
4620 break;
4621
4622 case 68: /* kd_opt_space_metric: 'm' */
4623 #line 2353 "kate_parser.y"
4624 { (yyval.number)=kate_millionths; }
4625 #line 4626 "kate_parser.c"
4626 break;
4627
4628 case 69: /* kd_opt_space_metric: %empty */
4629 #line 2354 "kate_parser.y"
4630 { (yyval.number)=kate_pixel; }
4631 #line 4632 "kate_parser.c"
4632 break;
4633
4634 case 71: /* kd_region_defs: %empty */
4635 #line 2358 "kate_parser.y"
4636 {}
4637 #line 4638 "kate_parser.c"
4638 break;
4639
4640 case 72: /* kd_region_def: METRIC */
4641 #line 2361 "kate_parser.y"
4642 {kregion.metric=(yyvsp[0].number); }
4643 #line 4644 "kate_parser.c"
4644 break;
4645
4646 case 73: /* kd_region_def: POSITION float float */
4647 #line 2362 "kate_parser.y"
4648 { kregion.x=(yyvsp[-1].fp);kregion.y=(yyvsp[0].fp); }
4649 #line 4650 "kate_parser.c"
4650 break;
4651
4652 case 74: /* kd_region_def: SIZE float float */
4653 #line 2363 "kate_parser.y"
4654 { kregion.w=(yyvsp[-1].fp);kregion.h=(yyvsp[0].fp); }
4655 #line 4656 "kate_parser.c"
4656 break;
4657
4658 case 75: /* kd_region_def: CLIP */
4659 #line 2364 "kate_parser.y"
4660 { kregion.clip=1; }
4661 #line 4662 "kate_parser.c"
4662 break;
4663
4664 case 76: /* kd_region_def: DEFAULT STYLE kd_style_name_or_index */
4665 #line 2365 "kate_parser.y"
4666 { kregion.style=(yyvsp[0].number); }
4667 #line 4668 "kate_parser.c"
4668 break;
4669
4670 case 77: /* kd_region_def: META STRING '=' STRING */
4671 #line 2366 "kate_parser.y"
4672 { add_meta(&kregion.meta,(yyvsp[-2].string),(yyvsp[0].string)); }
4673 #line 4674 "kate_parser.c"
4674 break;
4675
4676 case 78: /* $@14: %empty */
4677 #line 2367 "kate_parser.y"
4678 {init_byte_stream((yyvsp[0].unumber));}
4679 #line 4680 "kate_parser.c"
4680 break;
4681
4682 case 79: /* kd_region_def: META STRING '=' UNUMBER $@14 '{' kd_byte_stream '}' */
4683 #line 2367 "kate_parser.y"
4684 { add_meta_byte_stream(&kregion.meta,(yyvsp[-6].string)); }
4685 #line 4686 "kate_parser.c"
4686 break;
4687
4688 case 81: /* kd_curve_defs: %empty */
4689 #line 2371 "kate_parser.y"
4690 {}
4691 #line 4692 "kate_parser.c"
4692 break;
4693
4694 case 82: /* kd_curve_def: kd_curvetype */
4695 #line 2374 "kate_parser.y"
4696 { kcurve.curve->type=(yyvsp[0].number); n_curve_pts=0; }
4697 #line 4698 "kate_parser.c"
4698 break;
4699
4700 case 83: /* $@15: %empty */
4701 #line 2375 "kate_parser.y"
4702 { init_curve_points((yyvsp[-1].unumber)); }
4703 #line 4704 "kate_parser.c"
4704 break;
4705
4706 case 84: /* kd_curve_def: UNUMBER POINTS $@15 '{' kd_curve_points '}' */
4707 #line 2375 "kate_parser.y"
4708 {
4709 if ((size_t)n_curve_pts!=kcurve.curve->npts*2) katedesc_error("Wrong number of points in the curve");
4710 }
4711 #line 4712 "kate_parser.c"
4712 break;
4713
4714 case 85: /* $@16: %empty */
4715 #line 2378 "kate_parser.y"
4716 { init_open_ended_curve_points(); }
4717 #line 4718 "kate_parser.c"
4718 break;
4719
4720 case 88: /* kd_palette_defs: %empty */
4721 #line 2382 "kate_parser.y"
4722 {}
4723 #line 4724 "kate_parser.c"
4724 break;
4725
4726 case 89: /* $@17: %empty */
4727 #line 2385 "kate_parser.y"
4728 { init_palette_colors((yyvsp[-1].unumber)); }
4729 #line 4730 "kate_parser.c"
4730 break;
4731
4732 case 90: /* kd_palette_def: UNUMBER COLORS $@17 '{' kd_palette_colors '}' */
4733 #line 2385 "kate_parser.y"
4734 {
4735 if ((size_t)n_palette_colors!=kpalette.palette->ncolors) {
4736 katedesc_error("Wrong number of colors in the palette");
4737 }
4738 }
4739 #line 4740 "kate_parser.c"
4740 break;
4741
4742 case 91: /* kd_palette_def: SOURCE STRING */
4743 #line 2390 "kate_parser.y"
4744 { load_palette((yyvsp[0].string)); }
4745 #line 4746 "kate_parser.c"
4746 break;
4747
4748 case 93: /* kd_bitmap_defs: %empty */
4749 #line 2394 "kate_parser.y"
4750 {}
4751 #line 4752 "kate_parser.c"
4752 break;
4753
4754 case 94: /* $@18: %empty */
4755 #line 2397 "kate_parser.y"
4756 { init_bitmap_pixels((yyvsp[-4].unumber),(yyvsp[-2].unumber),(yyvsp[0].unumber)); }
4757 #line 4758 "kate_parser.c"
4758 break;
4759
4760 case 95: /* kd_bitmap_def: UNUMBER 'x' UNUMBER 'x' UNUMBER $@18 '{' kd_bitmap_pixels '}' */
4761 #line 2397 "kate_parser.y"
4762 {
4763 if ((size_t)n_bitmap_pixels!=kbitmap.bitmap->width*kbitmap.bitmap->height) {
4764 katedesc_error("Wrong number of pixels in the bitmap");
4765 }
4766 }
4767 #line 4768 "kate_parser.c"
4768 break;
4769
4770 case 96: /* $@19: %empty */
4771 #line 2402 "kate_parser.y"
4772 { init_png_bitmap_pixels((yyvsp[-4].unumber),(yyvsp[-2].unumber),(yyvsp[0].unumber)); }
4773 #line 4774 "kate_parser.c"
4774 break;
4775
4776 case 97: /* kd_bitmap_def: UNUMBER 'x' UNUMBER PNG UNUMBER $@19 '{' kd_png_bitmap_pixels '}' */
4777 #line 2402 "kate_parser.y"
4778 {
4779 if ((size_t)n_bitmap_pixels!=kbitmap.bitmap->size) {
4780 katedesc_error("Wrong number of bytes in the PNG bitmap");
4781 }
4782 }
4783 #line 4784 "kate_parser.c"
4784 break;
4785
4786 case 98: /* kd_bitmap_def: SOURCE STRING */
4787 #line 2407 "kate_parser.y"
4788 { load_bitmap((yyvsp[0].string),0); }
4789 #line 4790 "kate_parser.c"
4790 break;
4791
4792 case 99: /* kd_bitmap_def: DEFAULT PALETTE kd_palette_name_or_index */
4793 #line 2408 "kate_parser.y"
4794 { kbitmap.bitmap->palette=(yyvsp[0].number); }
4795 #line 4796 "kate_parser.c"
4796 break;
4797
4798 case 100: /* kd_bitmap_def: OFFSET bitmap_x_offset bitmap_y_offset */
4799 #line 2409 "kate_parser.y"
4800 { kbitmap.bitmap->x_offset=(yyvsp[-1].number); kbitmap.bitmap->y_offset=(yyvsp[0].number); }
4801 #line 4802 "kate_parser.c"
4802 break;
4803
4804 case 101: /* kd_bitmap_def: META STRING '=' STRING */
4805 #line 2410 "kate_parser.y"
4806 { add_meta(&kbitmap.bitmap->meta,(yyvsp[-2].string),(yyvsp[0].string)); }
4807 #line 4808 "kate_parser.c"
4808 break;
4809
4810 case 102: /* $@20: %empty */
4811 #line 2411 "kate_parser.y"
4812 {init_byte_stream((yyvsp[0].unumber));}
4813 #line 4814 "kate_parser.c"
4814 break;
4815
4816 case 103: /* kd_bitmap_def: META STRING '=' UNUMBER $@20 '{' kd_byte_stream '}' */
4817 #line 2411 "kate_parser.y"
4818 { add_meta_byte_stream(&kbitmap.bitmap->meta,(yyvsp[-6].string)); }
4819 #line 4820 "kate_parser.c"
4820 break;
4821
4822 case 104: /* kd_color: UNUMBER UNUMBER UNUMBER */
4823 #line 2414 "kate_parser.y"
4824 { (yyval.color)=make_color((yyvsp[-2].unumber),(yyvsp[-1].unumber),(yyvsp[0].unumber),255); }
4825 #line 4826 "kate_parser.c"
4826 break;
4827
4828 case 105: /* kd_color: UNUMBER UNUMBER UNUMBER UNUMBER */
4829 #line 2415 "kate_parser.y"
4830 { (yyval.color)=make_color((yyvsp[-3].unumber),(yyvsp[-2].unumber),(yyvsp[-1].unumber),(yyvsp[0].unumber)); }
4831 #line 4832 "kate_parser.c"
4832 break;
4833
4834 case 106: /* kd_color: COLORSPEC */
4835 #line 2416 "kate_parser.y"
4836 { (yyval.color)=make_color_alpha((yyvsp[0].color),255); }
4837 #line 4838 "kate_parser.c"
4838 break;
4839
4840 case 107: /* kd_color: COLORSPEC ALPHA UNUMBER */
4841 #line 2417 "kate_parser.y"
4842 { (yyval.color)=make_color_alpha((yyvsp[-2].color),(yyvsp[0].unumber)); }
4843 #line 4844 "kate_parser.c"
4844 break;
4845
4846 case 108: /* kd_wrap_mode: NONE */
4847 #line 2420 "kate_parser.y"
4848 { (yyval.number)=kate_wrap_none; }
4849 #line 4850 "kate_parser.c"
4850 break;
4851
4852 case 109: /* kd_wrap_mode: WORD */
4853 #line 2421 "kate_parser.y"
4854 { (yyval.number)=kate_wrap_word; }
4855 #line 4856 "kate_parser.c"
4856 break;
4857
4858 case 110: /* kd_curvetype: NONE */
4859 #line 2424 "kate_parser.y"
4860 { (yyval.number)=kate_curve_none; }
4861 #line 4862 "kate_parser.c"
4862 break;
4863
4864 case 111: /* kd_curvetype: STATIC */
4865 #line 2425 "kate_parser.y"
4866 { (yyval.number)=kate_curve_static; }
4867 #line 4868 "kate_parser.c"
4868 break;
4869
4870 case 112: /* kd_curvetype: LINEAR */
4871 #line 2426 "kate_parser.y"
4872 { (yyval.number)=kate_curve_linear; }
4873 #line 4874 "kate_parser.c"
4874 break;
4875
4876 case 113: /* kd_curvetype: CATMULL_ROM */
4877 #line 2427 "kate_parser.y"
4878 { (yyval.number)=kate_curve_catmull_rom_spline; }
4879 #line 4880 "kate_parser.c"
4880 break;
4881
4882 case 114: /* kd_curvetype: BEZIER_CUBIC */
4883 #line 2428 "kate_parser.y"
4884 { (yyval.number)=kate_curve_bezier_cubic_spline; }
4885 #line 4886 "kate_parser.c"
4886 break;
4887
4888 case 115: /* kd_curvetype: BSPLINE */
4889 #line 2429 "kate_parser.y"
4890 { (yyval.number)=kate_curve_bspline; }
4891 #line 4892 "kate_parser.c"
4892 break;
4893
4894 case 116: /* kd_curve_points: kd_curve_points float */
4895 #line 2432 "kate_parser.y"
4896 {
4897 if (open_ended_curve) {
4898 add_open_ended_curve_point((yyvsp[0].fp));
4899 }
4900 else {
4901 if ((size_t)n_curve_pts>=kcurve.curve->npts*2) katedesc_error("Too many points in curve");
4902 else { kcurve.curve->pts[n_curve_pts++]=(yyvsp[0].fp); }
4903 }
4904 }
4905 #line 4906 "kate_parser.c"
4906 break;
4907
4908 case 117: /* kd_curve_points: %empty */
4909 #line 2441 "kate_parser.y"
4910 {}
4911 #line 4912 "kate_parser.c"
4912 break;
4913
4914 case 118: /* kd_palette_colors: kd_palette_colors '{' kd_color '}' kd_opt_comma */
4915 #line 2444 "kate_parser.y"
4916 {
4917 if ((size_t)n_palette_colors>=kpalette.palette->ncolors) katedesc_error("Too many colors in palette");
4918 else { set_color(&kpalette.palette->colors[n_palette_colors++],(yyvsp[-2].color)); }
4919 }
4920 #line 4921 "kate_parser.c"
4921 break;
4922
4923 case 119: /* kd_palette_colors: %empty */
4924 #line 2448 "kate_parser.y"
4925 {}
4926 #line 4927 "kate_parser.c"
4927 break;
4928
4929 case 120: /* kd_bitmap_pixels: kd_bitmap_pixels UNUMBER kd_opt_comma */
4930 #line 2451 "kate_parser.y"
4931 {
4932 if ((size_t)n_bitmap_pixels>=kbitmap.bitmap->width*kbitmap.bitmap->height) {
4933 katedesc_error("Too many pixels in bitmap");
4934 }
4935 else {
4936 if ((yyvsp[-1].unumber)>(unsigned int)(1<<kbitmap.bitmap->bpp)-1) {
4937 katedesc_error("pixels out of range for given bpp");
4938 }
4939 else {
4940 kbitmap.bitmap->pixels[n_bitmap_pixels++]=(yyvsp[-1].unumber);
4941 }
4942 }
4943 }
4944 #line 4945 "kate_parser.c"
4945 break;
4946
4947 case 121: /* kd_bitmap_pixels: %empty */
4948 #line 2464 "kate_parser.y"
4949 {}
4950 #line 4951 "kate_parser.c"
4951 break;
4952
4953 case 122: /* kd_png_bitmap_pixels: kd_png_bitmap_pixels UNUMBER kd_opt_comma */
4954 #line 2467 "kate_parser.y"
4955 {
4956 if ((size_t)n_bitmap_pixels>=kbitmap.bitmap->size) {
4957 katedesc_error("Too many pixels in bitmap");
4958 }
4959 else {
4960 kbitmap.bitmap->pixels[n_bitmap_pixels++]=(yyvsp[-1].unumber);
4961 }
4962 }
4963 #line 4964 "kate_parser.c"
4964 break;
4965
4966 case 123: /* kd_png_bitmap_pixels: %empty */
4967 #line 2475 "kate_parser.y"
4968 {}
4969 #line 4970 "kate_parser.c"
4970 break;
4971
4972 case 124: /* kd_byte_stream: kd_byte_stream UNUMBER kd_opt_comma */
4973 #line 2478 "kate_parser.y"
4974 {
4975 if (n_bytes_in_stream>=byte_stream_size) {
4976 katedesc_error("Too many bytes in byte stream");
4977 }
4978 else {
4979 byte_stream[n_bytes_in_stream++]=(yyvsp[-1].unumber);
4980 }
4981 }
4982 #line 4983 "kate_parser.c"
4983 break;
4984
4985 case 125: /* kd_byte_stream: %empty */
4986 #line 2486 "kate_parser.y"
4987 {}
4988 #line 4989 "kate_parser.c"
4989 break;
4990
4991 case 126: /* kd_opt_name: STRING */
4992 #line 2489 "kate_parser.y"
4993 { (yyval.string)=(yyvsp[0].string); }
4994 #line 4995 "kate_parser.c"
4995 break;
4996
4997 case 127: /* kd_opt_name: %empty */
4998 #line 2490 "kate_parser.y"
4999 { (yyval.string)=NULL; }
5000 #line 5001 "kate_parser.c"
5001 break;
5002
5003 case 128: /* kd_style_name_or_index: STRING */
5004 #line 2493 "kate_parser.y"
5005 { (yyval.number)=find_style(&ki,(yyvsp[0].string)); }
5006 #line 5007 "kate_parser.c"
5007 break;
5008
5009 case 129: /* kd_style_name_or_index: UNUMBER */
5010 #line 2494 "kate_parser.y"
5011 { if ((yyvsp[0].unumber)>=ki.nstyles) yyerrorf("Invalid style index (%u/%d)",(yyvsp[0].unumber),ki.nstyles); (yyval.number)=(yyvsp[0].unumber); }
5012 #line 5013 "kate_parser.c"
5013 break;
5014
5015 case 130: /* kd_region_name_or_index: STRING */
5016 #line 2497 "kate_parser.y"
5017 { (yyval.number)=find_region(&ki,(yyvsp[0].string)); }
5018 #line 5019 "kate_parser.c"
5019 break;
5020
5021 case 131: /* kd_region_name_or_index: UNUMBER */
5022 #line 2498 "kate_parser.y"
5023 { if ((yyvsp[0].unumber)>=ki.nregions) yyerrorf("Invalid region index (%u/%u)",(yyvsp[0].unumber),ki.nregions); (yyval.number)=(yyvsp[0].unumber); }
5024 #line 5025 "kate_parser.c"
5025 break;
5026
5027 case 132: /* kd_curve_name_or_index: STRING */
5028 #line 2501 "kate_parser.y"
5029 { (yyval.number)=find_curve(&ki,(yyvsp[0].string)); }
5030 #line 5031 "kate_parser.c"
5031 break;
5032
5033 case 133: /* kd_curve_name_or_index: UNUMBER */
5034 #line 2502 "kate_parser.y"
5035 { if ((yyvsp[0].unumber)>=ki.ncurves) yyerrorf("Invalid curve index (%u/%u)",(yyvsp[0].unumber),ki.ncurves); (yyval.number)=(yyvsp[0].unumber); }
5036 #line 5037 "kate_parser.c"
5037 break;
5038
5039 case 134: /* kd_motion_name_or_index: STRING */
5040 #line 2505 "kate_parser.y"
5041 { (yyval.number)=find_motion(&ki,(yyvsp[0].string)); }
5042 #line 5043 "kate_parser.c"
5043 break;
5044
5045 case 135: /* kd_motion_name_or_index: UNUMBER */
5046 #line 2506 "kate_parser.y"
5047 { if ((yyvsp[0].unumber)>=ki.nmotions) yyerrorf("Invalid motion index (%u/%u)",(yyvsp[0].unumber),ki.nmotions); (yyval.number)=(yyvsp[0].unumber); }
5048 #line 5049 "kate_parser.c"
5049 break;
5050
5051 case 136: /* kd_palette_name_or_index: STRING */
5052 #line 2509 "kate_parser.y"
5053 { (yyval.number)=find_palette(&ki,(yyvsp[0].string)); }
5054 #line 5055 "kate_parser.c"
5055 break;
5056
5057 case 137: /* kd_palette_name_or_index: UNUMBER */
5058 #line 2510 "kate_parser.y"
5059 { if ((yyvsp[0].unumber)>=ki.npalettes) yyerrorf("Invalid palette index (%u/%u)",(yyvsp[0].unumber),ki.npalettes); (yyval.number)=(yyvsp[0].unumber); }
5060 #line 5061 "kate_parser.c"
5061 break;
5062
5063 case 138: /* kd_bitmap_name_or_index: STRING */
5064 #line 2513 "kate_parser.y"
5065 { (yyval.number)=find_bitmap(&ki,(yyvsp[0].string)); }
5066 #line 5067 "kate_parser.c"
5067 break;
5068
5069 case 139: /* kd_bitmap_name_or_index: UNUMBER */
5070 #line 2514 "kate_parser.y"
5071 { if ((yyvsp[0].unumber)>=ki.nbitmaps) yyerrorf("Invalid bitmap index (%u/%u)",(yyvsp[0].unumber),ki.nbitmaps); (yyval.number)=(yyvsp[0].unumber); }
5072 #line 5073 "kate_parser.c"
5073 break;
5074
5075 case 140: /* kd_font_range_name_or_index: STRING */
5076 #line 2517 "kate_parser.y"
5077 { (yyval.number)=find_font_range(&ki,(yyvsp[0].string)); }
5078 #line 5079 "kate_parser.c"
5079 break;
5080
5081 case 141: /* kd_font_range_name_or_index: UNUMBER */
5082 #line 2518 "kate_parser.y"
5083 { if ((yyvsp[0].unumber)>=ki.nfont_ranges) yyerrorf("Invalid font range index (%u/%u)",(yyvsp[0].unumber),ki.nfont_ranges); (yyval.number)=(yyvsp[0].unumber); }
5084 #line 5085 "kate_parser.c"
5085 break;
5086
5087 case 142: /* kd_font_mapping_name_or_index: STRING */
5088 #line 2521 "kate_parser.y"
5089 { (yyval.number)=find_font_mapping(&ki,(yyvsp[0].string)); }
5090 #line 5091 "kate_parser.c"
5091 break;
5092
5093 case 143: /* kd_font_mapping_name_or_index: UNUMBER */
5094 #line 2522 "kate_parser.y"
5095 { if ((yyvsp[0].unumber)>=ki.nfont_mappings) yyerrorf("Invalid font mapping index (%u/%u)",(yyvsp[0].unumber),ki.nfont_mappings); (yyval.number)=(yyvsp[0].unumber); }
5096 #line 5097 "kate_parser.c"
5097 break;
5098
5099 case 144: /* kd_curve_def_name_or_index: kd_curve_name_or_index */
5100 #line 2525 "kate_parser.y"
5101 { reference_curve_from((yyvsp[0].number)); }
5102 #line 5103 "kate_parser.c"
5103 break;
5104
5105 case 145: /* $@21: %empty */
5106 #line 2526 "kate_parser.y"
5107 { init_curve(); }
5108 #line 5109 "kate_parser.c"
5109 break;
5110
5111 case 146: /* kd_curve_def_name_or_index: $@21 '{' kd_curve_defs '}' */
5112 #line 2526 "kate_parser.y"
5113 {}
5114 #line 5115 "kate_parser.c"
5115 break;
5116
5117 case 147: /* $@22: %empty */
5118 #line 2527 "kate_parser.y"
5119 { init_curve_from((yyvsp[0].number)); }
5120 #line 5121 "kate_parser.c"
5121 break;
5122
5123 case 148: /* kd_curve_def_name_or_index: kd_curve_name_or_index $@22 '{' kd_curve_defs '}' */
5124 #line 2527 "kate_parser.y"
5125 {}
5126 #line 5127 "kate_parser.c"
5127 break;
5128
5129 case 149: /* float: FLOAT */
5130 #line 2531 "kate_parser.y"
5131 { (yyval.fp)=(yyvsp[0].fp); }
5132 #line 5133 "kate_parser.c"
5133 break;
5134
5135 case 150: /* float: UNUMBER */
5136 #line 2532 "kate_parser.y"
5137 { (yyval.fp)=(kate_float)(yyvsp[0].unumber); }
5138 #line 5139 "kate_parser.c"
5139 break;
5140
5141 case 151: /* float: NUMBER */
5142 #line 2533 "kate_parser.y"
5143 { (yyval.fp)=(kate_float)(yyvsp[0].number); }
5144 #line 5145 "kate_parser.c"
5145 break;
5146
5147 case 152: /* bitmap_x_offset: UNUMBER */
5148 #line 2536 "kate_parser.y"
5149 { (yyval.number)=(yyvsp[0].unumber); }
5150 #line 5151 "kate_parser.c"
5151 break;
5152
5153 case 153: /* bitmap_x_offset: NUMBER */
5154 #line 2537 "kate_parser.y"
5155 { (yyval.number)=(yyvsp[0].number); }
5156 #line 5157 "kate_parser.c"
5157 break;
5158
5159 case 154: /* bitmap_x_offset: float '%' */
5160 #line 2538 "kate_parser.y"
5161 { (yyval.number)=compute_bitmap_x_offset((yyvsp[-1].fp)); }
5162 #line 5163 "kate_parser.c"
5163 break;
5164
5165 case 155: /* bitmap_y_offset: UNUMBER */
5166 #line 2541 "kate_parser.y"
5167 { (yyval.number)=(yyvsp[0].unumber); }
5168 #line 5169 "kate_parser.c"
5169 break;
5170
5171 case 156: /* bitmap_y_offset: NUMBER */
5172 #line 2542 "kate_parser.y"
5173 { (yyval.number)=(yyvsp[0].number); }
5174 #line 5175 "kate_parser.c"
5175 break;
5176
5177 case 157: /* bitmap_y_offset: float '%' */
5178 #line 2543 "kate_parser.y"
5179 { (yyval.number)=compute_bitmap_y_offset((yyvsp[-1].fp)); }
5180 #line 5181 "kate_parser.c"
5181 break;
5182
5183 case 158: /* timespec: UNUMBER ':' unumber60 ':' float60 */
5184 #line 2546 "kate_parser.y"
5185 { (yyval.fp)=(yyvsp[-4].unumber)*3600+(yyvsp[-2].unumber)*60+(yyvsp[0].fp); }
5186 #line 5187 "kate_parser.c"
5187 break;
5188
5189 case 159: /* timespec: UNUMBER ':' float60 */
5190 #line 2547 "kate_parser.y"
5191 { (yyval.fp)=(yyvsp[-2].unumber)*60+(yyvsp[0].fp); }
5192 #line 5193 "kate_parser.c"
5193 break;
5194
5195 case 160: /* timespec: float60 */
5196 #line 2548 "kate_parser.y"
5197 { (yyval.fp)=(yyvsp[0].fp); }
5198 #line 5199 "kate_parser.c"
5199 break;
5200
5201 case 162: /* kd_events: %empty */
5202 #line 2552 "kate_parser.y"
5203 {}
5204 #line 5205 "kate_parser.c"
5205 break;
5206
5207 case 163: /* $@23: %empty */
5208 #line 2555 "kate_parser.y"
5209 { init_event(&kevent); }
5210 #line 5211 "kate_parser.c"
5211 break;
5212
5213 case 164: /* kd_event: EVENT $@23 '{' kd_event_defs '}' */
5214 #line 2555 "kate_parser.y"
5215 {
5216 check_event(&kevent); kd_encode_text(&k,&kevent); clear_event(&kevent);
5217 }
5218 #line 5219 "kate_parser.c"
5219 break;
5220
5221 case 165: /* $@24: %empty */
5222 #line 2558 "kate_parser.y"
5223 { init_event(&kevent); }
5224 #line 5225 "kate_parser.c"
5225 break;
5226
5227 case 166: /* kd_event: EVENT $@24 kd_event_defs */
5228 #line 2558 "kate_parser.y"
5229 {
5230 check_event(&kevent); kd_encode_text(&k,&kevent); clear_event(&kevent);
5231 }
5232 #line 5233 "kate_parser.c"
5233 break;
5234
5235 case 168: /* kd_event_defs: %empty */
5236 #line 2564 "kate_parser.y"
5237 {}
5238 #line 5239 "kate_parser.c"
5239 break;
5240
5241 case 169: /* kd_event_def: ID UNUMBER */
5242 #line 2567 "kate_parser.y"
5243 { kd_encode_set_id(&k,(yyvsp[0].unumber)); }
5244 #line 5245 "kate_parser.c"
5245 break;
5246
5247 case 170: /* kd_event_def: LANGUAGE STRING */
5248 #line 2568 "kate_parser.y"
5249 { kd_encode_set_language(&k,(yyvsp[0].string)); }
5250 #line 5251 "kate_parser.c"
5251 break;
5252
5253 case 171: /* kd_event_def: DIRECTIONALITY directionality */
5254 #line 2569 "kate_parser.y"
5255 { CHECK_KATE_API_ERROR(kate_encode_set_text_directionality(&k,(yyvsp[0].number))); }
5256 #line 5257 "kate_parser.c"
5257 break;
5258
5259 case 172: /* kd_event_def: STARTS AT timespec */
5260 #line 2570 "kate_parser.y"
5261 { set_event_t0(&kevent,(yyvsp[0].fp)); }
5262 #line 5263 "kate_parser.c"
5263 break;
5264
5265 case 173: /* kd_event_def: ENDS AT timespec */
5266 #line 2571 "kate_parser.y"
5267 { set_event_t1(&kevent,(yyvsp[0].fp)); }
5268 #line 5269 "kate_parser.c"
5269 break;
5270
5271 case 174: /* kd_event_def: START TIME timespec */
5272 #line 2572 "kate_parser.y"
5273 { set_event_t0(&kevent,(yyvsp[0].fp)); }
5274 #line 5275 "kate_parser.c"
5275 break;
5276
5277 case 175: /* kd_event_def: END TIME timespec */
5278 #line 2573 "kate_parser.y"
5279 { set_event_t1(&kevent,(yyvsp[0].fp)); }
5280 #line 5281 "kate_parser.c"
5281 break;
5282
5283 case 176: /* kd_event_def: FROM timespec TO timespec */
5284 #line 2574 "kate_parser.y"
5285 { set_event_t0_t1(&kevent,(yyvsp[-2].fp),(yyvsp[0].fp)); }
5286 #line 5287 "kate_parser.c"
5287 break;
5288
5289 case 177: /* kd_event_def: DURATION timespec */
5290 #line 2575 "kate_parser.y"
5291 { set_event_duration(&kevent,(yyvsp[0].fp)); }
5292 #line 5293 "kate_parser.c"
5293 break;
5294
5295 case 178: /* kd_event_def: FROM timespec FOR timespec */
5296 #line 2576 "kate_parser.y"
5297 { set_event_t0(&kevent,(yyvsp[-2].fp)); set_event_duration(&kevent,(yyvsp[0].fp)); }
5298 #line 5299 "kate_parser.c"
5299 break;
5300
5301 case 179: /* kd_event_def: timespec ARROW timespec */
5302 #line 2577 "kate_parser.y"
5303 { set_event_t0_t1(&kevent,(yyvsp[-2].fp),(yyvsp[0].fp)); }
5304 #line 5305 "kate_parser.c"
5305 break;
5306
5307 case 180: /* kd_event_def: REGION kd_region_name_or_index */
5308 #line 2578 "kate_parser.y"
5309 { set_event_region_index(&kevent,(yyvsp[0].number)); }
5310 #line 5311 "kate_parser.c"
5311 break;
5312
5313 case 181: /* $@25: %empty */
5314 #line 2579 "kate_parser.y"
5315 { init_region_from((yyvsp[0].number)); }
5316 #line 5317 "kate_parser.c"
5317 break;
5318
5319 case 182: /* kd_event_def: REGION kd_region_name_or_index $@25 '{' kd_region_defs '}' */
5320 #line 2580 "kate_parser.y"
5321 { set_event_region(&kevent,&kregion); }
5322 #line 5323 "kate_parser.c"
5323 break;
5324
5325 case 183: /* $@26: %empty */
5326 #line 2581 "kate_parser.y"
5327 { init_region(&kregion); }
5328 #line 5329 "kate_parser.c"
5329 break;
5330
5331 case 184: /* kd_event_def: REGION $@26 '{' kd_region_defs '}' */
5332 #line 2581 "kate_parser.y"
5333 { set_event_region(&kevent,&kregion); }
5334 #line 5335 "kate_parser.c"
5335 break;
5336
5337 case 185: /* kd_event_def: kd_optional_secondary STYLE kd_style_name_or_index */
5338 #line 2583 "kate_parser.y"
5339 { if ((yyvsp[-2].number)) set_event_secondary_style_index(&kevent,(yyvsp[0].number)); else set_event_style_index(&kevent,(yyvsp[0].number)); }
5340 #line 5341 "kate_parser.c"
5341 break;
5342
5343 case 186: /* $@27: %empty */
5344 #line 2584 "kate_parser.y"
5345 {init_style_from((yyvsp[0].number)); }
5346 #line 5347 "kate_parser.c"
5347 break;
5348
5349 case 187: /* kd_event_def: kd_optional_secondary STYLE kd_style_name_or_index $@27 '{' kd_style_defs '}' */
5350 #line 2585 "kate_parser.y"
5351 { if ((yyvsp[-6].number)) set_event_secondary_style(&kevent,&kstyle); else set_event_style(&kevent,&kstyle); }
5352 #line 5353 "kate_parser.c"
5353 break;
5354
5355 case 188: /* $@28: %empty */
5356 #line 2586 "kate_parser.y"
5357 { init_style(&kstyle); }
5358 #line 5359 "kate_parser.c"
5359 break;
5360
5361 case 189: /* kd_event_def: kd_optional_secondary STYLE $@28 '{' kd_style_defs '}' */
5362 #line 2587 "kate_parser.y"
5363 { if ((yyvsp[-5].number)) set_event_secondary_style(&kevent,&kstyle); else set_event_style(&kevent,&kstyle); }
5364 #line 5365 "kate_parser.c"
5365 break;
5366
5367 case 190: /* kd_event_def: TEXT strings */
5368 #line 2588 "kate_parser.y"
5369 { set_event_text(&kevent,(yyvsp[0].dynstring),0,0); kate_free((yyvsp[0].dynstring)); }
5370 #line 5371 "kate_parser.c"
5371 break;
5372
5373 case 191: /* kd_event_def: PRE TEXT strings */
5374 #line 2589 "kate_parser.y"
5375 { set_event_text(&kevent,(yyvsp[0].dynstring),1,0); kate_free((yyvsp[0].dynstring)); }
5376 #line 5377 "kate_parser.c"
5377 break;
5378
5379 case 192: /* kd_event_def: MARKUP strings */
5380 #line 2590 "kate_parser.y"
5381 { set_event_text(&kevent,(yyvsp[0].dynstring),0,1); kate_free((yyvsp[0].dynstring)); }
5382 #line 5383 "kate_parser.c"
5383 break;
5384
5385 case 193: /* kd_event_def: PRE MARKUP strings */
5386 #line 2591 "kate_parser.y"
5387 { set_event_text(&kevent,(yyvsp[0].dynstring),1,1); kate_free((yyvsp[0].dynstring)); }
5388 #line 5389 "kate_parser.c"
5389 break;
5390
5391 case 194: /* kd_event_def: TEXT SOURCE STRING */
5392 #line 2592 "kate_parser.y"
5393 { set_event_text_from(&kevent,(yyvsp[0].string),0,0); }
5394 #line 5395 "kate_parser.c"
5395 break;
5396
5397 case 195: /* kd_event_def: PRE TEXT SOURCE STRING */
5398 #line 2593 "kate_parser.y"
5399 { set_event_text_from(&kevent,(yyvsp[0].string),1,0); }
5400 #line 5401 "kate_parser.c"
5401 break;
5402
5403 case 196: /* kd_event_def: MARKUP SOURCE STRING */
5404 #line 2594 "kate_parser.y"
5405 { set_event_text_from(&kevent,(yyvsp[0].string),0,1); }
5406 #line 5407 "kate_parser.c"
5407 break;
5408
5409 case 197: /* kd_event_def: PRE MARKUP SOURCE STRING */
5410 #line 2595 "kate_parser.y"
5411 { set_event_text_from(&kevent,(yyvsp[0].string),1,1); }
5412 #line 5413 "kate_parser.c"
5413 break;
5414
5415 case 198: /* kd_event_def: strings */
5416 #line 2596 "kate_parser.y"
5417 { set_event_text(&kevent,(yyvsp[0].dynstring),0,0); kate_free((yyvsp[0].dynstring)); }
5418 #line 5419 "kate_parser.c"
5419 break;
5420
5421 case 199: /* $@29: %empty */
5422 #line 2597 "kate_parser.y"
5423 { init_motion(); }
5424 #line 5425 "kate_parser.c"
5425 break;
5426
5427 case 200: /* kd_event_def: MOTION $@29 '{' kd_motion_defs '}' */
5428 #line 2597 "kate_parser.y"
5429 { kd_add_event_motion(kmotion); }
5430 #line 5431 "kate_parser.c"
5431 break;
5432
5433 case 201: /* kd_event_def: MOTION kd_motion_name_or_index */
5434 #line 2598 "kate_parser.y"
5435 { kd_add_event_motion_index((yyvsp[0].number)); }
5436 #line 5437 "kate_parser.c"
5437 break;
5438
5439 case 202: /* $@30: %empty */
5440 #line 2599 "kate_parser.y"
5441 {init_simple_glyph_pointer_motion(); }
5442 #line 5443 "kate_parser.c"
5443 break;
5444
5445 case 203: /* kd_event_def: SIMPLE_TIMED_GLYPH_MARKER $@30 '{' kd_simple_timed_glyph_marker_defs '}' */
5446 #line 2600 "kate_parser.y"
5447 { kd_finalize_simple_timed_glyph_motion(kmotion); kd_add_event_motion(kmotion); }
5448 #line 5449 "kate_parser.c"
5449 break;
5450
5451 case 204: /* $@31: %empty */
5452 #line 2601 "kate_parser.y"
5453 {init_simple_glyph_pointer_motion(); }
5454 #line 5455 "kate_parser.c"
5455 break;
5456
5457 case 205: /* kd_event_def: SIMPLE_TIMED_GLYPH_STYLE_MORPH $@31 '{' kd_simple_timed_glyph_style_morph_defs '}' */
5458 #line 2602 "kate_parser.y"
5459 { kd_finalize_simple_timed_glyph_motion(kmotion); kd_add_event_motion(kmotion); }
5460 #line 5461 "kate_parser.c"
5461 break;
5462
5463 case 206: /* kd_event_def: FONT MAPPING kd_font_mapping_name_or_index */
5464 #line 2603 "kate_parser.y"
5465 { CHECK_KATE_API_ERROR(kate_encode_set_font_mapping_index(&k,(yyvsp[0].number))); }
5466 #line 5467 "kate_parser.c"
5467 break;
5468
5469 case 207: /* kd_event_def: PALETTE kd_palette_name_or_index */
5470 #line 2604 "kate_parser.y"
5471 { set_event_palette_index(&kevent,(yyvsp[0].number)); }
5472 #line 5473 "kate_parser.c"
5473 break;
5474
5475 case 208: /* $@32: %empty */
5476 #line 2605 "kate_parser.y"
5477 { init_palette(); }
5478 #line 5479 "kate_parser.c"
5479 break;
5480
5481 case 209: /* kd_event_def: PALETTE $@32 '{' kd_palette_defs '}' */
5482 #line 2605 "kate_parser.y"
5483 { set_event_palette(&kevent,kpalette.palette); }
5484 #line 5485 "kate_parser.c"
5485 break;
5486
5487 case 210: /* kd_event_def: BITMAP kd_bitmap_name_or_index */
5488 #line 2606 "kate_parser.y"
5489 { set_event_bitmap_index(&kevent,(yyvsp[0].number)); }
5490 #line 5491 "kate_parser.c"
5491 break;
5492
5493 case 211: /* $@33: %empty */
5494 #line 2607 "kate_parser.y"
5495 { init_bitmap(); }
5496 #line 5497 "kate_parser.c"
5497 break;
5498
5499 case 212: /* kd_event_def: BITMAP $@33 '{' kd_bitmap_defs '}' */
5500 #line 2607 "kate_parser.y"
5501 { set_event_bitmap(&kevent,kbitmap.bitmap); }
5502 #line 5503 "kate_parser.c"
5503 break;
5504
5505 case 213: /* $@34: %empty */
5506 #line 2608 "kate_parser.y"
5507 {init_bitmap();}
5508 #line 5509 "kate_parser.c"
5509 break;
5510
5511 case 214: /* kd_event_def: DEFINE LOCAL BITMAP kd_opt_name $@34 '{' kd_bitmap_defs '}' */
5512 #line 2608 "kate_parser.y"
5513 { add_local_bitmap(&k,(yyvsp[-4].string),kbitmap.bitmap); }
5514 #line 5515 "kate_parser.c"
5515 break;
5516
5517 case 215: /* kd_event_def: DEFINE LOCAL BITMAP kd_opt_name '=' kd_bitmap_name_or_index */
5518 #line 2609 "kate_parser.y"
5519 { add_local_bitmap_index(&k,(yyvsp[-2].string),(yyvsp[0].number)); }
5520 #line 5521 "kate_parser.c"
5521 break;
5522
5523 case 216: /* kd_event_def: META STRING '=' STRING */
5524 #line 2610 "kate_parser.y"
5525 { kd_add_event_meta((yyvsp[-2].string),(yyvsp[0].string)); }
5526 #line 5527 "kate_parser.c"
5527 break;
5528
5529 case 217: /* kd_event_def: META STRING '=' kd_meta_byte_stream_def */
5530 #line 2611 "kate_parser.y"
5531 { kd_add_event_meta_byte_stream((yyvsp[-2].string)); }
5532 #line 5533 "kate_parser.c"
5533 break;
5534
5535 case 218: /* $@35: %empty */
5536 #line 2614 "kate_parser.y"
5537 {init_byte_stream((yyvsp[0].unumber));}
5538 #line 5539 "kate_parser.c"
5539 break;
5540
5541 case 219: /* kd_meta_byte_stream_def: UNUMBER $@35 '{' kd_byte_stream '}' */
5542 #line 2614 "kate_parser.y"
5543 { (yyval.number)=0; }
5544 #line 5545 "kate_parser.c"
5545 break;
5546
5547 case 220: /* kd_optional_secondary: SECONDARY */
5548 #line 2617 "kate_parser.y"
5549 { (yyval.number)=1; }
5550 #line 5551 "kate_parser.c"
5551 break;
5552
5553 case 221: /* kd_optional_secondary: %empty */
5554 #line 2618 "kate_parser.y"
5555 { (yyval.number)=0; }
5556 #line 5557 "kate_parser.c"
5557 break;
5558
5559 case 222: /* strings: strings '+' STRING */
5560 #line 2621 "kate_parser.y"
5561 { (yyval.dynstring)=catstrings((yyvsp[-2].dynstring),(yyvsp[0].string)); }
5562 #line 5563 "kate_parser.c"
5563 break;
5564
5565 case 223: /* strings: STRING */
5566 #line 2622 "kate_parser.y"
5567 { (yyval.dynstring)=catstrings(NULL,(yyvsp[0].string)); }
5568 #line 5569 "kate_parser.c"
5569 break;
5570
5571 case 225: /* kd_motion_defs: %empty */
5572 #line 2626 "kate_parser.y"
5573 {}
5574 #line 5575 "kate_parser.c"
5575 break;
5576
5577 case 226: /* kd_motion_def: MAPPING kd_motion_mapping */
5578 #line 2629 "kate_parser.y"
5579 { set_motion_mapping(kmotion,(yyvsp[0].number),(yyvsp[0].number)); }
5580 #line 5581 "kate_parser.c"
5581 break;
5582
5583 case 227: /* kd_motion_def: MAPPING kd_motion_mapping kd_motion_mapping */
5584 #line 2630 "kate_parser.y"
5585 { set_motion_mapping(kmotion,(yyvsp[-1].number),(yyvsp[0].number)); }
5586 #line 5587 "kate_parser.c"
5587 break;
5588
5589 case 228: /* kd_motion_def: SEMANTICS kd_motion_semantics */
5590 #line 2631 "kate_parser.y"
5591 { set_motion_semantics(kmotion,(yyvsp[0].number)); }
5592 #line 5593 "kate_parser.c"
5593 break;
5594
5595 case 229: /* kd_motion_def: CURVE kd_curve_def_name_or_index kd_optional_curve_duration */
5596 #line 2632 "kate_parser.y"
5597 { add_curve_to_motion(kmotion,(yyvsp[0].fp)); }
5598 #line 5599 "kate_parser.c"
5599 break;
5600
5601 case 230: /* kd_motion_def: PERIODIC */
5602 #line 2633 "kate_parser.y"
5603 { kmotion->periodic=1; }
5604 #line 5605 "kate_parser.c"
5605 break;
5606
5607 case 231: /* kd_optional_curve_duration: FOR float */
5608 #line 2636 "kate_parser.y"
5609 { (yyval.fp)=(yyvsp[0].fp); }
5610 #line 5611 "kate_parser.c"
5611 break;
5612
5613 case 232: /* kd_optional_curve_duration: FOR float '%' */
5614 #line 2637 "kate_parser.y"
5615 { (yyval.fp)=-(yyvsp[-1].fp)/(kate_float)100.0; }
5616 #line 5617 "kate_parser.c"
5617 break;
5618
5619 case 233: /* kd_optional_curve_duration: FOR float 'm' */
5620 #line 2638 "kate_parser.y"
5621 { (yyval.fp)=-(yyvsp[-1].fp)/(kate_float)1000000.0; }
5622 #line 5623 "kate_parser.c"
5623 break;
5624
5625 case 234: /* kd_optional_curve_duration: %empty */
5626 #line 2639 "kate_parser.y"
5627 { (yyval.fp)=(kate_float)-1.0; }
5628 #line 5629 "kate_parser.c"
5629 break;
5630
5631 case 235: /* kd_motion_mapping: NONE */
5632 #line 2642 "kate_parser.y"
5633 { (yyval.number)=kate_motion_mapping_none; }
5634 #line 5635 "kate_parser.c"
5635 break;
5636
5637 case 236: /* kd_motion_mapping: FRAME */
5638 #line 2643 "kate_parser.y"
5639 { (yyval.number)=kate_motion_mapping_frame; }
5640 #line 5641 "kate_parser.c"
5641 break;
5642
5643 case 237: /* kd_motion_mapping: REGION */
5644 #line 2644 "kate_parser.y"
5645 { (yyval.number)=kate_motion_mapping_region; }
5646 #line 5647 "kate_parser.c"
5647 break;
5648
5649 case 238: /* kd_motion_mapping: EVENT DURATION */
5650 #line 2645 "kate_parser.y"
5651 { (yyval.number)=kate_motion_mapping_event_duration; }
5652 #line 5653 "kate_parser.c"
5653 break;
5654
5655 case 239: /* kd_motion_mapping: BITMAP SIZE */
5656 #line 2646 "kate_parser.y"
5657 { (yyval.number)=kate_motion_mapping_bitmap_size; }
5658 #line 5659 "kate_parser.c"
5659 break;
5660
5661 case 240: /* kd_motion_mapping: USER UNUMBER */
5662 #line 2647 "kate_parser.y"
5663 {
5664 if ((yyvsp[0].unumber)<kate_motion_mapping_user) yyerrorf("invalid value for user motion mapping (%u), should be 128 or more",(yyvsp[0].unumber));
5665 (yyval.number)=(kate_motion_mapping)(yyvsp[0].unumber);
5666 }
5667 #line 5668 "kate_parser.c"
5668 break;
5669
5670 case 241: /* kd_motion_semantics: TIME */
5671 #line 2653 "kate_parser.y"
5672 { (yyval.number)=kate_motion_semantics_time; }
5673 #line 5674 "kate_parser.c"
5674 break;
5675
5676 case 242: /* kd_motion_semantics: REGION POSITION */
5677 #line 2654 "kate_parser.y"
5678 { (yyval.number)=kate_motion_semantics_region_position; }
5679 #line 5680 "kate_parser.c"
5680 break;
5681
5682 case 243: /* kd_motion_semantics: REGION SIZE */
5683 #line 2655 "kate_parser.y"
5684 { (yyval.number)=kate_motion_semantics_region_size; }
5685 #line 5686 "kate_parser.c"
5686 break;
5687
5688 case 244: /* kd_motion_semantics: TEXT ALIGNMENT */
5689 #line 2656 "kate_parser.y"
5690 { (yyval.number)=kate_motion_semantics_text_alignment_int; }
5691 #line 5692 "kate_parser.c"
5692 break;
5693
5694 case 245: /* kd_motion_semantics: INTERNAL TEXT ALIGNMENT */
5695 #line 2657 "kate_parser.y"
5696 { (yyval.number)=kate_motion_semantics_text_alignment_int; }
5697 #line 5698 "kate_parser.c"
5698 break;
5699
5700 case 246: /* kd_motion_semantics: EXTERNAL TEXT ALIGNMENT */
5701 #line 2658 "kate_parser.y"
5702 { (yyval.number)=kate_motion_semantics_text_alignment_ext; }
5703 #line 5704 "kate_parser.c"
5704 break;
5705
5706 case 247: /* kd_motion_semantics: TEXT POSITION */
5707 #line 2659 "kate_parser.y"
5708 { (yyval.number)=kate_motion_semantics_text_position; }
5709 #line 5710 "kate_parser.c"
5710 break;
5711
5712 case 248: /* kd_motion_semantics: TEXT SIZE */
5713 #line 2660 "kate_parser.y"
5714 { (yyval.number)=kate_motion_semantics_text_size; }
5715 #line 5716 "kate_parser.c"
5716 break;
5717
5718 case 249: /* kd_motion_semantics: MARKER UNUMBER POSITION */
5719 #line 2661 "kate_parser.y"
5720 { (yyval.number)=kd_get_marker_position_semantics((yyvsp[-1].unumber)); }
5721 #line 5722 "kate_parser.c"
5722 break;
5723
5724 case 250: /* kd_motion_semantics: GLYPH POINTER UNUMBER */
5725 #line 2662 "kate_parser.y"
5726 { (yyval.number)=kd_get_glyph_pointer_semantics((yyvsp[0].unumber)); }
5727 #line 5728 "kate_parser.c"
5728 break;
5729
5730 case 251: /* kd_motion_semantics: TEXT COLOR RG */
5731 #line 2663 "kate_parser.y"
5732 { (yyval.number)=kate_motion_semantics_text_color_rg; }
5733 #line 5734 "kate_parser.c"
5734 break;
5735
5736 case 252: /* kd_motion_semantics: TEXT COLOR BA */
5737 #line 2664 "kate_parser.y"
5738 { (yyval.number)=kate_motion_semantics_text_color_ba; }
5739 #line 5740 "kate_parser.c"
5740 break;
5741
5742 case 253: /* kd_motion_semantics: BACKGROUND COLOR RG */
5743 #line 2665 "kate_parser.y"
5744 { (yyval.number)=kate_motion_semantics_background_color_rg; }
5745 #line 5746 "kate_parser.c"
5746 break;
5747
5748 case 254: /* kd_motion_semantics: BACKGROUND COLOR BA */
5749 #line 2666 "kate_parser.y"
5750 { (yyval.number)=kate_motion_semantics_background_color_ba; }
5751 #line 5752 "kate_parser.c"
5752 break;
5753
5754 case 255: /* kd_motion_semantics: DRAW COLOR RG */
5755 #line 2667 "kate_parser.y"
5756 { (yyval.number)=kate_motion_semantics_draw_color_rg; }
5757 #line 5758 "kate_parser.c"
5758 break;
5759
5760 case 256: /* kd_motion_semantics: DRAW COLOR BA */
5761 #line 2668 "kate_parser.y"
5762 { (yyval.number)=kate_motion_semantics_draw_color_ba; }
5763 #line 5764 "kate_parser.c"
5764 break;
5765
5766 case 257: /* kd_motion_semantics: STYLE MORPH */
5767 #line 2669 "kate_parser.y"
5768 { (yyval.number)=kate_motion_semantics_style_morph; }
5769 #line 5770 "kate_parser.c"
5770 break;
5771
5772 case 258: /* kd_motion_semantics: TEXT PATH */
5773 #line 2670 "kate_parser.y"
5774 { (yyval.number)=kate_motion_semantics_text_path; }
5775 #line 5776 "kate_parser.c"
5776 break;
5777
5778 case 259: /* kd_motion_semantics: TEXT PATH SECTION */
5779 #line 2671 "kate_parser.y"
5780 { (yyval.number)=kate_motion_semantics_text_path_section; }
5781 #line 5782 "kate_parser.c"
5782 break;
5783
5784 case 260: /* kd_motion_semantics: DRAW */
5785 #line 2672 "kate_parser.y"
5786 { (yyval.number)=kate_motion_semantics_draw; }
5787 #line 5788 "kate_parser.c"
5788 break;
5789
5790 case 261: /* kd_motion_semantics: VISIBLE SECTION */
5791 #line 2673 "kate_parser.y"
5792 { (yyval.number)=kate_motion_semantics_text_visible_section; }
5793 #line 5794 "kate_parser.c"
5794 break;
5795
5796 case 262: /* kd_motion_semantics: 'z' */
5797 #line 2674 "kate_parser.y"
5798 { (yyval.number)=kate_motion_semantics_z; }
5799 #line 5800 "kate_parser.c"
5800 break;
5801
5802 case 263: /* kd_motion_semantics: HORIZONTAL MARGINS */
5803 #line 2675 "kate_parser.y"
5804 { (yyval.number)=kate_motion_semantics_horizontal_margins; }
5805 #line 5806 "kate_parser.c"
5806 break;
5807
5808 case 264: /* kd_motion_semantics: VERTICAL MARGINS */
5809 #line 2676 "kate_parser.y"
5810 { (yyval.number)=kate_motion_semantics_vertical_margins; }
5811 #line 5812 "kate_parser.c"
5812 break;
5813
5814 case 265: /* kd_motion_semantics: BITMAP POSITION */
5815 #line 2677 "kate_parser.y"
5816 { (yyval.number)=kate_motion_semantics_bitmap_position; }
5817 #line 5818 "kate_parser.c"
5818 break;
5819
5820 case 266: /* kd_motion_semantics: BITMAP SIZE */
5821 #line 2678 "kate_parser.y"
5822 { (yyval.number)=kate_motion_semantics_bitmap_size; }
5823 #line 5824 "kate_parser.c"
5824 break;
5825
5826 case 267: /* kd_motion_semantics: MARKER UNUMBER BITMAP */
5827 #line 2679 "kate_parser.y"
5828 { (yyval.number)=kd_get_marker_bitmap_semantics((yyvsp[-1].unumber)); }
5829 #line 5830 "kate_parser.c"
5830 break;
5831
5832 case 268: /* kd_motion_semantics: GLYPH POINTER UNUMBER BITMAP */
5833 #line 2680 "kate_parser.y"
5834 { (yyval.number)=kd_get_glyph_pointer_bitmap_semantics((yyvsp[-1].unumber)); }
5835 #line 5836 "kate_parser.c"
5836 break;
5837
5838 case 269: /* kd_motion_semantics: DRAW WIDTH */
5839 #line 2681 "kate_parser.y"
5840 { (yyval.number)=kate_motion_semantics_draw_width; }
5841 #line 5842 "kate_parser.c"
5842 break;
5843
5844 case 270: /* kd_motion_semantics: USER UNUMBER */
5845 #line 2682 "kate_parser.y"
5846 {
5847 if ((yyvsp[0].unumber)<kate_motion_semantics_user) yyerrorf("invalid value for user motion semantics (%u), should be 128 or more",(yyvsp[0].unumber));
5848 (yyval.number)=(kate_motion_semantics)(yyvsp[0].unumber);
5849 }
5850 #line 5851 "kate_parser.c"
5851 break;
5852
5853 case 272: /* kd_simple_timed_glyph_marker_defs: %empty */
5854 #line 2689 "kate_parser.y"
5855 {}
5856 #line 5857 "kate_parser.c"
5857 break;
5858
5859 case 273: /* kd_simple_timed_glyph_marker_def: GLYPH POINTER UNUMBER */
5860 #line 2692 "kate_parser.y"
5861 { kmotion->semantics=get_glyph_pointer_offset((yyvsp[0].unumber)); }
5862 #line 5863 "kate_parser.c"
5863 break;
5864
5865 case 274: /* kd_simple_timed_glyph_marker_def: 'Y' MAPPING kd_motion_mapping */
5866 #line 2693 "kate_parser.y"
5867 { kmotion->y_mapping=(yyvsp[0].number); }
5868 #line 5869 "kate_parser.c"
5869 break;
5870
5871 case 275: /* kd_simple_timed_glyph_marker_def: HEIGHT FROM float TO float */
5872 #line 2694 "kate_parser.y"
5873 { karaoke_base_height=(yyvsp[-2].fp); karaoke_top_height=(yyvsp[0].fp); }
5874 #line 5875 "kate_parser.c"
5875 break;
5876
5877 case 276: /* kd_simple_timed_glyph_marker_def: PAUSE FOR timespec */
5878 #line 2695 "kate_parser.y"
5879 { add_glyph_pause((yyvsp[0].fp),(kate_float)0.0); }
5880 #line 5881 "kate_parser.c"
5881 break;
5882
5883 case 277: /* kd_simple_timed_glyph_marker_def: GLYPH UNUMBER IN timespec */
5884 #line 2696 "kate_parser.y"
5885 { add_glyph_transition((yyvsp[-2].unumber),(yyvsp[0].fp),(kate_float)0.0,(kate_float)1.0,0,(kate_float)0.0); }
5886 #line 5887 "kate_parser.c"
5887 break;
5888
5889 case 278: /* kd_simple_timed_glyph_marker_def: GLYPH UNUMBER AT timespec */
5890 #line 2697 "kate_parser.y"
5891 { add_glyph_transition((yyvsp[-2].unumber),(yyvsp[0].fp),(kate_float)0.0,(kate_float)1.0,1,(kate_float)0.0); }
5892 #line 5893 "kate_parser.c"
5893 break;
5894
5895 case 280: /* kd_simple_timed_glyph_style_morph_defs: %empty */
5896 #line 2701 "kate_parser.y"
5897 {}
5898 #line 5899 "kate_parser.c"
5899 break;
5900
5901 case 281: /* kd_simple_timed_glyph_style_morph_def: GLYPH POINTER UNUMBER */
5902 #line 2704 "kate_parser.y"
5903 { kmotion->semantics=get_glyph_pointer_offset((yyvsp[0].unumber)); }
5904 #line 5905 "kate_parser.c"
5905 break;
5906
5907 case 282: /* kd_simple_timed_glyph_style_morph_def: FROM STYLE kd_style_name_or_index TO STYLE kd_style_name_or_index */
5908 #line 2706 "kate_parser.y"
5909 { set_style_morph(&kevent,(yyvsp[-3].number),(yyvsp[0].number)); }
5910 #line 5911 "kate_parser.c"
5911 break;
5912
5913 case 283: /* kd_simple_timed_glyph_style_morph_def: PAUSE FOR timespec */
5914 #line 2707 "kate_parser.y"
5915 { add_glyph_pause((yyvsp[0].fp),(kate_float)0.0); }
5916 #line 5917 "kate_parser.c"
5917 break;
5918
5919 case 284: /* kd_simple_timed_glyph_style_morph_def: GLYPH UNUMBER IN timespec */
5920 #line 2708 "kate_parser.y"
5921 { add_glyph_transition((yyvsp[-2].unumber),(yyvsp[0].fp),(kate_float)0.0,(kate_float)0.0,0,(kate_float)1.0); }
5922 #line 5923 "kate_parser.c"
5923 break;
5924
5925 case 285: /* kd_simple_timed_glyph_style_morph_def: GLYPH UNUMBER AT timespec */
5926 #line 2709 "kate_parser.y"
5927 { add_glyph_transition((yyvsp[-2].unumber),(yyvsp[0].fp),(kate_float)0.0,(kate_float)0.0,1,(kate_float)1.0); }
5928 #line 5929 "kate_parser.c"
5929 break;
5930
5931 case 286: /* kd_simple_timed_glyph_style_morph_def: STRING IN timespec */
5932 #line 2710 "kate_parser.y"
5933 { add_glyph_transition_to_text((yyvsp[-2].string),(yyvsp[0].fp),(kate_float)0.0,(kate_float)0.0,0,(kate_float)1.0); }
5934 #line 5935 "kate_parser.c"
5935 break;
5936
5937 case 287: /* kd_simple_timed_glyph_style_morph_def: STRING AT timespec */
5938 #line 2711 "kate_parser.y"
5939 { add_glyph_transition_to_text((yyvsp[-2].string),(yyvsp[0].fp),(kate_float)0.0,(kate_float)0.0,1,(kate_float)1.0); }
5940 #line 5941 "kate_parser.c"
5941 break;
5942
5943 case 288: /* $@36: %empty */
5944 #line 2714 "kate_parser.y"
5945 { if ((yyvsp[0].unumber)>59) yyerrorf("Value must be between 0 and 59, but is %u",(yyvsp[0].unumber)); }
5946 #line 5947 "kate_parser.c"
5947 break;
5948
5949 case 289: /* unumber60: UNUMBER $@36 */
5950 #line 2714 "kate_parser.y"
5951 { (yyval.unumber)=(yyvsp[-1].unumber); }
5952 #line 5953 "kate_parser.c"
5953 break;
5954
5955 case 290: /* $@37: %empty */
5956 #line 2717 "kate_parser.y"
5957 { if ((yyvsp[0].fp)<(kate_float)0.0 || (yyvsp[0].fp)>=(kate_float)60.0) yyerrorf("Value must be between 0 (inclusive) and 60 (exclusive), but is %f",(yyvsp[0].fp)); }
5958 #line 5959 "kate_parser.c"
5959 break;
5960
5961 case 291: /* float60: float $@37 */
5962 #line 2717 "kate_parser.y"
5963 { (yyval.fp)=(yyvsp[-1].fp); }
5964 #line 5965 "kate_parser.c"
5965 break;
5966
5967 case 292: /* kd_opt_comma: ',' */
5968 #line 2720 "kate_parser.y"
5969 {}
5970 #line 5971 "kate_parser.c"
5971 break;
5972
5973 case 293: /* kd_opt_comma: %empty */
5974 #line 2721 "kate_parser.y"
5975 {}
5976 #line 5977 "kate_parser.c"
5977 break;
5978
5979 case 294: /* directionality: L2R_T2B */
5980 #line 2724 "kate_parser.y"
5981 { (yyval.number)=kate_l2r_t2b; }
5982 #line 5983 "kate_parser.c"
5983 break;
5984
5985 case 295: /* directionality: R2L_T2B */
5986 #line 2725 "kate_parser.y"
5987 { (yyval.number)=kate_r2l_t2b; }
5988 #line 5989 "kate_parser.c"
5989 break;
5990
5991 case 296: /* directionality: T2B_R2L */
5992 #line 2726 "kate_parser.y"
5993 { (yyval.number)=kate_t2b_r2l; }
5994 #line 5995 "kate_parser.c"
5995 break;
5996
5997 case 297: /* directionality: T2B_L2R */
5998 #line 2727 "kate_parser.y"
5999 { (yyval.number)=kate_t2b_l2r; }
6000 #line 6001 "kate_parser.c"
6001 break;
6002
6003 case 299: /* kd_font_range_defs: %empty */
6004 #line 2731 "kate_parser.y"
6005 {}
6006 #line 6007 "kate_parser.c"
6007 break;
6008
6009 case 300: /* kd_font_range_def: FIRST CODE POINT STRING */
6010 #line 2734 "kate_parser.y"
6011 { set_font_range_first_code_point_string((yyvsp[0].string)); }
6012 #line 6013 "kate_parser.c"
6013 break;
6014
6015 case 301: /* kd_font_range_def: FIRST CODE POINT UNUMBER */
6016 #line 2735 "kate_parser.y"
6017 { set_font_range_first_code_point((yyvsp[0].unumber)); }
6018 #line 6019 "kate_parser.c"
6019 break;
6020
6021 case 302: /* kd_font_range_def: LAST CODE POINT STRING */
6022 #line 2736 "kate_parser.y"
6023 { set_font_range_last_code_point_string((yyvsp[0].string)); }
6024 #line 6025 "kate_parser.c"
6025 break;
6026
6027 case 303: /* kd_font_range_def: LAST CODE POINT UNUMBER */
6028 #line 2737 "kate_parser.y"
6029 { set_font_range_last_code_point((yyvsp[0].unumber)); }
6030 #line 6031 "kate_parser.c"
6031 break;
6032
6033 case 304: /* kd_font_range_def: FIRST BITMAP kd_bitmap_name_or_index */
6034 #line 2738 "kate_parser.y"
6035 { set_font_range_first_bitmap((yyvsp[0].number)); }
6036 #line 6037 "kate_parser.c"
6037 break;
6038
6039 case 306: /* kd_font_mapping_defs: %empty */
6040 #line 2742 "kate_parser.y"
6041 {}
6042 #line 6043 "kate_parser.c"
6043 break;
6044
6045 case 307: /* $@38: %empty */
6046 #line 2745 "kate_parser.y"
6047 {init_font_range();}
6048 #line 6049 "kate_parser.c"
6049 break;
6050
6051 case 308: /* kd_font_mapping_def: RANGE $@38 '{' kd_font_range_defs '}' */
6052 #line 2745 "kate_parser.y"
6053 { add_font_range_to_mapping(); }
6054 #line 6055 "kate_parser.c"
6055 break;
6056
6057 case 309: /* kd_font_mapping_def: RANGE kd_font_range_name_or_index */
6058 #line 2746 "kate_parser.y"
6059 { krange=ki.font_ranges[(yyvsp[0].number)]; add_font_range_to_mapping(); }
6060 #line 6061 "kate_parser.c"
6061 break;
6062
6063
6064 #line 6065 "kate_parser.c"
6065
6066 default: break;
6067 }
6068 /* User semantic actions sometimes alter yychar, and that requires
6069 that yytoken be updated with the new translation. We take the
6070 approach of translating immediately before every use of yytoken.
6071 One alternative is translating here after every semantic action,
6072 but that translation would be missed if the semantic action invokes
6073 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
6074 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
6075 incorrect destructor might then be invoked immediately. In the
6076 case of YYERROR or YYBACKUP, subsequent parser actions might lead
6077 to an incorrect destructor call or verbose syntax error message
6078 before the lookahead is translated. */
6079 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
6080
6081 YYPOPSTACK (yylen);
6082 yylen = 0;
6083
6084 *++yyvsp = yyval;
6085
6086 /* Now 'shift' the result of the reduction. Determine what state
6087 that goes to, based on the state we popped back to and the rule
6088 number reduced by. */
6089 {
6090 const int yylhs = yyr1[yyn] - YYNTOKENS;
6091 const int yyi = yypgoto[yylhs] + *yyssp;
6092 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
6093 ? yytable[yyi]
6094 : yydefgoto[yylhs]);
6095 }
6096
6097 goto yynewstate;
6098
6099
6100 /*--------------------------------------.
6101 | yyerrlab -- here on detecting error. |
6102 `--------------------------------------*/
6103 yyerrlab:
6104 /* Make sure we have latest lookahead translation. See comments at
6105 user semantic actions for why this is necessary. */
6106 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
6107 /* If not already recovering from an error, report this error. */
6108 if (!yyerrstatus)
6109 {
6110 ++yynerrs;
6111 yyerror (YY_("syntax error"));
6112 }
6113
6114 if (yyerrstatus == 3)
6115 {
6116 /* If just tried and failed to reuse lookahead token after an
6117 error, discard it. */
6118
6119 if (yychar <= YYEOF)
6120 {
6121 /* Return failure if at end of input. */
6122 if (yychar == YYEOF)
6123 YYABORT;
6124 }
6125 else
6126 {
6127 yydestruct ("Error: discarding",
6128 yytoken, &yylval);
6129 yychar = YYEMPTY;
6130 }
6131 }
6132
6133 /* Else will try to reuse lookahead token after shifting the error
6134 token. */
6135 goto yyerrlab1;
6136
6137
6138 /*---------------------------------------------------.
6139 | yyerrorlab -- error raised explicitly by YYERROR. |
6140 `---------------------------------------------------*/
6141 yyerrorlab:
6142 /* Pacify compilers when the user code never invokes YYERROR and the
6143 label yyerrorlab therefore never appears in user code. */
6144 if (0)
6145 YYERROR;
6146 ++yynerrs;
6147
6148 /* Do not reclaim the symbols of the rule whose action triggered
6149 this YYERROR. */
6150 YYPOPSTACK (yylen);
6151 yylen = 0;
6152 YY_STACK_PRINT (yyss, yyssp);
6153 yystate = *yyssp;
6154 goto yyerrlab1;
6155
6156
6157 /*-------------------------------------------------------------.
6158 | yyerrlab1 -- common code for both syntax error and YYERROR. |
6159 `-------------------------------------------------------------*/
6160 yyerrlab1:
6161 yyerrstatus = 3; /* Each real token shifted decrements this. */
6162
6163 /* Pop stack until we find a state that shifts the error token. */
6164 for (;;)
6165 {
6166 yyn = yypact[yystate];
6167 if (!yypact_value_is_default (yyn))
6168 {
6169 yyn += YYSYMBOL_YYerror;
6170 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
6171 {
6172 yyn = yytable[yyn];
6173 if (0 < yyn)
6174 break;
6175 }
6176 }
6177
6178 /* Pop the current state because it cannot handle the error token. */
6179 if (yyssp == yyss)
6180 YYABORT;
6181
6182
6183 yydestruct ("Error: popping",
6184 YY_ACCESSING_SYMBOL (yystate), yyvsp);
6185 YYPOPSTACK (1);
6186 yystate = *yyssp;
6187 YY_STACK_PRINT (yyss, yyssp);
6188 }
6189
6190 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
6191 *++yyvsp = yylval;
6192 YY_IGNORE_MAYBE_UNINITIALIZED_END
6193
6194
6195 /* Shift the error token. */
6196 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
6197
6198 yystate = yyn;
6199 goto yynewstate;
6200
6201
6202 /*-------------------------------------.
6203 | yyacceptlab -- YYACCEPT comes here. |
6204 `-------------------------------------*/
6205 yyacceptlab:
6206 yyresult = 0;
6207 goto yyreturnlab;
6208
6209
6210 /*-----------------------------------.
6211 | yyabortlab -- YYABORT comes here. |
6212 `-----------------------------------*/
6213 yyabortlab:
6214 yyresult = 1;
6215 goto yyreturnlab;
6216
6217
6218 /*-----------------------------------------------------------.
6219 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
6220 `-----------------------------------------------------------*/
6221 yyexhaustedlab:
6222 yyerror (YY_("memory exhausted"));
6223 yyresult = 2;
6224 goto yyreturnlab;
6225
6226
6227 /*----------------------------------------------------------.
6228 | yyreturnlab -- parsing is finished, clean up and return. |
6229 `----------------------------------------------------------*/
6230 yyreturnlab:
6231 if (yychar != YYEMPTY)
6232 {
6233 /* Make sure we have latest lookahead translation. See comments at
6234 user semantic actions for why this is necessary. */
6235 yytoken = YYTRANSLATE (yychar);
6236 yydestruct ("Cleanup: discarding lookahead",
6237 yytoken, &yylval);
6238 }
6239 /* Do not reclaim the symbols of the rule whose action triggered
6240 this YYABORT or YYACCEPT. */
6241 YYPOPSTACK (yylen);
6242 YY_STACK_PRINT (yyss, yyssp);
6243 while (yyssp != yyss)
6244 {
6245 yydestruct ("Cleanup: popping",
6246 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
6247 YYPOPSTACK (1);
6248 }
6249 #ifndef yyoverflow
6250 if (yyss != yyssa)
6251 YYSTACK_FREE (yyss);
6252 #endif
6253
6254 return yyresult;
6255 }
6256
6257 #line 2749 "kate_parser.y"
6258
6259