[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, master, updated. gawk-4.1.0-3854-g85d4a66
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, master, updated. gawk-4.1.0-3854-g85d4a66 |
Date: |
Fri, 20 Dec 2019 06:58:16 -0500 (EST) |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, master has been updated
via 85d4a663bbe5ac966b15b4d671bf892638350f4d (commit)
via 0e81d1df1aaa8f4b281efe9f63f5fd05e6e9ef9a (commit)
via ef3481f8b2564bbe9c3c43cbced3e8edc9608fb0 (commit)
from 6d1580bfd328fbbb04f4b5627032602dd8dfe98c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=85d4a663bbe5ac966b15b4d671bf892638350f4d
commit 85d4a663bbe5ac966b15b4d671bf892638350f4d
Author: Arnold D. Robbins <address@hidden>
Date: Fri Dec 20 13:58:00 2019 +0200
Update dfa from GNULIB.
diff --git a/support/ChangeLog b/support/ChangeLog
index d3213ee..4a57d55 100644
--- a/support/ChangeLog
+++ b/support/ChangeLog
@@ -1,3 +1,7 @@
+2019-12-20 Arnold D. Robbins <address@hidden>
+
+ * dfa.h, dfa.c: Updated from GNULIB.
+
2019-12-16 Arnold D. Robbins <address@hidden>
* localeinfo.h, localeinfo.c: Updated from GNULIB.
diff --git a/support/dfa.c b/support/dfa.c
index 9e7c8a8..0aa8124 100644
--- a/support/dfa.c
+++ b/support/dfa.c
@@ -22,6 +22,8 @@
#include <config.h>
+#include "dfa.h"
+
#include <assert.h>
#include <ctype.h>
#ifndef VMS
@@ -31,17 +33,15 @@
#define PTRDIFF_MAX __INT32_MAX
#endif
#include <stdio.h>
-
-#ifndef VMS
-#include <sys/types.h>
-#else
-#include <stddef.h>
-#endif
#include <stdlib.h>
#include <limits.h>
#include <string.h>
-#include "dfa.h" // gets stdbool.h for us
+/* Another name for ptrdiff_t, for sizes of objects and nonnegative
+ indexes into objects. It is signed to help catch integer overflow.
+ It has its own name because it is for nonnegative values only. */
+typedef ptrdiff_t idx_t;
+static idx_t const IDX_MAX = PTRDIFF_MAX;
static bool
streq (char const *a, char const *b)
@@ -99,28 +99,15 @@ is_blank (int c)
/* First integer value that is greater than any character code. */
enum { NOTCHAR = 1 << CHAR_BIT };
+/* Number of bits used in a charclass word. */
+enum { CHARCLASS_WORD_BITS = 64 };
+
/* This represents part of a character class. It must be unsigned and
at least CHARCLASS_WORD_BITS wide. Any excess bits are zero. */
-typedef unsigned long int charclass_word;
-
-/* CHARCLASS_WORD_BITS is the number of bits used in a charclass word.
- CHARCLASS_PAIR (LO, HI) is part of a charclass initializer, and
- represents 64 bits' worth of a charclass, where LO and HI are the
- low and high-order 32 bits of the 64-bit quantity. */
-#if ULONG_MAX >> 31 >> 31 < 3
-enum { CHARCLASS_WORD_BITS = 32 };
-# define CHARCLASS_PAIR(lo, hi) lo, hi
-#else
-enum { CHARCLASS_WORD_BITS = 64 };
-# define CHARCLASS_PAIR(lo, hi) (((charclass_word) (hi) << 32) + (lo))
-#endif
+typedef uint_fast64_t charclass_word;
-/* An initializer for a charclass whose 32-bit words are A through H. */
-#define CHARCLASS_INIT(a, b, c, d, e, f, g, h) \
- {{ \
- CHARCLASS_PAIR (a, b), CHARCLASS_PAIR (c, d), \
- CHARCLASS_PAIR (e, f), CHARCLASS_PAIR (g, h) \
- }}
+/* An initializer for a charclass whose 64-bit words are A through D. */
+#define CHARCLASS_INIT(a, b, c, d) {{a, b, c, d}}
/* The maximum useful value of a charclass_word; all used bits are 1. */
static charclass_word const CHARCLASS_WORD_MASK
@@ -236,7 +223,7 @@ enum
codes are returned by the lexical analyzer. */
typedef ptrdiff_t token;
-static ptrdiff_t const TOKEN_MAX = PTRDIFF_MAX;
+static token const TOKEN_MAX = PTRDIFF_MAX;
/* States are indexed by state_num values. These are normally
nonnegative but -1 is used as a special value. */
@@ -347,7 +334,7 @@ enum
a constraint. */
typedef struct
{
- ptrdiff_t index; /* Index into the parse array. */
+ idx_t index; /* Index into the parse array. */
unsigned int constraint; /* Constraint for matching this position. */
} position;
@@ -355,8 +342,8 @@ typedef struct
typedef struct
{
position *elems; /* Elements of this position set. */
- ptrdiff_t nelem; /* Number of elements in this set. */
- ptrdiff_t alloc; /* Number of elements allocated in ELEMS. */
+ idx_t nelem; /* Number of elements in this set. */
+ idx_t alloc; /* Number of elements allocated in ELEMS. */
} position_set;
/* A state of the dfa consists of a set of positions, some flags,
@@ -388,8 +375,8 @@ struct mb_char_classes
ptrdiff_t cset;
bool invert;
wchar_t *chars; /* Normal characters. */
- ptrdiff_t nchars;
- ptrdiff_t nchars_alloc;
+ idx_t nchars;
+ idx_t nchars_alloc;
};
struct regex_syntax
@@ -429,9 +416,9 @@ struct regex_syntax
struct lexer_state
{
char const *ptr; /* Pointer to next input character. */
- ptrdiff_t left; /* Number of characters remaining. */
+ idx_t left; /* Number of characters remaining. */
token lasttok; /* Previous token returned; initially END. */
- ptrdiff_t parens; /* Count of outstanding left parens. */
+ idx_t parens; /* Count of outstanding left parens. */
int minrep, maxrep; /* Repeat counts for {m,n}. */
/* Wide character representation of the current multibyte character,
@@ -439,9 +426,6 @@ struct lexer_state
MB_CUR_MAX > 1. */
wint_t wctok;
- /* Length of the multibyte representation of wctok. */
- int cur_mb_len;
-
/* The most recently analyzed multibyte bracket expression. */
struct mb_char_classes brack;
@@ -454,7 +438,7 @@ struct lexer_state
struct parser_state
{
token tok; /* Lookahead token. */
- ptrdiff_t depth; /* Current depth of a hypothetical stack
+ idx_t depth; /* Current depth of a hypothetical stack
holding deferred productions. This is
used to determine the depth that will be
required of the real stack later on in
@@ -464,13 +448,10 @@ struct parser_state
/* A compiled regular expression. */
struct dfa
{
- /* Syntax configuration */
- struct regex_syntax syntax;
-
/* Fields filled by the scanner. */
charclass *charclasses; /* Array of character sets for CSET tokens. */
- ptrdiff_t cindex; /* Index for adding new charclasses. */
- ptrdiff_t calloc; /* Number of charclasses allocated. */
+ idx_t cindex; /* Index for adding new charclasses. */
+ idx_t calloc; /* Number of charclasses allocated. */
ptrdiff_t canychar; /* Index of anychar class, or -1. */
/* Scanner state */
@@ -481,16 +462,16 @@ struct dfa
/* Fields filled by the parser. */
token *tokens; /* Postfix parse array. */
- ptrdiff_t tindex; /* Index for adding new tokens. */
- ptrdiff_t talloc; /* Number of tokens currently allocated. */
- ptrdiff_t depth; /* Depth required of an evaluation stack
+ idx_t tindex; /* Index for adding new tokens. */
+ idx_t talloc; /* Number of tokens currently
allocated. */
+ idx_t depth; /* Depth required of an evaluation stack
used for depth-first traversal of the
parse tree. */
- ptrdiff_t nleaves; /* Number of leaves on the parse tree. */
- ptrdiff_t nregexps; /* Count of parallel regexps being built
+ idx_t nleaves; /* Number of leaves on the parse tree. */
+ idx_t nregexps; /* Count of parallel regexps being built
with dfaparse. */
bool fast; /* The DFA is fast. */
- token utf8_anychar_classes[5]; /* To lower ANYCHAR in UTF-8 locales. */
+ token utf8_anychar_classes[9]; /* To lower ANYCHAR in UTF-8 locales. */
mbstate_t mbs; /* Multibyte conversion state. */
/* The following are valid only if MB_CUR_MAX > 1. */
@@ -517,7 +498,7 @@ struct dfa
/* Fields filled by the state builder. */
dfa_state *states; /* States of the dfa. */
state_num sindex; /* Index for adding new states. */
- ptrdiff_t salloc; /* Number of states currently allocated. */
+ idx_t salloc; /* Number of states currently
allocated. */
/* Fields filled by the parse tree->NFA conversion. */
position_set *follows; /* Array of follow sets, indexed by position
@@ -582,12 +563,16 @@ struct dfa
state_num mb_trcount; /* Number of transition tables for states with
ANYCHAR that have actually been built. */
+ /* Syntax configuration. This is near the end so that dfacopysyntax
+ can memset up to here. */
+ struct regex_syntax syntax;
+
/* Information derived from the locale. This is at the end so that
a quick memset need not clear it specially. */
/* dfaexec implementation. */
char *(*dfaexec) (struct dfa *, char const *, char *,
- bool, size_t *, bool *);
+ bool, ptrdiff_t *, bool *);
/* Other cached information derived from the locale. */
struct localeinfo localeinfo;
@@ -807,10 +792,10 @@ emptyset (charclass const *s)
{ free (A); A = xpalloc (NULL, &AITEMS, ...); }. */
static void *
-xpalloc (void *pa, ptrdiff_t *nitems, ptrdiff_t nitems_incr_min,
- ptrdiff_t nitems_max, ptrdiff_t item_size)
+xpalloc (void *pa, idx_t *nitems, idx_t nitems_incr_min,
+ ptrdiff_t nitems_max, idx_t item_size)
{
- ptrdiff_t n0 = *nitems;
+ idx_t n0 = *nitems;
/* The approximate size to use for initial small allocation
requests. This is the largest "small" request for the GNU C
@@ -822,15 +807,15 @@ xpalloc (void *pa, ptrdiff_t *nitems, ptrdiff_t
nitems_incr_min,
Adjust the growth according to three constraints: NITEMS_INCR_MIN,
NITEMS_MAX, and what the C language can represent safely. */
- ptrdiff_t n, nbytes;
+ idx_t n, nbytes;
if (INT_ADD_WRAPV (n0, n0 >> 1, &n))
- n = PTRDIFF_MAX;
+ n = IDX_MAX;
if (0 <= nitems_max && nitems_max < n)
n = nitems_max;
- ptrdiff_t adjusted_nbytes
+ idx_t adjusted_nbytes
= ((INT_MULTIPLY_WRAPV (n, item_size, &nbytes) || SIZE_MAX < nbytes)
- ? MIN (PTRDIFF_MAX, SIZE_MAX)
+ ? MIN (IDX_MAX, SIZE_MAX)
: nbytes < DEFAULT_MXFAST ? DEFAULT_MXFAST : 0);
if (adjusted_nbytes)
{
@@ -860,8 +845,8 @@ xpalloc (void *pa, ptrdiff_t *nitems, ptrdiff_t
nitems_incr_min,
ITEM_SIZE is the size of one item; it must be positive.
Avoid O(N**2) behavior on arrays growing linearly. */
static void *
-maybe_realloc (void *pa, ptrdiff_t i, ptrdiff_t *nitems,
- ptrdiff_t nitems_max, ptrdiff_t item_size)
+maybe_realloc (void *pa, idx_t i, idx_t *nitems,
+ ptrdiff_t nitems_max, idx_t item_size)
{
if (i < *nitems)
return pa;
@@ -869,10 +854,10 @@ maybe_realloc (void *pa, ptrdiff_t i, ptrdiff_t *nitems,
}
/* In DFA D, find the index of charclass S, or allocate a new one. */
-static ptrdiff_t
-charclass_index (struct dfa *d, charclass *s)
+static idx_t
+charclass_index (struct dfa *d, charclass const *s)
{
- ptrdiff_t i;
+ idx_t i;
for (i = 0; i < d->cindex; ++i)
if (equal (s, &d->charclasses[i]))
@@ -900,22 +885,6 @@ char_context (struct dfa const *dfa, unsigned char c)
return CTX_NONE;
}
-/* Copy the syntax settings from one dfa instance to another.
- Saves considerable computation time if compiling many regular expressions
- based on the same setting. */
-void
-dfacopysyntax (struct dfa *to, const struct dfa *from)
-{
- to->dfaexec = from->dfaexec;
- to->localeinfo = from->localeinfo;
-
- to->fast = from->fast;
-
- to->canychar = from->canychar;
- to->lex.cur_mb_len = from->lex.cur_mb_len;
- to->syntax = from->syntax;
-}
-
/* Set a bit in the charclass for the given wchar_t. Do nothing if WC
is represented by a multi-byte sequence. Even for MB_CUR_MAX == 1,
this may happen when folding case in weird Turkish locales where
@@ -954,7 +923,6 @@ fetch_wc (struct dfa *dfa)
{
int nbytes = mbs_to_wchar (&dfa->lex.wctok, dfa->lex.ptr, dfa->lex.left,
dfa);
- dfa->lex.cur_mb_len = nbytes;
int c = nbytes == 1 ? to_uchar (dfa->lex.ptr[0]) : EOF;
dfa->lex.ptr += nbytes;
dfa->lex.left -= nbytes;
@@ -1144,8 +1112,8 @@ parse_bracket_exp (struct dfa *dfa)
{
/* In the case [x-], the - is an ordinary hyphen,
which is left in c1, the lookahead character. */
- dfa->lex.ptr -= dfa->lex.cur_mb_len;
- dfa->lex.left += dfa->lex.cur_mb_len;
+ dfa->lex.ptr--;
+ dfa->lex.left++;
}
else
{
@@ -1239,7 +1207,7 @@ parse_bracket_exp (struct dfa *dfa)
struct lexptr
{
char const *ptr;
- ptrdiff_t left;
+ idx_t left;
};
static void
@@ -1659,7 +1627,7 @@ addtok (struct dfa *dfa, token t)
/* Extract wide characters into alternations for better performance.
This does not require UTF-8. */
- for (ptrdiff_t i = 0; i < dfa->lex.brack.nchars; i++)
+ for (idx_t i = 0; i < dfa->lex.brack.nchars; i++)
{
addtok_wc (dfa, dfa->lex.brack.chars[i]);
if (need_or)
@@ -1695,21 +1663,22 @@ addtok_wc (struct dfa *dfa, wint_t wc)
unsigned char buf[MB_LEN_MAX];
mbstate_t s = { 0 };
size_t stored_bytes = wcrtomb ((char *) buf, wc, &s);
+ int buflen;
if (stored_bytes != (size_t) -1)
- dfa->lex.cur_mb_len = stored_bytes;
+ buflen = stored_bytes;
else
{
/* This is merely stop-gap. buf[0] is undefined, yet skipping
the addtok_mb call altogether can corrupt the heap. */
- dfa->lex.cur_mb_len = 1;
+ buflen = 1;
buf[0] = 0;
}
- addtok_mb (dfa, buf[0], dfa->lex.cur_mb_len == 1 ? 3 : 1);
- for (int i = 1; i < dfa->lex.cur_mb_len; i++)
+ addtok_mb (dfa, buf[0], buflen == 1 ? 3 : 1);
+ for (int i = 1; i < buflen; i++)
{
- addtok_mb (dfa, buf[i], i == dfa->lex.cur_mb_len - 1 ? 2 : 0);
+ addtok_mb (dfa, buf[i], i == buflen - 1 ? 2 : 0);
addtok (dfa, CAT);
}
}
@@ -1717,55 +1686,111 @@ addtok_wc (struct dfa *dfa, wint_t wc)
static void
add_utf8_anychar (struct dfa *dfa)
{
- static charclass const utf8_classes[5] = {
- /* 80-bf: non-leading bytes. */
- CHARCLASS_INIT (0, 0, 0, 0, 0xffffffff, 0xffffffff, 0, 0),
+ /* Since the Unicode Standard Version 4.0.0 (2003), a well-formed
+ UTF-8 byte sequence has been defined as follows:
- /* 00-7f: 1-byte sequence. */
- CHARCLASS_INIT (0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0, 0, 0,
0),
+ ([\x00-\x7f]
+ |[\xc2-\xdf][\x80-\xbf]
+ |[\xe0][\xa0-\xbf][\x80-\xbf]
+ |[\xe1-\xec\xee-\xef][\x80-\xbf][\x80-\xbf]
+ |[\xed][\x80-\x9f][\x80-\xbf]
+ |[\xf0][\x90-\xbf][\x80-\xbf][\x80-\xbf])
+ |[\xf1-\xf3][\x80-\xbf][\x80-\xbf][\x80-\xbf]
+ |[\xf4][\x80-\x8f][\x80-\xbf][\x80-\xbf])
- /* c2-df: 2-byte sequence. */
- CHARCLASS_INIT (0, 0, 0, 0, 0, 0, 0xfffffffc, 0),
+ which I'll write more concisely "A|BC|DEC|FCC|GHC|IJCC|KCCC|LMCC",
+ where A = [\x00-\x7f], B = [\xc2-\xdf], C = [\x80-\xbf],
+ D = [\xe0], E = [\xa0-\xbf], F = [\xe1-\xec\xee-\xef], G = [\xed],
+ H = [\x80-\x9f], I = [\xf0],
+ J = [\x90-\xbf], K = [\xf1-\xf3], L = [\xf4], M = [\x80-\x8f].
- /* e0-ef: 3-byte sequence. */
- CHARCLASS_INIT (0, 0, 0, 0, 0, 0, 0, 0xffff),
+ This can be refactored to "A|(B|DE|GH|(F|IJ|LM|KC)C)C". */
- /* f0-f7: 4-byte sequence. */
- CHARCLASS_INIT (0, 0, 0, 0, 0, 0, 0, 0xff0000)
- };
- int n = sizeof utf8_classes / sizeof *utf8_classes;
+ /* Mnemonics for classes containing two or more bytes. */
+ enum { A, B, C, E, F, H, J, K, M };
- /* Define the five character classes that are needed below. */
- if (dfa->utf8_anychar_classes[0] == 0)
- for (int i = 0; i < n; i++)
- {
- charclass c = utf8_classes[i];
- if (i == 1)
- {
- if (!(dfa->syntax.syntax_bits & RE_DOT_NEWLINE))
- clrbit ('\n', &c);
- if (dfa->syntax.syntax_bits & RE_DOT_NOT_NULL)
- clrbit ('\0', &c);
- }
- dfa->utf8_anychar_classes[i] = CSET + charclass_index (dfa, &c);
- }
+ /* Mnemonics for single-byte tokens. */
+ enum { D_token = 0xe0, G_token = 0xed, I_token = 0xf0, L_token = 0xf4 };
+
+ static charclass const utf8_classes[] = {
+ /* A. 00-7f: 1-byte sequence. */
+ CHARCLASS_INIT (0xffffffffffffffff, 0xffffffffffffffff, 0, 0),
+
+ /* B. c2-df: 1st byte of a 2-byte sequence. */
+ CHARCLASS_INIT (0, 0, 0, 0x00000000fffffffc),
+
+ /* C. 80-bf: non-leading bytes. */
+ CHARCLASS_INIT (0, 0, 0xffffffffffffffff, 0),
+
+ /* D. e0 (just a token). */
+
+ /* E. a0-bf: 2nd byte of a "DEC" sequence. */
+ CHARCLASS_INIT (0, 0, 0xffffffff00000000, 0),
+
+ /* F. e1-ec + ee-ef: 1st byte of an "FCC" sequence. */
+ CHARCLASS_INIT (0, 0, 0, 0x0000dffe00000000),
- /* A valid UTF-8 character is
+ /* G. ed (just a token). */
- ([0x00-0x7f]
- |[0xc2-0xdf][0x80-0xbf]
- |[0xe0-0xef[0x80-0xbf][0x80-0xbf]
- |[0xf0-f7][0x80-0xbf][0x80-0xbf][0x80-0xbf])
+ /* H. 80-9f: 2nd byte of a "GHC" sequence. */
+ CHARCLASS_INIT (0, 0, 0x000000000000ffff, 0),
- which I'll write more concisely "B|CA|DAA|EAAA". Factor the [0x00-0x7f]
- and you get "B|(C|(D|EA)A)A". And since the token buffer is in reverse
- Polish notation, you get "B C D E A CAT OR A CAT OR A CAT OR". */
- int i;
- for (i = 1; i < n; i++)
- addtok (dfa, dfa->utf8_anychar_classes[i]);
- while (--i > 1)
+ /* I. f0 (just a token). */
+
+ /* J. 90-bf: 2nd byte of an "IJCC" sequence. */
+ CHARCLASS_INIT (0, 0, 0xffffffffffff0000, 0),
+
+ /* K. f1-f3: 1st byte of a "KCCC" sequence. */
+ CHARCLASS_INIT (0, 0, 0, 0x000e000000000000),
+
+ /* L. f4 (just a token). */
+
+ /* M. 80-8f: 2nd byte of a "LMCC" sequence. */
+ CHARCLASS_INIT (0, 0, 0x00000000000000ff, 0),
+ };
+
+ /* Define the character classes that are needed below. */
+ if (dfa->utf8_anychar_classes[0] == 0)
{
- addtok (dfa, dfa->utf8_anychar_classes[0]);
+ charclass c = utf8_classes[0];
+ if (! (dfa->syntax.syntax_bits & RE_DOT_NEWLINE))
+ clrbit ('\n', &c);
+ if (dfa->syntax.syntax_bits & RE_DOT_NOT_NULL)
+ clrbit ('\0', &c);
+ dfa->utf8_anychar_classes[0] = CSET + charclass_index (dfa, &c);
+
+ for (int i = 1; i < sizeof utf8_classes / sizeof *utf8_classes; i++)
+ dfa->utf8_anychar_classes[i]
+ = CSET + charclass_index (dfa, &utf8_classes[i]);
+ }
+
+ /* Implement the "A|(B|DE|GH|(F|IJ|LM|KC)C)C" pattern mentioned above.
+ The token buffer is in reverse Polish order, so we get
+ "A B D E CAT OR G H CAT OR F I J CAT OR L M CAT OR K
+ C CAT OR C CAT OR C CAT OR". */
+ addtok (dfa, dfa->utf8_anychar_classes[A]);
+ addtok (dfa, dfa->utf8_anychar_classes[B]);
+ addtok (dfa, D_token);
+ addtok (dfa, dfa->utf8_anychar_classes[E]);
+ addtok (dfa, CAT);
+ addtok (dfa, OR);
+ addtok (dfa, G_token);
+ addtok (dfa, dfa->utf8_anychar_classes[H]);
+ addtok (dfa, CAT);
+ addtok (dfa, OR);
+ addtok (dfa, dfa->utf8_anychar_classes[F]);
+ addtok (dfa, I_token);
+ addtok (dfa, dfa->utf8_anychar_classes[J]);
+ addtok (dfa, CAT);
+ addtok (dfa, OR);
+ addtok (dfa, L_token);
+ addtok (dfa, dfa->utf8_anychar_classes[M]);
+ addtok (dfa, CAT);
+ addtok (dfa, OR);
+ addtok (dfa, dfa->utf8_anychar_classes[K]);
+ for (int i = 0; i < 3; i++)
+ {
+ addtok (dfa, dfa->utf8_anychar_classes[C]);
addtok (dfa, CAT);
addtok (dfa, OR);
}
@@ -1867,8 +1892,8 @@ atom (struct dfa *dfa)
}
/* Return the number of tokens in the given subexpression. */
-static ptrdiff_t _GL_ATTRIBUTE_PURE
-nsubtoks (struct dfa const *dfa, ptrdiff_t tindex)
+static idx_t _GL_ATTRIBUTE_PURE
+nsubtoks (struct dfa const *dfa, idx_t tindex)
{
switch (dfa->tokens[tindex - 1])
{
@@ -1881,7 +1906,7 @@ nsubtoks (struct dfa const *dfa, ptrdiff_t tindex)
case CAT:
case OR:
{
- ptrdiff_t ntoks1 = nsubtoks (dfa, tindex - 1);
+ idx_t ntoks1 = nsubtoks (dfa, tindex - 1);
return 1 + ntoks1 + nsubtoks (dfa, tindex - 1 - ntoks1);
}
}
@@ -1889,14 +1914,14 @@ nsubtoks (struct dfa const *dfa, ptrdiff_t tindex)
/* Copy the given subexpression to the top of the tree. */
static void
-copytoks (struct dfa *dfa, ptrdiff_t tindex, ptrdiff_t ntokens)
+copytoks (struct dfa *dfa, idx_t tindex, idx_t ntokens)
{
if (dfa->localeinfo.multibyte)
- for (ptrdiff_t i = 0; i < ntokens; ++i)
+ for (idx_t i = 0; i < ntokens; i++)
addtok_mb (dfa, dfa->tokens[tindex + i],
dfa->multibyte_prop[tindex + i]);
else
- for (ptrdiff_t i = 0; i < ntokens; ++i)
+ for (idx_t i = 0; i < ntokens; i++)
addtok_mb (dfa, dfa->tokens[tindex + i], 3);
}
@@ -1908,8 +1933,8 @@ closure (struct dfa *dfa)
|| dfa->parse.tok == PLUS || dfa->parse.tok == REPMN)
if (dfa->parse.tok == REPMN && (dfa->lex.minrep || dfa->lex.maxrep))
{
- ptrdiff_t ntokens = nsubtoks (dfa, dfa->tindex);
- ptrdiff_t tindex = dfa->tindex - ntokens;
+ idx_t ntokens = nsubtoks (dfa, dfa->tindex);
+ idx_t tindex = dfa->tindex - ntokens;
if (dfa->lex.maxrep < 0)
addtok (dfa, PLUS);
if (dfa->lex.minrep == 0)
@@ -1968,7 +1993,7 @@ regexp (struct dfa *dfa)
/* Parse a string S of length LEN into D. S can include NUL characters.
This is the main entry point for the parser. */
void
-dfaparse (char const *s, size_t len, struct dfa *d)
+dfaparse (char const *s, idx_t len, struct dfa *d)
{
d->lex.ptr = s;
d->lex.left = len;
@@ -2016,7 +2041,7 @@ copy (position_set const *src, position_set *dst)
}
static void
-alloc_position_set (position_set *s, ptrdiff_t size)
+alloc_position_set (position_set *s, idx_t size)
{
s->elems = xnmalloc (size, sizeof *s->elems);
s->alloc = size;
@@ -2030,11 +2055,11 @@ alloc_position_set (position_set *s, ptrdiff_t size)
static void
insert (position p, position_set *s)
{
- ptrdiff_t count = s->nelem;
- ptrdiff_t lo = 0, hi = count;
+ idx_t count = s->nelem;
+ idx_t lo = 0, hi = count;
while (lo < hi)
{
- ptrdiff_t mid = (lo + hi) >> 1;
+ idx_t mid = (lo + hi) >> 1;
if (s->elems[mid].index < p.index)
lo = mid + 1;
else if (s->elems[mid].index == p.index)
@@ -2047,7 +2072,7 @@ insert (position p, position_set *s)
}
s->elems = maybe_realloc (s->elems, count, &s->alloc, -1, sizeof *s->elems);
- for (ptrdiff_t i = count; i > lo; i--)
+ for (idx_t i = count; i > lo; i--)
s->elems[i] = s->elems[i - 1];
s->elems[lo] = p;
++s->nelem;
@@ -2056,7 +2081,7 @@ insert (position p, position_set *s)
static void
append (position p, position_set *s)
{
- ptrdiff_t count = s->nelem;
+ idx_t count = s->nelem;
s->elems = maybe_realloc (s->elems, count, &s->alloc, -1, sizeof *s->elems);
s->elems[s->nelem++] = p;
}
@@ -2068,7 +2093,7 @@ static void
merge_constrained (position_set const *s1, position_set const *s2,
unsigned int c2, position_set *m)
{
- ptrdiff_t i = 0, j = 0;
+ idx_t i = 0, j = 0;
if (m->alloc - s1->nelem < s2->nelem)
{
@@ -2112,7 +2137,7 @@ merge2 (position_set *dst, position_set const *src,
position_set *m)
{
if (src->nelem < 4)
{
- for (ptrdiff_t i = 0; i < src->nelem; ++i)
+ for (idx_t i = 0; i < src->nelem; i++)
insert (src->elems[i], dst);
}
else
@@ -2125,19 +2150,19 @@ merge2 (position_set *dst, position_set const *src,
position_set *m)
/* Delete a position from a set. Return the nonzero constraint of the
deleted position, or zero if there was no such position. */
static unsigned int
-delete (ptrdiff_t del, position_set *s)
+delete (idx_t del, position_set *s)
{
- ptrdiff_t count = s->nelem;
- ptrdiff_t lo = 0, hi = count;
+ idx_t count = s->nelem;
+ idx_t lo = 0, hi = count;
while (lo < hi)
{
- ptrdiff_t mid = (lo + hi) >> 1;
+ idx_t mid = (lo + hi) >> 1;
if (s->elems[mid].index < del)
lo = mid + 1;
else if (s->elems[mid].index == del)
{
unsigned int c = s->elems[mid].constraint;
- ptrdiff_t i;
+ idx_t i;
for (i = mid; i + 1 < count; i++)
s->elems[i] = s->elems[i + 1];
s->nelem = i;
@@ -2151,7 +2176,7 @@ delete (ptrdiff_t del, position_set *s)
/* Replace a position with the followed set. */
static void
-replace (position_set *dst, ptrdiff_t del, position_set *add,
+replace (position_set *dst, idx_t del, position_set *add,
unsigned int constraint, position_set *tmp)
{
unsigned int c = delete (del, dst) & constraint;
@@ -2261,7 +2286,7 @@ epsclosure (struct dfa const *d)
{
position_set tmp;
alloc_position_set (&tmp, d->nleaves);
- for (ptrdiff_t i = 0; i < d->tindex; ++i)
+ for (idx_t i = 0; i < d->tindex; i++)
if (d->follows[i].nelem > 0 && d->tokens[i] >= NOTCHAR
&& d->tokens[i] != BACKREF && d->tokens[i] != ANYCHAR
&& d->tokens[i] != MBCSET && d->tokens[i] < CSET)
@@ -2294,7 +2319,7 @@ epsclosure (struct dfa const *d)
delete (i, &d->follows[i]);
- for (ptrdiff_t j = 0; j < d->tindex; j++)
+ for (idx_t j = 0; j < d->tindex; j++)
if (i != j && d->follows[j].nelem > 0)
replace (&d->follows[j], i, &d->follows[i], constraint, &tmp);
}
@@ -2333,7 +2358,7 @@ state_separate_contexts (struct dfa *d, position_set
const *s)
{
int separate_contexts = 0;
- for (ptrdiff_t j = 0; j < s->nelem; j++)
+ for (idx_t j = 0; j < s->nelem; j++)
separate_contexts |= d->separates[s->elems[j].index];
return separate_contexts;
@@ -2360,17 +2385,17 @@ enum
};
static void
-merge_nfa_state (struct dfa *d, ptrdiff_t tindex, char *flags,
+merge_nfa_state (struct dfa *d, idx_t tindex, char *flags,
position_set *merged)
{
position_set *follows = d->follows;
- ptrdiff_t nelem = 0;
+ idx_t nelem = 0;
d->constraints[tindex] = 0;
- for (ptrdiff_t i = 0; i < follows[tindex].nelem; i++)
+ for (idx_t i = 0; i < follows[tindex].nelem; i++)
{
- ptrdiff_t sindex = follows[tindex].elems[i].index;
+ idx_t sindex = follows[tindex].elems[i].index;
/* Skip the node as pruned in future. */
unsigned int iconstraint = follows[tindex].elems[i].constraint;
@@ -2385,11 +2410,11 @@ merge_nfa_state (struct dfa *d, ptrdiff_t tindex, char
*flags,
if (!(flags[sindex] & (OPT_LPAREN | OPT_RPAREN)))
{
- ptrdiff_t j;
+ idx_t j;
for (j = 0; j < nelem; j++)
{
- ptrdiff_t dindex = follows[tindex].elems[j].index;
+ idx_t dindex = follows[tindex].elems[j].index;
if (follows[tindex].elems[j].constraint != iconstraint)
continue;
@@ -2432,7 +2457,7 @@ compare (const void *a, const void *b)
static void
reorder_tokens (struct dfa *d)
{
- ptrdiff_t nleaves;
+ idx_t nleaves;
ptrdiff_t *map;
token *tokens;
position_set *follows;
@@ -2445,7 +2470,7 @@ reorder_tokens (struct dfa *d)
map[0] = nleaves++;
- for (ptrdiff_t i = 1; i < d->tindex; i++)
+ for (idx_t i = 1; i < d->tindex; i++)
map[i] = -1;
tokens = xnmalloc (d->nleaves, sizeof *tokens);
@@ -2457,7 +2482,7 @@ reorder_tokens (struct dfa *d)
else
multibyte_prop = NULL;
- for (ptrdiff_t i = 0; i < d->tindex; i++)
+ for (idx_t i = 0; i < d->tindex; i++)
{
if (map[i] == -1)
{
@@ -2474,7 +2499,7 @@ reorder_tokens (struct dfa *d)
if (multibyte_prop != NULL)
multibyte_prop[map[i]] = d->multibyte_prop[i];
- for (ptrdiff_t j = 0; j < d->follows[i].nelem; j++)
+ for (idx_t j = 0; j < d->follows[i].nelem; j++)
{
if (map[d->follows[i].elems[j].index] == -1)
map[d->follows[i].elems[j].index] = nleaves++;
@@ -2486,7 +2511,7 @@ reorder_tokens (struct dfa *d)
sizeof *d->follows[i].elems, compare);
}
- for (ptrdiff_t i = 0; i < nleaves; i++)
+ for (idx_t i = 0; i < nleaves; i++)
{
d->tokens[i] = tokens[i];
d->follows[i] = follows[i];
@@ -2508,16 +2533,11 @@ reorder_tokens (struct dfa *d)
static void
dfaoptimize (struct dfa *d)
{
- char *flags;
- position_set merged0;
- position_set *merged;
+ char *flags = xzalloc (d->tindex);
- flags = xmalloc (d->tindex * sizeof *flags);
- memset (flags, 0, d->tindex * sizeof *flags);
-
- for (ptrdiff_t i = 0; i < d->tindex; i++)
+ for (idx_t i = 0; i < d->tindex; i++)
{
- for (ptrdiff_t j = 0; j < d->follows[i].nelem; j++)
+ for (idx_t j = 0; j < d->follows[i].nelem; j++)
{
if (d->follows[i].elems[j].index == i)
flags[d->follows[i].elems[j].index] |= OPT_REPEAT;
@@ -2532,12 +2552,13 @@ dfaoptimize (struct dfa *d)
flags[0] |= OPT_QUEUED;
- merged = &merged0;
+ position_set merged0;
+ position_set *merged = &merged0;
alloc_position_set (merged, d->nleaves);
d->constraints = xnmalloc (d->tindex, sizeof *d->constraints);
- for (ptrdiff_t i = 0; i < d->tindex; i++)
+ for (idx_t i = 0; i < d->tindex; i++)
if (flags[i] & OPT_QUEUED)
merge_nfa_state (d, i, flags, merged);
@@ -2617,8 +2638,8 @@ dfaanalyze (struct dfa *d, bool searchflag)
bool nullable;
/* Counts of firstpos and lastpos sets. */
- ptrdiff_t nfirstpos;
- ptrdiff_t nlastpos;
+ idx_t nfirstpos;
+ idx_t nlastpos;
} *stkalloc = xnmalloc (d->depth, sizeof *stkalloc), *stk = stkalloc;
position_set merged; /* Result of merging sets. */
@@ -2627,7 +2648,7 @@ dfaanalyze (struct dfa *d, bool searchflag)
#ifdef DEBUG
fprintf (stderr, "dfaanalyze:\n");
- for (ptrdiff_t i = 0; i < d->tindex; ++i)
+ for (idx_t i = 0; i < d->tindex; i++)
{
fprintf (stderr, " %td:", i);
prtok (d->tokens[i]);
@@ -2639,7 +2660,7 @@ dfaanalyze (struct dfa *d, bool searchflag)
alloc_position_set (&merged, d->nleaves);
d->follows = xcalloc (d->tindex, sizeof *d->follows);
- for (ptrdiff_t i = 0; i < d->tindex; ++i)
+ for (idx_t i = 0; i < d->tindex; i++)
{
switch (d->tokens[i])
{
@@ -2660,7 +2681,7 @@ dfaanalyze (struct dfa *d, bool searchflag)
tmp.elems = firstpos - stk[-1].nfirstpos;
tmp.nelem = stk[-1].nfirstpos;
position *p = lastpos - stk[-1].nlastpos;
- for (ptrdiff_t j = 0; j < stk[-1].nlastpos; j++)
+ for (idx_t j = 0; j < stk[-1].nlastpos; j++)
{
merge (&tmp, &d->follows[p[j].index], &merged);
copy (&merged, &d->follows[p[j].index]);
@@ -2680,7 +2701,7 @@ dfaanalyze (struct dfa *d, bool searchflag)
tmp.nelem = stk[-1].nfirstpos;
tmp.elems = firstpos - stk[-1].nfirstpos;
position *p = lastpos - stk[-1].nlastpos - stk[-2].nlastpos;
- for (ptrdiff_t j = 0; j < stk[-2].nlastpos; j++)
+ for (idx_t j = 0; j < stk[-2].nlastpos; j++)
{
merge (&tmp, &d->follows[p[j].index], &merged);
copy (&merged, &d->follows[p[j].index]);
@@ -2701,7 +2722,7 @@ dfaanalyze (struct dfa *d, bool searchflag)
else
{
position *p = lastpos - stk[-1].nlastpos - stk[-2].nlastpos;
- for (ptrdiff_t j = 0; j < stk[-1].nlastpos; j++)
+ for (idx_t j = 0; j < stk[-1].nlastpos; j++)
p[j] = p[j + stk[-2].nlastpos];
lastpos -= stk[-2].nlastpos;
stk[-2].nlastpos = stk[-1].nlastpos;
@@ -2750,13 +2771,13 @@ dfaanalyze (struct dfa *d, bool searchflag)
fprintf (stderr,
stk[-1].nullable ? " nullable: yes\n" : " nullable: no\n");
fprintf (stderr, " firstpos:");
- for (ptrdiff_t j = 0; j < stk[-1].nfirstpos; j++)
+ for (idx_t j = 0; j < stk[-1].nfirstpos; j++)
{
fprintf (stderr, " %td:", firstpos[j - stk[-1].nfirstpos].index);
prtok (d->tokens[firstpos[j - stk[-1].nfirstpos].index]);
}
fprintf (stderr, "\n lastpos:");
- for (ptrdiff_t j = 0; j < stk[-1].nlastpos; j++)
+ for (idx_t j = 0; j < stk[-1].nlastpos; j++)
{
fprintf (stderr, " %td:", lastpos[j - stk[-1].nlastpos].index);
prtok (d->tokens[lastpos[j - stk[-1].nlastpos].index]);
@@ -2772,7 +2793,7 @@ dfaanalyze (struct dfa *d, bool searchflag)
dfaoptimize (d);
#ifdef DEBUG
- for (ptrdiff_t i = 0; i < d->tindex; ++i)
+ for (idx_t i = 0; i < d->tindex; i++)
if (d->tokens[i] == BEG || d->tokens[i] < NOTCHAR
|| d->tokens[i] == BACKREF || d->tokens[i] == ANYCHAR
|| d->tokens[i] == MBCSET || d->tokens[i] >= CSET)
@@ -2780,7 +2801,7 @@ dfaanalyze (struct dfa *d, bool searchflag)
fprintf (stderr, "follows(%td:", i);
prtok (d->tokens[i]);
fprintf (stderr, "):");
- for (ptrdiff_t j = 0; j < d->follows[i].nelem; j++)
+ for (idx_t j = 0; j < d->follows[i].nelem; j++)
{
fprintf (stderr, " %td:", d->follows[i].elems[j].index);
prtok (d->tokens[d->follows[i].elems[j].index]);
@@ -2798,7 +2819,7 @@ dfaanalyze (struct dfa *d, bool searchflag)
d->separates = xnmalloc (d->tindex, sizeof *d->separates);
- for (ptrdiff_t i = 0; i < d->tindex; i++)
+ for (idx_t i = 0; i < d->tindex; i++)
{
d->separates[i] = 0;
@@ -2807,7 +2828,7 @@ dfaanalyze (struct dfa *d, bool searchflag)
if (prev_letter_dependent (d->constraints[i]))
d->separates[i] |= CTX_LETTER;
- for (ptrdiff_t j = 0; j < d->follows[i].nelem; j++)
+ for (idx_t j = 0; j < d->follows[i].nelem; j++)
{
if (prev_newline_dependent (d->follows[i].elems[j].constraint))
d->separates[i] |= CTX_NEWLINE;
@@ -2843,12 +2864,12 @@ realloc_trans_if_necessary (struct dfa *d)
if (oldalloc < d->sindex)
{
state_num **realtrans = d->trans ? d->trans - 2 : NULL;
- ptrdiff_t newalloc1 = realtrans ? d->tralloc + 2 : 0;
+ idx_t newalloc1 = realtrans ? d->tralloc + 2 : 0;
realtrans = xpalloc (realtrans, &newalloc1, d->sindex - oldalloc,
-1, sizeof *realtrans);
realtrans[0] = realtrans[1] = NULL;
d->trans = realtrans + 2;
- ptrdiff_t newalloc = d->tralloc = newalloc1 - 2;
+ idx_t newalloc = d->tralloc = newalloc1 - 2;
d->fails = xnrealloc (d->fails, newalloc, sizeof *d->fails);
d->success = xnrealloc (d->success, newalloc, sizeof *d->success);
d->newlines = xnrealloc (d->newlines, newalloc, sizeof *d->newlines);
@@ -2961,8 +2982,8 @@ build_state (state_num s, struct dfa *d, unsigned char uc)
/* Find the union of the follows of the positions of the group.
This is a hideously inefficient loop. Fix it someday. */
- for (ptrdiff_t j = 0; j < d->states[s].elems.nelem; j++)
- for (ptrdiff_t k = 0;
+ for (idx_t j = 0; j < d->states[s].elems.nelem; j++)
+ for (idx_t k = 0;
k < d->follows[d->states[s].elems.elems[j].index].nelem; ++k)
insert (d->follows[d->states[s].elems.elems[j].index].elems[k],
&follows);
@@ -2974,7 +2995,7 @@ build_state (state_num s, struct dfa *d, unsigned char uc)
charclass label;
fillset (&label);
- for (ptrdiff_t i = 0; i < follows.nelem; ++i)
+ for (idx_t i = 0; i < follows.nelem; i++)
{
charclass matches; /* Set of matching characters. */
position pos = follows.elems[i];
@@ -3095,7 +3116,7 @@ build_state (state_num s, struct dfa *d, unsigned char uc)
if (!mergeit)
{
mergeit = true;
- for (ptrdiff_t j = 0; mergeit && j < group.nelem; j++)
+ for (idx_t j = 0; mergeit && j < group.nelem; j++)
mergeit &= d->multibyte_prop[group.elems[j].index];
}
if (mergeit)
@@ -3346,7 +3367,7 @@ skip_remains_mb (struct dfa *d, unsigned char const *p,
static inline char *
dfaexec_main (struct dfa *d, char const *begin, char *end, bool allow_nl,
- size_t *count, bool multibyte)
+ ptrdiff_t *count, bool multibyte)
{
if (MAX_TRCOUNT <= d->sindex)
{
@@ -3404,7 +3425,7 @@ dfaexec_main (struct dfa *d, char const *begin, char
*end, bool allow_nl,
alloc_position_set (&d->mb_follows, d->nleaves);
}
- ptrdiff_t nlcount = 0;
+ idx_t nlcount = 0;
for (;;)
{
state_num *t;
@@ -3529,14 +3550,14 @@ dfaexec_main (struct dfa *d, char const *begin, char
*end, bool allow_nl,
static char *
dfaexec_mb (struct dfa *d, char const *begin, char *end,
- bool allow_nl, size_t *count, bool *backref)
+ bool allow_nl, ptrdiff_t *count, bool *backref)
{
return dfaexec_main (d, begin, end, allow_nl, count, true);
}
static char *
dfaexec_sb (struct dfa *d, char const *begin, char *end,
- bool allow_nl, size_t *count, bool *backref)
+ bool allow_nl, ptrdiff_t *count, bool *backref)
{
return dfaexec_main (d, begin, end, allow_nl, count, false);
}
@@ -3545,7 +3566,7 @@ dfaexec_sb (struct dfa *d, char const *begin, char *end,
any regexp that uses a construct not supported by this code. */
static char *
dfaexec_noop (struct dfa *d, char const *begin, char *end,
- bool allow_nl, size_t *count, bool *backref)
+ bool allow_nl, ptrdiff_t *count, bool *backref)
{
*backref = true;
return (char *) begin;
@@ -3557,7 +3578,7 @@ dfaexec_noop (struct dfa *d, char const *begin, char *end,
char *
dfaexec (struct dfa *d, char const *begin, char *end,
- bool allow_nl, size_t *count, bool *backref)
+ bool allow_nl, ptrdiff_t *count, bool *backref)
{
return d->dfaexec (d, begin, end, allow_nl, count, backref);
}
@@ -3594,7 +3615,7 @@ free_mbdata (struct dfa *d)
static bool _GL_ATTRIBUTE_PURE
dfa_supported (struct dfa const *d)
{
- for (ptrdiff_t i = 0; i < d->tindex; i++)
+ for (idx_t i = 0; i < d->tindex; i++)
{
switch (d->tokens[i])
{
@@ -3622,7 +3643,7 @@ maybe_disable_superset_dfa (struct dfa *d)
return;
bool have_backref = false;
- for (ptrdiff_t i = 0; i < d->tindex; ++i)
+ for (idx_t i = 0; i < d->tindex; i++)
{
switch (d->tokens[i])
{
@@ -3687,8 +3708,8 @@ dfassbuild (struct dfa *d)
bool have_achar = false;
bool have_nchar = false;
- ptrdiff_t j;
- for (ptrdiff_t i = j = 0; i < d->tindex; i++)
+ idx_t j;
+ for (idx_t i = j = 0; i < d->tindex; i++)
{
switch (d->tokens[i])
{
@@ -3741,7 +3762,7 @@ dfassbuild (struct dfa *d)
Then analyze D and build a matcher for it.
SEARCHFLAG says whether to build a searching or an exact matcher. */
void
-dfacomp (char const *s, size_t len, struct dfa *d, bool searchflag)
+dfacomp (char const *s, idx_t len, struct dfa *d, bool searchflag)
{
if (s != NULL)
dfaparse (s, len, d);
@@ -3778,7 +3799,7 @@ dfafree (struct dfa *d)
free (d->constraints);
free (d->separates);
- for (ptrdiff_t i = 0; i < d->sindex; ++i)
+ for (idx_t i = 0; i < d->sindex; i++)
{
free (d->states[i].elems.elems);
free (d->states[i].mbps.elems);
@@ -3787,14 +3808,14 @@ dfafree (struct dfa *d)
if (d->follows)
{
- for (ptrdiff_t i = 0; i < d->tindex; ++i)
+ for (idx_t i = 0; i < d->tindex; i++)
free (d->follows[i].elems);
free (d->follows);
}
if (d->trans)
{
- for (ptrdiff_t i = 0; i < d->tralloc; ++i)
+ for (idx_t i = 0; i < d->tralloc; i++)
{
free (d->trans[i]);
free (d->fails[i]);
@@ -3898,10 +3919,10 @@ dfafree (struct dfa *d)
static char *
icatalloc (char *old, char const *new)
{
- ptrdiff_t newsize = strlen (new);
+ idx_t newsize = strlen (new);
if (newsize == 0)
return old;
- ptrdiff_t oldsize = strlen (old);
+ idx_t oldsize = strlen (old);
char *result = xrealloc (old, oldsize + newsize + 1);
memcpy (result + oldsize, new, newsize + 1);
return result;
@@ -3915,12 +3936,12 @@ freelist (char **cpp)
}
static char **
-enlist (char **cpp, char *new, ptrdiff_t len)
+enlist (char **cpp, char *new, idx_t len)
{
new = memcpy (xmalloc (len + 1), new, len);
new[len] = '\0';
/* Is there already something in the list that's new (or longer)? */
- ptrdiff_t i;
+ idx_t i;
for (i = 0; cpp[i] != NULL; i++)
if (strstr (cpp[i], new) != NULL)
{
@@ -3928,7 +3949,7 @@ enlist (char **cpp, char *new, ptrdiff_t len)
return cpp;
}
/* Eliminate any obsoleted strings. */
- for (ptrdiff_t j = 0; cpp[j] != NULL; )
+ for (idx_t j = 0; cpp[j] != NULL; )
if (strstr (new, cpp[j]) == NULL)
++j;
else
@@ -3955,11 +3976,11 @@ comsubs (char *left, char const *right)
for (char *lcp = left; *lcp != '\0'; lcp++)
{
- ptrdiff_t len = 0;
+ idx_t len = 0;
char *rcp = strchr (right, *lcp);
while (rcp != NULL)
{
- ptrdiff_t i;
+ idx_t i;
for (i = 1; lcp[i] != '\0' && lcp[i] == rcp[i]; ++i)
continue;
if (i > len)
@@ -3987,9 +4008,9 @@ inboth (char **left, char **right)
{
char **both = xzalloc (sizeof *both);
- for (ptrdiff_t lnum = 0; left[lnum] != NULL; lnum++)
+ for (idx_t lnum = 0; left[lnum] != NULL; lnum++)
{
- for (ptrdiff_t rnum = 0; right[rnum] != NULL; rnum++)
+ for (idx_t rnum = 0; right[rnum] != NULL; rnum++)
{
char **temp = comsubs (left[lnum], right[rnum]);
both = addlists (both, temp);
@@ -4014,7 +4035,7 @@ struct must
};
static must *
-allocmust (must *mp, ptrdiff_t size)
+allocmust (must *mp, idx_t size)
{
must *new_mp = xmalloc (sizeof *new_mp);
new_mp->in = xzalloc (sizeof *new_mp->in);
@@ -4058,9 +4079,9 @@ dfamust (struct dfa const *d)
bool endline = false;
bool need_begline = false;
bool need_endline = false;
- bool case_fold_unibyte = d->syntax.case_fold && MB_CUR_MAX == 1;
+ bool case_fold_unibyte = d->syntax.case_fold & !d->localeinfo.multibyte;
- for (ptrdiff_t ri = 1; ri + 1 < d->tindex; ri++)
+ for (idx_t ri = 1; ri + 1 < d->tindex; ri++)
{
token t = d->tokens[ri];
switch (t)
@@ -4100,7 +4121,7 @@ dfamust (struct dfa const *d)
char **new;
must *rmp = mp;
must *lmp = mp = mp->prev;
- ptrdiff_t j, ln, rn, n;
+ idx_t j, ln, rn, n;
/* Guaranteed to be. Unlikely, but ... */
if (streq (lmp->is, rmp->is))
@@ -4115,7 +4136,7 @@ dfamust (struct dfa const *d)
lmp->endline = false;
}
/* Left side--easy */
- ptrdiff_t i = 0;
+ idx_t i = 0;
while (lmp->left[i] != '\0' && lmp->left[i] == rmp->left[i])
++i;
lmp->left[i] = '\0';
@@ -4145,7 +4166,7 @@ dfamust (struct dfa const *d)
case END:
assert (!mp->prev);
- for (ptrdiff_t i = 0; mp->in[i] != NULL; i++)
+ for (idx_t i = 0; mp->in[i] != NULL; i++)
if (strlen (mp->in[i]) > strlen (result))
result = mp->in[i];
if (streq (result, mp->is))
@@ -4169,8 +4190,8 @@ dfamust (struct dfa const *d)
lmp->in = addlists (lmp->in, rmp->in);
if (lmp->right[0] != '\0' && rmp->left[0] != '\0')
{
- ptrdiff_t lrlen = strlen (lmp->right);
- ptrdiff_t rllen = strlen (rmp->left);
+ idx_t lrlen = strlen (lmp->right);
+ idx_t rllen = strlen (rmp->left);
char *tp = xmalloc (lrlen + rllen);
memcpy (tp, lmp->right, lrlen);
memcpy (tp + lrlen, rmp->left, rllen);
@@ -4235,7 +4256,7 @@ dfamust (struct dfa const *d)
}
}
- ptrdiff_t rj = ri + 2;
+ idx_t rj = ri + 2;
if (d->tokens[ri + 1] == CAT)
{
for (; rj < d->tindex - 1; rj += 2)
@@ -4250,7 +4271,7 @@ dfamust (struct dfa const *d)
mp->is[0] = mp->left[0] = mp->right[0]
= case_fold_unibyte ? toupper (t) : t;
- ptrdiff_t i;
+ idx_t i;
for (i = 1; ri + 2 < rj; i++)
{
ri += 2;
@@ -4295,7 +4316,7 @@ dfamustfree (struct dfamust *dm)
struct dfa *
dfaalloc (void)
{
- return xzalloc (sizeof (struct dfa));
+ return xmalloc (sizeof (struct dfa));
}
/* Initialize DFA. */
@@ -4310,7 +4331,6 @@ dfasyntax (struct dfa *dfa, struct localeinfo const
*linfo,
dfa->fast = !dfa->localeinfo.multibyte;
dfa->canychar = -1;
- dfa->lex.cur_mb_len = 1;
dfa->syntax.syntax_bits_set = true;
dfa->syntax.case_fold = (bits & RE_ICASE) != 0;
dfa->syntax.anchor = (dfaopts & DFA_ANCHOR) != 0;
@@ -4340,4 +4360,16 @@ dfasyntax (struct dfa *dfa, struct localeinfo const
*linfo,
}
}
+/* Initialize TO by copying FROM's syntax settings. */
+void
+dfacopysyntax (struct dfa *to, struct dfa const *from)
+{
+ memset (to, 0, offsetof (struct dfa, syntax));
+ to->canychar = -1;
+ to->fast = from->fast;
+ to->syntax = from->syntax;
+ to->dfaexec = from->dfaexec;
+ to->localeinfo = from->localeinfo;
+}
+
/* vim:set shiftwidth=2: */
diff --git a/support/dfa.h b/support/dfa.h
index 53d6d33..0da597f 100644
--- a/support/dfa.h
+++ b/support/dfa.h
@@ -37,12 +37,18 @@ struct dfamust
/* The dfa structure. It is completely opaque. */
struct dfa;
+/* Needed when Gnulib is not used. */
+#ifndef _GL_ATTRIBUTE_MALLOC
+# define _GL_ATTRIBUTE_MALLOC
+#endif
+
/* Entry points. */
/* Allocate a struct dfa. The struct dfa is completely opaque.
+ It should be initialized via dfasyntax or dfacopysyntax before other use.
The returned pointer should be passed directly to free() after
calling dfafree() on it. */
-extern struct dfa *dfaalloc (void) /* _GL_ATTRIBUTE_MALLOC */;
+extern struct dfa *dfaalloc (void) _GL_ATTRIBUTE_MALLOC;
/* DFA options that can be ORed together, for dfasyntax's 4th arg. */
enum
@@ -56,8 +62,7 @@ enum
DFA_EOL_NUL = 1 << 1
};
-/* Initialize or reinitialize a DFA. This must be called before
- any of the routines below. The arguments are:
+/* Initialize or reinitialize a DFA. The arguments are:
1. The DFA to operate on.
2. Information about the current locale.
3. Syntax bits described in regex.h.
@@ -65,8 +70,11 @@ enum
extern void dfasyntax (struct dfa *, struct localeinfo const *,
reg_syntax_t, int);
+/* Initialize or reinitialize a DFA from an already-initialized DFA. */
+extern void dfacopysyntax (struct dfa *, struct dfa const *);
+
/* Parse the given string of given length into the given struct dfa. */
-extern void dfaparse (char const *, size_t, struct dfa *);
+extern void dfaparse (char const *, ptrdiff_t, struct dfa *);
/* Allocate and return a struct dfamust from a struct dfa that was
initialized by dfaparse and not yet given to dfacomp. */
@@ -79,7 +87,7 @@ extern void dfamustfree (struct dfamust *);
The last argument says whether to build a searching or an exact matcher.
A null first argument means the struct dfa has already been
initialized by dfaparse; the second argument is ignored. */
-extern void dfacomp (char const *, size_t, struct dfa *, bool);
+extern void dfacomp (char const *, ptrdiff_t, struct dfa *, bool);
/* Search through a buffer looking for a match to the given struct dfa.
Find the first occurrence of a string matching the regexp in the
@@ -94,7 +102,7 @@ extern void dfacomp (char const *, size_t, struct dfa *,
bool);
encountered a back-reference. The caller can use this to decide
whether to fall back on a backtracking matcher. */
extern char *dfaexec (struct dfa *d, char const *begin, char *end,
- bool allow_nl, size_t *count, bool *backref);
+ bool allow_nl, ptrdiff_t *count, bool *backref);
/* Return a superset for D. The superset matches everything that D
matches, along with some other strings (though the latter should be
@@ -105,11 +113,6 @@ extern struct dfa *dfasuperset (struct dfa const *d)
_GL_ATTRIBUTE_PURE;
/* The DFA is likely to be fast. */
extern bool dfaisfast (struct dfa const *) _GL_ATTRIBUTE_PURE;
-/* Copy the syntax settings from one dfa instance to another.
- Saves considerable computation time if compiling many regular expressions
- based on the same setting. */
-extern void dfacopysyntax (struct dfa *to, const struct dfa *from);
-
/* Free the storage held by the components of a struct dfa. */
extern void dfafree (struct dfa *);
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=0e81d1df1aaa8f4b281efe9f63f5fd05e6e9ef9a
commit 0e81d1df1aaa8f4b281efe9f63f5fd05e6e9ef9a
Author: Arnold D. Robbins <address@hidden>
Date: Fri Dec 20 12:33:37 2019 +0200
Sanitization fix from Paul Eggert.
diff --git a/ChangeLog b/ChangeLog
index 4311db1..a589fb3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-12-18 Paul Eggert <address@hidden>
+
+ Fix memcpy issue found by -fsanitize=undefined
+ * field.c (set_record): Don't memcpy (databuf, NULL, 0),
+ as the C standard says the resulting behavior is undefined.
+
2019-12-16 Arnold D. Robbins <address@hidden>
* awkgram.y, command.y: Upgrade to Bison 3.5.
diff --git a/field.c b/field.c
index 8c7fe18..28891c8 100644
--- a/field.c
+++ b/field.c
@@ -288,7 +288,9 @@ set_record(const char *buf, int cnt, const
awk_fieldwidth_info_t *fw)
memset(databuf, '\0', databuf_size);
}
/* copy the data */
- memcpy(databuf, buf, cnt);
+ if (cnt != 0) {
+ memcpy(databuf, buf, cnt);
+ }
/*
* Add terminating '\0' so that C library routines
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=ef3481f8b2564bbe9c3c43cbced3e8edc9608fb0
commit ef3481f8b2564bbe9c3c43cbced3e8edc9608fb0
Author: Arnold D. Robbins <address@hidden>
Date: Mon Dec 16 21:55:41 2019 +0200
Update to Bison 3.5.
diff --git a/ChangeLog b/ChangeLog
index e9a543e..4311db1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-16 Arnold D. Robbins <address@hidden>
+
+ * awkgram.y, command.y: Upgrade to Bison 3.5.
+ * NEWS: Updated.
+
2019-11-21 Arnold D. Robbins <address@hidden>
* config.rpath: Update from GNULIB.
diff --git a/NEWS b/NEWS
index 4c8dcdf..c8a2c5b 100644
--- a/NEWS
+++ b/NEWS
@@ -12,7 +12,7 @@ Changes from 5.0.1 to 5.1.0
2. A number of memory leak issues have been fixed.
-3. Infrastructure upgrades: Bison 3.4.2, Texinfo 6.7.
+3. Infrastructure upgrades: Bison 3.5, Texinfo 6.7.
4. The indexing in the manual has been thoroughly revised, in particular
making use of the facilities in Texinfo 6.7. That version (or newer)
diff --git a/awkgram.c b/awkgram.c
index 3358629..63ea7a1 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 3.4.2. */
+/* A Bison parser, made by GNU Bison 3.5. */
/* Bison implementation for Yacc-like parsers in C
@@ -48,7 +48,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "3.4.2"
+#define YYBISON_VERSION "3.5"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -233,6 +233,15 @@ extern double fmod(double x, double y);
#line 235 "awkgram.c"
+# ifndef YY_CAST
+# ifdef __cplusplus
+# define YY_CAST(Type, Val) static_cast<Type> (Val)
+# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
+# else
+# define YY_CAST(Type, Val) ((Type) (Val))
+# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
+# endif
+# endif
# ifndef YY_NULLPTR
# if defined __cplusplus
# if 201103L <= __cplusplus
@@ -397,28 +406,75 @@ int yyparse (void);
# undef short
#endif
-#ifdef YYTYPE_UINT8
-typedef YYTYPE_UINT8 yytype_uint8;
-#else
-typedef unsigned char yytype_uint8;
+/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
+ <limits.h> and (if available) <stdint.h> are included
+ so that the code can choose integer types of a good width. */
+
+#ifndef __PTRDIFF_MAX__
+# include <limits.h> /* INFRINGES ON USER NAME SPACE */
+# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
+# include <stdint.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_STDINT_H
+# endif
#endif
-#ifdef YYTYPE_INT8
-typedef YYTYPE_INT8 yytype_int8;
+/* Narrow types that promote to a signed type and that can represent a
+ signed or unsigned integer of at least N bits. In tables they can
+ save space and decrease cache pressure. Promoting to a signed type
+ helps avoid bugs in integer arithmetic. */
+
+#ifdef __INT_LEAST8_MAX__
+typedef __INT_LEAST8_TYPE__ yytype_int8;
+#elif defined YY_STDINT_H
+typedef int_least8_t yytype_int8;
#else
typedef signed char yytype_int8;
#endif
-#ifdef YYTYPE_UINT16
-typedef YYTYPE_UINT16 yytype_uint16;
+#ifdef __INT_LEAST16_MAX__
+typedef __INT_LEAST16_TYPE__ yytype_int16;
+#elif defined YY_STDINT_H
+typedef int_least16_t yytype_int16;
#else
-typedef unsigned short yytype_uint16;
+typedef short yytype_int16;
#endif
-#ifdef YYTYPE_INT16
-typedef YYTYPE_INT16 yytype_int16;
+#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST8_TYPE__ yytype_uint8;
+#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
+ && UINT_LEAST8_MAX <= INT_MAX)
+typedef uint_least8_t yytype_uint8;
+#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
+typedef unsigned char yytype_uint8;
#else
-typedef short yytype_int16;
+typedef short yytype_uint8;
+#endif
+
+#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST16_TYPE__ yytype_uint16;
+#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
+ && UINT_LEAST16_MAX <= INT_MAX)
+typedef uint_least16_t yytype_uint16;
+#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
+typedef unsigned short yytype_uint16;
+#else
+typedef int yytype_uint16;
+#endif
+
+#ifndef YYPTRDIFF_T
+# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
+# define YYPTRDIFF_T __PTRDIFF_TYPE__
+# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
+# elif defined PTRDIFF_MAX
+# ifndef ptrdiff_t
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# endif
+# define YYPTRDIFF_T ptrdiff_t
+# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
+# else
+# define YYPTRDIFF_T long
+# define YYPTRDIFF_MAXIMUM LONG_MAX
+# endif
#endif
#ifndef YYSIZE_T
@@ -426,7 +482,7 @@ typedef short yytype_int16;
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T
+# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
@@ -434,7 +490,19 @@ typedef short yytype_int16;
# endif
#endif
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+#define YYSIZE_MAXIMUM \
+ YY_CAST (YYPTRDIFF_T, \
+ (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
+ ? YYPTRDIFF_MAXIMUM \
+ : YY_CAST (YYSIZE_T, -1)))
+
+#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
+
+/* Stored state numbers (used for stacks). */
+typedef yytype_int16 yy_state_t;
+
+/* State numbers in computations. */
+typedef int yy_state_fast_t;
#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
@@ -448,22 +516,20 @@ typedef short yytype_int16;
# endif
#endif
-#ifndef YY_ATTRIBUTE
-# if (defined __GNUC__ \
- && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
- || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
-# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+#ifndef YY_ATTRIBUTE_PURE
+# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
+# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
# else
-# define YY_ATTRIBUTE(Spec) /* empty */
+# define YY_ATTRIBUTE_PURE
# endif
#endif
-#ifndef YY_ATTRIBUTE_PURE
-# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
-#endif
-
#ifndef YY_ATTRIBUTE_UNUSED
-# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
+# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+# else
+# define YY_ATTRIBUTE_UNUSED
+# endif
#endif
/* Suppress unused-variable warnings by "using" E. */
@@ -475,11 +541,11 @@ typedef short yytype_int16;
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 +
__GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
# define YY_INITIAL_VALUE(Value) Value
@@ -492,6 +558,18 @@ typedef short yytype_int16;
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
+#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
+# define YY_IGNORE_USELESS_CAST_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
+# define YY_IGNORE_USELESS_CAST_END \
+ _Pragma ("GCC diagnostic pop")
+#endif
+#ifndef YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_END
+#endif
+
#define YY_ASSERT(E) ((void) (0 && (E)))
@@ -570,17 +648,17 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
/* A type that is properly aligned for any stack member. */
union yyalloc
{
- yytype_int16 yyss_alloc;
+ yy_state_t yyss_alloc;
YYSTYPE yyvs_alloc;
};
/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
# define YYCOPY_NEEDED 1
@@ -593,11 +671,11 @@ union yyalloc
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
- YYSIZE_T yynewbytes; \
+ YYPTRDIFF_T yynewbytes; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
+ yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / YYSIZEOF (*yyptr); \
} \
while (0)
@@ -609,12 +687,12 @@ union yyalloc
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(Dst, Src, Count) \
- __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
+ __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof
(*(Src)))
# else
# define YYCOPY(Dst, Src, Count) \
do \
{ \
- YYSIZE_T yyi; \
+ YYPTRDIFF_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
@@ -640,14 +718,15 @@ union yyalloc
#define YYUNDEFTOK 2
#define YYMAXUTOK 310
+
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, with out-of-bounds checking. */
#define YYTRANSLATE(YYX) \
- ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+ (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
as returned by yylex. */
-static const yytype_uint8 yytranslate[] =
+static const yytype_int8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -685,7 +764,7 @@ static const yytype_uint8 yytranslate[] =
#if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
-static const yytype_uint16 yyrline[] =
+static const yytype_int16 yyrline[] =
{
0, 232, 232, 233, 238, 248, 252, 264, 272, 286,
297, 307, 317, 330, 340, 342, 347, 357, 359, 364,
@@ -750,7 +829,7 @@ static const char *const yytname[] =
# ifdef YYPRINT
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
(internal) symbol number NUM (which must be that of a token). */
-static const yytype_uint16 yytoknum[] =
+static const yytype_int16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
@@ -763,15 +842,15 @@ static const yytype_uint16 yytoknum[] =
};
# endif
-#define YYPACT_NINF -283
+#define YYPACT_NINF (-283)
-#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-283)))
+#define yypact_value_is_default(Yyn) \
+ ((Yyn) == YYPACT_NINF)
-#define YYTABLE_NINF -119
+#define YYTABLE_NINF (-119)
-#define yytable_value_is_error(Yytable_value) \
- (!!((Yytable_value) == (-119)))
+#define yytable_value_is_error(Yyn) \
+ ((Yyn) == YYTABLE_NINF)
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
@@ -1204,7 +1283,7 @@ static const yytype_uint8 yyr1[] =
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
+static const yytype_int8 yyr2[] =
{
0, 2, 0, 2, 2, 2, 2, 2, 2, 2,
4, 4, 4, 1, 2, 1, 1, 2, 1, 1,
@@ -1338,7 +1417,7 @@ yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const *
const yyvaluep)
`------------------------------------------------------------------*/
static void
-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
@@ -1361,12 +1440,12 @@ do {
\
`------------------------------------------------*/
static void
-yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
+yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule)
{
- unsigned long yylno = yyrline[yyrule];
+ int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
@@ -1418,13 +1497,13 @@ int yydebug;
# ifndef yystrlen
# if defined __GLIBC__ && defined _STRING_H
-# define yystrlen strlen
+# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
# else
/* Return the length of YYSTR. */
-static YYSIZE_T
+static YYPTRDIFF_T
yystrlen (const char *yystr)
{
- YYSIZE_T yylen;
+ YYPTRDIFF_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
continue;
return yylen;
@@ -1460,12 +1539,12 @@ yystpcpy (char *yydest, const char *yysrc)
backslash-backslash). YYSTR is taken from yytname. If YYRES is
null, do not copy; instead, return the length of what the result
would have been. */
-static YYSIZE_T
+static YYPTRDIFF_T
yytnamerr (char *yyres, const char *yystr)
{
if (*yystr == '"')
{
- YYSIZE_T yyn = 0;
+ YYPTRDIFF_T yyn = 0;
char const *yyp = yystr;
for (;;)
@@ -1496,10 +1575,10 @@ yytnamerr (char *yyres, const char *yystr)
do_not_strip_quotes: ;
}
- if (! yyres)
+ if (yyres)
+ return yystpcpy (yyres, yystr) - yyres;
+ else
return yystrlen (yystr);
-
- return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
}
# endif
@@ -1512,19 +1591,19 @@ yytnamerr (char *yyres, const char *yystr)
*YYMSG_ALLOC to the required number of bytes. Return 2 if the
required number of bytes is too large to store. */
static int
-yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
- yytype_int16 *yyssp, int yytoken)
+yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
+ yy_state_t *yyssp, int yytoken)
{
- YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
- YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULLPTR;
- /* Arguments of yyformat. */
+ /* Arguments of yyformat: reported tokens (one for the "unexpected",
+ one per "expected"). */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- /* Number of reported tokens (one for the "unexpected", one per
- "expected"). */
+ /* Actual size of YYARG. */
int yycount = 0;
+ /* Cumulated lengths of YYARG. */
+ YYPTRDIFF_T yysize = 0;
/* There are many possibilities here to consider:
- If this state is a consistent state with a default action, then
@@ -1552,6 +1631,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
+ YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
+ yysize = yysize0;
yyarg[yycount++] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
@@ -1576,7 +1657,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
}
yyarg[yycount++] = yytname[yyx];
{
- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR,
yytname[yyx]);
+ YYPTRDIFF_T yysize1
+ = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1;
else
@@ -1603,7 +1685,9 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
}
{
- YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+ /* Don't count the "%s"s in the final size, but reserve room for
+ the terminator. */
+ YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1;
else
@@ -1633,8 +1717,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
}
else
{
- yyp++;
- yyformat++;
+ ++yyp;
+ ++yyformat;
}
}
return 0;
@@ -1677,7 +1761,7 @@ int yynerrs;
int
yyparse (void)
{
- int yystate;
+ yy_state_fast_t yystate;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
@@ -1689,16 +1773,16 @@ yyparse (void)
to reallocate them elsewhere. */
/* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss;
- yytype_int16 *yyssp;
+ yy_state_t yyssa[YYINITDEPTH];
+ yy_state_t *yyss;
+ yy_state_t *yyssp;
/* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs;
YYSTYPE *yyvsp;
- YYSIZE_T yystacksize;
+ YYPTRDIFF_T yystacksize;
int yyn;
int yyresult;
@@ -1712,7 +1796,7 @@ yyparse (void)
/* Buffer for error messages, and its allocated size. */
char yymsgbuf[128];
char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+ YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
#endif
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
@@ -1744,12 +1828,14 @@ yynewstate:
/*--------------------------------------------------------------------.
-| yynewstate -- set current state (the top of the stack) to yystate. |
+| yysetstate -- set current state (the top of the stack) to yystate. |
`--------------------------------------------------------------------*/
yysetstate:
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
- *yyssp = (yytype_int16) yystate;
+ YY_IGNORE_USELESS_CAST_BEGIN
+ *yyssp = YY_CAST (yy_state_t, yystate);
+ YY_IGNORE_USELESS_CAST_END
if (yyss + yystacksize - 1 <= yyssp)
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
@@ -1757,23 +1843,23 @@ yysetstate:
#else
{
/* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
+ YYPTRDIFF_T yysize = yyssp - yyss + 1;
# if defined yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
memory. */
+ yy_state_t *yyss1 = yyss;
YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
be undefined if yyoverflow is a macro. */
yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
+ &yyss1, yysize * YYSIZEOF (*yyssp),
+ &yyvs1, yysize * YYSIZEOF (*yyvsp),
&yystacksize);
yyss = yyss1;
yyvs = yyvs1;
@@ -1787,9 +1873,10 @@ yysetstate:
yystacksize = YYMAXDEPTH;
{
- yytype_int16 *yyss1 = yyss;
+ yy_state_t *yyss1 = yyss;
union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ YY_CAST (union yyalloc *,
+ YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES
(yystacksize))));
if (! yyptr)
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss_alloc, yyss);
@@ -1803,8 +1890,10 @@ yysetstate:
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long) yystacksize));
+ YY_IGNORE_USELESS_CAST_BEGIN
+ YYDPRINTF ((stderr, "Stack size increased to %ld\n",
+ YY_CAST (long, yystacksize)));
+ YY_IGNORE_USELESS_CAST_END
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
@@ -1870,14 +1959,13 @@ yybackup:
/* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-
- /* Discard the shifted token. */
- yychar = YYEMPTY;
-
yystate = yyn;
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+ /* Discard the shifted token. */
+ yychar = YYEMPTY;
goto yynewstate;
@@ -1914,22 +2002,22 @@ yyreduce:
{
case 2:
#line 232 "awkgram.y"
- { yyval = NULL; }
-#line 1919 "awkgram.c"
+ { yyval = NULL; }
+#line 2007 "awkgram.c"
break;
case 3:
#line 234 "awkgram.y"
- {
+ {
rule = 0;
yyerrok;
}
-#line 1928 "awkgram.c"
+#line 2016 "awkgram.c"
break;
case 4:
#line 239 "awkgram.y"
- {
+ {
if (yyvsp[0] != NULL) {
if (yyvsp[-1] == NULL)
outer_comment = yyvsp[0];
@@ -1938,20 +2026,20 @@ yyreduce:
}
yyval = yyvsp[-1];
}
-#line 1942 "awkgram.c"
+#line 2030 "awkgram.c"
break;
case 5:
#line 249 "awkgram.y"
- {
+ {
next_sourcefile();
}
-#line 1950 "awkgram.c"
+#line 2038 "awkgram.c"
break;
case 6:
#line 253 "awkgram.y"
- {
+ {
rule = 0;
/*
* If errors, give up, don't produce an infinite
@@ -1959,24 +2047,24 @@ yyreduce:
*/
/* yyerrok; */
}
-#line 1963 "awkgram.c"
+#line 2051 "awkgram.c"
break;
case 7:
#line 265 "awkgram.y"
- {
+ {
(void) append_rule(yyvsp[-1], yyvsp[0]);
if (pending_comment != NULL) {
interblock_comment = pending_comment;
pending_comment = NULL;
}
}
-#line 1975 "awkgram.c"
+#line 2063 "awkgram.c"
break;
case 8:
#line 273 "awkgram.y"
- {
+ {
if (rule != Rule) {
msg(_("%s blocks must have an action part"),
ruletab[rule]);
errcount++;
@@ -1989,12 +2077,12 @@ yyreduce:
(void) append_rule(yyvsp[-1], NULL);
}
}
-#line 1993 "awkgram.c"
+#line 2081 "awkgram.c"
break;
case 9:
#line 287 "awkgram.y"
- {
+ {
in_function = false;
(void) mk_function(yyvsp[-1], yyvsp[0]);
want_param_names = DONT_CHECK;
@@ -2004,12 +2092,12 @@ yyreduce:
}
yyerrok;
}
-#line 2008 "awkgram.c"
+#line 2096 "awkgram.c"
break;
case 10:
#line 298 "awkgram.y"
- {
+ {
want_source = false;
at_seen = false;
if (yyvsp[-1] != NULL && yyvsp[0] != NULL) {
@@ -2018,12 +2106,12 @@ yyreduce:
}
yyerrok;
}
-#line 2022 "awkgram.c"
+#line 2110 "awkgram.c"
break;
case 11:
#line 308 "awkgram.y"
- {
+ {
want_source = false;
at_seen = false;
if (yyvsp[-1] != NULL && yyvsp[0] != NULL) {
@@ -2032,12 +2120,12 @@ yyreduce:
}
yyerrok;
}
-#line 2036 "awkgram.c"
+#line 2124 "awkgram.c"
break;
case 12:
#line 318 "awkgram.y"
- {
+ {
want_source = false;
at_seen = false;
@@ -2046,12 +2134,12 @@ yyreduce:
yyerrok;
}
-#line 2050 "awkgram.c"
+#line 2138 "awkgram.c"
break;
case 13:
#line 331 "awkgram.y"
- {
+ {
void *srcfile = NULL;
if (! include_source(yyvsp[0], & srcfile))
@@ -2060,24 +2148,24 @@ yyreduce:
bcfree(yyvsp[0]);
yyval = (INSTRUCTION *) srcfile;
}
-#line 2064 "awkgram.c"
+#line 2152 "awkgram.c"
break;
case 14:
#line 341 "awkgram.y"
- { yyval = NULL; }
-#line 2070 "awkgram.c"
+ { yyval = NULL; }
+#line 2158 "awkgram.c"
break;
case 15:
#line 343 "awkgram.y"
- { yyval = NULL; }
-#line 2076 "awkgram.c"
+ { yyval = NULL; }
+#line 2164 "awkgram.c"
break;
case 16:
#line 348 "awkgram.y"
- {
+ {
void *srcfile;
if (! load_library(yyvsp[0], & srcfile))
@@ -2086,59 +2174,59 @@ yyreduce:
bcfree(yyvsp[0]);
yyval = (INSTRUCTION *) srcfile;
}
-#line 2090 "awkgram.c"
+#line 2178 "awkgram.c"
break;
case 17:
#line 358 "awkgram.y"
- { yyval = NULL; }
-#line 2096 "awkgram.c"
+ { yyval = NULL; }
+#line 2184 "awkgram.c"
break;
case 18:
#line 360 "awkgram.y"
- { yyval = NULL; }
-#line 2102 "awkgram.c"
+ { yyval = NULL; }
+#line 2190 "awkgram.c"
break;
case 19:
#line 365 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 2108 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 2196 "awkgram.c"
break;
case 20:
#line 367 "awkgram.y"
- { yyval = NULL; }
-#line 2114 "awkgram.c"
+ { yyval = NULL; }
+#line 2202 "awkgram.c"
break;
case 21:
#line 369 "awkgram.y"
- { yyval = NULL; }
-#line 2120 "awkgram.c"
+ { yyval = NULL; }
+#line 2208 "awkgram.c"
break;
case 22:
#line 374 "awkgram.y"
- {
+ {
rule = Rule;
yyval = NULL;
}
-#line 2129 "awkgram.c"
+#line 2217 "awkgram.c"
break;
case 23:
#line 379 "awkgram.y"
- {
+ {
rule = Rule;
}
-#line 2137 "awkgram.c"
+#line 2225 "awkgram.c"
break;
case 24:
#line 384 "awkgram.y"
- {
+ {
INSTRUCTION *tp;
add_lint(yyvsp[-2], LINT_assign_in_cond);
@@ -2167,12 +2255,12 @@ yyreduce:
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]),
tp);
rule = Rule;
}
-#line 2171 "awkgram.c"
+#line 2259 "awkgram.c"
break;
case 25:
#line 414 "awkgram.y"
- {
+ {
static int begin_seen = 0;
if (do_lint_old && ++begin_seen == 2)
@@ -2183,12 +2271,12 @@ yyreduce:
yyvsp[0]->source_file = source;
yyval = yyvsp[0];
}
-#line 2187 "awkgram.c"
+#line 2275 "awkgram.c"
break;
case 26:
#line 426 "awkgram.y"
- {
+ {
static int end_seen = 0;
if (do_lint_old && ++end_seen == 2)
@@ -2199,32 +2287,32 @@ yyreduce:
yyvsp[0]->source_file = source;
yyval = yyvsp[0];
}
-#line 2203 "awkgram.c"
+#line 2291 "awkgram.c"
break;
case 27:
#line 438 "awkgram.y"
- {
+ {
yyvsp[0]->in_rule = rule = BEGINFILE;
yyvsp[0]->source_file = source;
yyval = yyvsp[0];
}
-#line 2213 "awkgram.c"
+#line 2301 "awkgram.c"
break;
case 28:
#line 444 "awkgram.y"
- {
+ {
yyvsp[0]->in_rule = rule = ENDFILE;
yyvsp[0]->source_file = source;
yyval = yyvsp[0];
}
-#line 2223 "awkgram.c"
+#line 2311 "awkgram.c"
break;
case 29:
#line 453 "awkgram.y"
- {
+ {
INSTRUCTION *ip = make_braced_statements(yyvsp[-4], yyvsp[-3],
yyvsp[-2]);
if (yyvsp[-2] != NULL && yyvsp[0] != NULL) {
@@ -2238,12 +2326,12 @@ yyreduce:
yyval = ip;
}
-#line 2242 "awkgram.c"
+#line 2330 "awkgram.c"
break;
case 31:
#line 472 "awkgram.y"
- {
+ {
const char *name = yyvsp[0]->lextok;
char *qname = qualify_name(name, strlen(name));
@@ -2253,37 +2341,37 @@ yyreduce:
}
yyval = yyvsp[0];
}
-#line 2257 "awkgram.c"
+#line 2345 "awkgram.c"
break;
case 32:
#line 483 "awkgram.y"
- {
+ {
yyerror(_("`%s' is a built-in function, it cannot be
redefined"),
tokstart);
YYABORT;
}
-#line 2267 "awkgram.c"
+#line 2355 "awkgram.c"
break;
case 33:
#line 489 "awkgram.y"
- {
+ {
yyval = yyvsp[0];
at_seen = false;
}
-#line 2276 "awkgram.c"
+#line 2364 "awkgram.c"
break;
case 36:
#line 501 "awkgram.y"
- { want_param_names = FUNC_HEADER; }
-#line 2282 "awkgram.c"
+ { want_param_names = FUNC_HEADER; }
+#line 2370 "awkgram.c"
break;
case 37:
#line 502 "awkgram.y"
- {
+ {
INSTRUCTION *func_comment = NULL;
// Merge any comments found in the parameter list with those
// following the function header, associate the whole shebang
@@ -2308,18 +2396,18 @@ yyreduce:
yyval = yyvsp[-6];
want_param_names = FUNC_BODY;
}
-#line 2312 "awkgram.c"
+#line 2400 "awkgram.c"
break;
case 38:
#line 535 "awkgram.y"
- { want_regexp = true; }
-#line 2318 "awkgram.c"
+ { want_regexp = true; }
+#line 2406 "awkgram.c"
break;
case 39:
#line 537 "awkgram.y"
- {
+ {
NODE *n, *exp;
char *re;
size_t len;
@@ -2347,12 +2435,12 @@ yyreduce:
yyval->opcode = Op_match_rec;
yyval->memory = n;
}
-#line 2351 "awkgram.c"
+#line 2439 "awkgram.c"
break;
case 40:
#line 569 "awkgram.y"
- {
+ {
char *re;
size_t len;
@@ -2364,24 +2452,24 @@ yyreduce:
yyval->opcode = Op_push_re;
yyval->memory = make_typed_regex(re, len);
}
-#line 2368 "awkgram.c"
+#line 2456 "awkgram.c"
break;
case 41:
#line 584 "awkgram.y"
- { bcfree(yyvsp[0]); }
-#line 2374 "awkgram.c"
+ { bcfree(yyvsp[0]); }
+#line 2462 "awkgram.c"
break;
case 43:
#line 590 "awkgram.y"
- { yyval = NULL; }
-#line 2380 "awkgram.c"
+ { yyval = NULL; }
+#line 2468 "awkgram.c"
break;
case 44:
#line 592 "awkgram.y"
- {
+ {
if (yyvsp[0] == NULL) {
yyval = yyvsp[-1];
} else {
@@ -2400,30 +2488,30 @@ yyreduce:
yyerrok;
}
-#line 2404 "awkgram.c"
+#line 2492 "awkgram.c"
break;
case 45:
#line 612 "awkgram.y"
- { yyval = NULL; }
-#line 2410 "awkgram.c"
+ { yyval = NULL; }
+#line 2498 "awkgram.c"
break;
case 46:
#line 616 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 2416 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 2504 "awkgram.c"
break;
case 47:
#line 617 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 2422 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 2510 "awkgram.c"
break;
case 48:
#line 622 "awkgram.y"
- {
+ {
if (yyvsp[0] != NULL) {
INSTRUCTION *ip;
@@ -2433,32 +2521,32 @@ yyreduce:
} else
yyval = NULL;
}
-#line 2437 "awkgram.c"
+#line 2525 "awkgram.c"
break;
case 49:
#line 633 "awkgram.y"
- {
+ {
trailing_comment = yyvsp[0]; // NULL or comment
yyval = make_braced_statements(yyvsp[-2], yyvsp[-1], yyvsp[0]);
}
-#line 2446 "awkgram.c"
+#line 2534 "awkgram.c"
break;
case 50:
#line 638 "awkgram.y"
- {
+ {
if (do_pretty_print)
yyval = list_prepend(yyvsp[0],
instruction(Op_exec_count));
else
yyval = yyvsp[0];
}
-#line 2457 "awkgram.c"
+#line 2545 "awkgram.c"
break;
case 51:
#line 645 "awkgram.y"
- {
+ {
INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt;
INSTRUCTION *ip, *nextc, *tbreak;
const char **case_values = NULL;
@@ -2565,12 +2653,12 @@ yyreduce:
break_allowed--;
fix_break_continue(ip, tbreak, NULL);
}
-#line 2569 "awkgram.c"
+#line 2657 "awkgram.c"
break;
case 52:
#line 753 "awkgram.y"
- {
+ {
/*
* -----------------
* tc:
@@ -2620,12 +2708,12 @@ yyreduce:
continue_allowed--;
fix_break_continue(ip, tbreak, tcont);
}
-#line 2624 "awkgram.c"
+#line 2712 "awkgram.c"
break;
case 53:
#line 804 "awkgram.y"
- {
+ {
/*
* -----------------
* z:
@@ -2674,12 +2762,12 @@ yyreduce:
/* else
$1 and $4 are NULLs */
}
-#line 2678 "awkgram.c"
+#line 2766 "awkgram.c"
break;
case 54:
#line 854 "awkgram.y"
- {
+ {
INSTRUCTION *ip;
char *var_name = yyvsp[-5]->lextok;
@@ -2804,12 +2892,12 @@ regular_loop:
break_allowed--;
continue_allowed--;
}
-#line 2808 "awkgram.c"
+#line 2896 "awkgram.c"
break;
case 55:
#line 980 "awkgram.y"
- {
+ {
if (yyvsp[-7] != NULL) {
merge_comments(yyvsp[-7], NULL);
yyvsp[-11]->comment = yyvsp[-7];
@@ -2829,12 +2917,12 @@ regular_loop:
break_allowed--;
continue_allowed--;
}
-#line 2833 "awkgram.c"
+#line 2921 "awkgram.c"
break;
case 56:
#line 1001 "awkgram.y"
- {
+ {
if (yyvsp[-6] != NULL) {
merge_comments(yyvsp[-6], NULL);
yyvsp[-10]->comment = yyvsp[-6];
@@ -2854,23 +2942,23 @@ regular_loop:
break_allowed--;
continue_allowed--;
}
-#line 2858 "awkgram.c"
+#line 2946 "awkgram.c"
break;
case 57:
#line 1022 "awkgram.y"
- {
+ {
if (do_pretty_print)
yyval = list_prepend(yyvsp[0],
instruction(Op_exec_count));
else
yyval = yyvsp[0];
}
-#line 2869 "awkgram.c"
+#line 2957 "awkgram.c"
break;
case 58:
#line 1032 "awkgram.y"
- {
+ {
if (! break_allowed)
error_ln(yyvsp[-1]->source_line,
_("`break' is not allowed outside a loop or
switch"));
@@ -2879,12 +2967,12 @@ regular_loop:
if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]);
}
-#line 2883 "awkgram.c"
+#line 2971 "awkgram.c"
break;
case 59:
#line 1042 "awkgram.y"
- {
+ {
if (! continue_allowed)
error_ln(yyvsp[-1]->source_line,
_("`continue' is not allowed outside a loop"));
@@ -2893,12 +2981,12 @@ regular_loop:
if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]);
}
-#line 2897 "awkgram.c"
+#line 2985 "awkgram.c"
break;
case 60:
#line 1052 "awkgram.y"
- {
+ {
/* if inside function (rule = 0), resolve context at run-time */
if (rule && rule != Rule)
error_ln(yyvsp[-1]->source_line,
@@ -2908,12 +2996,12 @@ regular_loop:
if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]);
}
-#line 2912 "awkgram.c"
+#line 3000 "awkgram.c"
break;
case 61:
#line 1063 "awkgram.y"
- {
+ {
/* if inside function (rule = 0), resolve context at run-time */
if (rule == BEGIN || rule == END || rule == ENDFILE)
error_ln(yyvsp[-1]->source_line,
@@ -2925,12 +3013,12 @@ regular_loop:
if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]);
}
-#line 2929 "awkgram.c"
+#line 3017 "awkgram.c"
break;
case 62:
#line 1076 "awkgram.y"
- {
+ {
/* Initialize the two possible jump targets, the actual target
* is resolved at run-time.
*/
@@ -2946,21 +3034,21 @@ regular_loop:
if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]);
}
-#line 2950 "awkgram.c"
+#line 3038 "awkgram.c"
break;
case 63:
#line 1093 "awkgram.y"
- {
+ {
if (! in_function)
yyerror(_("`return' used outside function context"));
}
-#line 2959 "awkgram.c"
+#line 3047 "awkgram.c"
break;
case 64:
#line 1096 "awkgram.y"
- {
+ {
if (called_from_eval)
yyvsp[-3]->opcode = Op_K_return_from_eval;
@@ -2973,29 +3061,29 @@ regular_loop:
if (yyvsp[0] != NULL)
yyval = list_append(yyval, yyvsp[0]);
}
-#line 2977 "awkgram.c"
+#line 3065 "awkgram.c"
break;
case 65:
#line 1110 "awkgram.y"
- {
+ {
if (yyvsp[0] != NULL)
yyval = list_append(yyvsp[-1], yyvsp[0]);
else
yyval = yyvsp[-1];
}
-#line 2988 "awkgram.c"
+#line 3076 "awkgram.c"
break;
case 66:
#line 1127 "awkgram.y"
- { in_print = true; in_parens = 0; }
-#line 2994 "awkgram.c"
+ { in_print = true; in_parens = 0; }
+#line 3082 "awkgram.c"
break;
case 67:
#line 1128 "awkgram.y"
- {
+ {
/*
* Optimization: plain `print' has no expression list, so $3 is
null.
* If $3 is NULL or is a bytecode list for $0 use
Op_K_print_rec,
@@ -3095,18 +3183,18 @@ regular_print:
}
}
}
-#line 3099 "awkgram.c"
+#line 3187 "awkgram.c"
break;
case 68:
#line 1229 "awkgram.y"
- { sub_counter = 0; }
-#line 3105 "awkgram.c"
+ { sub_counter = 0; }
+#line 3193 "awkgram.c"
break;
case 69:
#line 1230 "awkgram.y"
- {
+ {
char *arr = yyvsp[-2]->lextok;
yyvsp[-2]->opcode = Op_push_array;
@@ -3138,12 +3226,12 @@ regular_print:
yyval = list_append(list_append(yyvsp[0], yyvsp[-2]),
yyvsp[-3]);
}
}
-#line 3142 "awkgram.c"
+#line 3230 "awkgram.c"
break;
case 70:
#line 1267 "awkgram.y"
- {
+ {
static bool warned = false;
char *arr = yyvsp[-1]->lextok;
@@ -3168,55 +3256,55 @@ regular_print:
fatal(_("`delete' is not allowed with
FUNCTAB"));
}
}
-#line 3172 "awkgram.c"
+#line 3260 "awkgram.c"
break;
case 71:
#line 1293 "awkgram.y"
- {
+ {
yyval = optimize_assignment(yyvsp[0]);
}
-#line 3180 "awkgram.c"
+#line 3268 "awkgram.c"
break;
case 72:
#line 1300 "awkgram.y"
- { yyval = NULL; }
-#line 3186 "awkgram.c"
+ { yyval = NULL; }
+#line 3274 "awkgram.c"
break;
case 73:
#line 1302 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3192 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3280 "awkgram.c"
break;
case 74:
#line 1307 "awkgram.y"
- { yyval = NULL; }
-#line 3198 "awkgram.c"
+ { yyval = NULL; }
+#line 3286 "awkgram.c"
break;
case 75:
#line 1309 "awkgram.y"
- {
+ {
if (yyvsp[-1] == NULL)
yyval = list_create(yyvsp[0]);
else
yyval = list_prepend(yyvsp[-1], yyvsp[0]);
}
-#line 3209 "awkgram.c"
+#line 3297 "awkgram.c"
break;
case 76:
#line 1316 "awkgram.y"
- { yyval = NULL; }
-#line 3215 "awkgram.c"
+ { yyval = NULL; }
+#line 3303 "awkgram.c"
break;
case 77:
#line 1321 "awkgram.y"
- {
+ {
INSTRUCTION *casestmt = yyvsp[0];
if (yyvsp[0] == NULL)
casestmt = list_create(instruction(Op_no_op));
@@ -3228,12 +3316,12 @@ regular_print:
bcfree(yyvsp[-2]);
yyval = yyvsp[-4];
}
-#line 3232 "awkgram.c"
+#line 3320 "awkgram.c"
break;
case 78:
#line 1334 "awkgram.y"
- {
+ {
INSTRUCTION *casestmt = yyvsp[0];
if (yyvsp[0] == NULL)
casestmt = list_create(instruction(Op_no_op));
@@ -3244,105 +3332,105 @@ regular_print:
yyvsp[-3]->comment = yyvsp[-1];
yyval = yyvsp[-3];
}
-#line 3248 "awkgram.c"
+#line 3336 "awkgram.c"
break;
case 79:
#line 1349 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3254 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3342 "awkgram.c"
break;
case 80:
#line 1351 "awkgram.y"
- {
+ {
NODE *n = yyvsp[0]->memory;
(void) force_number(n);
negate_num(n);
bcfree(yyvsp[-1]);
yyval = yyvsp[0];
}
-#line 3266 "awkgram.c"
+#line 3354 "awkgram.c"
break;
case 81:
#line 1359 "awkgram.y"
- {
+ {
NODE *n = yyvsp[0]->lasti->memory;
bcfree(yyvsp[-1]);
add_sign_to_num(n, '+');
yyval = yyvsp[0];
}
-#line 3277 "awkgram.c"
+#line 3365 "awkgram.c"
break;
case 82:
#line 1366 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3283 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3371 "awkgram.c"
break;
case 83:
#line 1368 "awkgram.y"
- {
+ {
if (yyvsp[0]->memory->type == Node_regex)
yyvsp[0]->opcode = Op_push_re;
else
yyvsp[0]->opcode = Op_push;
yyval = yyvsp[0];
}
-#line 3295 "awkgram.c"
+#line 3383 "awkgram.c"
break;
case 84:
#line 1376 "awkgram.y"
- {
+ {
assert((yyvsp[0]->memory->flags & REGEX) == REGEX);
yyvsp[0]->opcode = Op_push_re;
yyval = yyvsp[0];
}
-#line 3305 "awkgram.c"
+#line 3393 "awkgram.c"
break;
case 85:
#line 1385 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3311 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3399 "awkgram.c"
break;
case 86:
#line 1387 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3317 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3405 "awkgram.c"
break;
case 88:
#line 1397 "awkgram.y"
- {
+ {
yyval = yyvsp[-1];
}
-#line 3325 "awkgram.c"
+#line 3413 "awkgram.c"
break;
case 89:
#line 1404 "awkgram.y"
- {
+ {
in_print = false;
in_parens = 0;
yyval = NULL;
}
-#line 3335 "awkgram.c"
+#line 3423 "awkgram.c"
break;
case 90:
#line 1409 "awkgram.y"
- { in_print = false; in_parens = 0; }
-#line 3341 "awkgram.c"
+ { in_print = false; in_parens = 0; }
+#line 3429 "awkgram.c"
break;
case 91:
#line 1410 "awkgram.y"
- {
+ {
if (yyvsp[-2]->redir_type == redirect_twoway
&& yyvsp[0]->lasti->opcode == Op_K_getline_redir
&& yyvsp[0]->lasti->redir_type ==
redirect_twoway)
@@ -3351,42 +3439,42 @@ regular_print:
lintwarn(_("concatenation as I/O `>' redirection target
is ambiguous"));
yyval = list_prepend(yyvsp[0], yyvsp[-2]);
}
-#line 3355 "awkgram.c"
+#line 3443 "awkgram.c"
break;
case 92:
#line 1423 "awkgram.y"
- {
+ {
if (yyvsp[-1] != NULL)
yyvsp[-5]->comment = yyvsp[-1];
yyval = mk_condition(yyvsp[-3], yyvsp[-5], yyvsp[0], NULL,
NULL);
}
-#line 3365 "awkgram.c"
+#line 3453 "awkgram.c"
break;
case 93:
#line 1430 "awkgram.y"
- {
+ {
if (yyvsp[-4] != NULL)
yyvsp[-8]->comment = yyvsp[-4];
if (yyvsp[-1] != NULL)
yyvsp[-2]->comment = yyvsp[-1];
yyval = mk_condition(yyvsp[-6], yyvsp[-8], yyvsp[-3],
yyvsp[-2], yyvsp[0]);
}
-#line 3377 "awkgram.c"
+#line 3465 "awkgram.c"
break;
case 94:
#line 1441 "awkgram.y"
- {
+ {
yyval = yyvsp[0];
}
-#line 3385 "awkgram.c"
+#line 3473 "awkgram.c"
break;
case 95:
#line 1445 "awkgram.y"
- {
+ {
if (yyvsp[-1] != NULL && yyvsp[0] != NULL) {
if (yyvsp[-1]->memory->comment_type == EOL_COMMENT) {
assert(yyvsp[0]->memory->comment_type ==
BLOCK_COMMENT);
@@ -3403,60 +3491,60 @@ regular_print:
} else
yyval = NULL;
}
-#line 3407 "awkgram.c"
+#line 3495 "awkgram.c"
break;
case 96:
#line 1466 "awkgram.y"
- { yyval = NULL; }
-#line 3413 "awkgram.c"
+ { yyval = NULL; }
+#line 3501 "awkgram.c"
break;
case 97:
#line 1468 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3419 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3507 "awkgram.c"
break;
case 98:
#line 1473 "awkgram.y"
- { yyval = NULL; }
-#line 3425 "awkgram.c"
+ { yyval = NULL; }
+#line 3513 "awkgram.c"
break;
case 99:
#line 1475 "awkgram.y"
- {
+ {
bcfree(yyvsp[-1]);
yyval = yyvsp[0];
}
-#line 3434 "awkgram.c"
+#line 3522 "awkgram.c"
break;
case 100:
#line 1483 "awkgram.y"
- { yyval = NULL; }
-#line 3440 "awkgram.c"
+ { yyval = NULL; }
+#line 3528 "awkgram.c"
break;
case 101:
#line 1485 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3446 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3534 "awkgram.c"
break;
case 102:
#line 1490 "awkgram.y"
- {
+ {
yyvsp[0]->param_count = 0;
yyval = list_create(yyvsp[0]);
}
-#line 3455 "awkgram.c"
+#line 3543 "awkgram.c"
break;
case 103:
#line 1495 "awkgram.y"
- {
+ {
if (yyvsp[-2] != NULL && yyvsp[0] != NULL) {
yyvsp[0]->param_count = yyvsp[-2]->lasti->param_count +
1;
yyval = list_append(yyvsp[-2], yyvsp[0]);
@@ -3472,219 +3560,219 @@ regular_print:
} else
yyval = NULL;
}
-#line 3476 "awkgram.c"
+#line 3564 "awkgram.c"
break;
case 104:
#line 1512 "awkgram.y"
- { yyval = NULL; }
-#line 3482 "awkgram.c"
+ { yyval = NULL; }
+#line 3570 "awkgram.c"
break;
case 105:
#line 1514 "awkgram.y"
- { yyval = yyvsp[-1]; }
-#line 3488 "awkgram.c"
+ { yyval = yyvsp[-1]; }
+#line 3576 "awkgram.c"
break;
case 106:
#line 1516 "awkgram.y"
- { yyval = yyvsp[-2]; }
-#line 3494 "awkgram.c"
+ { yyval = yyvsp[-2]; }
+#line 3582 "awkgram.c"
break;
case 107:
#line 1522 "awkgram.y"
- { yyval = NULL; }
-#line 3500 "awkgram.c"
+ { yyval = NULL; }
+#line 3588 "awkgram.c"
break;
case 108:
#line 1524 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3506 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3594 "awkgram.c"
break;
case 109:
#line 1529 "awkgram.y"
- { yyval = NULL; }
-#line 3512 "awkgram.c"
+ { yyval = NULL; }
+#line 3600 "awkgram.c"
break;
case 110:
#line 1531 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3518 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3606 "awkgram.c"
break;
case 111:
#line 1536 "awkgram.y"
- { yyval = mk_expression_list(NULL, yyvsp[0]); }
-#line 3524 "awkgram.c"
+ { yyval = mk_expression_list(NULL, yyvsp[0]); }
+#line 3612 "awkgram.c"
break;
case 112:
#line 1538 "awkgram.y"
- {
+ {
if (yyvsp[-1] != NULL)
yyvsp[-2]->lasti->comment = yyvsp[-1];
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
yyerrok;
}
-#line 3535 "awkgram.c"
+#line 3623 "awkgram.c"
break;
case 113:
#line 1545 "awkgram.y"
- { yyval = NULL; }
-#line 3541 "awkgram.c"
+ { yyval = NULL; }
+#line 3629 "awkgram.c"
break;
case 114:
#line 1547 "awkgram.y"
- {
+ {
/*
* Returning the expression list instead of NULL lets
* snode get a list of arguments that it can count.
*/
yyval = yyvsp[-1];
}
-#line 3553 "awkgram.c"
+#line 3641 "awkgram.c"
break;
case 115:
#line 1555 "awkgram.y"
- {
+ {
/* Ditto */
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
}
-#line 3562 "awkgram.c"
+#line 3650 "awkgram.c"
break;
case 116:
#line 1560 "awkgram.y"
- {
+ {
/* Ditto */
if (yyvsp[-1] != NULL)
yyvsp[-2]->lasti->comment = yyvsp[-1];
yyval = yyvsp[-2];
}
-#line 3573 "awkgram.c"
+#line 3661 "awkgram.c"
break;
case 117:
#line 1570 "awkgram.y"
- { yyval = NULL; }
-#line 3579 "awkgram.c"
+ { yyval = NULL; }
+#line 3667 "awkgram.c"
break;
case 118:
#line 1572 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3585 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3673 "awkgram.c"
break;
case 119:
#line 1577 "awkgram.y"
- { yyval = mk_expression_list(NULL, yyvsp[0]); }
-#line 3591 "awkgram.c"
+ { yyval = mk_expression_list(NULL, yyvsp[0]); }
+#line 3679 "awkgram.c"
break;
case 120:
#line 1579 "awkgram.y"
- {
+ {
if (yyvsp[-1] != NULL)
yyvsp[-2]->lasti->comment = yyvsp[-1];
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
yyerrok;
}
-#line 3602 "awkgram.c"
+#line 3690 "awkgram.c"
break;
case 121:
#line 1586 "awkgram.y"
- { yyval = NULL; }
-#line 3608 "awkgram.c"
+ { yyval = NULL; }
+#line 3696 "awkgram.c"
break;
case 122:
#line 1588 "awkgram.y"
- {
+ {
/*
* Returning the expression list instead of NULL lets
* snode get a list of arguments that it can count.
*/
yyval = yyvsp[-1];
}
-#line 3620 "awkgram.c"
+#line 3708 "awkgram.c"
break;
case 123:
#line 1596 "awkgram.y"
- {
+ {
/* Ditto */
yyval = mk_expression_list(yyvsp[-2], yyvsp[0]);
}
-#line 3629 "awkgram.c"
+#line 3717 "awkgram.c"
break;
case 124:
#line 1601 "awkgram.y"
- {
+ {
/* Ditto */
if (yyvsp[-1] != NULL)
yyvsp[-2]->comment = yyvsp[-1];
yyval = yyvsp[-2];
}
-#line 3640 "awkgram.c"
+#line 3728 "awkgram.c"
break;
case 125:
#line 1610 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3646 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3734 "awkgram.c"
break;
case 126:
#line 1611 "awkgram.y"
- { yyval = list_create(yyvsp[0]); }
-#line 3652 "awkgram.c"
+ { yyval = list_create(yyvsp[0]); }
+#line 3740 "awkgram.c"
break;
case 127:
#line 1617 "awkgram.y"
- {
+ {
if (do_lint && yyvsp[0]->lasti->opcode == Op_match_rec)
lintwarn_ln(yyvsp[-1]->source_line,
_("regular expression on right of assignment"));
yyval = mk_assignment(yyvsp[-2], yyvsp[0], yyvsp[-1]);
}
-#line 3663 "awkgram.c"
+#line 3751 "awkgram.c"
break;
case 128:
#line 1624 "awkgram.y"
- {
+ {
yyval = mk_assignment(yyvsp[-2], list_create(yyvsp[0]),
yyvsp[-1]);
}
-#line 3671 "awkgram.c"
+#line 3759 "awkgram.c"
break;
case 129:
#line 1628 "awkgram.y"
- { yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3677 "awkgram.c"
+ { yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
+#line 3765 "awkgram.c"
break;
case 130:
#line 1630 "awkgram.y"
- { yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3683 "awkgram.c"
+ { yyval = mk_boolean(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
+#line 3771 "awkgram.c"
break;
case 131:
#line 1632 "awkgram.y"
- {
+ {
if (yyvsp[-2]->lasti->opcode == Op_match_rec)
warning_ln(yyvsp[-1]->source_line,
_("regular expression on left of `~' or `!~'
operator"));
@@ -3696,12 +3784,12 @@ regular_print:
bcfree(yyvsp[0]);
yyval = list_append(yyvsp[-2], yyvsp[-1]);
}
-#line 3700 "awkgram.c"
+#line 3788 "awkgram.c"
break;
case 132:
#line 1645 "awkgram.y"
- {
+ {
if (yyvsp[-2]->lasti->opcode == Op_match_rec)
warning_ln(yyvsp[-1]->source_line,
_("regular expression on left of `~' or `!~'
operator"));
@@ -3717,12 +3805,12 @@ regular_print:
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]),
yyvsp[-1]);
}
}
-#line 3721 "awkgram.c"
+#line 3809 "awkgram.c"
break;
case 133:
#line 1662 "awkgram.y"
- {
+ {
if (do_lint_old)
lintwarn_ln(yyvsp[-1]->source_line,
_("old awk does not support the keyword `in'
except after `for'"));
@@ -3731,92 +3819,92 @@ regular_print:
yyvsp[-1]->expr_count = 1;
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]);
}
-#line 3735 "awkgram.c"
+#line 3823 "awkgram.c"
break;
case 134:
#line 1672 "awkgram.y"
- {
+ {
if (do_lint && yyvsp[0]->lasti->opcode == Op_match_rec)
lintwarn_ln(yyvsp[-1]->source_line,
_("regular expression on right of comparison"));
yyval = list_append(list_merge(yyvsp[-2], yyvsp[0]), yyvsp[-1]);
}
-#line 3746 "awkgram.c"
+#line 3834 "awkgram.c"
break;
case 135:
#line 1679 "awkgram.y"
- { yyval = mk_condition(yyvsp[-4], yyvsp[-3], yyvsp[-2], yyvsp[-1],
yyvsp[0]); }
-#line 3752 "awkgram.c"
+ { yyval = mk_condition(yyvsp[-4], yyvsp[-3], yyvsp[-2], yyvsp[-1],
yyvsp[0]); }
+#line 3840 "awkgram.c"
break;
case 136:
#line 1681 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3758 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3846 "awkgram.c"
break;
case 137:
#line 1686 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3764 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3852 "awkgram.c"
break;
case 138:
#line 1688 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3770 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3858 "awkgram.c"
break;
case 139:
#line 1690 "awkgram.y"
- {
+ {
yyvsp[0]->opcode = Op_assign_quotient;
yyval = yyvsp[0];
}
-#line 3779 "awkgram.c"
+#line 3867 "awkgram.c"
break;
case 140:
#line 1698 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3785 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3873 "awkgram.c"
break;
case 141:
#line 1700 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3791 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3879 "awkgram.c"
break;
case 142:
#line 1705 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3797 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3885 "awkgram.c"
break;
case 143:
#line 1707 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3803 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3891 "awkgram.c"
break;
case 144:
#line 1712 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3809 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3897 "awkgram.c"
break;
case 145:
#line 1714 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 3815 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 3903 "awkgram.c"
break;
case 146:
#line 1716 "awkgram.y"
- {
+ {
int count = 2;
bool is_simple_var = false;
@@ -3869,48 +3957,48 @@ regular_print:
max_args = count;
}
}
-#line 3873 "awkgram.c"
+#line 3961 "awkgram.c"
break;
case 148:
#line 1775 "awkgram.y"
- { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3879 "awkgram.c"
+ { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
+#line 3967 "awkgram.c"
break;
case 149:
#line 1777 "awkgram.y"
- { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3885 "awkgram.c"
+ { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
+#line 3973 "awkgram.c"
break;
case 150:
#line 1779 "awkgram.y"
- { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3891 "awkgram.c"
+ { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
+#line 3979 "awkgram.c"
break;
case 151:
#line 1781 "awkgram.y"
- { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3897 "awkgram.c"
+ { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
+#line 3985 "awkgram.c"
break;
case 152:
#line 1783 "awkgram.y"
- { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3903 "awkgram.c"
+ { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
+#line 3991 "awkgram.c"
break;
case 153:
#line 1785 "awkgram.y"
- { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3909 "awkgram.c"
+ { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
+#line 3997 "awkgram.c"
break;
case 154:
#line 1787 "awkgram.y"
- {
+ {
/*
* In BEGINFILE/ENDFILE, allow `getline [var] < file'
*/
@@ -3923,30 +4011,30 @@ regular_print:
_("non-redirected `getline' undefined inside
END action"));
yyval = mk_getline(yyvsp[-2], yyvsp[-1], yyvsp[0],
redirect_input);
}
-#line 3927 "awkgram.c"
+#line 4015 "awkgram.c"
break;
case 155:
#line 1801 "awkgram.y"
- {
+ {
yyvsp[0]->opcode = Op_postincrement;
yyval = mk_assignment(yyvsp[-1], NULL, yyvsp[0]);
}
-#line 3936 "awkgram.c"
+#line 4024 "awkgram.c"
break;
case 156:
#line 1806 "awkgram.y"
- {
+ {
yyvsp[0]->opcode = Op_postdecrement;
yyval = mk_assignment(yyvsp[-1], NULL, yyvsp[0]);
}
-#line 3945 "awkgram.c"
+#line 4033 "awkgram.c"
break;
case 157:
#line 1811 "awkgram.y"
- {
+ {
if (do_lint_old) {
/* first one is warning so that second one comes out if
warnings are fatal */
warning_ln(yyvsp[-1]->source_line,
@@ -3966,65 +4054,65 @@ regular_print:
yyval = list_append(list_merge(t, yyvsp[0]), yyvsp[-1]);
}
}
-#line 3970 "awkgram.c"
+#line 4058 "awkgram.c"
break;
case 158:
#line 1837 "awkgram.y"
- {
+ {
yyval = mk_getline(yyvsp[-1], yyvsp[0], yyvsp[-3],
yyvsp[-2]->redir_type);
bcfree(yyvsp[-2]);
}
-#line 3979 "awkgram.c"
+#line 4067 "awkgram.c"
break;
case 159:
#line 1843 "awkgram.y"
- { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3985 "awkgram.c"
+ { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
+#line 4073 "awkgram.c"
break;
case 160:
#line 1845 "awkgram.y"
- { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3991 "awkgram.c"
+ { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
+#line 4079 "awkgram.c"
break;
case 161:
#line 1847 "awkgram.y"
- { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 3997 "awkgram.c"
+ { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
+#line 4085 "awkgram.c"
break;
case 162:
#line 1849 "awkgram.y"
- { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 4003 "awkgram.c"
+ { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
+#line 4091 "awkgram.c"
break;
case 163:
#line 1851 "awkgram.y"
- { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 4009 "awkgram.c"
+ { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
+#line 4097 "awkgram.c"
break;
case 164:
#line 1853 "awkgram.y"
- { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
-#line 4015 "awkgram.c"
+ { yyval = mk_binary(yyvsp[-2], yyvsp[0], yyvsp[-1]); }
+#line 4103 "awkgram.c"
break;
case 165:
#line 1858 "awkgram.y"
- {
+ {
yyval = list_create(yyvsp[0]);
}
-#line 4023 "awkgram.c"
+#line 4111 "awkgram.c"
break;
case 166:
#line 1862 "awkgram.y"
- {
+ {
if (yyvsp[0]->opcode == Op_match_rec) {
yyvsp[0]->opcode = Op_nomatch;
yyvsp[-1]->opcode = Op_push_i;
@@ -4055,44 +4143,44 @@ regular_print:
}
}
}
-#line 4059 "awkgram.c"
+#line 4147 "awkgram.c"
break;
case 167:
#line 1894 "awkgram.y"
- {
+ {
// Always include. Allows us to lint warn on
// print "foo" > "bar" 1
// but not warn on
// print "foo" > ("bar" 1)
yyval = list_append(yyvsp[-1], bcalloc(Op_parens, 1,
sourceline));
}
-#line 4071 "awkgram.c"
+#line 4159 "awkgram.c"
break;
case 168:
#line 1902 "awkgram.y"
- {
+ {
yyval = snode(yyvsp[-1], yyvsp[-3]);
if (yyval == NULL)
YYABORT;
}
-#line 4081 "awkgram.c"
+#line 4169 "awkgram.c"
break;
case 169:
#line 1908 "awkgram.y"
- {
+ {
yyval = snode(yyvsp[-1], yyvsp[-3]);
if (yyval == NULL)
YYABORT;
}
-#line 4091 "awkgram.c"
+#line 4179 "awkgram.c"
break;
case 170:
#line 1914 "awkgram.y"
- {
+ {
static bool warned = false;
if (do_lint && ! warned) {
@@ -4104,46 +4192,46 @@ regular_print:
if (yyval == NULL)
YYABORT;
}
-#line 4108 "awkgram.c"
+#line 4196 "awkgram.c"
break;
case 173:
#line 1929 "awkgram.y"
- {
+ {
yyvsp[-1]->opcode = Op_preincrement;
yyval = mk_assignment(yyvsp[0], NULL, yyvsp[-1]);
}
-#line 4117 "awkgram.c"
+#line 4205 "awkgram.c"
break;
case 174:
#line 1934 "awkgram.y"
- {
+ {
yyvsp[-1]->opcode = Op_predecrement;
yyval = mk_assignment(yyvsp[0], NULL, yyvsp[-1]);
}
-#line 4126 "awkgram.c"
+#line 4214 "awkgram.c"
break;
case 175:
#line 1939 "awkgram.y"
- {
+ {
yyval = list_create(yyvsp[0]);
}
-#line 4134 "awkgram.c"
+#line 4222 "awkgram.c"
break;
case 176:
#line 1943 "awkgram.y"
- {
+ {
yyval = list_create(yyvsp[0]);
}
-#line 4142 "awkgram.c"
+#line 4230 "awkgram.c"
break;
case 177:
#line 1947 "awkgram.y"
- {
+ {
if (yyvsp[0]->lasti->opcode == Op_push_i
&& (yyvsp[0]->lasti->memory->flags & STRING) == 0
) {
@@ -4157,12 +4245,12 @@ regular_print:
yyval = list_append(yyvsp[0], yyvsp[-1]);
}
}
-#line 4161 "awkgram.c"
+#line 4249 "awkgram.c"
break;
case 178:
#line 1962 "awkgram.y"
- {
+ {
if (yyvsp[0]->lasti->opcode == Op_push_i
&& (yyvsp[0]->lasti->memory->flags & STRING) == 0
&& (yyvsp[0]->lasti->memory->flags & NUMCONSTSTR) != 0)
{
@@ -4179,21 +4267,21 @@ regular_print:
yyval = list_append(yyvsp[0], yyvsp[-1]);
}
}
-#line 4183 "awkgram.c"
+#line 4271 "awkgram.c"
break;
case 179:
#line 1983 "awkgram.y"
- {
+ {
func_use(yyvsp[0]->lasti->func_name, FUNC_USE);
yyval = yyvsp[0];
}
-#line 4192 "awkgram.c"
+#line 4280 "awkgram.c"
break;
case 180:
#line 1988 "awkgram.y"
- {
+ {
/* indirect function call */
INSTRUCTION *f, *t;
char *name;
@@ -4226,12 +4314,12 @@ regular_print:
yyval = list_prepend(yyvsp[0], t);
at_seen = false;
}
-#line 4230 "awkgram.c"
+#line 4318 "awkgram.c"
break;
case 181:
#line 2025 "awkgram.y"
- {
+ {
NODE *n;
char *name = yyvsp[-3]->func_name;
char *qname = qualify_name(name, strlen(name));
@@ -4263,50 +4351,50 @@ regular_print:
yyval = list_append(t, yyvsp[-3]);
}
}
-#line 4267 "awkgram.c"
+#line 4355 "awkgram.c"
break;
case 182:
#line 2061 "awkgram.y"
- { yyval = NULL; }
-#line 4273 "awkgram.c"
+ { yyval = NULL; }
+#line 4361 "awkgram.c"
break;
case 183:
#line 2063 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 4279 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 4367 "awkgram.c"
break;
case 184:
#line 2068 "awkgram.y"
- { yyval = NULL; }
-#line 4285 "awkgram.c"
+ { yyval = NULL; }
+#line 4373 "awkgram.c"
break;
case 185:
#line 2070 "awkgram.y"
- { yyval = yyvsp[-1]; }
-#line 4291 "awkgram.c"
+ { yyval = yyvsp[-1]; }
+#line 4379 "awkgram.c"
break;
case 186:
#line 2075 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 4297 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 4385 "awkgram.c"
break;
case 187:
#line 2077 "awkgram.y"
- {
+ {
yyval = list_merge(yyvsp[-1], yyvsp[0]);
}
-#line 4305 "awkgram.c"
+#line 4393 "awkgram.c"
break;
case 188:
#line 2084 "awkgram.y"
- {
+ {
INSTRUCTION *ip = yyvsp[0]->lasti;
int count = ip->sub_count; /* # of SUBSEP-seperated
expressions */
if (count > 1) {
@@ -4319,12 +4407,12 @@ regular_print:
sub_counter++; /* count # of dimensions */
yyval = yyvsp[0];
}
-#line 4323 "awkgram.c"
+#line 4411 "awkgram.c"
break;
case 189:
#line 2101 "awkgram.y"
- {
+ {
INSTRUCTION *t = yyvsp[-1];
if (yyvsp[-1] == NULL) {
error_ln(yyvsp[0]->source_line,
@@ -4337,54 +4425,54 @@ regular_print:
yyvsp[0]->sub_count = count_expressions(&t, false);
yyval = list_append(t, yyvsp[0]);
}
-#line 4341 "awkgram.c"
+#line 4429 "awkgram.c"
break;
case 190:
#line 2118 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 4347 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 4435 "awkgram.c"
break;
case 191:
#line 2120 "awkgram.y"
- {
+ {
yyval = list_merge(yyvsp[-1], yyvsp[0]);
}
-#line 4355 "awkgram.c"
+#line 4443 "awkgram.c"
break;
case 192:
#line 2127 "awkgram.y"
- { yyval = yyvsp[-1]; }
-#line 4361 "awkgram.c"
+ { yyval = yyvsp[-1]; }
+#line 4449 "awkgram.c"
break;
case 193:
#line 2132 "awkgram.y"
- {
+ {
yyvsp[0]->opcode = Op_push;
yyvsp[0]->memory = variable(yyvsp[0]->source_line,
yyvsp[0]->lextok, Node_var_new);
yyval = list_create(yyvsp[0]);
}
-#line 4371 "awkgram.c"
+#line 4459 "awkgram.c"
break;
case 194:
#line 2138 "awkgram.y"
- {
+ {
char *arr = yyvsp[-1]->lextok;
yyvsp[-1]->memory = variable(yyvsp[-1]->source_line, arr,
Node_var_new);
yyvsp[-1]->opcode = Op_push_array;
yyval = list_prepend(yyvsp[0], yyvsp[-1]);
}
-#line 4383 "awkgram.c"
+#line 4471 "awkgram.c"
break;
case 195:
#line 2149 "awkgram.y"
- {
+ {
INSTRUCTION *ip = yyvsp[0]->nexti;
if (ip->opcode == Op_push
&& ip->memory->type == Node_var
@@ -4395,85 +4483,85 @@ regular_print:
} else
yyval = yyvsp[0];
}
-#line 4399 "awkgram.c"
+#line 4487 "awkgram.c"
break;
case 196:
#line 2161 "awkgram.y"
- {
+ {
yyval = list_append(yyvsp[-1], yyvsp[-2]);
if (yyvsp[0] != NULL)
mk_assignment(yyvsp[-1], NULL, yyvsp[0]);
}
-#line 4409 "awkgram.c"
+#line 4497 "awkgram.c"
break;
case 197:
#line 2170 "awkgram.y"
- {
+ {
yyvsp[0]->opcode = Op_postincrement;
}
-#line 4417 "awkgram.c"
+#line 4505 "awkgram.c"
break;
case 198:
#line 2174 "awkgram.y"
- {
+ {
yyvsp[0]->opcode = Op_postdecrement;
}
-#line 4425 "awkgram.c"
+#line 4513 "awkgram.c"
break;
case 199:
#line 2178 "awkgram.y"
- { yyval = NULL; }
-#line 4431 "awkgram.c"
+ { yyval = NULL; }
+#line 4519 "awkgram.c"
break;
case 200:
#line 2182 "awkgram.y"
- { yyval = yyvsp[0]; }
-#line 4437 "awkgram.c"
+ { yyval = yyvsp[0]; }
+#line 4525 "awkgram.c"
break;
case 201:
#line 2186 "awkgram.y"
- { yyval = yyvsp[0]; yyerrok; }
-#line 4443 "awkgram.c"
+ { yyval = yyvsp[0]; yyerrok; }
+#line 4531 "awkgram.c"
break;
case 202:
#line 2190 "awkgram.y"
- { yyerrok; }
-#line 4449 "awkgram.c"
+ { yyerrok; }
+#line 4537 "awkgram.c"
break;
case 203:
#line 2195 "awkgram.y"
- { yyval = NULL; }
-#line 4455 "awkgram.c"
+ { yyval = NULL; }
+#line 4543 "awkgram.c"
break;
case 205:
#line 2200 "awkgram.y"
- { yyerrok; }
-#line 4461 "awkgram.c"
+ { yyerrok; }
+#line 4549 "awkgram.c"
break;
case 206:
#line 2204 "awkgram.y"
- { yyval = yyvsp[0]; yyerrok; }
-#line 4467 "awkgram.c"
+ { yyval = yyvsp[0]; yyerrok; }
+#line 4555 "awkgram.c"
break;
case 207:
#line 2208 "awkgram.y"
- { yyval = yyvsp[0]; yyerrok; }
-#line 4473 "awkgram.c"
+ { yyval = yyvsp[0]; yyerrok; }
+#line 4561 "awkgram.c"
break;
-#line 4477 "awkgram.c"
+#line 4565 "awkgram.c"
default: break;
}
@@ -4537,7 +4625,7 @@ yyerrlab:
{
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+ yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T,
yymsg_alloc)));
if (!yymsg)
{
yymsg = yymsgbuf;
diff --git a/command.c b/command.c
index 0bde9e4..eb46ad4 100644
--- a/command.c
+++ b/command.c
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 3.4.2. */
+/* A Bison parser, made by GNU Bison 3.5. */
/* Bison implementation for Yacc-like parsers in C
@@ -48,7 +48,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "3.4.2"
+#define YYBISON_VERSION "3.5"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -69,7 +69,6 @@
#define yyerror zzerror
#define yydebug zzdebug
#define yynerrs zznerrs
-
#define yylval zzlval
#define yychar zzchar
@@ -141,8 +140,17 @@ static void append_cmdarg(CMDARG *arg);
static int find_argument(CMDARG *arg);
#define YYSTYPE CMDARG *
-#line 145 "command.c"
+#line 144 "command.c"
+# ifndef YY_CAST
+# ifdef __cplusplus
+# define YY_CAST(Type, Val) static_cast<Type> (Val)
+# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
+# else
+# define YY_CAST(Type, Val) ((Type) (Val))
+# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
+# endif
+# endif
# ifndef YY_NULLPTR
# if defined __cplusplus
# if 201103L <= __cplusplus
@@ -293,28 +301,75 @@ int zzparse (void);
# undef short
#endif
-#ifdef YYTYPE_UINT8
-typedef YYTYPE_UINT8 yytype_uint8;
-#else
-typedef unsigned char yytype_uint8;
+/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
+ <limits.h> and (if available) <stdint.h> are included
+ so that the code can choose integer types of a good width. */
+
+#ifndef __PTRDIFF_MAX__
+# include <limits.h> /* INFRINGES ON USER NAME SPACE */
+# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
+# include <stdint.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_STDINT_H
+# endif
#endif
-#ifdef YYTYPE_INT8
-typedef YYTYPE_INT8 yytype_int8;
+/* Narrow types that promote to a signed type and that can represent a
+ signed or unsigned integer of at least N bits. In tables they can
+ save space and decrease cache pressure. Promoting to a signed type
+ helps avoid bugs in integer arithmetic. */
+
+#ifdef __INT_LEAST8_MAX__
+typedef __INT_LEAST8_TYPE__ yytype_int8;
+#elif defined YY_STDINT_H
+typedef int_least8_t yytype_int8;
#else
typedef signed char yytype_int8;
#endif
-#ifdef YYTYPE_UINT16
-typedef YYTYPE_UINT16 yytype_uint16;
+#ifdef __INT_LEAST16_MAX__
+typedef __INT_LEAST16_TYPE__ yytype_int16;
+#elif defined YY_STDINT_H
+typedef int_least16_t yytype_int16;
#else
-typedef unsigned short yytype_uint16;
+typedef short yytype_int16;
#endif
-#ifdef YYTYPE_INT16
-typedef YYTYPE_INT16 yytype_int16;
+#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST8_TYPE__ yytype_uint8;
+#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
+ && UINT_LEAST8_MAX <= INT_MAX)
+typedef uint_least8_t yytype_uint8;
+#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
+typedef unsigned char yytype_uint8;
#else
-typedef short yytype_int16;
+typedef short yytype_uint8;
+#endif
+
+#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST16_TYPE__ yytype_uint16;
+#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
+ && UINT_LEAST16_MAX <= INT_MAX)
+typedef uint_least16_t yytype_uint16;
+#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
+typedef unsigned short yytype_uint16;
+#else
+typedef int yytype_uint16;
+#endif
+
+#ifndef YYPTRDIFF_T
+# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
+# define YYPTRDIFF_T __PTRDIFF_TYPE__
+# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
+# elif defined PTRDIFF_MAX
+# ifndef ptrdiff_t
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# endif
+# define YYPTRDIFF_T ptrdiff_t
+# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
+# else
+# define YYPTRDIFF_T long
+# define YYPTRDIFF_MAXIMUM LONG_MAX
+# endif
#endif
#ifndef YYSIZE_T
@@ -322,7 +377,7 @@ typedef short yytype_int16;
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T
+# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
@@ -330,7 +385,19 @@ typedef short yytype_int16;
# endif
#endif
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+#define YYSIZE_MAXIMUM \
+ YY_CAST (YYPTRDIFF_T, \
+ (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
+ ? YYPTRDIFF_MAXIMUM \
+ : YY_CAST (YYSIZE_T, -1)))
+
+#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
+
+/* Stored state numbers (used for stacks). */
+typedef yytype_uint8 yy_state_t;
+
+/* State numbers in computations. */
+typedef int yy_state_fast_t;
#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
@@ -344,22 +411,20 @@ typedef short yytype_int16;
# endif
#endif
-#ifndef YY_ATTRIBUTE
-# if (defined __GNUC__ \
- && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
- || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
-# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
+#ifndef YY_ATTRIBUTE_PURE
+# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
+# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
# else
-# define YY_ATTRIBUTE(Spec) /* empty */
+# define YY_ATTRIBUTE_PURE
# endif
#endif
-#ifndef YY_ATTRIBUTE_PURE
-# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
-#endif
-
#ifndef YY_ATTRIBUTE_UNUSED
-# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
+# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
+# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+# else
+# define YY_ATTRIBUTE_UNUSED
+# endif
#endif
/* Suppress unused-variable warnings by "using" E. */
@@ -371,11 +436,11 @@ typedef short yytype_int16;
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 +
__GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
# define YY_INITIAL_VALUE(Value) Value
@@ -388,6 +453,18 @@ typedef short yytype_int16;
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
+#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
+# define YY_IGNORE_USELESS_CAST_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
+# define YY_IGNORE_USELESS_CAST_END \
+ _Pragma ("GCC diagnostic pop")
+#endif
+#ifndef YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_END
+#endif
+
#define YY_ASSERT(E) ((void) (0 && (E)))
@@ -466,17 +543,17 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
/* A type that is properly aligned for any stack member. */
union yyalloc
{
- yytype_int16 yyss_alloc;
+ yy_state_t yyss_alloc;
YYSTYPE yyvs_alloc;
};
/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
# define YYCOPY_NEEDED 1
@@ -489,11 +566,11 @@ union yyalloc
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
- YYSIZE_T yynewbytes; \
+ YYPTRDIFF_T yynewbytes; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
+ yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / YYSIZEOF (*yyptr); \
} \
while (0)
@@ -505,12 +582,12 @@ union yyalloc
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(Dst, Src, Count) \
- __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
+ __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof
(*(Src)))
# else
# define YYCOPY(Dst, Src, Count) \
do \
{ \
- YYSIZE_T yyi; \
+ YYPTRDIFF_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
@@ -536,14 +613,15 @@ union yyalloc
#define YYUNDEFTOK 2
#define YYMAXUTOK 303
+
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
as returned by yylex, with out-of-bounds checking. */
#define YYTRANSLATE(YYX) \
- ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+ (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
as returned by yylex. */
-static const yytype_uint8 yytranslate[] =
+static const yytype_int8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
58, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -580,7 +658,7 @@ static const yytype_uint8 yytranslate[] =
#if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
-static const yytype_uint16 yyrline[] =
+static const yytype_int16 yyrline[] =
{
0, 109, 109, 110, 128, 129, 179, 186, 187, 188,
189, 190, 194, 195, 196, 197, 201, 202, 203, 204,
@@ -632,7 +710,7 @@ static const char *const yytname[] =
# ifdef YYPRINT
/* YYTOKNUM[NUM] -- (External) token number corresponding to the
(internal) symbol number NUM (which must be that of a token). */
-static const yytype_uint16 yytoknum[] =
+static const yytype_int16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
@@ -643,14 +721,14 @@ static const yytype_uint16 yytoknum[] =
};
# endif
-#define YYPACT_NINF -151
+#define YYPACT_NINF (-151)
-#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-151)))
+#define yypact_value_is_default(Yyn) \
+ ((Yyn) == YYPACT_NINF)
-#define YYTABLE_NINF -148
+#define YYTABLE_NINF (-148)
-#define yytable_value_is_error(Yytable_value) \
+#define yytable_value_is_error(Yyn) \
0
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
@@ -785,7 +863,7 @@ static const yytype_int16 yycheck[] =
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
-static const yytype_uint8 yystos[] =
+static const yytype_int8 yystos[] =
{
0, 60, 0, 1, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
@@ -811,7 +889,7 @@ static const yytype_uint8 yystos[] =
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
+static const yytype_int8 yyr1[] =
{
0, 59, 60, 60, 61, 61, 61, 62, 62, 62,
62, 62, 63, 63, 63, 63, 64, 64, 64, 64,
@@ -832,7 +910,7 @@ static const yytype_uint8 yyr1[] =
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
+static const yytype_int8 yyr2[] =
{
0, 2, 0, 2, 1, 2, 2, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -961,7 +1039,7 @@ yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const *
const yyvaluep)
`------------------------------------------------------------------*/
static void
-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
@@ -984,12 +1062,12 @@ do {
\
`------------------------------------------------*/
static void
-yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
+yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, int yyrule)
{
- unsigned long yylno = yyrline[yyrule];
+ int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
@@ -1041,13 +1119,13 @@ int yydebug;
# ifndef yystrlen
# if defined __GLIBC__ && defined _STRING_H
-# define yystrlen strlen
+# define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
# else
/* Return the length of YYSTR. */
-static YYSIZE_T
+static YYPTRDIFF_T
yystrlen (const char *yystr)
{
- YYSIZE_T yylen;
+ YYPTRDIFF_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
continue;
return yylen;
@@ -1083,12 +1161,12 @@ yystpcpy (char *yydest, const char *yysrc)
backslash-backslash). YYSTR is taken from yytname. If YYRES is
null, do not copy; instead, return the length of what the result
would have been. */
-static YYSIZE_T
+static YYPTRDIFF_T
yytnamerr (char *yyres, const char *yystr)
{
if (*yystr == '"')
{
- YYSIZE_T yyn = 0;
+ YYPTRDIFF_T yyn = 0;
char const *yyp = yystr;
for (;;)
@@ -1119,10 +1197,10 @@ yytnamerr (char *yyres, const char *yystr)
do_not_strip_quotes: ;
}
- if (! yyres)
+ if (yyres)
+ return yystpcpy (yyres, yystr) - yyres;
+ else
return yystrlen (yystr);
-
- return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
}
# endif
@@ -1135,19 +1213,19 @@ yytnamerr (char *yyres, const char *yystr)
*YYMSG_ALLOC to the required number of bytes. Return 2 if the
required number of bytes is too large to store. */
static int
-yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
- yytype_int16 *yyssp, int yytoken)
+yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
+ yy_state_t *yyssp, int yytoken)
{
- YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
- YYSIZE_T yysize = yysize0;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
const char *yyformat = YY_NULLPTR;
- /* Arguments of yyformat. */
+ /* Arguments of yyformat: reported tokens (one for the "unexpected",
+ one per "expected"). */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- /* Number of reported tokens (one for the "unexpected", one per
- "expected"). */
+ /* Actual size of YYARG. */
int yycount = 0;
+ /* Cumulated lengths of YYARG. */
+ YYPTRDIFF_T yysize = 0;
/* There are many possibilities here to consider:
- If this state is a consistent state with a default action, then
@@ -1175,6 +1253,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
if (yytoken != YYEMPTY)
{
int yyn = yypact[*yyssp];
+ YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
+ yysize = yysize0;
yyarg[yycount++] = yytname[yytoken];
if (!yypact_value_is_default (yyn))
{
@@ -1199,7 +1279,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
}
yyarg[yycount++] = yytname[yyx];
{
- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR,
yytname[yyx]);
+ YYPTRDIFF_T yysize1
+ = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1;
else
@@ -1226,7 +1307,9 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
}
{
- YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+ /* Don't count the "%s"s in the final size, but reserve room for
+ the terminator. */
+ YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
yysize = yysize1;
else
@@ -1256,8 +1339,8 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
}
else
{
- yyp++;
- yyformat++;
+ ++yyp;
+ ++yyformat;
}
}
return 0;
@@ -1300,7 +1383,7 @@ int yynerrs;
int
yyparse (void)
{
- int yystate;
+ yy_state_fast_t yystate;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
@@ -1312,16 +1395,16 @@ yyparse (void)
to reallocate them elsewhere. */
/* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss;
- yytype_int16 *yyssp;
+ yy_state_t yyssa[YYINITDEPTH];
+ yy_state_t *yyss;
+ yy_state_t *yyssp;
/* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs;
YYSTYPE *yyvsp;
- YYSIZE_T yystacksize;
+ YYPTRDIFF_T yystacksize;
int yyn;
int yyresult;
@@ -1335,7 +1418,7 @@ yyparse (void)
/* Buffer for error messages, and its allocated size. */
char yymsgbuf[128];
char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+ YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
#endif
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
@@ -1367,12 +1450,14 @@ yynewstate:
/*--------------------------------------------------------------------.
-| yynewstate -- set current state (the top of the stack) to yystate. |
+| yysetstate -- set current state (the top of the stack) to yystate. |
`--------------------------------------------------------------------*/
yysetstate:
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
- *yyssp = (yytype_int16) yystate;
+ YY_IGNORE_USELESS_CAST_BEGIN
+ *yyssp = YY_CAST (yy_state_t, yystate);
+ YY_IGNORE_USELESS_CAST_END
if (yyss + yystacksize - 1 <= yyssp)
#if !defined yyoverflow && !defined YYSTACK_RELOCATE
@@ -1380,23 +1465,23 @@ yysetstate:
#else
{
/* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
+ YYPTRDIFF_T yysize = yyssp - yyss + 1;
# if defined yyoverflow
{
/* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
memory. */
+ yy_state_t *yyss1 = yyss;
YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
be undefined if yyoverflow is a macro. */
yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
+ &yyss1, yysize * YYSIZEOF (*yyssp),
+ &yyvs1, yysize * YYSIZEOF (*yyvsp),
&yystacksize);
yyss = yyss1;
yyvs = yyvs1;
@@ -1410,9 +1495,10 @@ yysetstate:
yystacksize = YYMAXDEPTH;
{
- yytype_int16 *yyss1 = yyss;
+ yy_state_t *yyss1 = yyss;
union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ YY_CAST (union yyalloc *,
+ YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES
(yystacksize))));
if (! yyptr)
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss_alloc, yyss);
@@ -1426,8 +1512,10 @@ yysetstate:
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long) yystacksize));
+ YY_IGNORE_USELESS_CAST_BEGIN
+ YYDPRINTF ((stderr, "Stack size increased to %ld\n",
+ YY_CAST (long, yystacksize)));
+ YY_IGNORE_USELESS_CAST_END
if (yyss + yystacksize - 1 <= yyssp)
YYABORT;
@@ -1493,14 +1581,13 @@ yybackup:
/* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-
- /* Discard the shifted token. */
- yychar = YYEMPTY;
-
yystate = yyn;
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+ /* Discard the shifted token. */
+ yychar = YYEMPTY;
goto yynewstate;
@@ -1537,7 +1624,7 @@ yyreduce:
{
case 3:
#line 111 "command.y"
- {
+ {
cmd_idx = -1;
want_nodeval = false;
if (lexptr_begin != NULL) {
@@ -1551,12 +1638,12 @@ yyreduce:
arg_list = NULL;
}
}
-#line 1555 "command.c"
+#line 1642 "command.c"
break;
case 5:
#line 130 "command.y"
- {
+ {
if (dbg_errcount == 0 && cmd_idx >= 0) {
Func_cmd cmdfunc;
bool terminate = false;
@@ -1605,26 +1692,26 @@ yyreduce:
YYACCEPT;
}
}
-#line 1609 "command.c"
+#line 1696 "command.c"
break;
case 6:
#line 180 "command.y"
- {
+ {
yyerrok;
}
-#line 1617 "command.c"
+#line 1704 "command.c"
break;
case 22:
#line 214 "command.y"
- { want_nodeval = true; }
-#line 1623 "command.c"
+ { want_nodeval = true; }
+#line 1710 "command.c"
break;
case 23:
#line 219 "command.y"
- {
+ {
if (dbg_errcount == 0) {
/* don't free arg_list; passed on to statement_list
* non-terminal (empty rule action). See below.
@@ -1639,38 +1726,38 @@ yyreduce:
in_eval = true;
}
}
-#line 1643 "command.c"
+#line 1730 "command.c"
break;
case 24:
#line 238 "command.y"
- {
+ {
yyval = append_statement(arg_list, (char *) start_EVAL);
if (read_a_line == read_commands_string) /*
unserializing 'eval' in 'commands' */
yyval->a_string[0] = '\0';
free_cmdarg(arg_list);
arg_list = NULL;
}
-#line 1655 "command.c"
+#line 1742 "command.c"
break;
case 25:
#line 245 "command.y"
- { yyval = append_statement(yyvsp[-1], lexptr_begin); }
-#line 1661 "command.c"
+ { yyval = append_statement(yyvsp[-1],
lexptr_begin); }
+#line 1748 "command.c"
break;
case 26:
#line 246 "command.y"
- {
+ {
yyval = yyvsp[-1];
}
-#line 1669 "command.c"
+#line 1756 "command.c"
break;
case 27:
#line 253 "command.y"
- {
+ {
arg_list = append_statement(yyvsp[-1], (char *) end_EVAL);
if (read_a_line == read_commands_string) { /*
unserializing 'eval' in 'commands' */
char *str = arg_list->a_string;
@@ -1685,12 +1772,12 @@ yyreduce:
cmd_idx = find_command("eval", 4);
in_eval = false;
}
-#line 1689 "command.c"
+#line 1776 "command.c"
break;
case 28:
#line 269 "command.y"
- {
+ {
NODE *n;
CMDARG *arg;
n = yyvsp[0]->a_node;
@@ -1700,22 +1787,22 @@ yyreduce:
free_cmdarg(arg_list);
arg_list = arg;
}
-#line 1704 "command.c"
+#line 1791 "command.c"
break;
case 34:
#line 288 "command.y"
- {
+ {
if (cmdtab[cmd_idx].class == D_FRAME
&& yyvsp[0] != NULL && yyvsp[0]->a_int < 0)
yyerror(_("invalid frame number: %d"), yyvsp[0]->a_int);
}
-#line 1714 "command.c"
+#line 1801 "command.c"
break;
case 35:
#line 294 "command.y"
- {
+ {
int idx = find_argument(yyvsp[0]);
if (idx < 0)
yyerror(_("info: invalid option - \"%s\""),
yyvsp[0]->a_string);
@@ -1726,66 +1813,66 @@ yyreduce:
yyvsp[0]->a_argument = argtab[idx].value;
}
}
-#line 1730 "command.c"
+#line 1817 "command.c"
break;
case 38:
#line 307 "command.y"
- { want_nodeval = true; }
-#line 1736 "command.c"
+ { want_nodeval = true; }
+#line 1823 "command.c"
break;
case 40:
#line 308 "command.y"
- { want_nodeval = true; }
-#line 1742 "command.c"
+ { want_nodeval = true; }
+#line 1829 "command.c"
break;
case 46:
#line 313 "command.y"
- { want_nodeval = true; }
-#line 1748 "command.c"
+ { want_nodeval = true; }
+#line 1835 "command.c"
break;
case 49:
#line 315 "command.y"
- { want_nodeval = true; }
-#line 1754 "command.c"
+ { want_nodeval = true; }
+#line 1841 "command.c"
break;
case 51:
#line 316 "command.y"
- { want_nodeval = true; }
-#line 1760 "command.c"
+ { want_nodeval = true; }
+#line 1847 "command.c"
break;
case 53:
#line 317 "command.y"
- { want_nodeval = true; }
-#line 1766 "command.c"
+ { want_nodeval = true; }
+#line 1853 "command.c"
break;
case 57:
#line 321 "command.y"
- {
+ {
if (in_cmd_src(yyvsp[0]->a_string))
yyerror(_("source \"%s\": already sourced."),
yyvsp[0]->a_string);
}
-#line 1775 "command.c"
+#line 1862 "command.c"
break;
case 58:
#line 326 "command.y"
- {
+ {
if (! input_from_tty)
yyerror(_("save \"%s\": command not permitted."),
yyvsp[0]->a_string);
}
-#line 1784 "command.c"
+#line 1871 "command.c"
break;
case 59:
#line 331 "command.y"
- {
+ {
int type = 0;
int num;
@@ -1810,12 +1897,12 @@ yyreduce:
}
}
}
-#line 1814 "command.c"
+#line 1901 "command.c"
break;
case 60:
#line 357 "command.y"
- {
+ {
if (! in_commands)
yyerror(_("`end' valid only in command `commands' or
`eval'"));
else {
@@ -1824,21 +1911,21 @@ yyreduce:
in_commands = false;
}
}
-#line 1828 "command.c"
+#line 1915 "command.c"
break;
case 61:
#line 367 "command.y"
- {
+ {
if (! in_commands)
yyerror(_("`silent' valid only in command `commands'"));
}
-#line 1837 "command.c"
+#line 1924 "command.c"
break;
case 62:
#line 372 "command.y"
- {
+ {
int idx = find_argument(yyvsp[0]);
if (idx < 0)
yyerror(_("trace: invalid option - \"%s\""),
yyvsp[0]->a_string);
@@ -1849,30 +1936,30 @@ yyreduce:
yyvsp[0]->a_argument = argtab[idx].value;
}
}
-#line 1853 "command.c"
+#line 1940 "command.c"
break;
case 63:
#line 383 "command.y"
- { want_nodeval = true; }
-#line 1859 "command.c"
+ { want_nodeval = true; }
+#line 1946 "command.c"
break;
case 64:
#line 384 "command.y"
- {
+ {
int type;
int num = yyvsp[-2]->a_int;
type = has_break_or_watch_point(&num, false);
if (! type)
yyerror(_("condition: invalid breakpoint/watchpoint
number"));
}
-#line 1871 "command.c"
+#line 1958 "command.c"
break;
case 65:
#line 392 "command.y"
- {
+ {
if (in_commands) {
/* Prepend command 'eval' to argument list */
CMDARG *arg;
@@ -1882,12 +1969,12 @@ yyreduce:
arg_list = arg;
}
}
-#line 1886 "command.c"
+#line 1973 "command.c"
break;
case 66:
#line 406 "command.y"
- {
+ {
if (yyvsp[0] != NULL) {
NODE *n = yyvsp[0]->a_node;
yyvsp[0]->type = D_string;
@@ -1896,77 +1983,77 @@ yyreduce:
}
yyval = yyvsp[0];
}
-#line 1900 "command.c"
+#line 1987 "command.c"
break;
case 68:
#line 420 "command.y"
- { yyval = NULL; }
-#line 1906 "command.c"
+ { yyval = NULL; }
+#line 1993 "command.c"
break;
case 69:
#line 425 "command.y"
- { yyval = NULL; }
-#line 1912 "command.c"
+ { yyval = NULL; }
+#line 1999 "command.c"
break;
case 74:
#line 434 "command.y"
- { yyval = NULL; }
-#line 1918 "command.c"
+ { yyval = NULL; }
+#line 2005 "command.c"
break;
case 75:
#line 439 "command.y"
- { yyval = NULL; }
-#line 1924 "command.c"
+ { yyval = NULL; }
+#line 2011 "command.c"
break;
case 77:
#line 442 "command.y"
- { yyval = NULL; }
-#line 1930 "command.c"
+ { yyval = NULL; }
+#line 2017 "command.c"
break;
case 78:
#line 447 "command.y"
- {
+ {
NODE *n;
n = yyvsp[0]->a_node;
if ((n->flags & STRING) == 0)
yyerror(_("argument not a string"));
}
-#line 1941 "command.c"
+#line 2028 "command.c"
break;
case 79:
#line 457 "command.y"
- { yyval = NULL; }
-#line 1947 "command.c"
+ { yyval = NULL; }
+#line 2034 "command.c"
break;
case 80:
#line 459 "command.y"
- {
+ {
if (find_option(yyvsp[0]->a_string) < 0)
yyerror(_("option: invalid parameter - \"%s\""),
yyvsp[0]->a_string);
}
-#line 1956 "command.c"
+#line 2043 "command.c"
break;
case 81:
#line 464 "command.y"
- {
+ {
if (find_option(yyvsp[-2]->a_string) < 0)
yyerror(_("option: invalid parameter - \"%s\""),
yyvsp[-2]->a_string);
}
-#line 1965 "command.c"
+#line 2052 "command.c"
break;
case 82:
#line 472 "command.y"
- {
+ {
NODE *n;
n = lookup(yyvsp[0]->a_string);
if (n == NULL || n->type != Node_func)
@@ -1978,54 +2065,54 @@ yyreduce:
yyvsp[0]->a_node = n;
}
}
-#line 1982 "command.c"
+#line 2069 "command.c"
break;
case 83:
#line 488 "command.y"
- { yyval = NULL; }
-#line 1988 "command.c"
+ { yyval = NULL; }
+#line 2075 "command.c"
break;
case 88:
#line 497 "command.y"
- { yyval = NULL; }
-#line 1994 "command.c"
+ { yyval = NULL; }
+#line 2081 "command.c"
break;
case 89:
#line 498 "command.y"
- { want_nodeval = true; }
-#line 2000 "command.c"
+ { want_nodeval = true; }
+#line 2087 "command.c"
break;
case 92:
#line 500 "command.y"
- { want_nodeval = true; }
-#line 2006 "command.c"
+ { want_nodeval = true; }
+#line 2093 "command.c"
break;
case 95:
#line 506 "command.y"
- { yyval = NULL; }
-#line 2012 "command.c"
+ { yyval = NULL; }
+#line 2099 "command.c"
break;
case 97:
#line 512 "command.y"
- { yyval = NULL; }
-#line 2018 "command.c"
+ { yyval = NULL; }
+#line 2105 "command.c"
break;
case 99:
#line 518 "command.y"
- { yyval = NULL; }
-#line 2024 "command.c"
+ { yyval = NULL; }
+#line 2111 "command.c"
break;
case 104:
#line 530 "command.y"
- {
+ {
int idx = find_argument(yyvsp[-1]);
if (idx < 0)
yyerror(_("enable: invalid option - \"%s\""),
yyvsp[-1]->a_string);
@@ -2036,53 +2123,53 @@ yyreduce:
yyvsp[-1]->a_argument = argtab[idx].value;
}
}
-#line 2040 "command.c"
+#line 2127 "command.c"
break;
case 106:
#line 546 "command.y"
- {
+ {
yyvsp[0]->type = D_array; /* dump all items */
yyvsp[0]->a_count = 0;
}
-#line 2049 "command.c"
+#line 2136 "command.c"
break;
case 107:
#line 551 "command.y"
- {
+ {
yyvsp[-1]->type = D_array;
yyvsp[-1]->a_count = num_dim;
}
-#line 2058 "command.c"
+#line 2145 "command.c"
break;
case 117:
#line 577 "command.y"
- { yyval = NULL; }
-#line 2064 "command.c"
+ { yyval = NULL; }
+#line 2151 "command.c"
break;
case 118:
#line 579 "command.y"
- { yyval = NULL; }
-#line 2070 "command.c"
+ { yyval = NULL; }
+#line 2157 "command.c"
break;
case 119:
#line 581 "command.y"
- {
+ {
CMDARG *a;
a = mk_cmdarg(D_int);
a->a_int = -1;
append_cmdarg(a);
}
-#line 2081 "command.c"
+#line 2168 "command.c"
break;
case 126:
#line 597 "command.y"
- {
+ {
if (yyvsp[-2]->a_int > yyvsp[0]->a_int)
yyerror(_("invalid range specification: %d - %d"),
yyvsp[-2]->a_int, yyvsp[0]->a_int);
@@ -2090,30 +2177,30 @@ yyreduce:
yyvsp[-2]->type = D_range;
yyval = yyvsp[-2];
}
-#line 2094 "command.c"
+#line 2181 "command.c"
break;
case 127:
#line 609 "command.y"
- { yyval = NULL; }
-#line 2100 "command.c"
+ { yyval = NULL; }
+#line 2187 "command.c"
break;
case 134:
#line 623 "command.y"
- { yyval = yyvsp[0]; }
-#line 2106 "command.c"
+ { yyval = yyvsp[0]; }
+#line 2193 "command.c"
break;
case 135:
#line 625 "command.y"
- { yyval = yyvsp[-2]; }
-#line 2112 "command.c"
+ { yyval = yyvsp[-2]; }
+#line 2199 "command.c"
break;
case 137:
#line 631 "command.y"
- {
+ {
CMDARG *a;
NODE *subs;
int count = 0;
@@ -2127,24 +2214,24 @@ yyreduce:
yyvsp[-1]->a_node = subs;
yyval = yyvsp[-1];
}
-#line 2131 "command.c"
+#line 2218 "command.c"
break;
case 139:
#line 650 "command.y"
- { yyval = yyvsp[0]; num_dim = 1; }
-#line 2137 "command.c"
+ { yyval = yyvsp[0]; num_dim = 1; }
+#line 2224 "command.c"
break;
case 140:
#line 652 "command.y"
- { yyval = yyvsp[-1]; num_dim++; }
-#line 2143 "command.c"
+ { yyval = yyvsp[-1]; num_dim++; }
+#line 2230 "command.c"
break;
case 142:
#line 658 "command.y"
- {
+ {
NODE *n = yyvsp[0]->a_node;
if ((n->flags & NUMBER) == 0)
yyerror(_("non-numeric value for field number"));
@@ -2152,40 +2239,40 @@ yyreduce:
yyvsp[0]->type = D_field;
yyval = yyvsp[0];
}
-#line 2156 "command.c"
+#line 2243 "command.c"
break;
case 143:
#line 667 "command.y"
- {
+ {
/* a_string is array name, a_count is dimension count */
yyvsp[-1]->type = D_subscript;
yyvsp[-1]->a_count = num_dim;
yyval = yyvsp[-1];
}
-#line 2167 "command.c"
+#line 2254 "command.c"
break;
case 144:
#line 677 "command.y"
- { yyval = yyvsp[0]; }
-#line 2173 "command.c"
+ { yyval = yyvsp[0]; }
+#line 2260 "command.c"
break;
case 145:
#line 679 "command.y"
- {
+ {
NODE *n = yyvsp[0]->a_node;
if ((n->flags & NUMBER) == 0)
yyerror(_("non-numeric value found, numeric expected"));
yyval = yyvsp[0];
}
-#line 2184 "command.c"
+#line 2271 "command.c"
break;
case 146:
#line 686 "command.y"
- {
+ {
NODE *n = yyvsp[0]->a_node;
if ((n->flags & NUMBER) == 0)
yyerror(_("non-numeric value found, numeric expected"));
@@ -2193,77 +2280,77 @@ yyreduce:
negate_num(n);
yyval = yyvsp[0];
}
-#line 2197 "command.c"
+#line 2284 "command.c"
break;
case 147:
#line 698 "command.y"
- { yyval = NULL; }
-#line 2203 "command.c"
+ { yyval = NULL; }
+#line 2290 "command.c"
break;
case 148:
#line 700 "command.y"
- { yyval = yyvsp[0]; }
-#line 2209 "command.c"
+ { yyval = yyvsp[0]; }
+#line 2296 "command.c"
break;
case 149:
#line 705 "command.y"
- { yyval = NULL; }
-#line 2215 "command.c"
+ { yyval = NULL; }
+#line 2302 "command.c"
break;
case 150:
#line 707 "command.y"
- { yyval = yyvsp[0]; }
-#line 2221 "command.c"
+ { yyval = yyvsp[0]; }
+#line 2308 "command.c"
break;
case 151:
#line 712 "command.y"
- {
+ {
if (yyvsp[0]->a_int == 0)
yyerror(_("non-zero integer value"));
yyval = yyvsp[0];
}
-#line 2231 "command.c"
+#line 2318 "command.c"
break;
case 152:
#line 718 "command.y"
- {
+ {
if (yyvsp[0]->a_int == 0)
yyerror(_("non-zero integer value"));
yyval = yyvsp[0];
}
-#line 2241 "command.c"
+#line 2328 "command.c"
break;
case 153:
#line 727 "command.y"
- { yyval = yyvsp[0]; }
-#line 2247 "command.c"
+ { yyval = yyvsp[0]; }
+#line 2334 "command.c"
break;
case 154:
#line 729 "command.y"
- { yyval = yyvsp[0]; }
-#line 2253 "command.c"
+ { yyval = yyvsp[0]; }
+#line 2340 "command.c"
break;
case 155:
#line 731 "command.y"
- {
+ {
yyvsp[0]->a_int = - yyvsp[0]->a_int;
yyval = yyvsp[0];
}
-#line 2262 "command.c"
+#line 2349 "command.c"
break;
case 156:
#line 739 "command.y"
- {
+ {
if (lexptr_begin != NULL) {
if (input_from_tty && lexptr_begin[0] != '\0')
add_history(lexptr_begin);
@@ -2271,11 +2358,11 @@ yyreduce:
lexptr_begin = NULL;
}
}
-#line 2275 "command.c"
+#line 2362 "command.c"
break;
-#line 2279 "command.c"
+#line 2366 "command.c"
default: break;
}
@@ -2339,7 +2426,7 @@ yyerrlab:
{
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+ yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T,
yymsg_alloc)));
if (!yymsg)
{
yymsg = yymsgbuf;
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 11 +
NEWS | 2 +-
awkgram.c | 1066 +++++++++++++++++++++++++++++------------------------
command.c | 575 +++++++++++++++++------------
field.c | 4 +-
support/ChangeLog | 4 +
support/dfa.c | 492 +++++++++++++------------
support/dfa.h | 25 +-
8 files changed, 1203 insertions(+), 976 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, master, updated. gawk-4.1.0-3854-g85d4a66,
Arnold Robbins <=