1 /* A Bison parser, made by GNU Bison 3.7.5. */
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 <http://www.gnu.org/licenses/>. */
20
21 /* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
30
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
33
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
36
37 /* 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 30705
50
51 /* Bison version string. */
52 #define YYBISON_VERSION "3.7.5"
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 /* Substitute the type names. */
67 #define YYSTYPE OCTAVE_TEX_STYPE
68 /* Substitute the variable and function names. */
69 #define yyparse octave_tex_parse
70 #define yylex octave_tex_lex
71 #define yyerror octave_tex_error
72 #define yydebug octave_tex_debug
73 #define yynerrs octave_tex_nerrs
74
75 /* First part of user prologue. */
76 #line 26 "../libinterp/corefcn/oct-tex-parser.yy"
77
78
79 #define YYDEBUG 1
80
81 #if defined (HAVE_CONFIG_H)
82 # include "config.h"
83 #endif
84
85 #include "text-engine.h"
86
87 // oct-tex-parser.h must be included after text-engine.h
88 #include "oct-tex-parser.h"
89
90 extern int octave_tex_lex (YYSTYPE *, void *);
91 static void yyerror (octave::text_parser_tex& parser, const char *s);
92
93 #define scanner parser.get_scanner ()
94 #define yyalloc octave_tex_yyalloc
95
96 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
97 // Disable this warning for code that is generated by Bison,
98 // including grammar rules. Push the current state so we can
99 // restore the warning state prior to functions we define at
100 // the bottom of the file.
101 # pragma GCC diagnostic push
102 # pragma GCC diagnostic ignored "-Wold-style-cast"
103 #endif
104
105
106 #line 107 "libinterp/corefcn/oct-tex-parser.cc"
107
108 # ifndef YY_CAST
109 # ifdef __cplusplus
110 # define YY_CAST(Type, Val) static_cast<Type> (Val)
111 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
112 # else
113 # define YY_CAST(Type, Val) ((Type) (Val))
114 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
115 # endif
116 # endif
117 # ifndef YY_NULLPTR
118 # if defined __cplusplus
119 # if 201103L <= __cplusplus
120 # define YY_NULLPTR nullptr
121 # else
122 # define YY_NULLPTR 0
123 # endif
124 # else
125 # define YY_NULLPTR ((void*)0)
126 # endif
127 # endif
128
129 /* Use api.header.include to #include this header
130 instead of duplicating it here. */
131 #ifndef YY_OCTAVE_TEX_LIBINTERP_COREFCN_OCT_TEX_PARSER_H_INCLUDED
132 # define YY_OCTAVE_TEX_LIBINTERP_COREFCN_OCT_TEX_PARSER_H_INCLUDED
133 /* Debug traces. */
134 #ifndef OCTAVE_TEX_DEBUG
135 # if defined YYDEBUG
136 #if YYDEBUG
137 # define OCTAVE_TEX_DEBUG 1
138 # else
139 # define OCTAVE_TEX_DEBUG 0
140 # endif
141 # else /* ! defined YYDEBUG */
142 # define OCTAVE_TEX_DEBUG 0
143 # endif /* ! defined YYDEBUG */
144 #endif /* ! defined OCTAVE_TEX_DEBUG */
145 #if OCTAVE_TEX_DEBUG
146 extern int octave_tex_debug;
147 #endif
148 /* "%code requires" blocks. */
149 #line 62 "../libinterp/corefcn/oct-tex-parser.yy"
150 #include <string>
151
152 #line 153 "libinterp/corefcn/oct-tex-parser.cc"
153
154 /* Token kinds. */
155 #ifndef OCTAVE_TEX_TOKENTYPE
156 # define OCTAVE_TEX_TOKENTYPE
157 enum octave_tex_tokentype
158 {
159 OCTAVE_TEX_EMPTY = -2,
160 OCTAVE_TEX_EOF = 0, /* "end of file" */
161 OCTAVE_TEX_error = 256, /* error */
162 OCTAVE_TEX_UNDEF = 257, /* "invalid token" */
163 BF = 258, /* BF */
164 IT = 259, /* IT */
165 SL = 260, /* SL */
166 RM = 261, /* RM */
167 FONTNAME = 262, /* FONTNAME */
168 FONTSIZE = 263, /* FONTSIZE */
169 COLOR = 264, /* COLOR */
170 COLOR_RGB = 265, /* COLOR_RGB */
171 START = 266, /* START */
172 END = 267, /* END */
173 SUPER = 268, /* SUPER */
174 SUB = 269, /* SUB */
175 CH = 270, /* CH */
176 NUM = 271, /* NUM */
177 SYM = 272, /* SYM */
178 SCRIPT = 273, /* SCRIPT */
179 STR = 274 /* STR */
180 };
181 typedef enum octave_tex_tokentype octave_tex_token_kind_t;
182 #endif
183 /* Token kinds. */
184 #define OCTAVE_TEX_EMPTY -2
185 #define OCTAVE_TEX_EOF 0
186 #define OCTAVE_TEX_error 256
187 #define OCTAVE_TEX_UNDEF 257
188 #define BF 258
189 #define IT 259
190 #define SL 260
191 #define RM 261
192 #define FONTNAME 262
193 #define FONTSIZE 263
194 #define COLOR 264
195 #define COLOR_RGB 265
196 #define START 266
197 #define END 267
198 #define SUPER 268
199 #define SUB 269
200 #define CH 270
201 #define NUM 271
202 #define SYM 272
203 #define SCRIPT 273
204 #define STR 274
205
206 /* Value type. */
207 #if ! defined OCTAVE_TEX_STYPE && ! defined OCTAVE_TEX_STYPE_IS_DECLARED
208 union OCTAVE_TEX_STYPE
209 {
210 #line 65 "../libinterp/corefcn/oct-tex-parser.yy"
211
212 // Leaf symbols produced by the scanner.
213 char ch;
214 double num;
215 int sym;
216
217 // Used for string buffering.
218 std::string *str;
219
220 // Objects produced by the parser.
221 octave::text_element *e_base;
222 octave::text_element_list *e_list;
223
224 #line 225 "libinterp/corefcn/oct-tex-parser.cc"
225
226 };
227 typedef union OCTAVE_TEX_STYPE OCTAVE_TEX_STYPE;
228 # define OCTAVE_TEX_STYPE_IS_TRIVIAL 1
229 # define OCTAVE_TEX_STYPE_IS_DECLARED 1
230 #endif
231
232
233
234 int octave_tex_parse (octave::text_parser_tex& parser);
235
236 #endif /* !YY_OCTAVE_TEX_LIBINTERP_COREFCN_OCT_TEX_PARSER_H_INCLUDED */
237 /* Symbol kind. */
238 enum yysymbol_kind_t
239 {
240 YYSYMBOL_YYEMPTY = -2,
241 YYSYMBOL_YYEOF = 0, /* "end of file" */
242 YYSYMBOL_YYerror = 1, /* error */
243 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
244 YYSYMBOL_BF = 3, /* BF */
245 YYSYMBOL_IT = 4, /* IT */
246 YYSYMBOL_SL = 5, /* SL */
247 YYSYMBOL_RM = 6, /* RM */
248 YYSYMBOL_FONTNAME = 7, /* FONTNAME */
249 YYSYMBOL_FONTSIZE = 8, /* FONTSIZE */
250 YYSYMBOL_COLOR = 9, /* COLOR */
251 YYSYMBOL_COLOR_RGB = 10, /* COLOR_RGB */
252 YYSYMBOL_START = 11, /* START */
253 YYSYMBOL_END = 12, /* END */
254 YYSYMBOL_SUPER = 13, /* SUPER */
255 YYSYMBOL_SUB = 14, /* SUB */
256 YYSYMBOL_CH = 15, /* CH */
257 YYSYMBOL_NUM = 16, /* NUM */
258 YYSYMBOL_SYM = 17, /* SYM */
259 YYSYMBOL_SCRIPT = 18, /* SCRIPT */
260 YYSYMBOL_STR = 19, /* STR */
261 YYSYMBOL_YYACCEPT = 20, /* $accept */
262 YYSYMBOL_simple_string = 21, /* simple_string */
263 YYSYMBOL_symbol_element = 22, /* symbol_element */
264 YYSYMBOL_font_modifier_element = 23, /* font_modifier_element */
265 YYSYMBOL_fontsize_element = 24, /* fontsize_element */
266 YYSYMBOL_fontname_element = 25, /* fontname_element */
267 YYSYMBOL_color_element = 26, /* color_element */
268 YYSYMBOL_string_element = 27, /* string_element */
269 YYSYMBOL_superscript_element = 28, /* superscript_element */
270 YYSYMBOL_subscript_element = 29, /* subscript_element */
271 YYSYMBOL_combined_script_element = 30, /* combined_script_element */
272 YYSYMBOL_string_element_list = 31, /* string_element_list */
273 YYSYMBOL_scoped_string_element_list = 32, /* scoped_string_element_list */
274 YYSYMBOL_string = 33 /* string */
275 };
276 typedef enum yysymbol_kind_t yysymbol_kind_t;
277
278
279
280
281 #ifdef short
282 # undef short
283 #endif
284
285 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
286 <limits.h> and (if available) <stdint.h> are included
287 so that the code can choose integer types of a good width. */
288
289 #ifndef __PTRDIFF_MAX__
290 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
291 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
292 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
293 # define YY_STDINT_H
294 # endif
295 #endif
296
297 /* Narrow types that promote to a signed type and that can represent a
298 signed or unsigned integer of at least N bits. In tables they can
299 save space and decrease cache pressure. Promoting to a signed type
300 helps avoid bugs in integer arithmetic. */
301
302 #ifdef __INT_LEAST8_MAX__
303 typedef __INT_LEAST8_TYPE__ yytype_int8;
304 #elif defined YY_STDINT_H
305 typedef int_least8_t yytype_int8;
306 #else
307 typedef signed char yytype_int8;
308 #endif
309
310 #ifdef __INT_LEAST16_MAX__
311 typedef __INT_LEAST16_TYPE__ yytype_int16;
312 #elif defined YY_STDINT_H
313 typedef int_least16_t yytype_int16;
314 #else
315 typedef short yytype_int16;
316 #endif
317
318 /* Work around bug in HP-UX 11.23, which defines these macros
319 incorrectly for preprocessor constants. This workaround can likely
320 be removed in 2023, as HPE has promised support for HP-UX 11.23
321 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
322 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
323 #ifdef __hpux
324 # undef UINT_LEAST8_MAX
325 # undef UINT_LEAST16_MAX
326 # define UINT_LEAST8_MAX 255
327 # define UINT_LEAST16_MAX 65535
328 #endif
329
330 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
331 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
332 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
333 && UINT_LEAST8_MAX <= INT_MAX)
334 typedef uint_least8_t yytype_uint8;
335 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
336 typedef unsigned char yytype_uint8;
337 #else
338 typedef short yytype_uint8;
339 #endif
340
341 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
342 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
343 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
344 && UINT_LEAST16_MAX <= INT_MAX)
345 typedef uint_least16_t yytype_uint16;
346 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
347 typedef unsigned short yytype_uint16;
348 #else
349 typedef int yytype_uint16;
350 #endif
351
352 #ifndef YYPTRDIFF_T
353 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
354 # define YYPTRDIFF_T __PTRDIFF_TYPE__
355 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
356 # elif defined PTRDIFF_MAX
357 # ifndef ptrdiff_t
358 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
359 # endif
360 # define YYPTRDIFF_T ptrdiff_t
361 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
362 # else
363 # define YYPTRDIFF_T long
364 # define YYPTRDIFF_MAXIMUM LONG_MAX
365 # endif
366 #endif
367
368 #ifndef YYSIZE_T
369 # ifdef __SIZE_TYPE__
370 # define YYSIZE_T __SIZE_TYPE__
371 # elif defined size_t
372 # define YYSIZE_T size_t
373 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
374 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
375 # define YYSIZE_T size_t
376 # else
377 # define YYSIZE_T unsigned
378 # endif
379 #endif
380
381 #define YYSIZE_MAXIMUM \
382 YY_CAST (YYPTRDIFF_T, \
383 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
384 ? YYPTRDIFF_MAXIMUM \
385 : YY_CAST (YYSIZE_T, -1)))
386
387 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
388
389
390 /* Stored state numbers (used for stacks). */
391 typedef yytype_int8 yy_state_t;
392
393 /* State numbers in computations. */
394 typedef int yy_state_fast_t;
395
396 #ifndef YY_
397 # if defined YYENABLE_NLS && YYENABLE_NLS
398 # if ENABLE_NLS
399 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
400 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
401 # endif
402 # endif
403 # ifndef YY_
404 # define YY_(Msgid) Msgid
405 # endif
406 #endif
407
408
409 #ifndef YY_ATTRIBUTE_PURE
410 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
411 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
412 # else
413 # define YY_ATTRIBUTE_PURE
414 # endif
415 #endif
416
417 #ifndef YY_ATTRIBUTE_UNUSED
418 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
419 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
420 # else
421 # define YY_ATTRIBUTE_UNUSED
422 # endif
423 #endif
424
425 /* Suppress unused-variable warnings by "using" E. */
426 #if ! defined lint || defined __GNUC__
427 # define YY_USE(E) ((void) (E))
428 #else
429 # define YY_USE(E) /* empty */
430 #endif
431
432 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
433 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
434 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
435 _Pragma ("GCC diagnostic push") \
436 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
437 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
438 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
439 _Pragma ("GCC diagnostic pop")
440 #else
441 # define YY_INITIAL_VALUE(Value) Value
442 #endif
443 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
444 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
445 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
446 #endif
447 #ifndef YY_INITIAL_VALUE
448 # define YY_INITIAL_VALUE(Value) /* Nothing. */
449 #endif
450
451 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
452 # define YY_IGNORE_USELESS_CAST_BEGIN \
453 _Pragma ("GCC diagnostic push") \
454 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
455 # define YY_IGNORE_USELESS_CAST_END \
456 _Pragma ("GCC diagnostic pop")
457 #endif
458 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
459 # define YY_IGNORE_USELESS_CAST_BEGIN
460 # define YY_IGNORE_USELESS_CAST_END
461 #endif
462
463
464 #define YY_ASSERT(E) ((void) (0 && (E)))
465
466 #if !defined yyoverflow
467
468 /* The parser invokes alloca or malloc; define the necessary symbols. */
469
470 # ifdef YYSTACK_USE_ALLOCA
471 # if YYSTACK_USE_ALLOCA
472 # ifdef __GNUC__
473 # define YYSTACK_ALLOC __builtin_alloca
474 # elif defined __BUILTIN_VA_ARG_INCR
475 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
476 # elif defined _AIX
477 # define YYSTACK_ALLOC __alloca
478 # elif defined _MSC_VER
479 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
480 # define alloca _alloca
481 # else
482 # define YYSTACK_ALLOC alloca
483 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
484 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
485 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
486 # ifndef EXIT_SUCCESS
487 # define EXIT_SUCCESS 0
488 # endif
489 # endif
490 # endif
491 # endif
492 # endif
493
494 # ifdef YYSTACK_ALLOC
495 /* Pacify GCC's 'empty if-body' warning. */
496 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
497 # ifndef YYSTACK_ALLOC_MAXIMUM
498 /* The OS might guarantee only one guard page at the bottom of the stack,
499 and a page size can be as small as 4096 bytes. So we cannot safely
500 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
501 to allow for a few compiler-allocated temporary stack slots. */
502 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
503 # endif
504 # else
505 # define YYSTACK_ALLOC YYMALLOC
506 # define YYSTACK_FREE YYFREE
507 # ifndef YYSTACK_ALLOC_MAXIMUM
508 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
509 # endif
510 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
511 && ! ((defined YYMALLOC || defined malloc) \
512 && (defined YYFREE || defined free)))
513 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
514 # ifndef EXIT_SUCCESS
515 # define EXIT_SUCCESS 0
516 # endif
517 # endif
518 # ifndef YYMALLOC
519 # define YYMALLOC malloc
520 # if ! defined malloc && ! defined EXIT_SUCCESS
521 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
522 # endif
523 # endif
524 # ifndef YYFREE
525 # define YYFREE free
526 # if ! defined free && ! defined EXIT_SUCCESS
527 void free (void *); /* INFRINGES ON USER NAME SPACE */
528 # endif
529 # endif
530 # endif
531 #endif /* !defined yyoverflow */
532
533 #if (! defined yyoverflow \
534 && (! defined __cplusplus \
535 || (defined OCTAVE_TEX_STYPE_IS_TRIVIAL && OCTAVE_TEX_STYPE_IS_TRIVIAL)))
536
537 /* A type that is properly aligned for any stack member. */
538 union yyalloc
539 {
540 yy_state_t yyss_alloc;
541 YYSTYPE yyvs_alloc;
542 };
543
544 /* The size of the maximum gap between one aligned stack and the next. */
545 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
546
547 /* The size of an array large to enough to hold all stacks, each with
548 N elements. */
549 # define YYSTACK_BYTES(N) \
550 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
551 + YYSTACK_GAP_MAXIMUM)
552
553 # define YYCOPY_NEEDED 1
554
555 /* Relocate STACK from its old location to the new one. The
556 local variables YYSIZE and YYSTACKSIZE give the old and new number of
557 elements in the stack, and YYPTR gives the new location of the
558 stack. Advance YYPTR to a properly aligned location for the next
559 stack. */
560 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
561 do \
562 { \
563 YYPTRDIFF_T yynewbytes; \
564 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
565 Stack = &yyptr->Stack_alloc; \
566 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
567 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
568 } \
569 while (0)
570
571 #endif
572
573 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
574 /* Copy COUNT objects from SRC to DST. The source and destination do
575 not overlap. */
576 # ifndef YYCOPY
577 # if defined __GNUC__ && 1 < __GNUC__
578 # define YYCOPY(Dst, Src, Count) \
579 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
580 # else
581 # define YYCOPY(Dst, Src, Count) \
582 do \
583 { \
584 YYPTRDIFF_T yyi; \
585 for (yyi = 0; yyi < (Count); yyi++) \
586 (Dst)[yyi] = (Src)[yyi]; \
587 } \
588 while (0)
589 # endif
590 # endif
591 #endif /* !YYCOPY_NEEDED */
592
593 /* YYFINAL -- State number of the termination state. */
594 #define YYFINAL 43
595 /* YYLAST -- Last index in YYTABLE. */
596 #define YYLAST 81
597
598 /* YYNTOKENS -- Number of terminals. */
599 #define YYNTOKENS 20
600 /* YYNNTS -- Number of nonterminals. */
601 #define YYNNTS 14
602 /* YYNRULES -- Number of rules. */
603 #define YYNRULES 36
604 /* YYNSTATES -- Number of states. */
605 #define YYNSTATES 55
606
607 /* YYMAXUTOK -- Last valid token kind. */
608 #define YYMAXUTOK 274
609
610
611 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
612 as returned by yylex, with out-of-bounds checking. */
613 #define YYTRANSLATE(YYX) \
614 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
615 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
616 : YYSYMBOL_YYUNDEF)
617
618 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
619 as returned by yylex. */
620 static const yytype_int8 yytranslate[] =
621 {
622 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
623 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
624 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
625 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
626 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
627 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
628 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
629 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
630 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
631 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
632 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
633 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
634 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
635 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
636 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
637 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
638 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
639 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
641 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
642 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
643 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
644 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
645 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
646 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
647 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
648 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
649 15, 16, 17, 18, 19
650 };
651
652 #if OCTAVE_TEX_DEBUG
653 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
654 static const yytype_uint8 yyrline[] =
655 {
656 0, 108, 108, 110, 114, 118, 120, 122, 124, 128,
657 132, 139, 144, 150, 155, 157, 158, 159, 160, 161,
658 162, 163, 164, 167, 169, 171, 175, 177, 179, 183,
659 185, 189, 191, 196, 198, 203, 204
660 };
661 #endif
662
663 /** Accessing symbol of state STATE. */
664 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
665
666 #if OCTAVE_TEX_DEBUG || 0
667 /* The user-facing name of the symbol whose (internal) number is
668 YYSYMBOL. No bounds checking. */
669 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
670
671 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
672 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
673 static const char *const yytname[] =
674 {
675 "\"end of file\"", "error", "\"invalid token\"", "BF", "IT", "SL", "RM",
676 "FONTNAME", "FONTSIZE", "COLOR", "COLOR_RGB", "START", "END", "SUPER",
677 "SUB", "CH", "NUM", "SYM", "SCRIPT", "STR", "$accept", "simple_string",
678 "symbol_element", "font_modifier_element", "fontsize_element",
679 "fontname_element", "color_element", "string_element",
680 "superscript_element", "subscript_element", "combined_script_element",
681 "string_element_list", "scoped_string_element_list", "string", YY_NULLPTR
682 };
683
684 static const char *
yysymbol_name(yysymbol_kind_t yysymbol)685 yysymbol_name (yysymbol_kind_t yysymbol)
686 {
687 return yytname[yysymbol];
688 }
689 #endif
690
691 #ifdef YYPRINT
692 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
693 (internal) symbol number NUM (which must be that of a token). */
694 static const yytype_int16 yytoknum[] =
695 {
696 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
697 265, 266, 267, 268, 269, 270, 271, 272, 273, 274
698 };
699 #endif
700
701 #define YYPACT_NINF (-4)
702
703 #define yypact_value_is_default(Yyn) \
704 ((Yyn) == YYPACT_NINF)
705
706 #define YYTABLE_NINF (-1)
707
708 #define yytable_value_is_error(Yyn) \
709 0
710
711 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
712 STATE-NUM. */
713 static const yytype_int8 yypact[] =
714 {
715 27, -4, -4, -4, -4, 2, 17, 32, 37, -3,
716 34, 35, -4, -4, 40, -4, -4, -4, -4, -4,
717 -4, 45, 52, -4, 27, -4, 66, 54, 55, 54,
718 56, -4, 12, -4, -4, -4, -4, -4, -4, -4,
719 -4, -4, -4, -4, 41, 58, 42, 57, -4, -4,
720 -4, -4, 59, 62, -4
721 };
722
723 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
724 Performed when YYTABLE does not specify something else to do. Zero
725 means the default is an error. */
726 static const yytype_int8 yydefact[] =
727 {
728 35, 5, 6, 7, 8, 0, 0, 0, 0, 0,
729 0, 0, 2, 4, 13, 15, 16, 17, 18, 19,
730 31, 20, 21, 22, 36, 14, 0, 0, 0, 0,
731 0, 34, 0, 23, 25, 24, 26, 28, 27, 3,
732 30, 29, 32, 1, 0, 0, 0, 0, 33, 10,
733 9, 11, 0, 0, 12
734 };
735
736 /* YYPGOTO[NTERM-NUM]. */
737 static const yytype_int8 yypgoto[] =
738 {
739 -4, 31, 51, -4, -4, -4, -4, 15, 46, 60,
740 -4, 67, 53, -4
741 };
742
743 /* YYDEFGOTO[NTERM-NUM]. */
744 static const yytype_int8 yydefgoto[] =
745 {
746 0, 14, 15, 16, 17, 18, 19, 20, 21, 22,
747 23, 24, 25, 26
748 };
749
750 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
751 positive, shift that token. If negative, reduce the rule whose
752 number is the opposite. If YYTABLE_NINF, syntax error. */
753 static const yytype_int8 yytable[] =
754 {
755 1, 2, 3, 4, 5, 6, 7, 8, 9, 31,
756 10, 11, 12, 27, 13, 1, 2, 3, 4, 5,
757 6, 7, 8, 9, 48, 10, 11, 12, 28, 13,
758 1, 2, 3, 4, 5, 6, 7, 8, 9, 42,
759 10, 11, 12, 29, 13, 9, 9, 42, 30, 33,
760 36, 13, 13, 49, 51, 39, 39, 39, 44, 11,
761 46, 34, 37, 35, 38, 10, 43, 0, 41, 12,
762 50, 45, 47, 52, 54, 53, 32, 0, 0, 0,
763 0, 40
764 };
765
766 static const yytype_int8 yycheck[] =
767 {
768 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
769 13, 14, 15, 11, 17, 3, 4, 5, 6, 7,
770 8, 9, 10, 11, 12, 13, 14, 15, 11, 17,
771 3, 4, 5, 6, 7, 8, 9, 10, 11, 24,
772 13, 14, 15, 11, 17, 11, 11, 32, 11, 15,
773 15, 17, 17, 12, 12, 15, 15, 15, 27, 14,
774 29, 10, 11, 10, 11, 13, 0, -1, 22, 15,
775 12, 16, 16, 16, 12, 16, 9, -1, -1, -1,
776 -1, 21
777 };
778
779 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
780 symbol of state STATE-NUM. */
781 static const yytype_int8 yystos[] =
782 {
783 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
784 13, 14, 15, 17, 21, 22, 23, 24, 25, 26,
785 27, 28, 29, 30, 31, 32, 33, 11, 11, 11,
786 11, 12, 31, 15, 22, 32, 15, 22, 32, 15,
787 29, 28, 27, 0, 21, 16, 21, 16, 12, 12,
788 12, 12, 16, 16, 12
789 };
790
791 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
792 static const yytype_int8 yyr1[] =
793 {
794 0, 20, 21, 21, 22, 23, 23, 23, 23, 24,
795 25, 26, 26, 27, 27, 27, 27, 27, 27, 27,
796 27, 27, 27, 28, 28, 28, 29, 29, 29, 30,
797 30, 31, 31, 32, 32, 33, 33
798 };
799
800 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
801 static const yytype_int8 yyr2[] =
802 {
803 0, 2, 1, 2, 1, 1, 1, 1, 1, 4,
804 4, 4, 6, 1, 1, 1, 1, 1, 1, 1,
805 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
806 2, 1, 2, 3, 2, 0, 1
807 };
808
809
810 enum { YYENOMEM = -2 };
811
812 #define yyerrok (yyerrstatus = 0)
813 #define yyclearin (yychar = OCTAVE_TEX_EMPTY)
814
815 #define YYACCEPT goto yyacceptlab
816 #define YYABORT goto yyabortlab
817 #define YYERROR goto yyerrorlab
818
819
820 #define YYRECOVERING() (!!yyerrstatus)
821
822 #define YYBACKUP(Token, Value) \
823 do \
824 if (yychar == OCTAVE_TEX_EMPTY) \
825 { \
826 yychar = (Token); \
827 yylval = (Value); \
828 YYPOPSTACK (yylen); \
829 yystate = *yyssp; \
830 goto yybackup; \
831 } \
832 else \
833 { \
834 yyerror (parser, YY_("syntax error: cannot back up")); \
835 YYERROR; \
836 } \
837 while (0)
838
839 /* Backward compatibility with an undocumented macro.
840 Use OCTAVE_TEX_error or OCTAVE_TEX_UNDEF. */
841 #define YYERRCODE OCTAVE_TEX_UNDEF
842
843
844 /* Enable debugging if requested. */
845 #if OCTAVE_TEX_DEBUG
846
847 # ifndef YYFPRINTF
848 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
849 # define YYFPRINTF fprintf
850 # endif
851
852 # define YYDPRINTF(Args) \
853 do { \
854 if (yydebug) \
855 YYFPRINTF Args; \
856 } while (0)
857
858 /* This macro is provided for backward compatibility. */
859 # ifndef YY_LOCATION_PRINT
860 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
861 # endif
862
863
864 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
865 do { \
866 if (yydebug) \
867 { \
868 YYFPRINTF (stderr, "%s ", Title); \
869 yy_symbol_print (stderr, \
870 Kind, Value, parser); \
871 YYFPRINTF (stderr, "\n"); \
872 } \
873 } while (0)
874
875
876 /*-----------------------------------.
877 | Print this symbol's value on YYO. |
878 `-----------------------------------*/
879
880 static void
yy_symbol_value_print(FILE * yyo,yysymbol_kind_t yykind,YYSTYPE const * const yyvaluep,octave::text_parser_tex & parser)881 yy_symbol_value_print (FILE *yyo,
882 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, octave::text_parser_tex& parser)
883 {
884 FILE *yyoutput = yyo;
885 YY_USE (yyoutput);
886 YY_USE (parser);
887 if (!yyvaluep)
888 return;
889 # ifdef YYPRINT
890 if (yykind < YYNTOKENS)
891 YYPRINT (yyo, yytoknum[yykind], *yyvaluep);
892 # endif
893 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
894 YY_USE (yykind);
895 YY_IGNORE_MAYBE_UNINITIALIZED_END
896 }
897
898
899 /*---------------------------.
900 | Print this symbol on YYO. |
901 `---------------------------*/
902
903 static void
yy_symbol_print(FILE * yyo,yysymbol_kind_t yykind,YYSTYPE const * const yyvaluep,octave::text_parser_tex & parser)904 yy_symbol_print (FILE *yyo,
905 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, octave::text_parser_tex& parser)
906 {
907 YYFPRINTF (yyo, "%s %s (",
908 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
909
910 yy_symbol_value_print (yyo, yykind, yyvaluep, parser);
911 YYFPRINTF (yyo, ")");
912 }
913
914 /*------------------------------------------------------------------.
915 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
916 | TOP (included). |
917 `------------------------------------------------------------------*/
918
919 static void
yy_stack_print(yy_state_t * yybottom,yy_state_t * yytop)920 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
921 {
922 YYFPRINTF (stderr, "Stack now");
923 for (; yybottom <= yytop; yybottom++)
924 {
925 int yybot = *yybottom;
926 YYFPRINTF (stderr, " %d", yybot);
927 }
928 YYFPRINTF (stderr, "\n");
929 }
930
931 # define YY_STACK_PRINT(Bottom, Top) \
932 do { \
933 if (yydebug) \
934 yy_stack_print ((Bottom), (Top)); \
935 } while (0)
936
937
938 /*------------------------------------------------.
939 | Report that the YYRULE is going to be reduced. |
940 `------------------------------------------------*/
941
942 static void
yy_reduce_print(yy_state_t * yyssp,YYSTYPE * yyvsp,int yyrule,octave::text_parser_tex & parser)943 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
944 int yyrule, octave::text_parser_tex& parser)
945 {
946 int yylno = yyrline[yyrule];
947 int yynrhs = yyr2[yyrule];
948 int yyi;
949 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
950 yyrule - 1, yylno);
951 /* The symbols being reduced. */
952 for (yyi = 0; yyi < yynrhs; yyi++)
953 {
954 YYFPRINTF (stderr, " $%d = ", yyi + 1);
955 yy_symbol_print (stderr,
956 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
957 &yyvsp[(yyi + 1) - (yynrhs)], parser);
958 YYFPRINTF (stderr, "\n");
959 }
960 }
961
962 # define YY_REDUCE_PRINT(Rule) \
963 do { \
964 if (yydebug) \
965 yy_reduce_print (yyssp, yyvsp, Rule, parser); \
966 } while (0)
967
968 /* Nonzero means print parse trace. It is left uninitialized so that
969 multiple parsers can coexist. */
970 int yydebug;
971 #else /* !OCTAVE_TEX_DEBUG */
972 # define YYDPRINTF(Args) ((void) 0)
973 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
974 # define YY_STACK_PRINT(Bottom, Top)
975 # define YY_REDUCE_PRINT(Rule)
976 #endif /* !OCTAVE_TEX_DEBUG */
977
978
979 /* YYINITDEPTH -- initial size of the parser's stacks. */
980 #ifndef YYINITDEPTH
981 # define YYINITDEPTH 200
982 #endif
983
984 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
985 if the built-in stack extension method is used).
986
987 Do not make this value too large; the results are undefined if
988 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
989 evaluated with infinite-precision integer arithmetic. */
990
991 #ifndef YYMAXDEPTH
992 # define YYMAXDEPTH 10000
993 #endif
994
995
996
997
998
999
1000 /*-----------------------------------------------.
1001 | Release the memory associated to this symbol. |
1002 `-----------------------------------------------*/
1003
1004 static void
yydestruct(const char * yymsg,yysymbol_kind_t yykind,YYSTYPE * yyvaluep,octave::text_parser_tex & parser)1005 yydestruct (const char *yymsg,
1006 yysymbol_kind_t yykind, YYSTYPE *yyvaluep, octave::text_parser_tex& parser)
1007 {
1008 YY_USE (yyvaluep);
1009 YY_USE (parser);
1010 if (!yymsg)
1011 yymsg = "Deleting";
1012 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1013
1014 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1015 switch (yykind)
1016 {
1017 case YYSYMBOL_CH: /* CH */
1018 #line 95 "../libinterp/corefcn/oct-tex-parser.yy"
1019 { }
1020 #line 1021 "libinterp/corefcn/oct-tex-parser.cc"
1021 break;
1022
1023 case YYSYMBOL_NUM: /* NUM */
1024 #line 95 "../libinterp/corefcn/oct-tex-parser.yy"
1025 { }
1026 #line 1027 "libinterp/corefcn/oct-tex-parser.cc"
1027 break;
1028
1029 case YYSYMBOL_SYM: /* SYM */
1030 #line 95 "../libinterp/corefcn/oct-tex-parser.yy"
1031 { }
1032 #line 1033 "libinterp/corefcn/oct-tex-parser.cc"
1033 break;
1034
1035 case YYSYMBOL_simple_string: /* simple_string */
1036 #line 96 "../libinterp/corefcn/oct-tex-parser.yy"
1037 { delete ((*yyvaluep).str); }
1038 #line 1039 "libinterp/corefcn/oct-tex-parser.cc"
1039 break;
1040
1041 case YYSYMBOL_symbol_element: /* symbol_element */
1042 #line 96 "../libinterp/corefcn/oct-tex-parser.yy"
1043 { delete ((*yyvaluep).e_base); }
1044 #line 1045 "libinterp/corefcn/oct-tex-parser.cc"
1045 break;
1046
1047 case YYSYMBOL_font_modifier_element: /* font_modifier_element */
1048 #line 96 "../libinterp/corefcn/oct-tex-parser.yy"
1049 { delete ((*yyvaluep).e_base); }
1050 #line 1051 "libinterp/corefcn/oct-tex-parser.cc"
1051 break;
1052
1053 case YYSYMBOL_fontsize_element: /* fontsize_element */
1054 #line 96 "../libinterp/corefcn/oct-tex-parser.yy"
1055 { delete ((*yyvaluep).e_base); }
1056 #line 1057 "libinterp/corefcn/oct-tex-parser.cc"
1057 break;
1058
1059 case YYSYMBOL_fontname_element: /* fontname_element */
1060 #line 96 "../libinterp/corefcn/oct-tex-parser.yy"
1061 { delete ((*yyvaluep).e_base); }
1062 #line 1063 "libinterp/corefcn/oct-tex-parser.cc"
1063 break;
1064
1065 case YYSYMBOL_color_element: /* color_element */
1066 #line 96 "../libinterp/corefcn/oct-tex-parser.yy"
1067 { delete ((*yyvaluep).e_base); }
1068 #line 1069 "libinterp/corefcn/oct-tex-parser.cc"
1069 break;
1070
1071 case YYSYMBOL_string_element: /* string_element */
1072 #line 96 "../libinterp/corefcn/oct-tex-parser.yy"
1073 { delete ((*yyvaluep).e_base); }
1074 #line 1075 "libinterp/corefcn/oct-tex-parser.cc"
1075 break;
1076
1077 case YYSYMBOL_superscript_element: /* superscript_element */
1078 #line 96 "../libinterp/corefcn/oct-tex-parser.yy"
1079 { delete ((*yyvaluep).e_base); }
1080 #line 1081 "libinterp/corefcn/oct-tex-parser.cc"
1081 break;
1082
1083 case YYSYMBOL_subscript_element: /* subscript_element */
1084 #line 96 "../libinterp/corefcn/oct-tex-parser.yy"
1085 { delete ((*yyvaluep).e_base); }
1086 #line 1087 "libinterp/corefcn/oct-tex-parser.cc"
1087 break;
1088
1089 case YYSYMBOL_combined_script_element: /* combined_script_element */
1090 #line 96 "../libinterp/corefcn/oct-tex-parser.yy"
1091 { delete ((*yyvaluep).e_base); }
1092 #line 1093 "libinterp/corefcn/oct-tex-parser.cc"
1093 break;
1094
1095 case YYSYMBOL_string_element_list: /* string_element_list */
1096 #line 96 "../libinterp/corefcn/oct-tex-parser.yy"
1097 { delete ((*yyvaluep).e_list); }
1098 #line 1099 "libinterp/corefcn/oct-tex-parser.cc"
1099 break;
1100
1101 case YYSYMBOL_scoped_string_element_list: /* scoped_string_element_list */
1102 #line 96 "../libinterp/corefcn/oct-tex-parser.yy"
1103 { delete ((*yyvaluep).e_list); }
1104 #line 1105 "libinterp/corefcn/oct-tex-parser.cc"
1105 break;
1106
1107 default:
1108 break;
1109 }
1110 YY_IGNORE_MAYBE_UNINITIALIZED_END
1111 }
1112
1113
1114
1115
1116
1117
1118 /*----------.
1119 | yyparse. |
1120 `----------*/
1121
1122 int
yyparse(octave::text_parser_tex & parser)1123 yyparse (octave::text_parser_tex& parser)
1124 {
1125 /* Lookahead token kind. */
1126 int yychar;
1127
1128
1129 /* The semantic value of the lookahead symbol. */
1130 /* Default value used for initialization, for pacifying older GCCs
1131 or non-GCC compilers. */
1132 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1133 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1134
1135 /* Number of syntax errors so far. */
1136 int yynerrs = 0;
1137
1138 yy_state_fast_t yystate = 0;
1139 /* Number of tokens to shift before error messages enabled. */
1140 int yyerrstatus = 0;
1141
1142 /* Refer to the stacks through separate pointers, to allow yyoverflow
1143 to reallocate them elsewhere. */
1144
1145 /* Their size. */
1146 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1147
1148 /* The state stack: array, bottom, top. */
1149 yy_state_t yyssa[YYINITDEPTH];
1150 yy_state_t *yyss = yyssa;
1151 yy_state_t *yyssp = yyss;
1152
1153 /* The semantic value stack: array, bottom, top. */
1154 YYSTYPE yyvsa[YYINITDEPTH];
1155 YYSTYPE *yyvs = yyvsa;
1156 YYSTYPE *yyvsp = yyvs;
1157
1158 int yyn;
1159 /* The return value of yyparse. */
1160 int yyresult;
1161 /* Lookahead symbol kind. */
1162 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1163 /* The variables used to return semantic value and location from the
1164 action routines. */
1165 YYSTYPE yyval;
1166
1167
1168
1169 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1170
1171 /* The number of symbols on the RHS of the reduced rule.
1172 Keep to zero when no symbol should be popped. */
1173 int yylen = 0;
1174
1175 YYDPRINTF ((stderr, "Starting parse\n"));
1176
1177 yychar = OCTAVE_TEX_EMPTY; /* Cause a token to be read. */
1178 goto yysetstate;
1179
1180
1181 /*------------------------------------------------------------.
1182 | yynewstate -- push a new state, which is found in yystate. |
1183 `------------------------------------------------------------*/
1184 yynewstate:
1185 /* In all cases, when you get here, the value and location stacks
1186 have just been pushed. So pushing a state here evens the stacks. */
1187 yyssp++;
1188
1189
1190 /*--------------------------------------------------------------------.
1191 | yysetstate -- set current state (the top of the stack) to yystate. |
1192 `--------------------------------------------------------------------*/
1193 yysetstate:
1194 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1195 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1196 YY_IGNORE_USELESS_CAST_BEGIN
1197 *yyssp = YY_CAST (yy_state_t, yystate);
1198 YY_IGNORE_USELESS_CAST_END
1199 YY_STACK_PRINT (yyss, yyssp);
1200
1201 if (yyss + yystacksize - 1 <= yyssp)
1202 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1203 goto yyexhaustedlab;
1204 #else
1205 {
1206 /* Get the current used size of the three stacks, in elements. */
1207 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1208
1209 # if defined yyoverflow
1210 {
1211 /* Give user a chance to reallocate the stack. Use copies of
1212 these so that the &'s don't force the real ones into
1213 memory. */
1214 yy_state_t *yyss1 = yyss;
1215 YYSTYPE *yyvs1 = yyvs;
1216
1217 /* Each stack pointer address is followed by the size of the
1218 data in use in that stack, in bytes. This used to be a
1219 conditional around just the two extra args, but that might
1220 be undefined if yyoverflow is a macro. */
1221 yyoverflow (YY_("memory exhausted"),
1222 &yyss1, yysize * YYSIZEOF (*yyssp),
1223 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1224 &yystacksize);
1225 yyss = yyss1;
1226 yyvs = yyvs1;
1227 }
1228 # else /* defined YYSTACK_RELOCATE */
1229 /* Extend the stack our own way. */
1230 if (YYMAXDEPTH <= yystacksize)
1231 goto yyexhaustedlab;
1232 yystacksize *= 2;
1233 if (YYMAXDEPTH < yystacksize)
1234 yystacksize = YYMAXDEPTH;
1235
1236 {
1237 yy_state_t *yyss1 = yyss;
1238 union yyalloc *yyptr =
1239 YY_CAST (union yyalloc *,
1240 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1241 if (! yyptr)
1242 goto yyexhaustedlab;
1243 YYSTACK_RELOCATE (yyss_alloc, yyss);
1244 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1245 # undef YYSTACK_RELOCATE
1246 if (yyss1 != yyssa)
1247 YYSTACK_FREE (yyss1);
1248 }
1249 # endif
1250
1251 yyssp = yyss + yysize - 1;
1252 yyvsp = yyvs + yysize - 1;
1253
1254 YY_IGNORE_USELESS_CAST_BEGIN
1255 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1256 YY_CAST (long, yystacksize)));
1257 YY_IGNORE_USELESS_CAST_END
1258
1259 if (yyss + yystacksize - 1 <= yyssp)
1260 YYABORT;
1261 }
1262 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1263
1264 if (yystate == YYFINAL)
1265 YYACCEPT;
1266
1267 goto yybackup;
1268
1269
1270 /*-----------.
1271 | yybackup. |
1272 `-----------*/
1273 yybackup:
1274 /* Do appropriate processing given the current state. Read a
1275 lookahead token if we need one and don't already have one. */
1276
1277 /* First try to decide what to do without reference to lookahead token. */
1278 yyn = yypact[yystate];
1279 if (yypact_value_is_default (yyn))
1280 goto yydefault;
1281
1282 /* Not known => get a lookahead token if don't already have one. */
1283
1284 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1285 if (yychar == OCTAVE_TEX_EMPTY)
1286 {
1287 YYDPRINTF ((stderr, "Reading a token\n"));
1288 yychar = yylex (&yylval, scanner);
1289 }
1290
1291 if (yychar <= OCTAVE_TEX_EOF)
1292 {
1293 yychar = OCTAVE_TEX_EOF;
1294 yytoken = YYSYMBOL_YYEOF;
1295 YYDPRINTF ((stderr, "Now at end of input.\n"));
1296 }
1297 else if (yychar == OCTAVE_TEX_error)
1298 {
1299 /* The scanner already issued an error message, process directly
1300 to error recovery. But do not keep the error token as
1301 lookahead, it is too special and may lead us to an endless
1302 loop in error recovery. */
1303 yychar = OCTAVE_TEX_UNDEF;
1304 yytoken = YYSYMBOL_YYerror;
1305 goto yyerrlab1;
1306 }
1307 else
1308 {
1309 yytoken = YYTRANSLATE (yychar);
1310 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1311 }
1312
1313 /* If the proper action on seeing token YYTOKEN is to reduce or to
1314 detect an error, take that action. */
1315 yyn += yytoken;
1316 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1317 goto yydefault;
1318 yyn = yytable[yyn];
1319 if (yyn <= 0)
1320 {
1321 if (yytable_value_is_error (yyn))
1322 goto yyerrlab;
1323 yyn = -yyn;
1324 goto yyreduce;
1325 }
1326
1327 /* Count tokens shifted since error; after three, turn off error
1328 status. */
1329 if (yyerrstatus)
1330 yyerrstatus--;
1331
1332 /* Shift the lookahead token. */
1333 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1334 yystate = yyn;
1335 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1336 *++yyvsp = yylval;
1337 YY_IGNORE_MAYBE_UNINITIALIZED_END
1338
1339 /* Discard the shifted token. */
1340 yychar = OCTAVE_TEX_EMPTY;
1341 goto yynewstate;
1342
1343
1344 /*-----------------------------------------------------------.
1345 | yydefault -- do the default action for the current state. |
1346 `-----------------------------------------------------------*/
1347 yydefault:
1348 yyn = yydefact[yystate];
1349 if (yyn == 0)
1350 goto yyerrlab;
1351 goto yyreduce;
1352
1353
1354 /*-----------------------------.
1355 | yyreduce -- do a reduction. |
1356 `-----------------------------*/
1357 yyreduce:
1358 /* yyn is the number of a rule to reduce with. */
1359 yylen = yyr2[yyn];
1360
1361 /* If YYLEN is nonzero, implement the default value of the action:
1362 '$$ = $1'.
1363
1364 Otherwise, the following line sets YYVAL to garbage.
1365 This behavior is undocumented and Bison
1366 users should not rely upon it. Assigning to YYVAL
1367 unconditionally makes the parser a bit smaller, and it avoids a
1368 GCC warning that YYVAL may be used uninitialized. */
1369 yyval = yyvsp[1-yylen];
1370
1371
1372 YY_REDUCE_PRINT (yyn);
1373 switch (yyn)
1374 {
1375 case 2: /* simple_string: CH */
1376 #line 109 "../libinterp/corefcn/oct-tex-parser.yy"
1377 { (yyval.str) = new std::string (1, (yyvsp[0].ch)); }
1378 #line 1379 "libinterp/corefcn/oct-tex-parser.cc"
1379 break;
1380
1381 case 3: /* simple_string: simple_string CH */
1382 #line 111 "../libinterp/corefcn/oct-tex-parser.yy"
1383 { (yyvsp[-1].str)->append (1, (yyvsp[0].ch)); (yyval.str) = (yyvsp[-1].str); }
1384 #line 1385 "libinterp/corefcn/oct-tex-parser.cc"
1385 break;
1386
1387 case 4: /* symbol_element: SYM */
1388 #line 115 "../libinterp/corefcn/oct-tex-parser.yy"
1389 { (yyval.e_base) = new octave::text_element_symbol ((yyvsp[0].sym)); }
1390 #line 1391 "libinterp/corefcn/oct-tex-parser.cc"
1391 break;
1392
1393 case 5: /* font_modifier_element: BF */
1394 #line 119 "../libinterp/corefcn/oct-tex-parser.yy"
1395 { (yyval.e_base) = new octave::text_element_fontstyle (octave::text_element_fontstyle::bold); }
1396 #line 1397 "libinterp/corefcn/oct-tex-parser.cc"
1397 break;
1398
1399 case 6: /* font_modifier_element: IT */
1400 #line 121 "../libinterp/corefcn/oct-tex-parser.yy"
1401 { (yyval.e_base) = new octave::text_element_fontstyle (octave::text_element_fontstyle::italic); }
1402 #line 1403 "libinterp/corefcn/oct-tex-parser.cc"
1403 break;
1404
1405 case 7: /* font_modifier_element: SL */
1406 #line 123 "../libinterp/corefcn/oct-tex-parser.yy"
1407 { (yyval.e_base) = new octave::text_element_fontstyle (octave::text_element_fontstyle::oblique); }
1408 #line 1409 "libinterp/corefcn/oct-tex-parser.cc"
1409 break;
1410
1411 case 8: /* font_modifier_element: RM */
1412 #line 125 "../libinterp/corefcn/oct-tex-parser.yy"
1413 { (yyval.e_base) = new octave::text_element_fontstyle (octave::text_element_fontstyle::normal); }
1414 #line 1415 "libinterp/corefcn/oct-tex-parser.cc"
1415 break;
1416
1417 case 9: /* fontsize_element: FONTSIZE START NUM END */
1418 #line 129 "../libinterp/corefcn/oct-tex-parser.yy"
1419 { (yyval.e_base) = new octave::text_element_fontsize ((yyvsp[-1].num)); }
1420 #line 1421 "libinterp/corefcn/oct-tex-parser.cc"
1421 break;
1422
1423 case 10: /* fontname_element: FONTNAME START simple_string END */
1424 #line 133 "../libinterp/corefcn/oct-tex-parser.yy"
1425 {
1426 (yyval.e_base) = new octave::text_element_fontname (*(yyvsp[-1].str));
1427 delete (yyvsp[-1].str);
1428 }
1429 #line 1430 "libinterp/corefcn/oct-tex-parser.cc"
1430 break;
1431
1432 case 11: /* color_element: COLOR START simple_string END */
1433 #line 140 "../libinterp/corefcn/oct-tex-parser.yy"
1434 {
1435 (yyval.e_base) = new octave::text_element_color (*(yyvsp[-1].str));
1436 delete (yyvsp[-1].str);
1437 }
1438 #line 1439 "libinterp/corefcn/oct-tex-parser.cc"
1439 break;
1440
1441 case 12: /* color_element: COLOR_RGB START NUM NUM NUM END */
1442 #line 145 "../libinterp/corefcn/oct-tex-parser.yy"
1443 {
1444 (yyval.e_base) = new octave::text_element_color ((yyvsp[-3].num), (yyvsp[-2].num), (yyvsp[-1].num));
1445 }
1446 #line 1447 "libinterp/corefcn/oct-tex-parser.cc"
1447 break;
1448
1449 case 13: /* string_element: simple_string */
1450 #line 151 "../libinterp/corefcn/oct-tex-parser.yy"
1451 {
1452 (yyval.e_base) = new octave::text_element_string (*(yyvsp[0].str));
1453 delete (yyvsp[0].str);
1454 }
1455 #line 1456 "libinterp/corefcn/oct-tex-parser.cc"
1456 break;
1457
1458 case 14: /* string_element: scoped_string_element_list */
1459 #line 156 "../libinterp/corefcn/oct-tex-parser.yy"
1460 { (yyval.e_base) = (yyvsp[0].e_list); }
1461 #line 1462 "libinterp/corefcn/oct-tex-parser.cc"
1462 break;
1463
1464 case 23: /* superscript_element: SUPER CH */
1465 #line 168 "../libinterp/corefcn/oct-tex-parser.yy"
1466 { (yyval.e_base) = new octave::text_element_superscript ((yyvsp[0].ch)); }
1467 #line 1468 "libinterp/corefcn/oct-tex-parser.cc"
1468 break;
1469
1470 case 24: /* superscript_element: SUPER scoped_string_element_list */
1471 #line 170 "../libinterp/corefcn/oct-tex-parser.yy"
1472 { (yyval.e_base) = new octave::text_element_superscript ((yyvsp[0].e_list)); }
1473 #line 1474 "libinterp/corefcn/oct-tex-parser.cc"
1474 break;
1475
1476 case 25: /* superscript_element: SUPER symbol_element */
1477 #line 172 "../libinterp/corefcn/oct-tex-parser.yy"
1478 { (yyval.e_base) = new octave::text_element_superscript ((yyvsp[0].e_base)); }
1479 #line 1480 "libinterp/corefcn/oct-tex-parser.cc"
1480 break;
1481
1482 case 26: /* subscript_element: SUB CH */
1483 #line 176 "../libinterp/corefcn/oct-tex-parser.yy"
1484 { (yyval.e_base) = new octave::text_element_subscript ((yyvsp[0].ch)); }
1485 #line 1486 "libinterp/corefcn/oct-tex-parser.cc"
1486 break;
1487
1488 case 27: /* subscript_element: SUB scoped_string_element_list */
1489 #line 178 "../libinterp/corefcn/oct-tex-parser.yy"
1490 { (yyval.e_base) = new octave::text_element_subscript ((yyvsp[0].e_list)); }
1491 #line 1492 "libinterp/corefcn/oct-tex-parser.cc"
1492 break;
1493
1494 case 28: /* subscript_element: SUB symbol_element */
1495 #line 180 "../libinterp/corefcn/oct-tex-parser.yy"
1496 { (yyval.e_base) = new octave::text_element_subscript ((yyvsp[0].e_base)); }
1497 #line 1498 "libinterp/corefcn/oct-tex-parser.cc"
1498 break;
1499
1500 case 29: /* combined_script_element: subscript_element superscript_element */
1501 #line 184 "../libinterp/corefcn/oct-tex-parser.yy"
1502 { (yyval.e_base) = new octave::text_element_combined ((yyvsp[-1].e_base), (yyvsp[0].e_base)); }
1503 #line 1504 "libinterp/corefcn/oct-tex-parser.cc"
1504 break;
1505
1506 case 30: /* combined_script_element: superscript_element subscript_element */
1507 #line 186 "../libinterp/corefcn/oct-tex-parser.yy"
1508 { (yyval.e_base) = new octave::text_element_combined ((yyvsp[-1].e_base), (yyvsp[0].e_base)); }
1509 #line 1510 "libinterp/corefcn/oct-tex-parser.cc"
1510 break;
1511
1512 case 31: /* string_element_list: string_element */
1513 #line 190 "../libinterp/corefcn/oct-tex-parser.yy"
1514 { (yyval.e_list) = new octave::text_element_list ((yyvsp[0].e_base)); }
1515 #line 1516 "libinterp/corefcn/oct-tex-parser.cc"
1516 break;
1517
1518 case 32: /* string_element_list: string_element_list string_element */
1519 #line 192 "../libinterp/corefcn/oct-tex-parser.yy"
1520 { (yyvsp[-1].e_list)->push_back ((yyvsp[0].e_base)); (yyval.e_list) = (yyvsp[-1].e_list); }
1521 #line 1522 "libinterp/corefcn/oct-tex-parser.cc"
1522 break;
1523
1524 case 33: /* scoped_string_element_list: START string_element_list END */
1525 #line 197 "../libinterp/corefcn/oct-tex-parser.yy"
1526 { (yyval.e_list) = (yyvsp[-1].e_list); }
1527 #line 1528 "libinterp/corefcn/oct-tex-parser.cc"
1528 break;
1529
1530 case 34: /* scoped_string_element_list: START END */
1531 #line 199 "../libinterp/corefcn/oct-tex-parser.yy"
1532 { (yyval.e_list) = new octave::text_element_list (); }
1533 #line 1534 "libinterp/corefcn/oct-tex-parser.cc"
1534 break;
1535
1536 case 35: /* string: %empty */
1537 #line 203 "../libinterp/corefcn/oct-tex-parser.yy"
1538 { parser.set_parse_result (new octave::text_element_string ("")); }
1539 #line 1540 "libinterp/corefcn/oct-tex-parser.cc"
1540 break;
1541
1542 case 36: /* string: string_element_list */
1543 #line 205 "../libinterp/corefcn/oct-tex-parser.yy"
1544 { parser.set_parse_result ((yyvsp[0].e_list)); }
1545 #line 1546 "libinterp/corefcn/oct-tex-parser.cc"
1546 break;
1547
1548
1549 #line 1550 "libinterp/corefcn/oct-tex-parser.cc"
1550
1551 default: break;
1552 }
1553 /* User semantic actions sometimes alter yychar, and that requires
1554 that yytoken be updated with the new translation. We take the
1555 approach of translating immediately before every use of yytoken.
1556 One alternative is translating here after every semantic action,
1557 but that translation would be missed if the semantic action invokes
1558 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1559 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1560 incorrect destructor might then be invoked immediately. In the
1561 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1562 to an incorrect destructor call or verbose syntax error message
1563 before the lookahead is translated. */
1564 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1565
1566 YYPOPSTACK (yylen);
1567 yylen = 0;
1568
1569 *++yyvsp = yyval;
1570
1571 /* Now 'shift' the result of the reduction. Determine what state
1572 that goes to, based on the state we popped back to and the rule
1573 number reduced by. */
1574 {
1575 const int yylhs = yyr1[yyn] - YYNTOKENS;
1576 const int yyi = yypgoto[yylhs] + *yyssp;
1577 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1578 ? yytable[yyi]
1579 : yydefgoto[yylhs]);
1580 }
1581
1582 goto yynewstate;
1583
1584
1585 /*--------------------------------------.
1586 | yyerrlab -- here on detecting error. |
1587 `--------------------------------------*/
1588 yyerrlab:
1589 /* Make sure we have latest lookahead translation. See comments at
1590 user semantic actions for why this is necessary. */
1591 yytoken = yychar == OCTAVE_TEX_EMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1592 /* If not already recovering from an error, report this error. */
1593 if (!yyerrstatus)
1594 {
1595 ++yynerrs;
1596 yyerror (parser, YY_("syntax error"));
1597 }
1598
1599 if (yyerrstatus == 3)
1600 {
1601 /* If just tried and failed to reuse lookahead token after an
1602 error, discard it. */
1603
1604 if (yychar <= OCTAVE_TEX_EOF)
1605 {
1606 /* Return failure if at end of input. */
1607 if (yychar == OCTAVE_TEX_EOF)
1608 YYABORT;
1609 }
1610 else
1611 {
1612 yydestruct ("Error: discarding",
1613 yytoken, &yylval, parser);
1614 yychar = OCTAVE_TEX_EMPTY;
1615 }
1616 }
1617
1618 /* Else will try to reuse lookahead token after shifting the error
1619 token. */
1620 goto yyerrlab1;
1621
1622
1623 /*---------------------------------------------------.
1624 | yyerrorlab -- error raised explicitly by YYERROR. |
1625 `---------------------------------------------------*/
1626 yyerrorlab:
1627 /* Pacify compilers when the user code never invokes YYERROR and the
1628 label yyerrorlab therefore never appears in user code. */
1629 if (0)
1630 YYERROR;
1631
1632 /* Do not reclaim the symbols of the rule whose action triggered
1633 this YYERROR. */
1634 YYPOPSTACK (yylen);
1635 yylen = 0;
1636 YY_STACK_PRINT (yyss, yyssp);
1637 yystate = *yyssp;
1638 goto yyerrlab1;
1639
1640
1641 /*-------------------------------------------------------------.
1642 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1643 `-------------------------------------------------------------*/
1644 yyerrlab1:
1645 yyerrstatus = 3; /* Each real token shifted decrements this. */
1646
1647 /* Pop stack until we find a state that shifts the error token. */
1648 for (;;)
1649 {
1650 yyn = yypact[yystate];
1651 if (!yypact_value_is_default (yyn))
1652 {
1653 yyn += YYSYMBOL_YYerror;
1654 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1655 {
1656 yyn = yytable[yyn];
1657 if (0 < yyn)
1658 break;
1659 }
1660 }
1661
1662 /* Pop the current state because it cannot handle the error token. */
1663 if (yyssp == yyss)
1664 YYABORT;
1665
1666
1667 yydestruct ("Error: popping",
1668 YY_ACCESSING_SYMBOL (yystate), yyvsp, parser);
1669 YYPOPSTACK (1);
1670 yystate = *yyssp;
1671 YY_STACK_PRINT (yyss, yyssp);
1672 }
1673
1674 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1675 *++yyvsp = yylval;
1676 YY_IGNORE_MAYBE_UNINITIALIZED_END
1677
1678
1679 /* Shift the error token. */
1680 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1681
1682 yystate = yyn;
1683 goto yynewstate;
1684
1685
1686 /*-------------------------------------.
1687 | yyacceptlab -- YYACCEPT comes here. |
1688 `-------------------------------------*/
1689 yyacceptlab:
1690 yyresult = 0;
1691 goto yyreturn;
1692
1693
1694 /*-----------------------------------.
1695 | yyabortlab -- YYABORT comes here. |
1696 `-----------------------------------*/
1697 yyabortlab:
1698 yyresult = 1;
1699 goto yyreturn;
1700
1701
1702 #if !defined yyoverflow
1703 /*-------------------------------------------------.
1704 | yyexhaustedlab -- memory exhaustion comes here. |
1705 `-------------------------------------------------*/
1706 yyexhaustedlab:
1707 yyerror (parser, YY_("memory exhausted"));
1708 yyresult = 2;
1709 goto yyreturn;
1710 #endif
1711
1712
1713 /*-------------------------------------------------------.
1714 | yyreturn -- parsing is finished, clean up and return. |
1715 `-------------------------------------------------------*/
1716 yyreturn:
1717 if (yychar != OCTAVE_TEX_EMPTY)
1718 {
1719 /* Make sure we have latest lookahead translation. See comments at
1720 user semantic actions for why this is necessary. */
1721 yytoken = YYTRANSLATE (yychar);
1722 yydestruct ("Cleanup: discarding lookahead",
1723 yytoken, &yylval, parser);
1724 }
1725 /* Do not reclaim the symbols of the rule whose action triggered
1726 this YYABORT or YYACCEPT. */
1727 YYPOPSTACK (yylen);
1728 YY_STACK_PRINT (yyss, yyssp);
1729 while (yyssp != yyss)
1730 {
1731 yydestruct ("Cleanup: popping",
1732 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, parser);
1733 YYPOPSTACK (1);
1734 }
1735 #ifndef yyoverflow
1736 if (yyss != yyssa)
1737 YYSTACK_FREE (yyss);
1738 #endif
1739
1740 return yyresult;
1741 }
1742
1743 #line 208 "../libinterp/corefcn/oct-tex-parser.yy"
1744
1745
1746 #if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC)
1747 // Restore prevailing warning state for remainder of the file.
1748 # pragma GCC diagnostic pop
1749 #endif
1750
1751 namespace octave
1752 {
1753 text_element*
parse(const std::string & s)1754 text_parser_tex::parse (const std::string& s)
1755 {
1756 octave_tex_debug = 0;
1757
1758 if (init_lexer (s))
1759 {
1760 result = nullptr;
1761
1762 if (octave_tex_parse (*this) == 0)
1763 return result;
1764 }
1765
1766 return new text_element_string (s);
1767 }
1768 }
1769
1770 static void
yyerror(octave::text_parser_tex &,const char * s)1771 yyerror (octave::text_parser_tex&, const char *s)
1772 {
1773 fprintf (stderr, "TeX parse error: %s\n", s);
1774 }
1775