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