1 /* A Bison parser, made by GNU Bison 3.2. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
43 /* Undocumented macros, especially those whose name start with YY_,
44 are private implementation details. Do not rely on them. */
46 /* Identify Bison output. */
50 #define YYBISON_VERSION "3.2"
53 #define YYSKELETON_NAME "yacc.c"
67 /* First part of user prologue. */
68 #line 20 "../src/preproc/refer/label.ypp" /* yacc.c:338 */
77 void yyerror(const char *);
80 static const char *format_serial(char c, int n);
87 label_info(const string &);
90 label_info *lookup_label(const string &label);
94 // Does the tentative label depend on the reference?
95 CONTAINS_VARIABLE = 01,
100 virtual ~expression() { }
101 virtual void evaluate(int, const reference &, string &,
102 substring_position &) = 0;
103 virtual unsigned analyze() { return 0; }
106 class at_expr : public expression {
109 void evaluate(int, const reference &, string &, substring_position &);
110 unsigned analyze() { return CONTAINS_VARIABLE|CONTAINS_AT; }
113 class format_expr : public expression {
118 format_expr(char c, int w = 0, int f = 1)
119 : type(c), width(w), first_number(f) { }
120 void evaluate(int, const reference &, string &, substring_position &);
121 unsigned analyze() { return CONTAINS_FORMAT; }
124 class field_expr : public expression {
128 field_expr(char nm, int num) : number(num), name(nm) { }
129 void evaluate(int, const reference &, string &, substring_position &);
130 unsigned analyze() { return CONTAINS_VARIABLE; }
133 class literal_expr : public expression {
136 literal_expr(const char *ptr, int len) : s(ptr, len) { }
137 void evaluate(int, const reference &, string &, substring_position &);
140 class unary_expr : public expression {
144 unary_expr(expression *e) : expr(e) { }
145 ~unary_expr() { delete expr; }
146 void evaluate(int, const reference &, string &, substring_position &) = 0;
147 unsigned analyze() { return expr ? expr->analyze() : 0; }
150 // This caches the analysis of an expression.
152 class analyzed_expr : public unary_expr {
155 analyzed_expr(expression *);
156 void evaluate(int, const reference &, string &, substring_position &);
157 unsigned analyze() { return flags; }
160 class star_expr : public unary_expr {
162 star_expr(expression *e) : unary_expr(e) { }
163 void evaluate(int, const reference &, string &, substring_position &);
165 return ((expr ? (expr->analyze() & ~CONTAINS_VARIABLE) : 0)
170 typedef void map_func(const char *, const char *, string &);
172 class map_expr : public unary_expr {
175 map_expr(expression *e, map_func *f) : unary_expr(e), func(f) { }
176 void evaluate(int, const reference &, string &, substring_position &);
179 typedef const char *extractor_func(const char *, const char *, const char **);
181 class extractor_expr : public unary_expr {
183 extractor_func *func;
185 enum { BEFORE = +1, MATCH = 0, AFTER = -1 };
186 extractor_expr(expression *e, extractor_func *f, int pt)
187 : unary_expr(e), part(pt), func(f) { }
188 void evaluate(int, const reference &, string &, substring_position &);
191 class truncate_expr : public unary_expr {
194 truncate_expr(expression *e, int i) : unary_expr(e), n(i) { }
195 void evaluate(int, const reference &, string &, substring_position &);
198 class separator_expr : public unary_expr {
200 separator_expr(expression *e) : unary_expr(e) { }
201 void evaluate(int, const reference &, string &, substring_position &);
204 class binary_expr : public expression {
209 binary_expr(expression *e1, expression *e2) : expr1(e1), expr2(e2) { }
210 ~binary_expr() { delete expr1; delete expr2; }
211 void evaluate(int, const reference &, string &, substring_position &) = 0;
213 return (expr1 ? expr1->analyze() : 0) | (expr2 ? expr2->analyze() : 0);
217 class alternative_expr : public binary_expr {
219 alternative_expr(expression *e1, expression *e2) : binary_expr(e1, e2) { }
220 void evaluate(int, const reference &, string &, substring_position &);
223 class list_expr : public binary_expr {
225 list_expr(expression *e1, expression *e2) : binary_expr(e1, e2) { }
226 void evaluate(int, const reference &, string &, substring_position &);
229 class substitute_expr : public binary_expr {
231 substitute_expr(expression *e1, expression *e2) : binary_expr(e1, e2) { }
232 void evaluate(int, const reference &, string &, substring_position &);
235 class ternary_expr : public expression {
241 ternary_expr(expression *e1, expression *e2, expression *e3)
242 : expr1(e1), expr2(e2), expr3(e3) { }
243 ~ternary_expr() { delete expr1; delete expr2; delete expr3; }
244 void evaluate(int, const reference &, string &, substring_position &) = 0;
246 return ((expr1 ? expr1->analyze() : 0)
247 | (expr2 ? expr2->analyze() : 0)
248 | (expr3 ? expr3->analyze() : 0));
252 class conditional_expr : public ternary_expr {
254 conditional_expr(expression *e1, expression *e2, expression *e3)
255 : ternary_expr(e1, e2, e3) { }
256 void evaluate(int, const reference &, string &, substring_position &);
259 static expression *parsed_label = 0;
260 static expression *parsed_date_label = 0;
261 static expression *parsed_short_label = 0;
263 static expression *parse_result;
268 #line 269 "src/preproc/refer/label.cpp" /* yacc.c:338 */
270 # if defined __cplusplus
271 # if 201103L <= __cplusplus
272 # define YY_NULLPTR nullptr
274 # define YY_NULLPTR 0
277 # define YY_NULLPTR ((void*)0)
281 /* Enabling verbose error messages. */
282 #ifdef YYERROR_VERBOSE
283 # undef YYERROR_VERBOSE
284 # define YYERROR_VERBOSE 1
286 # define YYERROR_VERBOSE 0
289 /* In a future release of Bison, this section will be replaced
290 by #include "y.tab.h". */
291 #ifndef YY_YY_SRC_PREPROC_REFER_LABEL_HPP_INCLUDED
292 # define YY_YY_SRC_PREPROC_REFER_LABEL_HPP_INCLUDED
312 #define TOKEN_LETTER 258
313 #define TOKEN_LITERAL 259
314 #define TOKEN_DIGIT 260
317 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
321 #line 220 "../src/preproc/refer/label.ypp" /* yacc.c:353 */
325 struct { int ndigits; int val; } dig;
326 struct { int start; int len; } str;
328 #line 329 "src/preproc/refer/label.cpp" /* yacc.c:353 */
331 typedef union YYSTYPE YYSTYPE;
332 # define YYSTYPE_IS_TRIVIAL 1
333 # define YYSTYPE_IS_DECLARED 1
337 extern YYSTYPE yylval;
341 #endif /* !YY_YY_SRC_PREPROC_REFER_LABEL_HPP_INCLUDED */
350 typedef YYTYPE_UINT8 yytype_uint8;
352 typedef unsigned char yytype_uint8;
356 typedef YYTYPE_INT8 yytype_int8;
358 typedef signed char yytype_int8;
362 typedef YYTYPE_UINT16 yytype_uint16;
364 typedef unsigned short yytype_uint16;
368 typedef YYTYPE_INT16 yytype_int16;
370 typedef short yytype_int16;
374 # ifdef __SIZE_TYPE__
375 # define YYSIZE_T __SIZE_TYPE__
376 # elif defined size_t
377 # define YYSIZE_T size_t
378 # elif ! defined YYSIZE_T
379 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
380 # define YYSIZE_T size_t
382 # define YYSIZE_T unsigned
386 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
389 # if defined YYENABLE_NLS && YYENABLE_NLS
391 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
392 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
396 # define YY_(Msgid) Msgid
401 # if (defined __GNUC__ \
402 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
403 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
404 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
406 # define YY_ATTRIBUTE(Spec) /* empty */
410 #ifndef YY_ATTRIBUTE_PURE
411 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
414 #ifndef YY_ATTRIBUTE_UNUSED
415 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
418 /* Suppress unused-variable warnings by "using" E. */
419 #if ! defined lint || defined __GNUC__
420 # define YYUSE(E) ((void) (E))
422 # define YYUSE(E) /* empty */
425 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
426 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
427 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
428 _Pragma ("GCC diagnostic push") \
429 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
430 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
431 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
432 _Pragma ("GCC diagnostic pop")
434 # define YY_INITIAL_VALUE(Value) Value
436 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
437 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
438 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
440 #ifndef YY_INITIAL_VALUE
441 # define YY_INITIAL_VALUE(Value) /* Nothing. */
445 #if ! defined yyoverflow || YYERROR_VERBOSE
447 /* The parser invokes alloca or malloc; define the necessary symbols. */
449 # ifdef YYSTACK_USE_ALLOCA
450 # if YYSTACK_USE_ALLOCA
452 # define YYSTACK_ALLOC __builtin_alloca
453 # elif defined __BUILTIN_VA_ARG_INCR
454 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
456 # define YYSTACK_ALLOC __alloca
457 # elif defined _MSC_VER
458 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
459 # define alloca _alloca
461 # define YYSTACK_ALLOC alloca
462 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
463 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
464 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
465 # ifndef EXIT_SUCCESS
466 # define EXIT_SUCCESS 0
473 # ifdef YYSTACK_ALLOC
474 /* Pacify GCC's 'empty if-body' warning. */
475 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
476 # ifndef YYSTACK_ALLOC_MAXIMUM
477 /* The OS might guarantee only one guard page at the bottom of the stack,
478 and a page size can be as small as 4096 bytes. So we cannot safely
479 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
480 to allow for a few compiler-allocated temporary stack slots. */
481 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
484 # define YYSTACK_ALLOC YYMALLOC
485 # define YYSTACK_FREE YYFREE
486 # ifndef YYSTACK_ALLOC_MAXIMUM
487 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
489 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
490 && ! ((defined YYMALLOC || defined malloc) \
491 && (defined YYFREE || defined free)))
492 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
493 # ifndef EXIT_SUCCESS
494 # define EXIT_SUCCESS 0
498 # define YYMALLOC malloc
499 # if ! defined malloc && ! defined EXIT_SUCCESS
500 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
505 # if ! defined free && ! defined EXIT_SUCCESS
506 void free (void *); /* INFRINGES ON USER NAME SPACE */
510 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
513 #if (! defined yyoverflow \
514 && (! defined __cplusplus \
515 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
517 /* A type that is properly aligned for any stack member. */
520 yytype_int16 yyss_alloc;
524 /* The size of the maximum gap between one aligned stack and the next. */
525 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
527 /* The size of an array large to enough to hold all stacks, each with
529 # define YYSTACK_BYTES(N) \
530 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
531 + YYSTACK_GAP_MAXIMUM)
533 # define YYCOPY_NEEDED 1
535 /* Relocate STACK from its old location to the new one. The
536 local variables YYSIZE and YYSTACKSIZE give the old and new number of
537 elements in the stack, and YYPTR gives the new location of the
538 stack. Advance YYPTR to a properly aligned location for the next
540 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
543 YYSIZE_T yynewbytes; \
544 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
545 Stack = &yyptr->Stack_alloc; \
546 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
547 yyptr += yynewbytes / sizeof (*yyptr); \
553 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
554 /* Copy COUNT objects from SRC to DST. The source and destination do
557 # if defined __GNUC__ && 1 < __GNUC__
558 # define YYCOPY(Dst, Src, Count) \
559 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
561 # define YYCOPY(Dst, Src, Count) \
565 for (yyi = 0; yyi < (Count); yyi++) \
566 (Dst)[yyi] = (Src)[yyi]; \
571 #endif /* !YYCOPY_NEEDED */
573 /* YYFINAL -- State number of the termination state. */
575 /* YYLAST -- Last index in YYTABLE. */
578 /* YYNTOKENS -- Number of terminals. */
580 /* YYNNTS -- Number of nonterminals. */
582 /* YYNRULES -- Number of rules. */
584 /* YYNSTATES -- Number of states. */
587 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
588 by yylex, with out-of-bounds checking. */
590 #define YYMAXUTOK 260
592 #define YYTRANSLATE(YYX) \
593 ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
595 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
596 as returned by yylex, without out-of-bounds checking. */
597 static const yytype_uint8 yytranslate[] =
599 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
600 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
601 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
602 2, 2, 2, 2, 2, 2, 2, 12, 9, 2,
603 17, 18, 16, 14, 2, 15, 13, 2, 2, 2,
604 2, 2, 2, 2, 2, 2, 2, 2, 7, 2,
605 19, 2, 20, 6, 11, 2, 2, 2, 2, 2,
606 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
607 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
608 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
609 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
610 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
611 2, 2, 2, 2, 8, 2, 10, 2, 2, 2,
612 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
613 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
614 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
615 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
616 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
617 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
618 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
619 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
620 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
621 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
622 2, 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, 1, 2, 3, 4,
629 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
630 static const yytype_uint16 yyrline[] =
632 0, 248, 248, 253, 255, 261, 262, 267, 269, 271,
633 276, 278, 283, 285, 290, 292, 297, 299, 301, 317,
634 321, 352, 354, 356, 358, 360, 366, 367, 372, 374,
635 379, 381, 388, 389, 391
639 #if YYDEBUG || YYERROR_VERBOSE || 0
640 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
641 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
642 static const char *const yytname[] =
644 "$end", "error", "$undefined", "TOKEN_LETTER", "TOKEN_LITERAL",
645 "TOKEN_DIGIT", "'?'", "':'", "'|'", "'&'", "'~'", "'@'", "'%'", "'.'",
646 "'+'", "'-'", "'*'", "'('", "')'", "'<'", "'>'", "$accept", "expr",
647 "conditional", "optional_conditional", "alternative", "list",
648 "substitute", "string", "optional_number", "number", "digits", "flag", YY_NULLPTR
653 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
654 (internal) symbol number NUM (which must be that of a token). */
655 static const yytype_uint16 yytoknum[] =
657 0, 256, 257, 258, 259, 260, 63, 58, 124, 38,
658 126, 64, 37, 46, 43, 45, 42, 40, 41, 60,
663 #define YYPACT_NINF -26
665 #define yypact_value_is_default(Yystate) \
666 (!!((Yystate) == (-26)))
668 #define YYTABLE_NINF -1
670 #define yytable_value_is_error(Yytable_value) \
673 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
675 static const yytype_int8 yypact[] =
677 2, 11, -26, -26, 12, 2, 2, 24, -26, -26,
678 21, 2, 18, -6, -26, 26, -26, -26, 27, 15,
679 14, -26, 2, 2, 2, 18, 2, -3, 11, 11,
680 -26, -26, -26, -26, -26, 28, 2, 2, -6, -26,
681 -26, 33, 26, 26, 2, 11, -26, -26, 26
684 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
685 Performed when YYTABLE does not specify something else to do. Zero
686 means the default is an error. */
687 static const yytype_uint8 yydefact[] =
689 5, 16, 15, 14, 0, 5, 5, 0, 6, 2,
690 3, 7, 10, 12, 28, 17, 18, 30, 19, 0,
691 0, 1, 5, 0, 0, 11, 0, 32, 0, 0,
692 23, 29, 31, 24, 25, 0, 8, 9, 13, 33,
693 34, 0, 21, 22, 0, 26, 4, 20, 27
696 /* YYPGOTO[NTERM-NUM]. */
697 static const yytype_int8 yypgoto[] =
699 -26, -26, -7, -4, -26, -1, -11, 13, -26, -25,
703 /* YYDEFGOTO[NTERM-NUM]. */
704 static const yytype_int8 yydefgoto[] =
706 -1, 7, 8, 9, 10, 11, 12, 13, 47, 15,
710 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
711 positive, shift that token. If negative, reduce the rule whose
712 number is the opposite. If YYTABLE_NINF, syntax error. */
713 static const yytype_uint8 yytable[] =
715 25, 19, 20, 42, 43, 1, 2, 27, 28, 29,
716 30, 39, 40, 3, 4, 16, 14, 17, 35, 5,
717 48, 6, 36, 37, 21, 25, 25, 22, 26, 23,
718 24, 31, 32, 33, 34, 44, 45, 46, 0, 38
721 static const yytype_int8 yycheck[] =
723 11, 5, 6, 28, 29, 3, 4, 13, 14, 15,
724 16, 14, 15, 11, 12, 3, 5, 5, 22, 17,
725 45, 19, 23, 24, 0, 36, 37, 6, 10, 8,
726 9, 5, 5, 18, 20, 7, 3, 44, -1, 26
729 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
730 symbol of state STATE-NUM. */
731 static const yytype_uint8 yystos[] =
733 0, 3, 4, 11, 12, 17, 19, 22, 23, 24,
734 25, 26, 27, 28, 5, 30, 3, 5, 31, 24,
735 24, 0, 6, 8, 9, 27, 10, 13, 14, 15,
736 16, 5, 5, 18, 20, 24, 26, 26, 28, 14,
737 15, 32, 30, 30, 7, 3, 23, 29, 30
740 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
741 static const yytype_uint8 yyr1[] =
743 0, 21, 22, 23, 23, 24, 24, 25, 25, 25,
744 26, 26, 27, 27, 28, 28, 28, 28, 28, 28,
745 28, 28, 28, 28, 28, 28, 29, 29, 30, 30,
749 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
750 static const yytype_uint8 yyr2[] =
752 0, 2, 1, 1, 5, 0, 1, 1, 3, 3,
753 1, 2, 1, 3, 1, 1, 1, 2, 2, 2,
754 5, 3, 3, 2, 3, 3, 0, 1, 1, 2,
759 #define yyerrok (yyerrstatus = 0)
760 #define yyclearin (yychar = YYEMPTY)
764 #define YYACCEPT goto yyacceptlab
765 #define YYABORT goto yyabortlab
766 #define YYERROR goto yyerrorlab
769 #define YYRECOVERING() (!!yyerrstatus)
771 #define YYBACKUP(Token, Value) \
773 if (yychar == YYEMPTY) \
777 YYPOPSTACK (yylen); \
783 yyerror (YY_("syntax error: cannot back up")); \
788 /* Error token number */
790 #define YYERRCODE 256
794 /* Enable debugging if requested. */
798 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
799 # define YYFPRINTF fprintf
802 # define YYDPRINTF(Args) \
808 /* This macro is provided for backward compatibility. */
809 #ifndef YY_LOCATION_PRINT
810 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
814 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
818 YYFPRINTF (stderr, "%s ", Title); \
819 yy_symbol_print (stderr, \
821 YYFPRINTF (stderr, "\n"); \
826 /*-----------------------------------.
827 | Print this symbol's value on YYO. |
828 `-----------------------------------*/
831 yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
833 FILE *yyoutput = yyo;
838 if (yytype < YYNTOKENS)
839 YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
845 /*---------------------------.
846 | Print this symbol on YYO. |
847 `---------------------------*/
850 yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
852 YYFPRINTF (yyo, "%s %s (",
853 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
855 yy_symbol_value_print (yyo, yytype, yyvaluep);
856 YYFPRINTF (yyo, ")");
859 /*------------------------------------------------------------------.
860 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
862 `------------------------------------------------------------------*/
865 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
867 YYFPRINTF (stderr, "Stack now");
868 for (; yybottom <= yytop; yybottom++)
870 int yybot = *yybottom;
871 YYFPRINTF (stderr, " %d", yybot);
873 YYFPRINTF (stderr, "\n");
876 # define YY_STACK_PRINT(Bottom, Top) \
879 yy_stack_print ((Bottom), (Top)); \
883 /*------------------------------------------------.
884 | Report that the YYRULE is going to be reduced. |
885 `------------------------------------------------*/
888 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
890 unsigned long yylno = yyrline[yyrule];
891 int yynrhs = yyr2[yyrule];
893 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
895 /* The symbols being reduced. */
896 for (yyi = 0; yyi < yynrhs; yyi++)
898 YYFPRINTF (stderr, " $%d = ", yyi + 1);
899 yy_symbol_print (stderr,
900 yystos[yyssp[yyi + 1 - yynrhs]],
901 &(yyvsp[(yyi + 1) - (yynrhs)])
903 YYFPRINTF (stderr, "\n");
907 # define YY_REDUCE_PRINT(Rule) \
910 yy_reduce_print (yyssp, yyvsp, Rule); \
913 /* Nonzero means print parse trace. It is left uninitialized so that
914 multiple parsers can coexist. */
917 # define YYDPRINTF(Args)
918 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
919 # define YY_STACK_PRINT(Bottom, Top)
920 # define YY_REDUCE_PRINT(Rule)
921 #endif /* !YYDEBUG */
924 /* YYINITDEPTH -- initial size of the parser's stacks. */
926 # define YYINITDEPTH 200
929 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
930 if the built-in stack extension method is used).
932 Do not make this value too large; the results are undefined if
933 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
934 evaluated with infinite-precision integer arithmetic. */
937 # define YYMAXDEPTH 10000
944 # if defined __GLIBC__ && defined _STRING_H
945 # define yystrlen strlen
947 /* Return the length of YYSTR. */
949 yystrlen (const char *yystr)
952 for (yylen = 0; yystr[yylen]; yylen++)
960 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
961 # define yystpcpy stpcpy
963 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
966 yystpcpy (char *yydest, const char *yysrc)
969 const char *yys = yysrc;
971 while ((*yyd++ = *yys++) != '\0')
980 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
981 quotes and backslashes, so that it's suitable for yyerror. The
982 heuristic is that double-quoting is unnecessary unless the string
983 contains an apostrophe, a comma, or backslash (other than
984 backslash-backslash). YYSTR is taken from yytname. If YYRES is
985 null, do not copy; instead, return the length of what the result
988 yytnamerr (char *yyres, const char *yystr)
993 char const *yyp = yystr;
1000 goto do_not_strip_quotes;
1004 goto do_not_strip_quotes;
1017 do_not_strip_quotes: ;
1021 return yystrlen (yystr);
1023 return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
1027 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1028 about the unexpected token YYTOKEN for the state stack whose top is
1031 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1032 not large enough to hold the message. In that case, also set
1033 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1034 required number of bytes is too large to store. */
1036 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
1037 yytype_int16 *yyssp, int yytoken)
1039 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1040 YYSIZE_T yysize = yysize0;
1041 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1042 /* Internationalized format string. */
1043 const char *yyformat = YY_NULLPTR;
1044 /* Arguments of yyformat. */
1045 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1046 /* Number of reported tokens (one for the "unexpected", one per
1050 /* There are many possibilities here to consider:
1051 - If this state is a consistent state with a default action, then
1052 the only way this function was invoked is if the default action
1053 is an error action. In that case, don't check for expected
1054 tokens because there are none.
1055 - The only way there can be no lookahead present (in yychar) is if
1056 this state is a consistent state with a default action. Thus,
1057 detecting the absence of a lookahead is sufficient to determine
1058 that there is no unexpected or expected token to report. In that
1059 case, just report a simple "syntax error".
1060 - Don't assume there isn't a lookahead just because this state is a
1061 consistent state with a default action. There might have been a
1062 previous inconsistent state, consistent state with a non-default
1063 action, or user semantic action that manipulated yychar.
1064 - Of course, the expected token list depends on states to have
1065 correct lookahead information, and it depends on the parser not
1066 to perform extra reductions after fetching a lookahead from the
1067 scanner and before detecting a syntax error. Thus, state merging
1068 (from LALR or IELR) and default reductions corrupt the expected
1069 token list. However, the list is correct for canonical LR with
1070 one exception: it will still contain any token that will not be
1071 accepted due to an error action in a later state.
1073 if (yytoken != YYEMPTY)
1075 int yyn = yypact[*yyssp];
1076 yyarg[yycount++] = yytname[yytoken];
1077 if (!yypact_value_is_default (yyn))
1079 /* Start YYX at -YYN if negative to avoid negative indexes in
1080 YYCHECK. In other words, skip the first -YYN actions for
1081 this state because they are default actions. */
1082 int yyxbegin = yyn < 0 ? -yyn : 0;
1083 /* Stay within bounds of both yycheck and yytname. */
1084 int yychecklim = YYLAST - yyn + 1;
1085 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1088 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1089 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1090 && !yytable_value_is_error (yytable[yyx + yyn]))
1092 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1098 yyarg[yycount++] = yytname[yyx];
1100 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1101 if (! (yysize <= yysize1
1102 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1112 # define YYCASE_(N, S) \
1116 default: /* Avoid compiler warnings. */
1117 YYCASE_(0, YY_("syntax error"));
1118 YYCASE_(1, YY_("syntax error, unexpected %s"));
1119 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1120 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1121 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1122 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1127 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1128 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1133 if (*yymsg_alloc < yysize)
1135 *yymsg_alloc = 2 * yysize;
1136 if (! (yysize <= *yymsg_alloc
1137 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1138 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1142 /* Avoid sprintf, as that infringes on the user's name space.
1143 Don't have undefined behavior even if the translation
1144 produced a string with the wrong number of "%s"s. */
1148 while ((*yyp = *yyformat) != '\0')
1149 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1151 yyp += yytnamerr (yyp, yyarg[yyi++]);
1162 #endif /* YYERROR_VERBOSE */
1164 /*-----------------------------------------------.
1165 | Release the memory associated to this symbol. |
1166 `-----------------------------------------------*/
1169 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1174 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1176 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1178 YY_IGNORE_MAYBE_UNINITIALIZED_END
1184 /* The lookahead symbol. */
1187 /* The semantic value of the lookahead symbol. */
1189 /* Number of syntax errors so far. */
1201 /* Number of tokens to shift before error messages enabled. */
1204 /* The stacks and their tools:
1205 'yyss': related to states.
1206 'yyvs': related to semantic values.
1208 Refer to the stacks through separate pointers, to allow yyoverflow
1209 to reallocate them elsewhere. */
1211 /* The state stack. */
1212 yytype_int16 yyssa[YYINITDEPTH];
1214 yytype_int16 *yyssp;
1216 /* The semantic value stack. */
1217 YYSTYPE yyvsa[YYINITDEPTH];
1221 YYSIZE_T yystacksize;
1225 /* Lookahead token as an internal (translated) token number. */
1227 /* The variables used to return semantic value and location from the
1232 /* Buffer for error messages, and its allocated size. */
1234 char *yymsg = yymsgbuf;
1235 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1238 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1240 /* The number of symbols on the RHS of the reduced rule.
1241 Keep to zero when no symbol should be popped. */
1244 yyssp = yyss = yyssa;
1245 yyvsp = yyvs = yyvsa;
1246 yystacksize = YYINITDEPTH;
1248 YYDPRINTF ((stderr, "Starting parse\n"));
1253 yychar = YYEMPTY; /* Cause a token to be read. */
1256 /*------------------------------------------------------------.
1257 | yynewstate -- Push a new state, which is found in yystate. |
1258 `------------------------------------------------------------*/
1260 /* In all cases, when you get here, the value and location stacks
1261 have just been pushed. So pushing a state here evens the stacks. */
1265 *yyssp = (yytype_int16) yystate;
1267 if (yyss + yystacksize - 1 <= yyssp)
1269 /* Get the current used size of the three stacks, in elements. */
1270 YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
1274 /* Give user a chance to reallocate the stack. Use copies of
1275 these so that the &'s don't force the real ones into
1277 YYSTYPE *yyvs1 = yyvs;
1278 yytype_int16 *yyss1 = yyss;
1280 /* Each stack pointer address is followed by the size of the
1281 data in use in that stack, in bytes. This used to be a
1282 conditional around just the two extra args, but that might
1283 be undefined if yyoverflow is a macro. */
1284 yyoverflow (YY_("memory exhausted"),
1285 &yyss1, yysize * sizeof (*yyssp),
1286 &yyvs1, yysize * sizeof (*yyvsp),
1291 #else /* no yyoverflow */
1292 # ifndef YYSTACK_RELOCATE
1293 goto yyexhaustedlab;
1295 /* Extend the stack our own way. */
1296 if (YYMAXDEPTH <= yystacksize)
1297 goto yyexhaustedlab;
1299 if (YYMAXDEPTH < yystacksize)
1300 yystacksize = YYMAXDEPTH;
1303 yytype_int16 *yyss1 = yyss;
1304 union yyalloc *yyptr =
1305 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1307 goto yyexhaustedlab;
1308 YYSTACK_RELOCATE (yyss_alloc, yyss);
1309 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1310 # undef YYSTACK_RELOCATE
1312 YYSTACK_FREE (yyss1);
1315 #endif /* no yyoverflow */
1317 yyssp = yyss + yysize - 1;
1318 yyvsp = yyvs + yysize - 1;
1320 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1321 (unsigned long) yystacksize));
1323 if (yyss + yystacksize - 1 <= yyssp)
1327 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1329 if (yystate == YYFINAL)
1339 /* Do appropriate processing given the current state. Read a
1340 lookahead token if we need one and don't already have one. */
1342 /* First try to decide what to do without reference to lookahead token. */
1343 yyn = yypact[yystate];
1344 if (yypact_value_is_default (yyn))
1347 /* Not known => get a lookahead token if don't already have one. */
1349 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1350 if (yychar == YYEMPTY)
1352 YYDPRINTF ((stderr, "Reading a token: "));
1356 if (yychar <= YYEOF)
1358 yychar = yytoken = YYEOF;
1359 YYDPRINTF ((stderr, "Now at end of input.\n"));
1363 yytoken = YYTRANSLATE (yychar);
1364 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1367 /* If the proper action on seeing token YYTOKEN is to reduce or to
1368 detect an error, take that action. */
1370 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1375 if (yytable_value_is_error (yyn))
1381 /* Count tokens shifted since error; after three, turn off error
1386 /* Shift the lookahead token. */
1387 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1389 /* Discard the shifted token. */
1393 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1395 YY_IGNORE_MAYBE_UNINITIALIZED_END
1400 /*-----------------------------------------------------------.
1401 | yydefault -- do the default action for the current state. |
1402 `-----------------------------------------------------------*/
1404 yyn = yydefact[yystate];
1410 /*-----------------------------.
1411 | yyreduce -- Do a reduction. |
1412 `-----------------------------*/
1414 /* yyn is the number of a rule to reduce with. */
1417 /* If YYLEN is nonzero, implement the default value of the action:
1420 Otherwise, the following line sets YYVAL to garbage.
1421 This behavior is undocumented and Bison
1422 users should not rely upon it. Assigning to YYVAL
1423 unconditionally makes the parser a bit smaller, and it avoids a
1424 GCC warning that YYVAL may be used uninitialized. */
1425 yyval = yyvsp[1-yylen];
1428 YY_REDUCE_PRINT (yyn);
1432 #line 249 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1433 { parse_result = ((yyvsp[0].expr) ? new analyzed_expr((yyvsp[0].expr)) : 0); }
1434 #line 1435 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1438 #line 254 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1439 { (yyval.expr) = (yyvsp[0].expr); }
1440 #line 1441 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1444 #line 256 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1445 { (yyval.expr) = new conditional_expr((yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); }
1446 #line 1447 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1450 #line 261 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1451 { (yyval.expr) = 0; }
1452 #line 1453 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1456 #line 263 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1457 { (yyval.expr) = (yyvsp[0].expr); }
1458 #line 1459 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1462 #line 268 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1463 { (yyval.expr) = (yyvsp[0].expr); }
1464 #line 1465 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1468 #line 270 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1469 { (yyval.expr) = new alternative_expr((yyvsp[-2].expr), (yyvsp[0].expr)); }
1470 #line 1471 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1474 #line 272 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1475 { (yyval.expr) = new conditional_expr((yyvsp[-2].expr), (yyvsp[0].expr), 0); }
1476 #line 1477 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1480 #line 277 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1481 { (yyval.expr) = (yyvsp[0].expr); }
1482 #line 1483 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1486 #line 279 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1487 { (yyval.expr) = new list_expr((yyvsp[-1].expr), (yyvsp[0].expr)); }
1488 #line 1489 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1492 #line 284 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1493 { (yyval.expr) = (yyvsp[0].expr); }
1494 #line 1495 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1498 #line 286 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1499 { (yyval.expr) = new substitute_expr((yyvsp[-2].expr), (yyvsp[0].expr)); }
1500 #line 1501 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1504 #line 291 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1505 { (yyval.expr) = new at_expr; }
1506 #line 1507 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1510 #line 293 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1512 (yyval.expr) = new literal_expr(literals.contents() + (yyvsp[0].str).start,
1513 (yyvsp[0].str).len);
1515 #line 1516 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1519 #line 298 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1520 { (yyval.expr) = new field_expr((yyvsp[0].num), 0); }
1521 #line 1522 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1525 #line 300 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1526 { (yyval.expr) = new field_expr((yyvsp[-1].num), (yyvsp[0].num) - 1); }
1527 #line 1528 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1531 #line 302 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1533 switch ((yyvsp[0].num)) {
1538 (yyval.expr) = new format_expr((yyvsp[0].num));
1541 command_error("unrecognized format '%1'", char((yyvsp[0].num)));
1542 (yyval.expr) = new format_expr('a');
1546 #line 1547 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1550 #line 318 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1552 (yyval.expr) = new format_expr('0', (yyvsp[0].dig).ndigits, (yyvsp[0].dig).val);
1554 #line 1555 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1558 #line 322 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1560 switch ((yyvsp[-1].num)) {
1562 (yyval.expr) = new map_expr((yyvsp[-4].expr), lowercase);
1565 (yyval.expr) = new map_expr((yyvsp[-4].expr), uppercase);
1568 (yyval.expr) = new map_expr((yyvsp[-4].expr), capitalize);
1571 (yyval.expr) = new map_expr((yyvsp[-4].expr), reverse_name);
1574 (yyval.expr) = new map_expr((yyvsp[-4].expr), abbreviate_name);
1577 (yyval.expr) = new extractor_expr((yyvsp[-4].expr), find_year, (yyvsp[-2].num));
1580 (yyval.expr) = new extractor_expr((yyvsp[-4].expr), find_last_name, (yyvsp[-2].num));
1583 (yyval.expr) = (yyvsp[-4].expr);
1584 command_error("unknown function '%1'", char((yyvsp[-1].num)));
1588 #line 1589 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1592 #line 353 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1593 { (yyval.expr) = new truncate_expr((yyvsp[-2].expr), (yyvsp[0].num)); }
1594 #line 1595 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1598 #line 355 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1599 { (yyval.expr) = new truncate_expr((yyvsp[-2].expr), -(yyvsp[0].num)); }
1600 #line 1601 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1604 #line 357 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1605 { (yyval.expr) = new star_expr((yyvsp[-1].expr)); }
1606 #line 1607 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1610 #line 359 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1611 { (yyval.expr) = (yyvsp[-1].expr); }
1612 #line 1613 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1616 #line 361 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1617 { (yyval.expr) = new separator_expr((yyvsp[-1].expr)); }
1618 #line 1619 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1622 #line 366 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1623 { (yyval.num) = -1; }
1624 #line 1625 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1628 #line 368 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1629 { (yyval.num) = (yyvsp[0].num); }
1630 #line 1631 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1634 #line 373 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1635 { (yyval.num) = (yyvsp[0].num); }
1636 #line 1637 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1640 #line 375 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1641 { (yyval.num) = (yyvsp[-1].num)*10 + (yyvsp[0].num); }
1642 #line 1643 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1646 #line 380 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1647 { (yyval.dig).ndigits = 1; (yyval.dig).val = (yyvsp[0].num); }
1648 #line 1649 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1652 #line 382 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1653 { (yyval.dig).ndigits = (yyvsp[-1].dig).ndigits + 1; (yyval.dig).val = (yyvsp[-1].dig).val*10 + (yyvsp[0].num); }
1654 #line 1655 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1658 #line 388 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1659 { (yyval.num) = 0; }
1660 #line 1661 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1664 #line 390 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1665 { (yyval.num) = 1; }
1666 #line 1667 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1670 #line 392 "../src/preproc/refer/label.ypp" /* yacc.c:1645 */
1671 { (yyval.num) = -1; }
1672 #line 1673 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1676 #line 1677 "src/preproc/refer/label.cpp" /* yacc.c:1645 */
1679 /* User semantic actions sometimes alter yychar, and that requires
1680 that yytoken be updated with the new translation. We take the
1681 approach of translating immediately before every use of yytoken.
1682 One alternative is translating here after every semantic action,
1683 but that translation would be missed if the semantic action invokes
1684 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1685 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1686 incorrect destructor might then be invoked immediately. In the
1687 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1688 to an incorrect destructor call or verbose syntax error message
1689 before the lookahead is translated. */
1690 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1694 YY_STACK_PRINT (yyss, yyssp);
1698 /* Now 'shift' the result of the reduction. Determine what state
1699 that goes to, based on the state we popped back to and the rule
1700 number reduced by. */
1702 const int yylhs = yyr1[yyn] - YYNTOKENS;
1703 const int yyi = yypgoto[yylhs] + *yyssp;
1704 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1706 : yydefgoto[yylhs]);
1712 /*--------------------------------------.
1713 | yyerrlab -- here on detecting error. |
1714 `--------------------------------------*/
1716 /* Make sure we have latest lookahead translation. See comments at
1717 user semantic actions for why this is necessary. */
1718 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1720 /* If not already recovering from an error, report this error. */
1724 #if ! YYERROR_VERBOSE
1725 yyerror (YY_("syntax error"));
1727 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1730 char const *yymsgp = YY_("syntax error");
1731 int yysyntax_error_status;
1732 yysyntax_error_status = YYSYNTAX_ERROR;
1733 if (yysyntax_error_status == 0)
1735 else if (yysyntax_error_status == 1)
1737 if (yymsg != yymsgbuf)
1738 YYSTACK_FREE (yymsg);
1739 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1743 yymsg_alloc = sizeof yymsgbuf;
1744 yysyntax_error_status = 2;
1748 yysyntax_error_status = YYSYNTAX_ERROR;
1753 if (yysyntax_error_status == 2)
1754 goto yyexhaustedlab;
1756 # undef YYSYNTAX_ERROR
1762 if (yyerrstatus == 3)
1764 /* If just tried and failed to reuse lookahead token after an
1765 error, discard it. */
1767 if (yychar <= YYEOF)
1769 /* Return failure if at end of input. */
1770 if (yychar == YYEOF)
1775 yydestruct ("Error: discarding",
1781 /* Else will try to reuse lookahead token after shifting the error
1786 /*---------------------------------------------------.
1787 | yyerrorlab -- error raised explicitly by YYERROR. |
1788 `---------------------------------------------------*/
1791 /* Pacify compilers like GCC when the user code never invokes
1792 YYERROR and the label yyerrorlab therefore never appears in user
1794 if (/*CONSTCOND*/ 0)
1797 /* Do not reclaim the symbols of the rule whose action triggered
1801 YY_STACK_PRINT (yyss, yyssp);
1806 /*-------------------------------------------------------------.
1807 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1808 `-------------------------------------------------------------*/
1810 yyerrstatus = 3; /* Each real token shifted decrements this. */
1814 yyn = yypact[yystate];
1815 if (!yypact_value_is_default (yyn))
1818 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1826 /* Pop the current state because it cannot handle the error token. */
1831 yydestruct ("Error: popping",
1832 yystos[yystate], yyvsp);
1835 YY_STACK_PRINT (yyss, yyssp);
1838 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1840 YY_IGNORE_MAYBE_UNINITIALIZED_END
1843 /* Shift the error token. */
1844 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1850 /*-------------------------------------.
1851 | yyacceptlab -- YYACCEPT comes here. |
1852 `-------------------------------------*/
1857 /*-----------------------------------.
1858 | yyabortlab -- YYABORT comes here. |
1859 `-----------------------------------*/
1864 #if !defined yyoverflow || YYERROR_VERBOSE
1865 /*-------------------------------------------------.
1866 | yyexhaustedlab -- memory exhaustion comes here. |
1867 `-------------------------------------------------*/
1869 yyerror (YY_("memory exhausted"));
1875 if (yychar != YYEMPTY)
1877 /* Make sure we have latest lookahead translation. See comments at
1878 user semantic actions for why this is necessary. */
1879 yytoken = YYTRANSLATE (yychar);
1880 yydestruct ("Cleanup: discarding lookahead",
1883 /* Do not reclaim the symbols of the rule whose action triggered
1884 this YYABORT or YYACCEPT. */
1886 YY_STACK_PRINT (yyss, yyssp);
1887 while (yyssp != yyss)
1889 yydestruct ("Cleanup: popping",
1890 yystos[*yyssp], yyvsp);
1895 YYSTACK_FREE (yyss);
1898 if (yymsg != yymsgbuf)
1899 YYSTACK_FREE (yymsg);
1903 #line 395 "../src/preproc/refer/label.ypp" /* yacc.c:1903 */
1906 /* bison defines const to be empty unless __STDC__ is defined, which it
1907 isn't under cfront */
1913 const char *spec_ptr;
1914 const char *spec_end;
1915 const char *spec_cur;
1917 static char uppercase_array[] = {
1918 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
1919 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
1920 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
1924 static char lowercase_array[] = {
1925 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
1926 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
1927 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
1933 while (spec_ptr < spec_end && csspace(*spec_ptr))
1935 spec_cur = spec_ptr;
1936 if (spec_ptr >= spec_end)
1938 unsigned char c = *spec_ptr++;
1941 return TOKEN_LETTER;
1944 yylval.num = c - '0';
1948 yylval.str.start = literals.length();
1949 for (; spec_ptr < spec_end; spec_ptr++) {
1950 if (*spec_ptr == '\'') {
1951 if (++spec_ptr < spec_end && *spec_ptr == '\'')
1954 yylval.str.len = literals.length() - yylval.str.start;
1955 return TOKEN_LITERAL;
1959 literals += *spec_ptr;
1961 yylval.str.len = literals.length() - yylval.str.start;
1962 return TOKEN_LITERAL;
1967 int set_label_spec(const char *label_spec)
1969 spec_cur = spec_ptr = label_spec;
1970 spec_end = strchr(label_spec, '\0');
1974 delete parsed_label;
1975 parsed_label = parse_result;
1979 int set_date_label_spec(const char *label_spec)
1981 spec_cur = spec_ptr = label_spec;
1982 spec_end = strchr(label_spec, '\0');
1986 delete parsed_date_label;
1987 parsed_date_label = parse_result;
1991 int set_short_label_spec(const char *label_spec)
1993 spec_cur = spec_ptr = label_spec;
1994 spec_end = strchr(label_spec, '\0');
1998 delete parsed_short_label;
1999 parsed_short_label = parse_result;
2003 void yyerror(const char *message)
2005 if (spec_cur < spec_end)
2006 command_error("label specification %1 before '%2'", message, spec_cur);
2008 command_error("label specification %1 at end of string",
2012 void at_expr::evaluate(int tentative, const reference &ref,
2013 string &result, substring_position &)
2016 ref.canonicalize_authors(result);
2018 const char *end, *start = ref.get_authors(&end);
2020 result.append(start, end - start);
2024 void format_expr::evaluate(int tentative, const reference &ref,
2025 string &result, substring_position &)
2029 const label_info *lp = ref.get_label_ptr();
2030 int num = lp == 0 ? ref.get_number() : lp->count;
2032 result += format_serial(type, num + 1);
2034 const char *ptr = i_to_a(num + first_number);
2035 int pad = width - strlen(ptr);
2042 static const char *format_serial(char c, int n)
2045 static char buf[128]; // more than enough.
2051 // troff uses z and w to represent 10000 and 5000 in Roman
2052 // numerals; I can find no historical basis for this usage
2053 const char *s = c == 'i' ? "zwmdclxvi" : "ZWMDCLXVI";
2056 while (n >= 10000) {
2060 for (int i = 1000; i > 0; i /= 10, s += 2) {
2107 // this is derived from troff/reg.c
2114 *p++ = c == 'a' ? lowercase_array[d - 1] :
2115 uppercase_array[d - 1];
2135 void field_expr::evaluate(int, const reference &ref,
2136 string &result, substring_position &)
2139 const char *start = ref.get_field(name, &end);
2141 start = nth_field(number, start, &end);
2143 result.append(start, end - start);
2147 void literal_expr::evaluate(int, const reference &,
2148 string &result, substring_position &)
2153 analyzed_expr::analyzed_expr(expression *e)
2154 : unary_expr(e), flags(e ? e->analyze() : 0)
2158 void analyzed_expr::evaluate(int tentative, const reference &ref,
2159 string &result, substring_position &pos)
2162 expr->evaluate(tentative, ref, result, pos);
2165 void star_expr::evaluate(int tentative, const reference &ref,
2166 string &result, substring_position &pos)
2168 const label_info *lp = ref.get_label_ptr();
2170 && (lp == 0 || lp->total > 1)
2172 expr->evaluate(tentative, ref, result, pos);
2175 void separator_expr::evaluate(int tentative, const reference &ref,
2176 string &result, substring_position &pos)
2178 int start_length = result.length();
2179 int is_first = pos.start < 0;
2181 expr->evaluate(tentative, ref, result, pos);
2183 pos.start = start_length;
2184 pos.length = result.length() - start_length;
2188 void map_expr::evaluate(int tentative, const reference &ref,
2189 string &result, substring_position &)
2193 substring_position temp_pos;
2194 expr->evaluate(tentative, ref, temp, temp_pos);
2195 (*func)(temp.contents(), temp.contents() + temp.length(), result);
2199 void extractor_expr::evaluate(int tentative, const reference &ref,
2200 string &result, substring_position &)
2204 substring_position temp_pos;
2205 expr->evaluate(tentative, ref, temp, temp_pos);
2206 const char *end, *start = (*func)(temp.contents(),
2207 temp.contents() + temp.length(),
2212 result.append(temp.contents(), start - temp.contents());
2218 result.append(start, end - start);
2222 result.append(end, temp.contents() + temp.length() - end);
2230 static void first_part(int len, const char *ptr, const char *end,
2234 const char *token_start = ptr;
2235 if (!get_token(&ptr, end))
2237 const token_info *ti = lookup_token(token_start, ptr);
2238 int counts = ti->sortify_non_empty(token_start, ptr);
2239 if (counts && --len < 0)
2241 if (counts || ti->is_accent())
2242 result.append(token_start, ptr - token_start);
2246 static void last_part(int len, const char *ptr, const char *end,
2249 const char *start = ptr;
2252 const char *token_start = ptr;
2253 if (!get_token(&ptr, end))
2255 const token_info *ti = lookup_token(token_start, ptr);
2256 if (ti->sortify_non_empty(token_start, ptr))
2260 int skip = count - len;
2263 const char *token_start = ptr;
2264 if (!get_token(&ptr, end))
2266 const token_info *ti = lookup_token(token_start, ptr);
2267 if (ti->sortify_non_empty(token_start, ptr) && --skip < 0) {
2273 first_part(len, ptr, end, result);
2276 void truncate_expr::evaluate(int tentative, const reference &ref,
2277 string &result, substring_position &)
2281 substring_position temp_pos;
2282 expr->evaluate(tentative, ref, temp, temp_pos);
2283 const char *start = temp.contents();
2284 const char *end = start + temp.length();
2286 first_part(n, start, end, result);
2288 last_part(-n, start, end, result);
2292 void alternative_expr::evaluate(int tentative, const reference &ref,
2293 string &result, substring_position &pos)
2295 int start_length = result.length();
2297 expr1->evaluate(tentative, ref, result, pos);
2298 if (result.length() == start_length && expr2)
2299 expr2->evaluate(tentative, ref, result, pos);
2302 void list_expr::evaluate(int tentative, const reference &ref,
2303 string &result, substring_position &pos)
2306 expr1->evaluate(tentative, ref, result, pos);
2308 expr2->evaluate(tentative, ref, result, pos);
2311 void substitute_expr::evaluate(int tentative, const reference &ref,
2312 string &result, substring_position &pos)
2314 int start_length = result.length();
2316 expr1->evaluate(tentative, ref, result, pos);
2317 if (result.length() > start_length && result[result.length() - 1] == '-') {
2318 // ought to see if pos covers the -
2319 result.set_length(result.length() - 1);
2321 expr2->evaluate(tentative, ref, result, pos);
2325 void conditional_expr::evaluate(int tentative, const reference &ref,
2326 string &result, substring_position &pos)
2329 substring_position temp_pos;
2331 expr1->evaluate(tentative, ref, temp, temp_pos);
2332 if (temp.length() > 0) {
2334 expr2->evaluate(tentative, ref, result, pos);
2338 expr3->evaluate(tentative, ref, result, pos);
2342 void reference::pre_compute_label()
2344 if (parsed_label != 0
2345 && (parsed_label->analyze() & expression::CONTAINS_VARIABLE)) {
2347 substring_position temp_pos;
2348 parsed_label->evaluate(1, *this, label, temp_pos);
2349 label_ptr = lookup_label(label);
2353 void reference::compute_label()
2357 parsed_label->evaluate(0, *this, label, separator_pos);
2358 if (short_label_flag && parsed_short_label)
2359 parsed_short_label->evaluate(0, *this, short_label, short_separator_pos);
2360 if (date_as_label) {
2362 if (parsed_date_label) {
2363 substring_position temp_pos;
2364 parsed_date_label->evaluate(0, *this, new_date, temp_pos);
2369 label_ptr->count += 1;
2372 void reference::immediate_compute_label()
2375 label_ptr->total = 2; // force use of disambiguator
2379 int reference::merge_labels(reference **v, int n, label_type type,
2382 if (abbreviate_label_ranges)
2383 return merge_labels_by_number(v, n, type, result);
2385 return merge_labels_by_parts(v, n, type, result);
2388 int reference::merge_labels_by_number(reference **v, int n, label_type type,
2393 int num = get_number();
2394 // Only merge three or more labels.
2395 if (v[0]->get_number() != num + 1
2396 || v[1]->get_number() != num + 2)
2399 for (i = 2; i < n; i++)
2400 if (v[i]->get_number() != num + i + 1)
2402 result = get_label(type);
2403 result += label_range_indicator;
2404 result += v[i - 1]->get_label(type);
2408 const substring_position &reference::get_separator_pos(label_type type) const
2410 if (type == SHORT_LABEL && short_label_flag)
2411 return short_separator_pos;
2413 return separator_pos;
2416 const string &reference::get_label(label_type type) const
2418 if (type == SHORT_LABEL && short_label_flag)
2424 int reference::merge_labels_by_parts(reference **v, int n, label_type type,
2429 const string &lb = get_label(type);
2430 const substring_position &sp = get_separator_pos(type);
2432 || sp.start != v[0]->get_separator_pos(type).start
2433 || memcmp(lb.contents(), v[0]->get_label(type).contents(),
2439 result += separate_label_second_parts;
2440 const substring_position &s = v[i]->get_separator_pos(type);
2441 int sep_end_pos = s.start + s.length;
2442 result.append(v[i]->get_label(type).contents() + sep_end_pos,
2443 v[i]->get_label(type).length() - sep_end_pos);
2445 && sp.start == v[i]->get_separator_pos(type).start
2446 && memcmp(lb.contents(), v[i]->get_label(type).contents(),
2453 label_info::label_info(const string &s)
2454 : start(label_pool.length()), length(s.length()), count(0), total(1)
2459 static label_info **label_table = 0;
2460 static int label_table_size = 0;
2461 static int label_table_used = 0;
2463 label_info *lookup_label(const string &label)
2465 if (label_table == 0) {
2466 label_table = new label_info *[17];
2467 label_table_size = 17;
2468 for (int i = 0; i < 17; i++)
2471 unsigned h = hash_string(label.contents(), label.length()) % label_table_size;
2473 for (ptr = label_table + h;
2475 (ptr == label_table)
2476 ? (ptr = label_table + label_table_size - 1)
2478 if ((*ptr)->length == label.length()
2479 && memcmp(label_pool.contents() + (*ptr)->start, label.contents(),
2480 label.length()) == 0) {
2484 label_info *result = *ptr = new label_info(label);
2485 if (++label_table_used * 2 > label_table_size) {
2486 // Rehash the table.
2487 label_info **old_table = label_table;
2488 int old_size = label_table_size;
2489 label_table_size = next_size(label_table_size);
2490 label_table = new label_info *[label_table_size];
2492 for (i = 0; i < label_table_size; i++)
2494 for (i = 0; i < old_size; i++)
2496 h = hash_string(label_pool.contents() + old_table[i]->start,
2497 old_table[i]->length);
2499 for (p = label_table + (h % label_table_size);
2502 ? (p = label_table + label_table_size - 1)
2514 for (int i = 0; i < label_table_size; i++) {
2515 delete label_table[i];
2518 label_table_used = 0;
2522 static void consider_authors(reference **start, reference **end, int i);
2524 void compute_labels(reference **v, int n)
2527 && (parsed_label->analyze() & expression::CONTAINS_AT)
2528 && sort_fields.length() >= 2
2529 && sort_fields[0] == 'A'
2530 && sort_fields[1] == '+')
2531 consider_authors(v, v + n, 0);
2532 for (int i = 0; i < n; i++)
2533 v[i]->compute_label();
2537 /* A reference with a list of authors <A0,A1,...,AN> _needs_ author i
2538 where 0 <= i <= N if there exists a reference with a list of authors
2539 <B0,B1,...,BM> such that <A0,A1,...,AN> != <B0,B1,...,BM> and M >= i
2540 and Aj = Bj for 0 <= j < i. In this case if we can't say "A0,
2541 A1,...,A(i-1) et al" because this would match both <A0,A1,...,AN> and
2542 <B0,B1,...,BM>. If a reference needs author i we only have to call
2543 need_author(j) for some j >= i such that the reference also needs
2546 /* This function handles 2 tasks:
2547 determine which authors are needed (cannot be elided with et al.);
2548 determine which authors can have only last names in the labels.
2550 References >= start and < end have the same first i author names.
2551 Also they're sorted by A+. */
2553 static void consider_authors(reference **start, reference **end, int i)
2557 reference **p = start;
2558 if (i >= (*p)->get_nauthors()) {
2559 for (++p; p < end && i >= (*p)->get_nauthors(); p++)
2561 if (p < end && i > 0) {
2562 // If we have an author list <A B C> and an author list <A B C D>,
2563 // then both lists need C.
2564 for (reference **q = start; q < end; q++)
2565 (*q)->need_author(i - 1);
2570 reference **last_name_start = p;
2571 reference **name_start = p;
2573 p < end && i < (*p)->get_nauthors()
2574 && same_author_last_name(**last_name_start, **p, i);
2576 if (!same_author_name(**name_start, **p, i)) {
2577 consider_authors(name_start, p, i + 1);
2581 consider_authors(name_start, p, i + 1);
2582 if (last_name_start == name_start) {
2583 for (reference **q = last_name_start; q < p; q++)
2584 (*q)->set_last_name_unambiguous(i);
2586 // If we have an author list <A B C D> and <A B C E>, then the lists
2587 // need author D and E respectively.
2588 if (name_start > start || p < end) {
2589 for (reference **q = last_name_start; q < p; q++)
2590 (*q)->need_author(i);
2595 int same_author_last_name(const reference &r1, const reference &r2, int n)
2598 const char *as1 = r1.get_sort_field(0, n, 0, &ae1);
2600 const char *as2 = r2.get_sort_field(0, n, 0, &ae2);
2601 if (!as1 && !as2) return 1; // they are the same
2602 if (!as1 || !as2) return 0;
2603 return ae1 - as1 == ae2 - as2 && memcmp(as1, as2, ae1 - as1) == 0;
2606 int same_author_name(const reference &r1, const reference &r2, int n)
2609 const char *as1 = r1.get_sort_field(0, n, -1, &ae1);
2611 const char *as2 = r2.get_sort_field(0, n, -1, &ae2);
2612 if (!as1 && !as2) return 1; // they are the same
2613 if (!as1 || !as2) return 0;
2614 return ae1 - as1 == ae2 - as2 && memcmp(as1, as2, ae1 - as1) == 0;
2618 void int_set::set(int i)
2622 if (bytei >= v.length()) {
2623 int old_length = v.length();
2624 v.set_length(bytei + 1);
2625 for (int j = old_length; j <= bytei; j++)
2628 v[bytei] |= 1 << (i & 7);
2631 int int_set::get(int i) const
2635 return bytei >= v.length() ? 0 : (v[bytei] & (1 << (i & 7))) != 0;
2638 void reference::set_last_name_unambiguous(int i)
2640 last_name_unambiguous.set(i);
2643 void reference::need_author(int n)
2645 if (n > last_needed_author)
2646 last_needed_author = n;
2649 const char *reference::get_authors(const char **end) const
2651 if (!computed_authors) {
2652 ((reference *)this)->computed_authors = 1;
2653 string &result = ((reference *)this)->authors;
2654 int na = get_nauthors();
2656 for (int i = 0; i < na; i++) {
2657 if (last_name_unambiguous.get(i)) {
2658 const char *e, *start = get_author_last_name(i, &e);
2660 result.append(start, e - start);
2663 const char *e, *start = get_author(i, &e);
2665 result.append(start, e - start);
2667 if (i == last_needed_author
2668 && et_al.length() > 0
2669 && et_al_min_elide > 0
2670 && last_needed_author + et_al_min_elide < na
2671 && na >= et_al_min_total) {
2677 result += join_authors_exactly_two;
2678 else if (i < na - 2)
2679 result += join_authors_default;
2681 result += join_authors_last_two;
2685 const char *start = authors.contents();
2686 *end = start + authors.length();
2690 int reference::get_nauthors() const
2695 for (na = 0; get_author(na, &dummy) != 0; na++)
2697 ((reference *)this)->nauthors = na;