Browse Source

Restoring authorship annotation for <axc@yandex-team.ru>. Commit 2 of 2.

axc 3 years ago
parent
commit
7b65903761

+ 3 - 3
build/ymake_conf.py

@@ -605,7 +605,7 @@ class Build(object):
             type_ = detector.type
         else:
             detector = None
- 
+
         if type_ == 'msvc':
             return MSVCToolchainOptions(self, detector)
         else:
@@ -613,7 +613,7 @@ class Build(object):
 
     def _print_other_settings(self, compiler):
         host = self.host
- 
+
         emit('USE_LOCAL_TOOLS', 'no' if self.ignore_local_files else 'yes')
 
         ragel = Ragel()
@@ -623,7 +623,7 @@ class Build(object):
         perl = Perl()
         perl.configure_local()
         perl.print_variables('LOCAL_')
- 
+
         swiftc = SwiftCompiler(self)
         swiftc.configure()
         swiftc.print_compiler()

+ 53 - 53
contrib/libs/libidn/idna.c

@@ -33,43 +33,43 @@
 #define DOTP(c) ((c) == 0x002E || (c) == 0x3002 ||	\
 		 (c) == 0xFF0E || (c) == 0xFF61)
 
-#ifdef WITH_VALGRIND 
- 
-static size_t STRLEN(const char *s) { 
-    size_t ret = 0; 
-    while (*s++) 
-        ++ret; 
-    return ret; 
-} 
- 
-static char* STRCPY(char* destination, const char* source) { 
-    char *p = destination; 
-    while (*source) 
-        *p++ = *source++; 
-    *p = 0; 
-    return destination; 
-} 
- 
-static char* STRCAT(char* destination, const char* source) { 
-    char *p = destination; 
-    while (*p) 
-        ++p; 
- 
-    while (*source) 
-        *p++ = *source++; 
-    *p = 0; 
- 
-    return destination; 
-} 
- 
-#else //WITH_VALGRIND 
- 
-#   define STRLEN(s) strlen(s) 
-#   define STRCAT(d, s) strcat(d, s) 
-#   define STRCPY(d, s) strcpy(d, s) 
+#ifdef WITH_VALGRIND
+
+static size_t STRLEN(const char *s) {
+    size_t ret = 0;
+    while (*s++)
+        ++ret;
+    return ret;
+}
+
+static char* STRCPY(char* destination, const char* source) {
+    char *p = destination;
+    while (*source)
+        *p++ = *source++;
+    *p = 0;
+    return destination;
+}
+
+static char* STRCAT(char* destination, const char* source) {
+    char *p = destination;
+    while (*p)
+        ++p;
+
+    while (*source)
+        *p++ = *source++;
+    *p = 0;
+
+    return destination;
+}
+
+#else //WITH_VALGRIND
+
+#   define STRLEN(s) strlen(s)
+#   define STRCAT(d, s) strcat(d, s)
+#   define STRCPY(d, s) strcpy(d, s)
+
+#endif
  
-#endif 
-  
 /* Core functions */
 
 /**
@@ -150,7 +150,7 @@ idna_to_ascii_4i (const uint32_t * in, size_t inlen, char *out, int flags)
     if (p == NULL)
       return IDNA_MALLOC_ERROR;
 
-    len = STRLEN (p); 
+    len = STRLEN (p);
     do
       {
 	char *newp;
@@ -251,7 +251,7 @@ step3:
     int match;
 
     match = 1;
-    for (i = 0; match && i < STRLEN (IDNA_ACE_PREFIX); i++) 
+    for (i = 0; match && i < STRLEN (IDNA_ACE_PREFIX); i++)
       if (((uint32_t) IDNA_ACE_PREFIX[i] & 0xFF) != src[i])
 	match = 0;
     if (match)
@@ -270,19 +270,19 @@ step3:
   src[len] = '\0';
   outlen = IDNA_LABEL_MAX_LENGTH - STRLEN (IDNA_ACE_PREFIX);
   rc = punycode_encode (len, src, NULL,
-			&outlen, &out[STRLEN (IDNA_ACE_PREFIX)]); 
+			&outlen, &out[STRLEN (IDNA_ACE_PREFIX)]);
   if (rc != PUNYCODE_SUCCESS)
     {
       free (src);
       return IDNA_PUNYCODE_ERROR;
     }
-  out[STRLEN (IDNA_ACE_PREFIX) + outlen] = '\0'; 
+  out[STRLEN (IDNA_ACE_PREFIX) + outlen] = '\0';
 
   /*
    * 7. Prepend the ACE prefix.
    */
 
-  memcpy (out, IDNA_ACE_PREFIX, STRLEN (IDNA_ACE_PREFIX)); 
+  memcpy (out, IDNA_ACE_PREFIX, STRLEN (IDNA_ACE_PREFIX));
 
   /*
    * 8. Verify that the number of code points is in the range 1 to IDNA_LABEL_MAX_LENGTH
@@ -304,7 +304,7 @@ idna_to_unicode_internal (char *utf8in,
 {
   int rc;
   char tmpout[IDNA_LABEL_MAX_LENGTH + 1];
-  size_t utf8len = STRLEN (utf8in) + 1; 
+  size_t utf8len = STRLEN (utf8in) + 1;
   size_t addlen = 0;
 
   /*
@@ -369,8 +369,8 @@ step3:
   /* 4. Remove the ACE prefix.
    */
 
-  memmove (utf8in, &utf8in[STRLEN (IDNA_ACE_PREFIX)], 
-	   STRLEN (utf8in) - STRLEN (IDNA_ACE_PREFIX) + 1); 
+  memmove (utf8in, &utf8in[STRLEN (IDNA_ACE_PREFIX)],
+	   STRLEN (utf8in) - STRLEN (IDNA_ACE_PREFIX) + 1);
 
   /* 5. Decode the sequence using the decoding algorithm in [PUNYCODE]
    * and fail if there is an error. Save a copy of the result of
@@ -379,7 +379,7 @@ step3:
 
   (*outlen)--;			/* reserve one for the zero */
 
-  rc = punycode_decode (STRLEN (utf8in), utf8in, outlen, out, NULL); 
+  rc = punycode_decode (STRLEN (utf8in), utf8in, outlen, out, NULL);
   if (rc != PUNYCODE_SUCCESS)
     {
       free (utf8in);
@@ -402,7 +402,7 @@ step3:
    * step 3, using a case-insensitive ASCII comparison.
    */
 
-  if (strcasecmp (utf8in, tmpout + STRLEN (IDNA_ACE_PREFIX)) != 0) 
+  if (strcasecmp (utf8in, tmpout + STRLEN (IDNA_ACE_PREFIX)) != 0)
     {
       free (utf8in);
       return IDNA_ROUNDTRIP_VERIFY_ERROR;
@@ -510,7 +510,7 @@ idna_to_ascii_4z (const uint32_t * input, char **output, int flags)
       *output = malloc (1);
       if (!*output)
 	return IDNA_MALLOC_ERROR;
-      STRCPY (*output, ""); 
+      STRCPY (*output, "");
       return IDNA_SUCCESS;
     }
 
@@ -520,7 +520,7 @@ idna_to_ascii_4z (const uint32_t * input, char **output, int flags)
       *output = malloc (2);
       if (!*output)
 	return IDNA_MALLOC_ERROR;
-      STRCPY (*output, "."); 
+      STRCPY (*output, ".");
       return IDNA_SUCCESS;
     }
 
@@ -549,22 +549,22 @@ idna_to_ascii_4z (const uint32_t * input, char **output, int flags)
 
       if (out)
 	{
-	  char *newp = realloc (out, STRLEN (out) + 1 + STRLEN (buf) + 1); 
+	  char *newp = realloc (out, STRLEN (out) + 1 + STRLEN (buf) + 1);
 	  if (!newp)
 	    {
 	      free (out);
 	      return IDNA_MALLOC_ERROR;
 	    }
 	  out = newp;
-	  STRCAT (out, "."); 
-	  STRCAT (out, buf); 
+	  STRCAT (out, ".");
+	  STRCAT (out, buf);
 	}
       else
 	{
-	  out = (char *) malloc (STRLEN (buf) + 1); 
+	  out = (char *) malloc (STRLEN (buf) + 1);
 	  if (!out)
 	    return IDNA_MALLOC_ERROR;
-	  STRCPY (out, buf); 
+	  STRCPY (out, buf);
 	}
 
       start = end + 1;

+ 88 - 88
contrib/libs/pire/pire/platform.h

@@ -74,19 +74,19 @@ typedef i32 ssize_t;
 
 inline int snprintf(char *str, size_t size, const char *format, ...)
 {
-    va_list argptr; 
-    va_start(argptr, format); 
-    int i = _vsnprintf(str, size-1, format, argptr); 
-    va_end(argptr); 
-
-    // A workaround for some bug 
-    if (i < 0) { 
-        str[size - 1] = '\x00'; 
-        i = (int)size; 
-    } else if (i < (int)size) { 
-        str[i] = '\x00'; 
-    } 
-    return i; 
+    va_list argptr;
+    va_start(argptr, format);
+    int i = _vsnprintf(str, size-1, format, argptr);
+    va_end(argptr);
+
+    // A workaround for some bug
+    if (i < 0) {
+        str[size - 1] = '\x00';
+        i = (int)size;
+    } else if (i < (int)size) {
+        str[i] = '\x00';
+    }
+    return i;
 }
 
 }
@@ -95,40 +95,40 @@ inline int snprintf(char *str, size_t size, const char *format, ...)
 namespace Pire {
 namespace Impl {
 
-// A portable way to define a constant like `(size_t)0101010101010101ull' without any warnings. 
-template<unsigned Pos, unsigned char Byte> 
-struct DoGenerateConst { 
-    static const size_t Value = DoGenerateConst<Pos-1, Byte>::Value << 8 | (size_t) Byte; 
-}; 
- 
-template<unsigned char Byte> 
-struct DoGenerateConst<0, Byte> { 
-    static const size_t Value = 0; 
-}; 
- 
-template<unsigned char Byte> 
-struct GenerateConst { 
-    static const size_t Value = DoGenerateConst<sizeof(size_t), Byte>::Value; 
-}; 
- 
- 
+// A portable way to define a constant like `(size_t)0101010101010101ull' without any warnings.
+template<unsigned Pos, unsigned char Byte>
+struct DoGenerateConst {
+    static const size_t Value = DoGenerateConst<Pos-1, Byte>::Value << 8 | (size_t) Byte;
+};
+
+template<unsigned char Byte>
+struct DoGenerateConst<0, Byte> {
+    static const size_t Value = 0;
+};
+
+template<unsigned char Byte>
+struct GenerateConst {
+    static const size_t Value = DoGenerateConst<sizeof(size_t), Byte>::Value;
+};
+
+
 // Common implementation of mask comparison logic suitable for
 // any instruction set
 struct BasicInstructionSet {
-    typedef size_t Vector; 
+    typedef size_t Vector;
 
-    // Check bytes in the chunk against bytes in the mask 
-    static inline Vector CheckBytes(Vector mask, Vector chunk) 
-    { 
-        const size_t mask0x01 = GenerateConst<0x01>::Value; 
-        const size_t mask0x80 = GenerateConst<0x80>::Value; 
-        size_t mc = chunk ^ mask; 
-        return ((mc - mask0x01) & ~mc & mask0x80); 
-    } 
+    // Check bytes in the chunk against bytes in the mask
+    static inline Vector CheckBytes(Vector mask, Vector chunk)
+    {
+        const size_t mask0x01 = GenerateConst<0x01>::Value;
+        const size_t mask0x80 = GenerateConst<0x80>::Value;
+        size_t mc = chunk ^ mask;
+        return ((mc - mask0x01) & ~mc & mask0x80);
+    }
 
-    static inline Vector Or(Vector mask1, Vector mask2) { return (mask1 | mask2); } 
+    static inline Vector Or(Vector mask1, Vector mask2) { return (mask1 | mask2); }
 
-    static inline bool IsAnySet(Vector mask) { return (mask != 0); } 
+    static inline bool IsAnySet(Vector mask) { return (mask != 0); }
 };
 
 }}
@@ -141,22 +141,22 @@ namespace Impl {
 
 // SSE2-optimized mask comparison logic
 struct AvailSSE2 {
-    typedef __m128i Vector; 
-
-    static inline Vector CheckBytes(Vector mask, Vector chunk) 
-    { 
-        return _mm_cmpeq_epi8(mask, chunk); 
-    } 
-
-    static inline Vector Or(Vector mask1, Vector mask2) 
-    { 
-        return _mm_or_si128(mask1, mask2); 
-    } 
-
-    static inline bool IsAnySet(Vector mask) 
-    { 
-        return _mm_movemask_epi8(mask); 
-    } 
+    typedef __m128i Vector;
+
+    static inline Vector CheckBytes(Vector mask, Vector chunk)
+    {
+        return _mm_cmpeq_epi8(mask, chunk);
+    }
+
+    static inline Vector Or(Vector mask1, Vector mask2)
+    {
+        return _mm_or_si128(mask1, mask2);
+    }
+
+    static inline bool IsAnySet(Vector mask)
+    {
+        return _mm_movemask_epi8(mask);
+    }
 };
 
 typedef AvailSSE2 AvailInstructionSet;
@@ -173,27 +173,27 @@ namespace Impl {
 
 // MMX-optimized mask comparison logic
 struct AvailMMX {
-    typedef __m64 Vector; 
-
-    static inline Vector CheckBytes(Vector mask, Vector chunk) 
-    { 
-        return _mm_cmpeq_pi8(mask, chunk); 
-    } 
-
-    static inline Vector Or(Vector mask1, Vector mask2) 
-    { 
-        return _mm_or_si64(mask1, mask2); 
-    } 
-
-    static inline bool IsAnySet(Vector mask) 
-    { 
-        union { 
-            Vector mmxMask; 
-            ui64 ui64Mask; 
-        }; 
-        mmxMask = mask; 
-        return ui64Mask; 
-    } 
+    typedef __m64 Vector;
+
+    static inline Vector CheckBytes(Vector mask, Vector chunk)
+    {
+        return _mm_cmpeq_pi8(mask, chunk);
+    }
+
+    static inline Vector Or(Vector mask1, Vector mask2)
+    {
+        return _mm_or_si64(mask1, mask2);
+    }
+
+    static inline bool IsAnySet(Vector mask)
+    {
+        union {
+            Vector mmxMask;
+            ui64 ui64Mask;
+        };
+        mmxMask = mask;
+        return ui64Mask;
+    }
 };
 
 typedef AvailMMX AvailInstructionSet;
@@ -234,25 +234,25 @@ template <size_t Size> struct MaxWordSizeHelper;
 // Maximum size of SSE register is 128 bit on x86 and x86_64
 template <>
 struct MaxWordSizeHelper<16> {
-    struct MaxSizeWord { 
-        char val[16]; 
-    }; 
+    struct MaxSizeWord {
+        char val[16];
+    };
 };
 
 typedef MaxWordSizeHelper<16>::MaxSizeWord MaxSizeWord;
 
 // MaxSizeWord size should be a multiple of size_t size and a multipe of Word size
 PIRE_STATIC_ASSERT(
-    (sizeof(MaxSizeWord) % sizeof(size_t) == 0) && 
-    (sizeof(MaxSizeWord) % sizeof(Word) == 0)); 
+    (sizeof(MaxSizeWord) % sizeof(size_t) == 0) &&
+    (sizeof(MaxSizeWord) % sizeof(Word) == 0));
 
 inline size_t FillSizeT(char c)
 {
-    size_t w = c; 
-    w &= 0x0ff; 
-    for (size_t i = 8; i != sizeof(size_t)*8; i <<= 1) 
-        w = (w << i) | w; 
-    return w; 
+    size_t w = c;
+    w &= 0x0ff;
+    for (size_t i = 8; i != sizeof(size_t)*8; i <<= 1)
+        w = (w << i) | w;
+    return w;
 }
 
 }}

+ 213 - 213
contrib/libs/pire/pire/re_lexer.cpp

@@ -29,15 +29,15 @@
 #include <contrib/libs/pire/pire/stub/singleton.h>
 
 #include "fsm.h"
-#include "re_lexer.h" 
-#include "re_parser.h" 
+#include "re_lexer.h"
+#include "re_parser.h"
 #include "read_unicode.h"
 
 
 namespace Pire {
 
 namespace Impl {
-    int yre_parse(Pire::Lexer& lexer); 
+    int yre_parse(Pire::Lexer& lexer);
 }
 
 Term Term::Character(wchar32 c) { Term::CharacterRange cr; cr.first.insert(Term::String(1, c)); cr.second = false; return Term(TokenTypes::Letters, cr); }
@@ -50,51 +50,51 @@ Lexer::~Lexer() = default;
 
 wchar32 Lexer::GetChar()
 {
-    if (m_input.empty()) 
-        return End; 
-    else if (m_input.front() == '\\') { 
-        m_input.pop_front(); 
-        if (m_input.empty()) 
-            Error("Regexp must not end with a backslash"); 
-        wchar32 ch = m_input.front(); 
-        m_input.pop_front(); 
-        return Control | ch; 
-    } else { 
-        wchar32 ch = m_input.front(); 
-        m_input.pop_front(); 
-        return ch; 
-    } 
+    if (m_input.empty())
+        return End;
+    else if (m_input.front() == '\\') {
+        m_input.pop_front();
+        if (m_input.empty())
+            Error("Regexp must not end with a backslash");
+        wchar32 ch = m_input.front();
+        m_input.pop_front();
+        return Control | ch;
+    } else {
+        wchar32 ch = m_input.front();
+        m_input.pop_front();
+        return ch;
+    }
 }
 
 wchar32 Lexer::PeekChar()
 {
-    if (m_input.empty()) 
-        return End; 
-    else 
-        return m_input.front(); 
+    if (m_input.empty())
+        return End;
+    else
+        return m_input.front();
 }
 
 void Lexer::UngetChar(wchar32 c)
 {
-    if (c != End) 
-        m_input.push_front(c); 
+    if (c != End)
+        m_input.push_front(c);
 }
 
 namespace {
     class CompareFeaturesByPriority: public ybinary_function<const Feature::Ptr&, const Feature::Ptr&, bool> {
-    public: 
+    public:
         bool operator()(const Feature::Ptr& a, const Feature::Ptr& b) const
-        { 
-            return a->Priority() < b->Priority(); 
-        } 
-    }; 
+        {
+            return a->Priority() < b->Priority();
+        }
+    };
 }
 
 Lexer& Lexer::AddFeature(Feature::Ptr& feature)
 {
-    feature->m_lexer = this; 
+    feature->m_lexer = this;
     m_features.insert(LowerBound(m_features.begin(), m_features.end(), feature, CompareFeaturesByPriority()), std::move(feature));
-    return *this; 
+    return *this;
 }
 
 Lexer& Lexer::AddFeature(Feature::Ptr&& feature)
@@ -106,107 +106,107 @@ Lexer& Lexer::AddFeature(Feature::Ptr&& feature)
 
 Term Lexer::DoLex()
 {
-    static const char* controls = "|().*+?^$\\"; 
-    for (;;) { 
-        UngetChar(GetChar()); 
-        wchar32 ch = PeekChar(); 
-        if (ch == End) 
-            return Term(TokenTypes::End); 
+    static const char* controls = "|().*+?^$\\";
+    for (;;) {
+        UngetChar(GetChar());
+        wchar32 ch = PeekChar();
+        if (ch == End)
+            return Term(TokenTypes::End);
         for (auto&& i : m_features) {
             if (i->Accepts(ch)) {
                 Term ret = i->Lex();
-                if (ret.Type()) 
-                    return ret; 
-            } 
-        } 
-        ch = GetChar(); 
-
-        if (ch == '|') 
-            return Term(TokenTypes::Or); 
-        else if (ch == '(') { 
-            return Term(TokenTypes::Open); 
-        } else if (ch == ')') 
-            return Term(TokenTypes::Close); 
-        else if (ch == '.') 
-            return Term::Dot(); 
-        else if (ch == '*') 
-            return Term::Repetition(0, Inf); 
-        else if (ch == '+') 
-            return Term::Repetition(1, Inf); 
-        else if (ch == '?') 
-            return Term::Repetition(0, 1); 
-        else if (ch == '^') 
-            return Term::BeginMark(); 
-        else if (ch == '$') 
-            return Term::EndMark(); 
-        else if ((ch & ControlMask) == Control && strchr(controls, ch & ~ControlMask)) 
-            return Term::Character(ch & ~ControlMask); 
-        else 
-            return Term::Character(ch); 
-    } 
+                if (ret.Type())
+                    return ret;
+            }
+        }
+        ch = GetChar();
+
+        if (ch == '|')
+            return Term(TokenTypes::Or);
+        else if (ch == '(') {
+            return Term(TokenTypes::Open);
+        } else if (ch == ')')
+            return Term(TokenTypes::Close);
+        else if (ch == '.')
+            return Term::Dot();
+        else if (ch == '*')
+            return Term::Repetition(0, Inf);
+        else if (ch == '+')
+            return Term::Repetition(1, Inf);
+        else if (ch == '?')
+            return Term::Repetition(0, 1);
+        else if (ch == '^')
+            return Term::BeginMark();
+        else if (ch == '$')
+            return Term::EndMark();
+        else if ((ch & ControlMask) == Control && strchr(controls, ch & ~ControlMask))
+            return Term::Character(ch & ~ControlMask);
+        else
+            return Term::Character(ch);
+    }
 }
 
 Term Lexer::Lex()
 {
-    Term t = DoLex(); 
+    Term t = DoLex();
 
     for (auto i = m_features.rbegin(), ie = m_features.rend(); i != ie; ++i)
-        (*i)->Alter(t); 
+        (*i)->Alter(t);
 
-    if (t.Value().IsA<Term::CharacterRange>()) { 
+    if (t.Value().IsA<Term::CharacterRange>()) {
         const auto& chars = t.Value().As<Term::CharacterRange>();
-        //std::cerr << "lex: type " << t.type() << "; chars = { " << join(chars.first.begin(), chars.first.end(), ", ") << " }" << std::endl; 
+        //std::cerr << "lex: type " << t.type() << "; chars = { " << join(chars.first.begin(), chars.first.end(), ", ") << " }" << std::endl;
         for (auto&& i : chars.first)
             for (auto&& j : i)
                 if ((j & ControlMask) == Control)
-                    Error("Control character in tokens sequence"); 
-    } 
-
-    int type = t.Type(); 
-    if (type == TokenTypes::Letters) 
-        type = YRE_LETTERS; 
-    else if (type == TokenTypes::Count) 
-        type = YRE_COUNT; 
-    else if (type == TokenTypes::Dot) 
-        type = YRE_DOT; 
-    else if (type == TokenTypes::Open) 
-        type = '('; 
-    else if (type == TokenTypes::Close) 
-        type = ')'; 
-    else if (type == TokenTypes::Or) 
-        type = '|'; 
-    else if (type == TokenTypes::And) 
-        type = YRE_AND; 
-    else if (type == TokenTypes::Not) 
-        type = YRE_NOT; 
-    else if (type == TokenTypes::BeginMark) 
-        type = '^'; 
-    else if (type == TokenTypes::EndMark) 
-        type = '$'; 
-    else if (type == TokenTypes::End) 
-        type = 0; 
-    return Term(type, t.Value()); 
+                    Error("Control character in tokens sequence");
+    }
+
+    int type = t.Type();
+    if (type == TokenTypes::Letters)
+        type = YRE_LETTERS;
+    else if (type == TokenTypes::Count)
+        type = YRE_COUNT;
+    else if (type == TokenTypes::Dot)
+        type = YRE_DOT;
+    else if (type == TokenTypes::Open)
+        type = '(';
+    else if (type == TokenTypes::Close)
+        type = ')';
+    else if (type == TokenTypes::Or)
+        type = '|';
+    else if (type == TokenTypes::And)
+        type = YRE_AND;
+    else if (type == TokenTypes::Not)
+        type = YRE_NOT;
+    else if (type == TokenTypes::BeginMark)
+        type = '^';
+    else if (type == TokenTypes::EndMark)
+        type = '$';
+    else if (type == TokenTypes::End)
+        type = 0;
+    return Term(type, t.Value());
 }
 
 void Lexer::Parenthesized(Fsm& fsm)
 {
     for (auto i = m_features.rbegin(), ie = m_features.rend(); i != ie; ++i)
-        (*i)->Parenthesized(fsm); 
+        (*i)->Parenthesized(fsm);
 }
 
 wchar32 Feature::CorrectChar(wchar32 c, const char* controls)
 {
-    bool ctrl = (strchr(controls, c & 0xFF) != 0); 
-    if ((c & ControlMask) == Control && ctrl) 
-        return c & ~ControlMask; 
-    if (c <= 0xFF && ctrl) 
-        return c | Control; 
-    return c; 
+    bool ctrl = (strchr(controls, c & 0xFF) != 0);
+    if ((c & ControlMask) == Control && ctrl)
+        return c & ~ControlMask;
+    if (c <= 0xFF && ctrl)
+        return c | Control;
+    return c;
 }
 
 namespace {
     class EnableUnicodeSequencesImpl : public UnicodeReader {
-    public: 
+    public:
         bool Accepts(wchar32 c) const {
             return c == (Control | 'x');
         }
@@ -218,27 +218,27 @@ namespace {
 
     class CharacterRangeReader: public UnicodeReader {
     public:
-        bool Accepts(wchar32 c) const { return c == '[' || c == (Control | '[') || c == (Control | ']'); } 
-
-        Term Lex() 
-        { 
-            static const char* controls = "^[]-\\"; 
-            static const char* controls2 = "*+{}()$?.&~"; 
-            wchar32 ch = CorrectChar(GetChar(), controls); 
-            if (ch == '[' || ch == ']') 
-                return Term::Character(ch); 
-
-            Term::CharacterRange cs; 
-            ch = CorrectChar(GetChar(), controls); 
-            if (ch == (Control | '^')) { 
-                cs.second = true; 
-                ch = CorrectChar(GetChar(), controls); 
-            } 
+        bool Accepts(wchar32 c) const { return c == '[' || c == (Control | '[') || c == (Control | ']'); }
+
+        Term Lex()
+        {
+            static const char* controls = "^[]-\\";
+            static const char* controls2 = "*+{}()$?.&~";
+            wchar32 ch = CorrectChar(GetChar(), controls);
+            if (ch == '[' || ch == ']')
+                return Term::Character(ch);
+
+            Term::CharacterRange cs;
+            ch = CorrectChar(GetChar(), controls);
+            if (ch == (Control | '^')) {
+                cs.second = true;
+                ch = CorrectChar(GetChar(), controls);
+            }
 
             bool firstUnicode;
             wchar32 unicodeSymbol = 0;
 
-            for (; ch != End && ch != (Control | ']'); ch = CorrectChar(GetChar(), controls)) { 
+            for (; ch != End && ch != (Control | ']'); ch = CorrectChar(GetChar(), controls)) {
                 if (ch == (Control | 'x')) {
                     UngetChar(ch);
 					firstUnicode = true;
@@ -248,7 +248,7 @@ namespace {
                 }
 
                 if (((ch & ControlMask) != Control || firstUnicode) && CorrectChar(PeekChar(), controls) == (Control | '-')) {
-                    GetChar(); 
+                    GetChar();
                     wchar32 current = GetChar();
 
                     bool secondUnicode = (current == (Control | 'x'));
@@ -265,104 +265,104 @@ namespace {
                     }
 
                     for (ch = begin; ch <= end; ++ch) {
-                        cs.first.insert(Term::String(1, ch)); 
+                        cs.first.insert(Term::String(1, ch));
                     }
                 } else if (ch == (Control | '-')) {
-                    cs.first.insert(Term::String(1, '-')); 
+                    cs.first.insert(Term::String(1, '-'));
                 }
                 else if ((ch & ControlMask) == Control && (strchr(controls2, ch & ~ControlMask) || strchr(controls, ch & ~ControlMask))) {
-                    cs.first.insert(Term::String(1, ch & ~ControlMask)); 
+                    cs.first.insert(Term::String(1, ch & ~ControlMask));
                 }
                 else if ((ch & ControlMask) != Control || !strchr(controls, ch & ~ControlMask)) {
                     cs.first.insert(Term::String(1, (firstUnicode) ? unicodeSymbol : ch));
                 } else {
-                    Error("Wrong character in range"); 
+                    Error("Wrong character in range");
                 }
-            } 
-            if (ch == End) 
-                Error("Unexpected end of pattern"); 
-
-            return Term(TokenTypes::Letters, cs); 
-        } 
-    }; 
-
-    class RepetitionCountReader: public Feature { 
-    public: 
-        bool Accepts(wchar32 c) const { return c == '{' || c == (Control | '{') || c == (Control | '}'); } 
-
-        Term Lex() 
-        { 
-            wchar32 ch = GetChar(); 
-            if (ch == (Control | '{') || ch == (Control | '}')) 
-                return Term::Character(ch & ~ControlMask); 
-            ch = GetChar(); 
-            int lower = 0, upper = 0; 
-
-            if (!is_digit(ch)) 
-                Error("Wrong repetition count"); 
-
-            for (; is_digit(ch); ch = GetChar()) 
-                lower = lower * 10 + (ch - '0'); 
-            if (ch == '}') 
-                return Term::Repetition(lower, lower); 
-            else if (ch != ',') 
-                Error("Wrong repetition count"); 
-
-            ch = GetChar(); 
-            if (ch == '}') 
-                return Term::Repetition(lower, Inf); 
-            else if (!is_digit(ch)) 
-                Error("Wrong repetition count"); 
-            for (; is_digit(ch); ch = GetChar()) 
-                upper = upper * 10 + (ch - '0'); 
-
-            if (ch != '}') 
-                Error("Wrong repetition count"); 
-            return Term::Repetition(lower, upper); 
-        } 
-    }; 
-
-    class CaseInsensitiveImpl: public Feature { 
-    public: 
-        void Alter(Term& t) 
-        { 
-            if (t.Value().IsA<Term::CharacterRange>()) { 
-                typedef Term::CharacterRange::first_type CharSet; 
-                const CharSet& old = t.Value().As<Term::CharacterRange>().first; 
-                CharSet altered; 
+            }
+            if (ch == End)
+                Error("Unexpected end of pattern");
+
+            return Term(TokenTypes::Letters, cs);
+        }
+    };
+
+    class RepetitionCountReader: public Feature {
+    public:
+        bool Accepts(wchar32 c) const { return c == '{' || c == (Control | '{') || c == (Control | '}'); }
+
+        Term Lex()
+        {
+            wchar32 ch = GetChar();
+            if (ch == (Control | '{') || ch == (Control | '}'))
+                return Term::Character(ch & ~ControlMask);
+            ch = GetChar();
+            int lower = 0, upper = 0;
+
+            if (!is_digit(ch))
+                Error("Wrong repetition count");
+
+            for (; is_digit(ch); ch = GetChar())
+                lower = lower * 10 + (ch - '0');
+            if (ch == '}')
+                return Term::Repetition(lower, lower);
+            else if (ch != ',')
+                Error("Wrong repetition count");
+
+            ch = GetChar();
+            if (ch == '}')
+                return Term::Repetition(lower, Inf);
+            else if (!is_digit(ch))
+                Error("Wrong repetition count");
+            for (; is_digit(ch); ch = GetChar())
+                upper = upper * 10 + (ch - '0');
+
+            if (ch != '}')
+                Error("Wrong repetition count");
+            return Term::Repetition(lower, upper);
+        }
+    };
+
+    class CaseInsensitiveImpl: public Feature {
+    public:
+        void Alter(Term& t)
+        {
+            if (t.Value().IsA<Term::CharacterRange>()) {
+                typedef Term::CharacterRange::first_type CharSet;
+                const CharSet& old = t.Value().As<Term::CharacterRange>().first;
+                CharSet altered;
                 for (auto&& i : old) {
                     if (i.size() == 1) {
                         altered.insert(Term::String(1, to_upper(i[0])));
                         altered.insert(Term::String(1, to_lower(i[0])));
-                    } else 
+                    } else
                         altered.insert(i);
-                } 
-                t = Term(t.Type(), Term::CharacterRange(altered, t.Value().As<Term::CharacterRange>().second)); 
-            } 
-        } 
-    }; 
-    class AndNotSupportImpl: public Feature { 
-    public: 
-        bool Accepts(wchar32 c) const 
-        { 
-            return c == '&' || c == '~' || c == (Control | '&') || c == (Control | '~'); 
-        } 
-
-        Term Lex() 
-        { 
-            wchar32 ch = GetChar(); 
-            if (ch == (Control | '&') || ch == (Control | '~')) 
-                return Term::Character(ch & ~ControlMask); 
-            else if (ch == '&') 
-                return Term(TokenTypes::And); 
-            else if (ch == '~') 
-                return Term(TokenTypes::Not); 
-            else { 
-                Error("Pire::AndNotSupport::Lex(): strange input character"); 
-                return Term(0); // Make compiler happy 
-            } 
-        } 
-    }; 
+                }
+                t = Term(t.Type(), Term::CharacterRange(altered, t.Value().As<Term::CharacterRange>().second));
+            }
+        }
+    };
+    class AndNotSupportImpl: public Feature {
+    public:
+        bool Accepts(wchar32 c) const
+        {
+            return c == '&' || c == '~' || c == (Control | '&') || c == (Control | '~');
+        }
+
+        Term Lex()
+        {
+            wchar32 ch = GetChar();
+            if (ch == (Control | '&') || ch == (Control | '~'))
+                return Term::Character(ch & ~ControlMask);
+            else if (ch == '&')
+                return Term(TokenTypes::And);
+            else if (ch == '~')
+                return Term(TokenTypes::Not);
+            else {
+                Error("Pire::AndNotSupport::Lex(): strange input character");
+                return Term(0); // Make compiler happy
+            }
+        }
+    };
 }
 
 namespace Features {
@@ -375,18 +375,18 @@ void Lexer::InstallDefaultFeatures()
 {
     AddFeature(Feature::Ptr(new CharacterRangeReader));
     AddFeature(Feature::Ptr(new RepetitionCountReader));
-    AddFeature(Features::CharClasses()); 
+    AddFeature(Features::CharClasses());
     AddFeature(Feature::Ptr(new EnableUnicodeSequencesImpl));
 }
 
 Fsm Lexer::Parse()
 {
-    if (!Impl::yre_parse(*this)) 
-        return m_retval.As<Fsm>(); 
-    else { 
-        Error("Syntax error in regexp"); 
-        return Fsm(); // Make compiler happy 
-    } 
+    if (!Impl::yre_parse(*this))
+        return m_retval.As<Fsm>();
+    else {
+        Error("Syntax error in regexp");
+        return Fsm(); // Make compiler happy
+    }
 }
 
 }

+ 106 - 106
contrib/libs/pire/pire/re_parser.y

@@ -52,16 +52,16 @@ using Pire::Fsm;
 using Pire::Encoding;
 
 int  yylex(YYSTYPE*, Lexer&);
-void yyerror(Pire::Lexer&, const char*); 
+void yyerror(Pire::Lexer&, const char*);
 
 Fsm& ConvertToFSM(const Encoding& encoding, Any* any);
 void AppendRange(const Encoding& encoding, Fsm& a, const Term::CharacterRange& cr);
 
 %}
 
-%parse-param { Pire::Lexer& rlex } 
-%lex-param { Pire::Lexer& rlex } 
-%pure-parser 
+%parse-param { Pire::Lexer& rlex }
+%lex-param { Pire::Lexer& rlex }
+%pure-parser
 
 // Terminal declarations
 %term YRE_LETTERS
@@ -75,83 +75,83 @@ void AppendRange(const Encoding& encoding, Fsm& a, const Term::CharacterRange& c
 %%
 
 regexp
-    : alternative 
-        { 
-            ConvertToFSM(rlex.Encoding(), $1); 
-            DoSwap(rlex.Retval(), *$1); 
-            delete $1; 
+    : alternative
+        {
+            ConvertToFSM(rlex.Encoding(), $1);
+            DoSwap(rlex.Retval(), *$1);
+            delete $1;
             $$ = nullptr;
-        } 
-    ; 
+        }
+    ;
 
 alternative
-    : conjunction 
+    : conjunction
     | alternative '|' conjunction { ConvertToFSM(rlex.Encoding(), ($$ = $1)) |= ConvertToFSM(rlex.Encoding(), $3); delete $2; delete $3; }
-    ; 
+    ;
 
 conjunction
-    : negation 
+    : negation
     | conjunction YRE_AND negation { ConvertToFSM(rlex.Encoding(), ($$ = $1)) &= ConvertToFSM(rlex.Encoding(), $3); delete $2; delete $3; }
-    ; 
+    ;
 
 negation
-    : concatenation 
+    : concatenation
     | YRE_NOT concatenation { ConvertToFSM(rlex.Encoding(), ($$ = $2)).Complement(); delete $1; }
-    ; 
+    ;
 
 concatenation
-    : { $$ = new Any(Fsm()); } 
-    | concatenation iteration 
-        { 
-            Fsm& a = ConvertToFSM(rlex.Encoding(), ($$ = $1)); 
-            if ($2->IsA<Term::CharacterRange>() && !$2->As<Term::CharacterRange>().second) 
-                AppendRange(rlex.Encoding(), a, $2->As<Term::CharacterRange>()); 
-            else if ($2->IsA<Term::DotTag>()) 
-                rlex.Encoding().AppendDot(a); 
-            else 
-                a += ConvertToFSM(rlex.Encoding(), $2); 
-            delete $2; 
-        } 
-    ; 
+    : { $$ = new Any(Fsm()); }
+    | concatenation iteration
+        {
+            Fsm& a = ConvertToFSM(rlex.Encoding(), ($$ = $1));
+            if ($2->IsA<Term::CharacterRange>() && !$2->As<Term::CharacterRange>().second)
+                AppendRange(rlex.Encoding(), a, $2->As<Term::CharacterRange>());
+            else if ($2->IsA<Term::DotTag>())
+                rlex.Encoding().AppendDot(a);
+            else
+                a += ConvertToFSM(rlex.Encoding(), $2);
+            delete $2;
+        }
+    ;
 
 iteration
-    : term 
-    | term YRE_COUNT 
-        { 
-            Fsm& orig = ConvertToFSM(rlex.Encoding(), $1); 
-            $$ = new Any(orig); 
-            Fsm& cur = $$->As<Fsm>(); 
-            const Term::RepetitionCount& repc = $2->As<Term::RepetitionCount>(); 
-
-
-            if (repc.first == 0 && repc.second == 1) { 
-                Fsm empty; 
-                cur |= empty; 
-            } else if (repc.first == 0 && repc.second == Inf) { 
-                cur.Iterate(); 
-            } else if (repc.first == 1 && repc.second == Inf) { 
-                cur += *cur; 
-            } else { 
-                cur *= repc.first; 
-                if (repc.second == Inf) { 
-                    cur += *orig; 
-                } else if (repc.second != repc.first) { 
-                    cur += (orig | Fsm()) * (repc.second - repc.first); 
-                } 
-            } 
+    : term
+    | term YRE_COUNT
+        {
+            Fsm& orig = ConvertToFSM(rlex.Encoding(), $1);
+            $$ = new Any(orig);
+            Fsm& cur = $$->As<Fsm>();
+            const Term::RepetitionCount& repc = $2->As<Term::RepetitionCount>();
+
+
+            if (repc.first == 0 && repc.second == 1) {
+                Fsm empty;
+                cur |= empty;
+            } else if (repc.first == 0 && repc.second == Inf) {
+                cur.Iterate();
+            } else if (repc.first == 1 && repc.second == Inf) {
+                cur += *cur;
+            } else {
+                cur *= repc.first;
+                if (repc.second == Inf) {
+                    cur += *orig;
+                } else if (repc.second != repc.first) {
+                    cur += (orig | Fsm()) * (repc.second - repc.first);
+                }
+            }
             rlex.Parenthesized($$->As<Fsm>());
-            delete $1; 
-            delete $2; 
-        } 
-    ; 
+            delete $1;
+            delete $2;
+        }
+    ;
 
 term
-    : YRE_LETTERS 
-    | YRE_DOT 
-    | '^' 
-    | '$' 
+    : YRE_LETTERS
+    | YRE_DOT
+    | '^'
+    | '$'
     | '(' alternative ')'      { $$ = $2; rlex.Parenthesized($$->As<Fsm>()); delete $1; delete $3; }
-    ; 
+    ;
 
 %%
 
@@ -181,60 +181,60 @@ void AppendRange(const Encoding& encoding, Fsm& a, const Term::CharacterRange& c
     TVector<ystring> strings;
 
     for (auto&& i : cr.first) {
-        ystring s; 
+        ystring s;
         for (auto&& j : i) {
             ystring c = encoding.ToLocal(j);
-            if (c.empty()) { 
-                s.clear(); 
-                break; 
-            } else 
+            if (c.empty()) {
+                s.clear();
+                break;
+            } else
                 s += encoding.ToLocal(j);
-        } 
-        if (!s.empty()) 
-            strings.push_back(s); 
-    } 
-    if (strings.empty()) 
-        // Strings accepted by this FSM are not representable in the current encoding. 
-        // Hence, FSM will accept nothing, and we simply can clear it. 
-        a = Fsm::MakeFalse(); 
-    else 
-        a.AppendStrings(strings); 
+        }
+        if (!s.empty())
+            strings.push_back(s);
+    }
+    if (strings.empty())
+        // Strings accepted by this FSM are not representable in the current encoding.
+        // Hence, FSM will accept nothing, and we simply can clear it.
+        a = Fsm::MakeFalse();
+    else
+        a.AppendStrings(strings);
 }
 
 Fsm& ConvertToFSM(const Encoding& encoding, Any* any)
 {
-    if (any->IsA<Fsm>()) 
-        return any->As<Fsm>(); 
-
-    Any ret = Fsm(); 
-    Fsm& a = ret.As<Fsm>(); 
-
-    if (any->IsA<Term::DotTag>()) { 
-        encoding.AppendDot(a); 
-    } else if (any->IsA<Term::BeginTag>()) { 
-        a.AppendSpecial(BeginMark); 
-    } else if (any->IsA<Term::EndTag>()) { 
-        a.AppendSpecial(EndMark); 
-    } else { 
-        Term::CharacterRange cr = any->As<Term::CharacterRange>(); 
-        AppendRange(encoding, a, cr); 
-        if (cr.second) { 
-            Fsm x; 
-            encoding.AppendDot(x); 
-            x.Complement(); 
-            a |= x; 
-            a.Complement(); 
-            a.RemoveDeadEnds(); 
-        } 
-    } 
-    any->Swap(ret); 
-    return a; 
+    if (any->IsA<Fsm>())
+        return any->As<Fsm>();
+
+    Any ret = Fsm();
+    Fsm& a = ret.As<Fsm>();
+
+    if (any->IsA<Term::DotTag>()) {
+        encoding.AppendDot(a);
+    } else if (any->IsA<Term::BeginTag>()) {
+        a.AppendSpecial(BeginMark);
+    } else if (any->IsA<Term::EndTag>()) {
+        a.AppendSpecial(EndMark);
+    } else {
+        Term::CharacterRange cr = any->As<Term::CharacterRange>();
+        AppendRange(encoding, a, cr);
+        if (cr.second) {
+            Fsm x;
+            encoding.AppendDot(x);
+            x.Complement();
+            a |= x;
+            a.Complement();
+            a.RemoveDeadEnds();
+        }
+    }
+    any->Swap(ret);
+    return a;
 }
 
 }
 
 namespace Pire {
-    namespace Impl { 
+    namespace Impl {
         int yre_parse(Pire::Lexer& rlex)
         {
             int rc = yyparse(rlex);
@@ -243,5 +243,5 @@ namespace Pire {
                 throw Error(rlex.GetError());
             return rc;
         }
-    } 
+    }
 }

+ 70 - 70
contrib/tools/bison/bison/data/README

@@ -1,70 +1,70 @@
--*- outline -*- 
- 
-This directory contains data needed by Bison. 
- 
-* Skeletons 
-Bison skeletons: the general shapes of the different parser kinds, 
-that are specialized for specific grammars by the bison program. 
- 
-Currently, the supported skeletons are: 
- 
-- yacc.c 
-  It used to be named bison.simple: it corresponds to C Yacc 
-  compatible LALR(1) parsers. 
- 
-- lalr1.cc 
-  Produces a C++ parser class. 
- 
-- lalr1.java 
-  Produces a Java parser class. 
- 
-- glr.c 
-  A Generalized LR C parser based on Bison's LALR(1) tables. 
- 
-- glr.cc 
-  A Generalized LR C++ parser.  Actually a C++ wrapper around glr.c. 
- 
-These skeletons are the only ones supported by the Bison team. 
-Because the interface between skeletons and the bison program is not 
-finished, *we are not bound to it*.  In particular, Bison is not 
-mature enough for us to consider that "foreign skeletons" are 
-supported. 
- 
-* m4sugar 
-This directory contains M4sugar, sort of an extended library for M4, 
-which is used by Bison to instantiate the skeletons. 
- 
-* xslt 
-This directory contains XSLT programs that transform Bison's XML output 
-into various formats. 
- 
-- bison.xsl 
-  A library of routines used by the other XSLT programs. 
- 
-- xml2dot.xsl 
-  Conversion into GraphViz's dot format. 
- 
-- xml2text.xsl 
-  Conversion into text. 
- 
-- xml2xhtml.xsl 
-  Conversion into XHTML. 
- 
------ 
- 
-Copyright (C) 2002, 2008-2013 Free Software Foundation, Inc. 
- 
-This file is part of GNU Bison. 
- 
-This program is free software: you can redistribute it and/or modify 
-it under the terms of the GNU General Public License as published by 
-the Free Software Foundation, either version 3 of the License, or 
-(at your option) any later version. 
- 
-This program is distributed in the hope that it will be useful, 
-but WITHOUT ANY WARRANTY; without even the implied warranty of 
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
-GNU General Public License for more details. 
- 
-You should have received a copy of the GNU General Public License 
-along with this program.  If not, see <http://www.gnu.org/licenses/>. 
+-*- outline -*-
+
+This directory contains data needed by Bison.
+
+* Skeletons
+Bison skeletons: the general shapes of the different parser kinds,
+that are specialized for specific grammars by the bison program.
+
+Currently, the supported skeletons are:
+
+- yacc.c
+  It used to be named bison.simple: it corresponds to C Yacc
+  compatible LALR(1) parsers.
+
+- lalr1.cc
+  Produces a C++ parser class.
+
+- lalr1.java
+  Produces a Java parser class.
+
+- glr.c
+  A Generalized LR C parser based on Bison's LALR(1) tables.
+
+- glr.cc
+  A Generalized LR C++ parser.  Actually a C++ wrapper around glr.c.
+
+These skeletons are the only ones supported by the Bison team.
+Because the interface between skeletons and the bison program is not
+finished, *we are not bound to it*.  In particular, Bison is not
+mature enough for us to consider that "foreign skeletons" are
+supported.
+
+* m4sugar
+This directory contains M4sugar, sort of an extended library for M4,
+which is used by Bison to instantiate the skeletons.
+
+* xslt
+This directory contains XSLT programs that transform Bison's XML output
+into various formats.
+
+- bison.xsl
+  A library of routines used by the other XSLT programs.
+
+- xml2dot.xsl
+  Conversion into GraphViz's dot format.
+
+- xml2text.xsl
+  Conversion into text.
+
+- xml2xhtml.xsl
+  Conversion into XHTML.
+
+-----
+
+Copyright (C) 2002, 2008-2013 Free Software Foundation, Inc.
+
+This file is part of GNU Bison.
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.

+ 1063 - 1063
contrib/tools/bison/bison/data/bison.m4

@@ -1,1063 +1,1063 @@
-                                                            -*- Autoconf -*- 
- 
-# Language-independent M4 Macros for Bison. 
- 
-# Copyright (C) 2002, 2004-2013 Free Software Foundation, Inc. 
- 
-# This program is free software: you can redistribute it and/or modify 
-# it under the terms of the GNU General Public License as published by 
-# the Free Software Foundation, either version 3 of the License, or 
-# (at your option) any later version. 
-# 
-# This program is distributed in the hope that it will be useful, 
-# but WITHOUT ANY WARRANTY; without even the implied warranty of 
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
-# GNU General Public License for more details. 
-# 
-# You should have received a copy of the GNU General Public License 
-# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
- 
- 
-## ---------------- ## 
-## Identification.  ## 
-## ---------------- ## 
- 
-# b4_copyright(TITLE, [YEARS]) 
-# ---------------------------- 
-# If YEARS are not defined, use b4_copyright_years. 
-m4_define([b4_copyright], 
-[b4_comment([A Bison parser, made by GNU Bison b4_version.]) 
- 
-b4_comment([$1 
- 
-]m4_dquote(m4_text_wrap([Copyright (C) 
-]m4_ifval([$2], [[$2]], [m4_defn([b4_copyright_years])])[ 
-Free Software Foundation, Inc.]))[ 
- 
-This program is free software: you can redistribute it and/or modify 
-it under the terms of the GNU General Public License as published by 
-the Free Software Foundation, either version 3 of the License, or 
-(at your option) any later version. 
- 
-This program is distributed in the hope that it will be useful, 
-but WITHOUT ANY WARRANTY; without even the implied warranty of 
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
-GNU General Public License for more details. 
- 
-You should have received a copy of the GNU General Public License 
-along with this program.  If not, see <http://www.gnu.org/licenses/>.]) 
- 
-b4_comment([As a special exception, you may create a larger work that contains 
-part or all of the Bison parser skeleton and distribute that work 
-under terms of your choice, so long as that work isn't itself a 
-parser generator using the skeleton or a modified version thereof 
-as a parser skeleton.  Alternatively, if you modify or redistribute 
-the parser skeleton itself, you may (at your option) remove this 
-special exception, which will cause the skeleton and the resulting 
-Bison output files to be licensed under the GNU General Public 
-License without this special exception. 
- 
-This special exception was added by the Free Software Foundation in 
-version 2.2 of Bison.])]) 
- 
- 
-## -------- ## 
-## Output.  ## 
-## -------- ## 
- 
-# b4_output_begin(FILE) 
-# --------------------- 
-# Enable output, i.e., send to diversion 0, expand after "#", and 
-# generate the tag to output into FILE.  Must be followed by EOL. 
-m4_define([b4_output_begin], 
-[m4_changecom() 
-m4_divert_push(0)dnl 
-@output(m4_unquote([$1])@)@dnl 
-]) 
- 
- 
-# b4_output_end() 
-# --------------- 
-# Output nothing, restore # as comment character (no expansions after #). 
-m4_define([b4_output_end], 
-[m4_divert_pop(0) 
-m4_changecom([#]) 
-]) 
- 
- 
-# b4_divert_kill(CODE) 
-# -------------------- 
-# Expand CODE for its side effects, discard its output. 
-m4_define([b4_divert_kill], 
-[m4_divert_text([KILL], [$1])]) 
- 
- 
-# b4_define_silent(MACRO, CODE) 
-# ----------------------------- 
-# Same as m4_define, but throw away the expansion of CODE. 
-m4_define([b4_define_silent], 
-[m4_define([$1], [b4_divert_kill([$2])])]) 
- 
- 
-## ---------------- ## 
-## Error handling.  ## 
-## ---------------- ## 
- 
-# The following error handling macros print error directives that should not 
-# become arguments of other macro invocations since they would likely then be 
-# mangled.  Thus, they print to stdout directly. 
- 
-# b4_cat(TEXT) 
-# ------------ 
-# Write TEXT to stdout.  Precede the final newline with an @ so that it's 
-# escaped.  For example: 
-# 
-#   b4_cat([[@complain(invalid input@)]]) 
-m4_define([b4_cat], 
-[m4_syscmd([cat <<'_m4eof' 
-]m4_bpatsubst(m4_dquote($1), [_m4eof], [_m4@`eof])[@ 
-_m4eof 
-])dnl 
-m4_if(m4_sysval, [0], [], [m4_fatal([$0: cannot write to stdout])])]) 
- 
-# b4_error(KIND, START, END, FORMAT, [ARG1], [ARG2], ...) 
-# ------------------------------------------------------- 
-# Write @KIND(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout. 
-# 
-# For example: 
-# 
-#   b4_error([[complain]], [[input.y:2.3]], [[input.y:5.4]], 
-#            [[invalid %s]], [[foo]]) 
-m4_define([b4_error], 
-[b4_cat([[@complain][(]$1[@,]$2[@,]$3[@,]$4[]]dnl 
-[m4_if([$#], [4], [], 
-       [m4_foreach([b4_arg], 
-                   m4_dquote(m4_shift(m4_shift(m4_shift(m4_shift($@))))), 
-                   [[@,]b4_arg])])[@)]])]) 
- 
-# b4_warn(FORMAT, [ARG1], [ARG2], ...) 
-# ------------------------------------ 
-# Write @warn(FORMAT@,ARG1@,ARG2@,...@) to stdout. 
-# 
-# For example: 
-# 
-#   b4_warn([[invalid value for '%s': %s]], [[foo]], [[3]]) 
-# 
-# As a simple test suite, this: 
-# 
-#   m4_divert(-1) 
-#   m4_define([asdf], [ASDF]) 
-#   m4_define([fsa], [FSA]) 
-#   m4_define([fdsa], [FDSA]) 
-#   b4_warn_at([[[asdf), asdf]]], [[[fsa), fsa]]], [[[fdsa), fdsa]]]) 
-#   b4_warn_at([[asdf), asdf]], [[fsa), fsa]], [[fdsa), fdsa]]) 
-#   b4_warn_at() 
-#   b4_warn_at(1) 
-#   b4_warn_at(1, 2) 
-# 
-# Should produce this without newlines: 
-# 
-#   @warn_at([asdf), asdf]@,@,@,[fsa), fsa]@,[fdsa), fdsa]@) 
-#   @warn(asdf), asdf@,@,@,fsa), fsa@,fdsa), fdsa@) 
-#   @warn(@) 
-#   @warn(1@) 
-#   @warn(1@,2@) 
-m4_define([b4_warn], 
-[b4_error([[warn]], [], [], $@)]) 
- 
-# b4_warn_at(START, END, FORMAT, [ARG1], [ARG2], ...) 
-# --------------------------------------------------- 
-# Write @warn(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout. 
-# 
-# For example: 
-# 
-#   b4_warn_at([[input.y:2.3]], [[input.y:5.4]], [[invalid %s]], [[foo]]) 
-m4_define([b4_warn_at], 
-[b4_error([[warn]], $@)]) 
- 
-# b4_complain(FORMAT, [ARG1], [ARG2], ...) 
-# ---------------------------------------- 
-# Bounce to b4_complain_at. 
-# 
-# See b4_warn example. 
-m4_define([b4_complain], 
-[b4_error([[complain]], [], [], $@)]) 
- 
-# b4_complain_at(START, END, FORMAT, [ARG1], [ARG2], ...) 
-# ------------------------------------------------------- 
-# Write @complain(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout. 
-# 
-# See b4_warn_at example. 
-m4_define([b4_complain_at], 
-[b4_error([[complain]], $@)]) 
- 
-# b4_fatal(FORMAT, [ARG1], [ARG2], ...) 
-# ------------------------------------- 
-# Bounce to b4_fatal_at. 
-# 
-# See b4_warn example. 
-m4_define([b4_fatal], 
-[b4_error([[fatal]], [], [], $@)dnl 
-m4_exit(1)]) 
- 
-# b4_fatal_at(START, END, FORMAT, [ARG1], [ARG2], ...) 
-# ---------------------------------------------------- 
-# Write @fatal(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout and exit. 
-# 
-# See b4_warn_at example. 
-m4_define([b4_fatal_at], 
-[b4_error([[fatal]], $@)dnl 
-m4_exit(1)]) 
- 
- 
-## ------------ ## 
-## Data Types.  ## 
-## ------------ ## 
- 
-# b4_ints_in(INT1, INT2, LOW, HIGH) 
-# --------------------------------- 
-# Return 1 iff both INT1 and INT2 are in [LOW, HIGH], 0 otherwise. 
-m4_define([b4_ints_in], 
-[m4_eval([$3 <= $1 && $1 <= $4 && $3 <= $2 && $2 <= $4])]) 
- 
- 
-# b4_subtract(LHS, RHS) 
-# --------------------- 
-# Evaluate LHS - RHS if they are integer literals, otherwise expand 
-# to (LHS) - (RHS). 
-m4_define([b4_subtract], 
-[m4_bmatch([$1$2], [^[0123456789]*$], 
-           [m4_eval([$1 - $2])], 
-           [($1) - ($2)])]) 
- 
-# b4_join(ARG1, ...) 
-# _b4_join(ARG1, ...) 
-# ------------------- 
-# Join with comma, skipping empty arguments. 
-# b4_join calls itself recursively until it sees the first non-empty 
-# argument, then calls _b4_join which prepends each non-empty argument 
-# with a comma. 
-m4_define([b4_join], 
-[m4_if([$#$1], 
-       [1], [], 
-       [m4_ifval([$1], 
-                 [$1[]_$0(m4_shift($@))], 
-                 [$0(m4_shift($@))])])]) 
- 
-# _b4_join(ARGS1, ...) 
-# -------------------- 
-m4_define([_b4_join], 
-[m4_if([$#$1], 
-       [1], [], 
-       [m4_ifval([$1], [, $1])[]$0(m4_shift($@))])]) 
- 
- 
- 
- 
-# b4_integral_parser_tables_map(MACRO) 
-# ------------------------------------- 
-# Map MACRO on all the integral tables.  MACRO is expected to have 
-# the signature MACRO(TABLE-NAME, CONTENT, COMMENT). 
-m4_define([b4_integral_parser_tables_map], 
-[$1([pact], [b4_pact], 
-    [[YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 
-STATE-NUM.]]) 
- 
-$1([defact], [b4_defact], 
-   [[YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. 
-Performed when YYTABLE does not specify something else to do.  Zero 
-means the default is an error.]]) 
- 
-$1([pgoto], [b4_pgoto], [[YYPGOTO[NTERM-NUM].]]) 
- 
-$1([defgoto], [b4_defgoto], [[YYDEFGOTO[NTERM-NUM].]]) 
- 
-$1([table], [b4_table], 
-   [[YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If 
-positive, shift that token.  If negative, reduce the rule whose 
-number is the opposite.  If YYTABLE_NINF, syntax error.]]) 
- 
-$1([check], [b4_check]) 
- 
-$1([stos], [b4_stos], 
-   [[YYSTOS[STATE-NUM] -- The (internal number of the) accessing 
-symbol of state STATE-NUM.]]) 
- 
-$1([r1], [b4_r1], 
-   [[YYR1[YYN] -- Symbol number of symbol that rule YYN derives.]]) 
- 
-$1([r2], [b4_r2], 
-   [[YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.]]) 
-]) 
- 
- 
-# b4_parser_tables_declare 
-# b4_parser_tables_define 
-# ------------------------ 
-# Define/declare the (deterministic) parser tables. 
-m4_define([b4_parser_tables_declare], 
-[b4_integral_parser_tables_map([b4_integral_parser_table_declare])]) 
- 
-m4_define([b4_parser_tables_define], 
-[b4_integral_parser_tables_map([b4_integral_parser_table_define])]) 
- 
- 
- 
-## ------------------ ## 
-## Decoding options.  ## 
-## ------------------ ## 
- 
-# b4_flag_if(FLAG, IF-TRUE, IF-FALSE) 
-# ----------------------------------- 
-# Run IF-TRUE if b4_FLAG_flag is 1, IF-FALSE if FLAG is 0, otherwise fail. 
-m4_define([b4_flag_if], 
-[m4_case(b4_$1_flag, 
-         [0], [$3], 
-         [1], [$2], 
-         [m4_fatal([invalid $1 value: ]b4_$1_flag)])]) 
- 
- 
-# b4_define_flag_if(FLAG) 
-# ----------------------- 
-# Define "b4_FLAG_if(IF-TRUE, IF-FALSE)" that depends on the 
-# value of the Boolean FLAG. 
-m4_define([b4_define_flag_if], 
-[_b4_define_flag_if($[1], $[2], [$1])]) 
- 
-# _b4_define_flag_if($1, $2, FLAG) 
-# -------------------------------- 
-# Work around the impossibility to define macros inside macros, 
-# because issuing '[$1]' is not possible in M4.  GNU M4 should provide 
-# $$1 a la M5/TeX. 
-m4_define([_b4_define_flag_if], 
-[m4_if([$1$2], $[1]$[2], [], 
-       [m4_fatal([$0: Invalid arguments: $@])])dnl 
-m4_define([b4_$3_if], 
-          [b4_flag_if([$3], [$1], [$2])])]) 
- 
- 
-# b4_FLAG_if(IF-TRUE, IF-FALSE) 
-# ----------------------------- 
-# Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise. 
-b4_define_flag_if([defines])            # Whether headers are requested. 
-b4_define_flag_if([glr])                # Whether a GLR parser is requested. 
-b4_define_flag_if([nondeterministic])   # Whether conflicts should be handled. 
-b4_define_flag_if([token_table])        # Whether yytoken_table is demanded. 
-b4_define_flag_if([yacc])               # Whether POSIX Yacc is emulated. 
- 
- 
-## --------- ## 
-## Symbols.  ## 
-## --------- ## 
- 
-# In order to unify the handling of the various aspects of symbols 
-# (tag, type_name, whether terminal, etc.), bison.exe defines one 
-# macro per (token, field), where field can has_id, id, etc.: see 
-# src/output.c:prepare_symbols_definitions(). 
-# 
-# The various FIELDS are: 
-# 
-# - has_id: 0 or 1. 
-#   Whether the symbol has an id. 
-# - id: string 
-#   If has_id, the id.  Guaranteed to be usable as a C identifier. 
-#   Prefixed by api.token.prefix if defined. 
-# - tag: string. 
-#   A representat of the symbol.  Can be 'foo', 'foo.id', '"foo"' etc. 
-# - user_number: integer 
-#   The assigned (external) number as used by yylex. 
-# - is_token: 0 or 1 
-#   Whether this is a terminal symbol. 
-# - number: integer 
-#   The internalized number (used after yytranslate). 
-# - has_type: 0, 1 
-#   Whether has a semantic value. 
-# - type_tag: string 
-#   When api.value.type=union, the generated name for the union member. 
-#   yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc. 
-# - type 
-#   If it has a semantic value, its type tag, or, if variant are used, 
-#   its type. 
-#   In the case of api.value.type=union, type is the real type (e.g. int). 
-# - has_printer: 0, 1 
-# - printer: string 
-# - printer_file: string 
-# - printer_line: integer 
-#   If the symbol has a printer, everything about it. 
-# - has_destructor, destructor, destructor_file, destructor_line 
-#   Likewise. 
-# 
-# The following macros provide access to these values. 
- 
-# b4_symbol_(NUM, FIELD) 
-# ---------------------- 
-# Recover a FIELD about symbol #NUM.  Thanks to m4_indir, fails if 
-# undefined. 
-m4_define([b4_symbol_], 
-[m4_indir([b4_symbol($1, $2)])]) 
- 
- 
-# b4_symbol(NUM, FIELD) 
-# --------------------- 
-# Recover a FIELD about symbol #NUM.  Thanks to m4_indir, fails if 
-# undefined.  If FIELD = id, prepend the token prefix. 
-m4_define([b4_symbol], 
-[m4_case([$2], 
-         [id],    [m4_do([b4_percent_define_get([api.token.prefix])], 
-                         [b4_symbol_([$1], [id])])], 
-         [b4_symbol_($@)])]) 
- 
- 
-# b4_symbol_if(NUM, FIELD, IF-TRUE, IF-FALSE) 
-# ------------------------------------------- 
-# If FIELD about symbol #NUM is 1 expand IF-TRUE, if is 0, expand IF-FALSE. 
-# Otherwise an error. 
-m4_define([b4_symbol_if], 
-[m4_case(b4_symbol([$1], [$2]), 
-         [1], [$3], 
-         [0], [$4], 
-         [m4_fatal([$0: field $2 of $1 is not a Boolean:] b4_symbol([$1], [$2]))])]) 
- 
- 
-# b4_symbol_tag_comment(SYMBOL-NUM) 
-# --------------------------------- 
-# Issue a comment giving the tag of symbol NUM. 
-m4_define([b4_symbol_tag_comment], 
-[b4_comment([b4_symbol([$1], [tag])]) 
-]) 
- 
- 
-# b4_symbol_action_location(SYMBOL-NUM, KIND) 
-# ------------------------------------------- 
-# Report the location of the KIND action as FILE:LINE. 
-m4_define([b4_symbol_action_location], 
-[b4_symbol([$1], [$2_file]):b4_syncline([b4_symbol([$1], [$2_line])])]) 
- 
- 
-# b4_symbol_action(SYMBOL-NUM, KIND) 
-# ---------------------------------- 
-# Run the action KIND (destructor or printer) for SYMBOL-NUM. 
-# Same as in C, but using references instead of pointers. 
-m4_define([b4_symbol_action], 
-[b4_symbol_if([$1], [has_$2], 
-[b4_dollar_pushdef([(*yyvaluep)], 
-                   b4_symbol_if([$1], [has_type], 
-                                [m4_dquote(b4_symbol([$1], [type]))]), 
-                   [(*yylocationp)])dnl 
-    b4_symbol_case_([$1])[]dnl 
-b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"]) 
-      b4_symbol([$1], [$2]) 
-b4_syncline([@oline@], [@ofile@]) 
-        break; 
- 
-b4_dollar_popdef[]dnl 
-])]) 
- 
- 
-# b4_symbol_destructor(SYMBOL-NUM) 
-# b4_symbol_printer(SYMBOL-NUM) 
-# -------------------------------- 
-m4_define([b4_symbol_destructor], [b4_symbol_action([$1], [destructor])]) 
-m4_define([b4_symbol_printer],    [b4_symbol_action([$1], [printer])]) 
- 
- 
-# b4_symbol_actions(KIND, [TYPE = yytype]) 
-# ---------------------------------------- 
-# Emit the symbol actions for KIND ("printer" or "destructor"). 
-# Dispatch on TYPE. 
-m4_define([b4_symbol_actions], 
-[m4_pushdef([b4_actions_], m4_expand([b4_symbol_foreach([b4_symbol_$1])]))dnl 
-m4_ifval(m4_defn([b4_actions_]), 
-[switch (m4_default([$2], [yytype])) 
-    { 
-      m4_defn([b4_actions_]) 
-      default: 
-        break; 
-    }dnl 
-], 
-[YYUSE (m4_default([$2], [yytype]));])dnl 
-m4_popdef([b4_actions_])dnl 
-]) 
- 
-# b4_symbol_case_(SYMBOL-NUM) 
-# --------------------------- 
-# Issue a "case NUM" for SYMBOL-NUM. 
-m4_define([b4_symbol_case_], 
-[case b4_symbol([$1], [number]): b4_symbol_tag_comment([$1])]) 
-]) 
- 
- 
-# b4_symbol_foreach(MACRO) 
-# ------------------------ 
-# Invoke MACRO(SYMBOL-NUM) for each SYMBOL-NUM. 
-m4_define([b4_symbol_foreach], 
-          [m4_map([$1], m4_defn([b4_symbol_numbers]))]) 
- 
-# b4_symbol_map(MACRO) 
-# -------------------- 
-# Return a list (possibly empty elements) of MACRO invoked for each 
-# SYMBOL-NUM. 
-m4_define([b4_symbol_map], 
-[m4_map_args_sep([$1(], [)], [,], b4_symbol_numbers)]) 
- 
- 
-# b4_token_visible_if(NUM, IF-TRUE, IF-FALSE) 
-# ------------------------------------------- 
-# Whether NUM denotes a token that has an exported definition (i.e., 
-# shows in enum yytokentype). 
-m4_define([b4_token_visible_if], 
-[b4_symbol_if([$1], [is_token], 
-              [b4_symbol_if([$1], [has_id], [$2], [$3])], 
-              [$3])]) 
- 
-# b4_token_has_definition(NUM) 
-# ---------------------------- 
-# 1 if NUM is visible, nothing otherwise. 
-m4_define([b4_token_has_definition], 
-[b4_token_visible_if([$1], [1])]) 
- 
-# b4_any_token_visible_if([IF-TRUE], [IF-FALSE]) 
-# ---------------------------------------------- 
-# Whether there is a token that needs to be defined. 
-m4_define([b4_any_token_visible_if], 
-[m4_ifval(b4_symbol_foreach([b4_token_has_definition]), 
-          [$1], [$2])]) 
- 
- 
-# b4_token_format(FORMAT, NUM) 
-# ---------------------------- 
-m4_define([b4_token_format], 
-[b4_token_visible_if([$2], 
-[m4_quote(m4_format([$1], 
-                     [b4_symbol([$2], [id])], 
-                     [b4_symbol([$2], [user_number])]))])]) 
- 
- 
-## ------- ## 
-## Types.  ## 
-## ------- ## 
- 
-# b4_type_action_(NUMS) 
-# --------------------- 
-# Run actions for the symbol NUMS that all have the same type-name. 
-# Skip NUMS that have no type-name. 
-# 
-# To specify the action to run, define b4_dollar_dollar(NUMBER, 
-# TAG, TYPE). 
-m4_define([b4_type_action_], 
-[b4_symbol_if([$1], [has_type], 
-[m4_map([      b4_symbol_case_], [$@])[]dnl 
-        b4_dollar_dollar([b4_symbol([$1], [number])], 
-                         [b4_symbol([$1], [tag])], 
-                         [b4_symbol([$1], [type])]); 
-        break; 
- 
-])]) 
- 
-# b4_type_foreach(MACRO) 
-# ---------------------- 
-# Invoke MACRO(SYMBOL-NUMS) for each set of SYMBOL-NUMS for each type set. 
-m4_define([b4_type_foreach], 
-          [m4_map([$1], m4_defn([b4_type_names]))]) 
- 
- 
- 
-## ----------- ## 
-## Synclines.  ## 
-## ----------- ## 
- 
-# b4_basename(NAME) 
-# ----------------- 
-# Similar to POSIX basename; the differences don't matter here. 
-# Beware that NAME is not evaluated. 
-m4_define([b4_basename], 
-[m4_bpatsubst([$1], [^.*/\([^/]+\)/*$], [\1])]) 
- 
- 
-# b4_syncline(LINE, FILE) 
-# ----------------------- 
-m4_define([b4_syncline], 
-[b4_flag_if([synclines], 
-[b4_sync_start([$1], [$2]) b4_sync_end([__line__], 
-                                       [b4_basename(m4_quote(__file__))])[]dnl 
-])]) 
- 
-# b4_sync_start(LINE, FILE) 
-# ----------------------- 
-# Syncline for the new place.  Typically a directive for the compiler. 
-m4_define([b4_sync_start], [b4_comment([$2:$1])]) 
- 
-# b4_sync_end(LINE, FILE) 
-# ----------------------- 
-# Syncline for the current place, which ends.  Typically a comment 
-# left for the reader. 
-m4_define([b4_sync_end],   [b4_comment([$2:$1])]) 
- 
- 
-# b4_user_code(USER-CODE) 
-# ----------------------- 
-# Emit code from the user, ending it with synclines. 
-m4_define([b4_user_code], 
-[$1 
-b4_syncline([@oline@], [@ofile@])]) 
- 
- 
-# b4_define_user_code(MACRO) 
-# -------------------------- 
-# From b4_MACRO, build b4_user_MACRO that includes the synclines. 
-m4_define([b4_define_user_code], 
-[m4_define([b4_user_$1], 
-[b4_user_code([b4_$1])])]) 
- 
- 
-# b4_user_actions 
-# b4_user_initial_action 
-# b4_user_post_prologue 
-# b4_user_pre_prologue 
-# b4_user_union_members 
-# ---------------------- 
-# Macros that issue user code, ending with synclines. 
-b4_define_user_code([actions]) 
-b4_define_user_code([initial_action]) 
-b4_define_user_code([post_prologue]) 
-b4_define_user_code([pre_prologue]) 
-b4_define_user_code([union_members]) 
- 
- 
-# b4_check_user_names(WHAT, USER-LIST, BISON-NAMESPACE) 
-# ----------------------------------------------------- 
-# Complain if any name of type WHAT is used by the user (as recorded in 
-# USER-LIST) but is not used by Bison (as recorded by macros in the 
-# namespace BISON-NAMESPACE). 
-# 
-# USER-LIST must expand to a list specifying all user occurrences of all names 
-# of type WHAT.   Each item in the list must be a triplet specifying one 
-# occurrence: name, start boundary, and end boundary.  Empty string names are 
-# fine.  An empty list is fine. 
-# 
-# For example, to define b4_foo_user_names to be used for USER-LIST with three 
-# name occurrences and with correct quoting: 
-# 
-#   m4_define([b4_foo_user_names], 
-#             [[[[[[bar]], [[parser.y:1.7]], [[parser.y:1.16]]]], 
-#               [[[[bar]], [[parser.y:5.7]], [[parser.y:5.16]]]], 
-#               [[[[baz]], [[parser.y:8.7]], [[parser.y:8.16]]]]]]) 
-# 
-# The macro BISON-NAMESPACE(bar) must be defined iff the name bar of type WHAT 
-# is used by Bison (in the front-end or in the skeleton).  Empty string names 
-# are fine, but it would be ugly for Bison to actually use one. 
-# 
-# For example, to use b4_foo_bison_names for BISON-NAMESPACE and define that 
-# the names bar and baz are used by Bison: 
-# 
-#   m4_define([b4_foo_bison_names(bar)]) 
-#   m4_define([b4_foo_bison_names(baz)]) 
-# 
-# To invoke b4_check_user_names with TYPE foo, with USER-LIST 
-# b4_foo_user_names, with BISON-NAMESPACE b4_foo_bison_names, and with correct 
-# quoting: 
-# 
-#   b4_check_user_names([[foo]], [b4_foo_user_names], 
-#                       [[b4_foo_bison_names]]) 
-m4_define([b4_check_user_names], 
-[m4_foreach([b4_occurrence], $2, 
-[m4_pushdef([b4_occurrence], b4_occurrence)dnl 
-m4_pushdef([b4_user_name], m4_car(b4_occurrence))dnl 
-m4_pushdef([b4_start], m4_car(m4_shift(b4_occurrence)))dnl 
-m4_pushdef([b4_end], m4_shift(m4_shift(b4_occurrence)))dnl 
-m4_ifndef($3[(]m4_quote(b4_user_name)[)], 
-          [b4_complain_at([b4_start], [b4_end], 
-                          [[%s '%s' is not used]], 
-                          [$1], [b4_user_name])])[]dnl 
-m4_popdef([b4_occurrence])dnl 
-m4_popdef([b4_user_name])dnl 
-m4_popdef([b4_start])dnl 
-m4_popdef([b4_end])dnl 
-])]) 
- 
- 
- 
-## --------------------- ## 
-## b4_percent_define_*.  ## 
-## --------------------- ## 
- 
- 
-# b4_percent_define_use(VARIABLE) 
-# ------------------------------- 
-# Declare that VARIABLE was used. 
-m4_define([b4_percent_define_use], 
-[m4_define([b4_percent_define_bison_variables(]$1[)])dnl 
-]) 
- 
-# b4_percent_define_get(VARIABLE, [DEFAULT]) 
-# ------------------------------------------ 
-# Mimic muscle_percent_define_get in ../src/muscle-tab.h.  That is, if 
-# the %define variable VARIABLE is defined, emit its value.  Contrary 
-# to its C counterpart, return DEFAULT otherwise.  Also, record 
-# Bison's usage of VARIABLE by defining 
-# b4_percent_define_bison_variables(VARIABLE). 
-# 
-# For example: 
-# 
-#   b4_percent_define_get([[foo]]) 
-m4_define([b4_percent_define_get], 
-[b4_percent_define_use([$1])dnl 
-b4_percent_define_ifdef_([$1], 
-                         [m4_indir([b4_percent_define(]$1[)])], 
-                         [$2])]) 
- 
-# b4_percent_define_get_loc(VARIABLE) 
-# ----------------------------------- 
-# Mimic muscle_percent_define_get_loc in ../src/muscle-tab.h exactly.  That is, 
-# if the %define variable VARIABLE is undefined, complain fatally since that's 
-# a Bison or skeleton error.  Otherwise, return its definition location in a 
-# form approriate for the first two arguments of b4_warn_at, b4_complain_at, or 
-# b4_fatal_at.  Don't record this as a Bison usage of VARIABLE as there's no 
-# reason to suspect that the user-supplied value has yet influenced the output. 
-# 
-# For example: 
-# 
-#   b4_complain_at(b4_percent_define_get_loc([[foo]]), [[invalid foo]]) 
-m4_define([b4_percent_define_get_loc], 
-[m4_ifdef([b4_percent_define_loc(]$1[)], 
-          [m4_pushdef([b4_loc], m4_indir([b4_percent_define_loc(]$1[)]))dnl 
-b4_loc[]dnl 
-m4_popdef([b4_loc])], 
-          [b4_fatal([[$0: undefined %%define variable '%s']], [$1])])]) 
- 
-# b4_percent_define_get_kind(VARIABLE) 
-# ------------------------------------ 
-# Get the kind (code, keyword, string) of VARIABLE, i.e., how its 
-# value was defined (braces, not delimiters, quotes). 
-# 
-# If the %define variable VARIABLE is undefined, complain fatally 
-# since that's a Bison or skeleton error.  Don't record this as a 
-# Bison usage of VARIABLE as there's no reason to suspect that the 
-# user-supplied value has yet influenced the output. 
-m4_define([b4_percent_define_get_kind], 
-[m4_ifdef([b4_percent_define_kind(]$1[)], 
-          [m4_indir([b4_percent_define_kind(]$1[)])], 
-          [b4_fatal([[$0: undefined %%define variable '%s']], [$1])])]) 
- 
-# b4_percent_define_get_syncline(VARIABLE) 
-# ---------------------------------------- 
-# Mimic muscle_percent_define_get_syncline in ../src/muscle-tab.h exactly. 
-# That is, if the %define variable VARIABLE is undefined, complain fatally 
-# since that's a Bison or skeleton error.  Otherwise, return its definition 
-# location as a b4_syncline invocation.  Don't record this as a Bison usage of 
-# VARIABLE as there's no reason to suspect that the user-supplied value has yet 
-# influenced the output. 
-# 
-# For example: 
-# 
-#   b4_percent_define_get_syncline([[foo]]) 
-m4_define([b4_percent_define_get_syncline], 
-[m4_ifdef([b4_percent_define_syncline(]$1[)], 
-          [m4_indir([b4_percent_define_syncline(]$1[)])], 
-          [b4_fatal([[$0: undefined %%define variable '%s']], [$1])])]) 
- 
-# b4_percent_define_ifdef_(VARIABLE, IF-TRUE, [IF-FALSE]) 
-# ------------------------------------------------------ 
-# If the %define variable VARIABLE is defined, expand IF-TRUE, else expand 
-# IF-FALSE.  Don't record usage of VARIABLE. 
-# 
-# For example: 
-# 
-#   b4_percent_define_ifdef_([[foo]], [[it's defined]], [[it's undefined]]) 
-m4_define([b4_percent_define_ifdef_], 
-[m4_ifdef([b4_percent_define(]$1[)], 
-          [$2], 
-          [$3])]) 
- 
-# b4_percent_define_ifdef(VARIABLE, IF-TRUE, [IF-FALSE]) 
-# ------------------------------------------------------ 
-# Mimic muscle_percent_define_ifdef in ../src/muscle-tab.h exactly.  That is, 
-# if the %define variable VARIABLE is defined, expand IF-TRUE, else expand 
-# IF-FALSE.  Also, record Bison's usage of VARIABLE by defining 
-# b4_percent_define_bison_variables(VARIABLE). 
-# 
-# For example: 
-# 
-#   b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]]) 
-m4_define([b4_percent_define_ifdef], 
-[b4_percent_define_ifdef_([$1], 
-                         [b4_percent_define_use([$1])$2], 
-                         [$3])]) 
- 
- 
-## --------- ## 
-## Options.  ## 
-## --------- ## 
- 
- 
-# b4_percent_define_flag_if(VARIABLE, IF-TRUE, [IF-FALSE]) 
-# -------------------------------------------------------- 
-# Mimic muscle_percent_define_flag_if in ../src/muscle-tab.h exactly.  That is, 
-# if the %define variable VARIABLE is defined to "" or "true", expand IF-TRUE. 
-# If it is defined to "false", expand IF-FALSE.  Complain if it is undefined 
-# (a Bison or skeleton error since the default value should have been set 
-# already) or defined to any other value (possibly a user error).  Also, record 
-# Bison's usage of VARIABLE by defining 
-# b4_percent_define_bison_variables(VARIABLE). 
-# 
-# For example: 
-# 
-#   b4_percent_define_flag_if([[foo]], [[it's true]], [[it's false]]) 
-m4_define([b4_percent_define_flag_if], 
-[b4_percent_define_ifdef([$1], 
-  [m4_case(b4_percent_define_get([$1]), 
-           [], [$2], [true], [$2], [false], [$3], 
-           [m4_expand_once([b4_complain_at(b4_percent_define_get_loc([$1]), 
-                                           [[invalid value for %%define Boolean variable '%s']], 
-                                           [$1])], 
-                           [[b4_percent_define_flag_if($1)]])])], 
-  [b4_fatal([[$0: undefined %%define variable '%s']], [$1])])]) 
- 
- 
-# b4_percent_define_default(VARIABLE, DEFAULT, [KIND = keyword]) 
-# -------------------------------------------------------------- 
-# Mimic muscle_percent_define_default in ../src/muscle-tab.h exactly.  That is, 
-# if the %define variable VARIABLE is undefined, set its value to DEFAULT. 
-# Don't record this as a Bison usage of VARIABLE as there's no reason to 
-# suspect that the value has yet influenced the output. 
-# 
-# For example: 
-# 
-#   b4_percent_define_default([[foo]], [[default value]]) 
-m4_define([b4_percent_define_default], 
-[b4_percent_define_ifdef_([$1], [], 
-           [m4_define([b4_percent_define(]$1[)], [$2])dnl 
-            m4_define([b4_percent_define_kind(]$1[)], 
-                      [m4_default([$3], [keyword])])dnl 
-            m4_define([b4_percent_define_loc(]$1[)], 
-                      [[[[<skeleton default value>:-1.-1]], 
-                        [[<skeleton default value>:-1.-1]]]])dnl 
-            m4_define([b4_percent_define_syncline(]$1[)], [[]])])]) 
- 
- 
-# b4_percent_define_if_define(NAME, [VARIABLE = NAME]) 
-# ---------------------------------------------------- 
-# Define b4_NAME_if that executes its $1 or $2 depending whether 
-# VARIABLE was %defined.  The characters '.' and `-' in VARIABLE are mapped 
-# to '_'. 
-m4_define([b4_percent_define_if_define_], 
-[m4_define(m4_bpatsubst([b4_$1_if], [[-.]], [_]), 
-           [b4_percent_define_flag_if(m4_default([$2], [$1]), 
-                                      [$3], [$4])])]) 
-m4_define([b4_percent_define_if_define], 
-[b4_percent_define_default([m4_default([$2], [$1])], [[false]]) 
-b4_percent_define_if_define_([$1], [$2], $[1], $[2])]) 
- 
- 
-# b4_percent_define_check_kind(VARIABLE, KIND, [DIAGNOSTIC = complain]) 
-# --------------------------------------------------------------------- 
-m4_define([b4_percent_define_check_kind], 
-[b4_percent_define_ifdef_([$1], 
-  [m4_if(b4_percent_define_get_kind([$1]), [$2], [], 
-    [b4_error([m4_default([$3], [complain])], 
-              b4_percent_define_get_loc([$1]), 
-              [m4_case([$2], 
-                 [code], [[%%define variable '%s' requires '{...}' values]], 
-                 [keyword], [[%%define variable '%s' requires keyword values]], 
-                 [string], [[%%define variable '%s' requires '"..."' values]])], 
-              [$1])])])dnl 
-]) 
- 
- 
-# b4_percent_define_check_values(VALUES) 
-# -------------------------------------- 
-# Mimic muscle_percent_define_check_values in ../src/muscle-tab.h exactly 
-# except that the VALUES structure is more appropriate for M4.  That is, VALUES 
-# is a list of sublists of strings.  For each sublist, the first string is the 
-# name of a %define variable, and all remaining strings in that sublist are the 
-# valid values for that variable.  Complain if such a variable is undefined (a 
-# Bison error since the default value should have been set already) or defined 
-# to any other value (possibly a user error).  Don't record this as a Bison 
-# usage of the variable as there's no reason to suspect that the value has yet 
-# influenced the output. 
-# 
-# For example: 
-# 
-#   b4_percent_define_check_values([[[[foo]], [[foo-value1]], [[foo-value2]]]], 
-#                                  [[[[bar]], [[bar-value1]]]]) 
-m4_define([b4_percent_define_check_values], 
-[m4_foreach([b4_sublist], m4_quote($@), 
-            [_b4_percent_define_check_values(b4_sublist)])]) 
- 
-m4_define([_b4_percent_define_check_values], 
-[b4_percent_define_ifdef_([$1], 
-  [b4_percent_define_check_kind(]$1[, [keyword], [deprecated])dnl 
-   m4_pushdef([b4_good_value], [0])dnl 
-   m4_if($#, 1, [], 
-         [m4_foreach([b4_value], m4_dquote(m4_shift($@)), 
-                     [m4_if(m4_indir([b4_percent_define(]$1[)]), b4_value, 
-                            [m4_define([b4_good_value], [1])])])])dnl 
-   m4_if(b4_good_value, [0], 
-         [b4_complain_at(b4_percent_define_get_loc([$1]), 
-                         [[invalid value for %%define variable '%s': '%s']], 
-                         [$1], 
-                         m4_dquote(m4_indir([b4_percent_define(]$1[)]))) 
-          m4_foreach([b4_value], m4_dquote(m4_shift($@)), 
-                     [b4_error([[note]], b4_percent_define_get_loc([$1]), [] 
-                                     [[accepted value: '%s']], 
-                                     m4_dquote(b4_value))])])dnl 
-   m4_popdef([b4_good_value])], 
-  [b4_fatal([[$0: undefined %%define variable '%s']], [$1])])]) 
- 
-# b4_percent_code_get([QUALIFIER]) 
-# -------------------------------- 
-# If any %code blocks for QUALIFIER are defined, emit them beginning with a 
-# comment and ending with synclines and a newline.  If QUALIFIER is not 
-# specified or empty, do this for the unqualified %code blocks.  Also, record 
-# Bison's usage of QUALIFIER (if specified) by defining 
-# b4_percent_code_bison_qualifiers(QUALIFIER). 
-# 
-# For example, to emit any unqualified %code blocks followed by any %code 
-# blocks for the qualifier foo: 
-# 
-#   b4_percent_code_get 
-#   b4_percent_code_get([[foo]]) 
-m4_define([b4_percent_code_get], 
-[m4_pushdef([b4_macro_name], [[b4_percent_code(]$1[)]])dnl 
-m4_ifval([$1], [m4_define([b4_percent_code_bison_qualifiers(]$1[)])])dnl 
-m4_ifdef(b4_macro_name, 
-[b4_comment([m4_if([$#], [0], [[Unqualified %code]], 
-                   [["%code ]$1["]])[ blocks.]]) 
-b4_user_code([m4_indir(b4_macro_name)]) 
-])dnl 
-m4_popdef([b4_macro_name])]) 
- 
-# b4_percent_code_ifdef(QUALIFIER, IF-TRUE, [IF-FALSE]) 
-# ----------------------------------------------------- 
-# If any %code blocks for QUALIFIER (or unqualified %code blocks if 
-# QUALIFIER is empty) are defined, expand IF-TRUE, else expand IF-FALSE. 
-# Also, record Bison's usage of QUALIFIER (if specified) by defining 
-# b4_percent_code_bison_qualifiers(QUALIFIER). 
-m4_define([b4_percent_code_ifdef], 
-[m4_ifdef([b4_percent_code(]$1[)], 
-          [m4_ifval([$1], [m4_define([b4_percent_code_bison_qualifiers(]$1[)])])$2], 
-          [$3])]) 
- 
- 
-## ------------------ ## 
-## Common variables.  ## 
-## ------------------ ## 
- 
- 
-# b4_parse_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT]) 
-# b4_parse_trace_if([IF-DEBUG-TRACES-ARE-ENABLED], [IF-NOT]) 
-# b4_token_ctor_if([IF-YYLEX-RETURNS-A-TOKEN], [IF-NOT]) 
-# ---------------------------------------------- 
-b4_percent_define_if_define([token_ctor], [api.token.constructor]) 
-b4_percent_define_if_define([locations])     # Whether locations are tracked. 
-b4_percent_define_if_define([parse.assert]) 
-b4_percent_define_if_define([parse.trace]) 
- 
- 
-# b4_bison_locations_if([IF-TRUE]) 
-# -------------------------------- 
-# Expand IF-TRUE if using locations, and using the default location 
-# type. 
-m4_define([b4_bison_locations_if], 
-[b4_locations_if([b4_percent_define_ifdef([[api.location.type]], [], [$1])])]) 
- 
- 
-# b4_error_verbose_if([IF-ERRORS-ARE-VERBOSE], [IF-NOT]) 
-# ------------------------------------------------------ 
-# Map %define parse.error "(simple|verbose)" to b4_error_verbose_if and 
-# b4_error_verbose_flag. 
-b4_percent_define_default([[parse.error]], [[simple]]) 
-b4_percent_define_check_values([[[[parse.error]], 
-                                 [[simple]], [[verbose]]]]) 
-m4_define([b4_error_verbose_flag], 
-          [m4_case(b4_percent_define_get([[parse.error]]), 
-                   [simple],  [[0]], 
-                   [verbose], [[1]])]) 
-b4_define_flag_if([error_verbose]) 
- 
-# yytoken_table is needed to support verbose errors. 
-b4_error_verbose_if([m4_define([b4_token_table_flag], [1])]) 
- 
- 
-# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT]) 
-# ---------------------------------------------- 
-b4_percent_define_if_define([variant]) 
-m4_define([b4_variant_flag], [[0]]) 
-b4_percent_define_ifdef([[api.value.type]], 
-   [m4_case(b4_percent_define_get_kind([[api.value.type]]), [keyword], 
-            [m4_case(b4_percent_define_get([[api.value.type]]), [variant], 
-                    [m4_define([b4_variant_flag], [[1]])])])]) 
-b4_define_flag_if([variant]) 
- 
- 
-## ----------------------------------------------------------- ## 
-## After processing the skeletons, check that all the user's   ## 
-## %define variables and %code qualifiers were used by Bison.  ## 
-## ----------------------------------------------------------- ## 
- 
-m4_define([b4_check_user_names_wrap], 
-[m4_ifdef([b4_percent_]$1[_user_]$2[s], 
-          [b4_check_user_names([[%]$1 $2], 
-                               [b4_percent_]$1[_user_]$2[s], 
-                               [[b4_percent_]$1[_bison_]$2[s]])])]) 
- 
-m4_wrap_lifo([ 
-b4_check_user_names_wrap([[define]], [[variable]]) 
-b4_check_user_names_wrap([[code]], [[qualifier]]) 
-]) 
- 
- 
-## ---------------- ## 
-## Default values.  ## 
-## ---------------- ## 
- 
-# m4_define_default([b4_lex_param], [])   dnl breaks other skeletons 
-m4_define_default([b4_pre_prologue], []) 
-m4_define_default([b4_post_prologue], []) 
-m4_define_default([b4_epilogue], []) 
-m4_define_default([b4_parse_param], []) 
- 
-# The initial column and line. 
-m4_define_default([b4_location_initial_column], [1]) 
-m4_define_default([b4_location_initial_line],   [1]) 
- 
- 
-## --------------- ## 
-## Sanity checks.  ## 
-## --------------- ## 
- 
-# api.location.prefix={...} (Java and C++). 
-b4_percent_define_check_kind([api.location.type], [code], [deprecated]) 
- 
-# api.position.prefix={...} (Java). 
-b4_percent_define_check_kind([api.position.type], [code], [deprecated]) 
- 
-# api.prefix >< %name-prefix. 
-b4_percent_define_check_kind([api.prefix], [code], [deprecated]) 
-b4_percent_define_ifdef([api.prefix], 
-[m4_ifdef([b4_prefix], 
-[b4_complain_at(b4_percent_define_get_loc([api.prefix]), 
-                [['%s' and '%s' cannot be used together]], 
-                [%name-prefix], 
-                [%define api.prefix])])]) 
- 
-# api.token.prefix={...} 
-# Make it a warning for those who used betas of Bison 3.0. 
-b4_percent_define_check_kind([api.token.prefix], [code], [deprecated]) 
- 
-# api.value.type >< %union. 
-b4_percent_define_ifdef([api.value.type], 
-[m4_ifdef([b4_union_members], 
-[b4_complain_at(b4_percent_define_get_loc([api.value.type]), 
-                [['%s' and '%s' cannot be used together]], 
-                [%union], 
-                [%define api.value.type])])]) 
- 
-# api.value.type=union >< %yacc. 
-b4_percent_define_ifdef([api.value.type], 
-[m4_if(b4_percent_define_get([api.value.type]), [union], 
-[b4_yacc_if(dnl 
-[b4_complain_at(b4_percent_define_get_loc([api.value.type]), 
-                [['%s' and '%s' cannot be used together]], 
-                [%yacc], 
-                [%define api.value.type "union"])])])]) 
+                                                            -*- Autoconf -*-
+
+# Language-independent M4 Macros for Bison.
+
+# Copyright (C) 2002, 2004-2013 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+## ---------------- ##
+## Identification.  ##
+## ---------------- ##
+
+# b4_copyright(TITLE, [YEARS])
+# ----------------------------
+# If YEARS are not defined, use b4_copyright_years.
+m4_define([b4_copyright],
+[b4_comment([A Bison parser, made by GNU Bison b4_version.])
+
+b4_comment([$1
+
+]m4_dquote(m4_text_wrap([Copyright (C)
+]m4_ifval([$2], [[$2]], [m4_defn([b4_copyright_years])])[
+Free Software Foundation, Inc.]))[
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.])
+
+b4_comment([As a special exception, you may create a larger work that contains
+part or all of the Bison parser skeleton and distribute that work
+under terms of your choice, so long as that work isn't itself a
+parser generator using the skeleton or a modified version thereof
+as a parser skeleton.  Alternatively, if you modify or redistribute
+the parser skeleton itself, you may (at your option) remove this
+special exception, which will cause the skeleton and the resulting
+Bison output files to be licensed under the GNU General Public
+License without this special exception.
+
+This special exception was added by the Free Software Foundation in
+version 2.2 of Bison.])])
+
+
+## -------- ##
+## Output.  ##
+## -------- ##
+
+# b4_output_begin(FILE)
+# ---------------------
+# Enable output, i.e., send to diversion 0, expand after "#", and
+# generate the tag to output into FILE.  Must be followed by EOL.
+m4_define([b4_output_begin],
+[m4_changecom()
+m4_divert_push(0)dnl
+@output(m4_unquote([$1])@)@dnl
+])
+
+
+# b4_output_end()
+# ---------------
+# Output nothing, restore # as comment character (no expansions after #).
+m4_define([b4_output_end],
+[m4_divert_pop(0)
+m4_changecom([#])
+])
+
+
+# b4_divert_kill(CODE)
+# --------------------
+# Expand CODE for its side effects, discard its output.
+m4_define([b4_divert_kill],
+[m4_divert_text([KILL], [$1])])
+
+
+# b4_define_silent(MACRO, CODE)
+# -----------------------------
+# Same as m4_define, but throw away the expansion of CODE.
+m4_define([b4_define_silent],
+[m4_define([$1], [b4_divert_kill([$2])])])
+
+
+## ---------------- ##
+## Error handling.  ##
+## ---------------- ##
+
+# The following error handling macros print error directives that should not
+# become arguments of other macro invocations since they would likely then be
+# mangled.  Thus, they print to stdout directly.
+
+# b4_cat(TEXT)
+# ------------
+# Write TEXT to stdout.  Precede the final newline with an @ so that it's
+# escaped.  For example:
+#
+#   b4_cat([[@complain(invalid input@)]])
+m4_define([b4_cat],
+[m4_syscmd([cat <<'_m4eof'
+]m4_bpatsubst(m4_dquote($1), [_m4eof], [_m4@`eof])[@
+_m4eof
+])dnl
+m4_if(m4_sysval, [0], [], [m4_fatal([$0: cannot write to stdout])])])
+
+# b4_error(KIND, START, END, FORMAT, [ARG1], [ARG2], ...)
+# -------------------------------------------------------
+# Write @KIND(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout.
+#
+# For example:
+#
+#   b4_error([[complain]], [[input.y:2.3]], [[input.y:5.4]],
+#            [[invalid %s]], [[foo]])
+m4_define([b4_error],
+[b4_cat([[@complain][(]$1[@,]$2[@,]$3[@,]$4[]]dnl
+[m4_if([$#], [4], [],
+       [m4_foreach([b4_arg],
+                   m4_dquote(m4_shift(m4_shift(m4_shift(m4_shift($@))))),
+                   [[@,]b4_arg])])[@)]])])
+
+# b4_warn(FORMAT, [ARG1], [ARG2], ...)
+# ------------------------------------
+# Write @warn(FORMAT@,ARG1@,ARG2@,...@) to stdout.
+#
+# For example:
+#
+#   b4_warn([[invalid value for '%s': %s]], [[foo]], [[3]])
+#
+# As a simple test suite, this:
+#
+#   m4_divert(-1)
+#   m4_define([asdf], [ASDF])
+#   m4_define([fsa], [FSA])
+#   m4_define([fdsa], [FDSA])
+#   b4_warn_at([[[asdf), asdf]]], [[[fsa), fsa]]], [[[fdsa), fdsa]]])
+#   b4_warn_at([[asdf), asdf]], [[fsa), fsa]], [[fdsa), fdsa]])
+#   b4_warn_at()
+#   b4_warn_at(1)
+#   b4_warn_at(1, 2)
+#
+# Should produce this without newlines:
+#
+#   @warn_at([asdf), asdf]@,@,@,[fsa), fsa]@,[fdsa), fdsa]@)
+#   @warn(asdf), asdf@,@,@,fsa), fsa@,fdsa), fdsa@)
+#   @warn(@)
+#   @warn(1@)
+#   @warn(1@,2@)
+m4_define([b4_warn],
+[b4_error([[warn]], [], [], $@)])
+
+# b4_warn_at(START, END, FORMAT, [ARG1], [ARG2], ...)
+# ---------------------------------------------------
+# Write @warn(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout.
+#
+# For example:
+#
+#   b4_warn_at([[input.y:2.3]], [[input.y:5.4]], [[invalid %s]], [[foo]])
+m4_define([b4_warn_at],
+[b4_error([[warn]], $@)])
+
+# b4_complain(FORMAT, [ARG1], [ARG2], ...)
+# ----------------------------------------
+# Bounce to b4_complain_at.
+#
+# See b4_warn example.
+m4_define([b4_complain],
+[b4_error([[complain]], [], [], $@)])
+
+# b4_complain_at(START, END, FORMAT, [ARG1], [ARG2], ...)
+# -------------------------------------------------------
+# Write @complain(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout.
+#
+# See b4_warn_at example.
+m4_define([b4_complain_at],
+[b4_error([[complain]], $@)])
+
+# b4_fatal(FORMAT, [ARG1], [ARG2], ...)
+# -------------------------------------
+# Bounce to b4_fatal_at.
+#
+# See b4_warn example.
+m4_define([b4_fatal],
+[b4_error([[fatal]], [], [], $@)dnl
+m4_exit(1)])
+
+# b4_fatal_at(START, END, FORMAT, [ARG1], [ARG2], ...)
+# ----------------------------------------------------
+# Write @fatal(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to stdout and exit.
+#
+# See b4_warn_at example.
+m4_define([b4_fatal_at],
+[b4_error([[fatal]], $@)dnl
+m4_exit(1)])
+
+
+## ------------ ##
+## Data Types.  ##
+## ------------ ##
+
+# b4_ints_in(INT1, INT2, LOW, HIGH)
+# ---------------------------------
+# Return 1 iff both INT1 and INT2 are in [LOW, HIGH], 0 otherwise.
+m4_define([b4_ints_in],
+[m4_eval([$3 <= $1 && $1 <= $4 && $3 <= $2 && $2 <= $4])])
+
+
+# b4_subtract(LHS, RHS)
+# ---------------------
+# Evaluate LHS - RHS if they are integer literals, otherwise expand
+# to (LHS) - (RHS).
+m4_define([b4_subtract],
+[m4_bmatch([$1$2], [^[0123456789]*$],
+           [m4_eval([$1 - $2])],
+           [($1) - ($2)])])
+
+# b4_join(ARG1, ...)
+# _b4_join(ARG1, ...)
+# -------------------
+# Join with comma, skipping empty arguments.
+# b4_join calls itself recursively until it sees the first non-empty
+# argument, then calls _b4_join which prepends each non-empty argument
+# with a comma.
+m4_define([b4_join],
+[m4_if([$#$1],
+       [1], [],
+       [m4_ifval([$1],
+                 [$1[]_$0(m4_shift($@))],
+                 [$0(m4_shift($@))])])])
+
+# _b4_join(ARGS1, ...)
+# --------------------
+m4_define([_b4_join],
+[m4_if([$#$1],
+       [1], [],
+       [m4_ifval([$1], [, $1])[]$0(m4_shift($@))])])
+
+
+
+
+# b4_integral_parser_tables_map(MACRO)
+# -------------------------------------
+# Map MACRO on all the integral tables.  MACRO is expected to have
+# the signature MACRO(TABLE-NAME, CONTENT, COMMENT).
+m4_define([b4_integral_parser_tables_map],
+[$1([pact], [b4_pact],
+    [[YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+STATE-NUM.]])
+
+$1([defact], [b4_defact],
+   [[YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+Performed when YYTABLE does not specify something else to do.  Zero
+means the default is an error.]])
+
+$1([pgoto], [b4_pgoto], [[YYPGOTO[NTERM-NUM].]])
+
+$1([defgoto], [b4_defgoto], [[YYDEFGOTO[NTERM-NUM].]])
+
+$1([table], [b4_table],
+   [[YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
+positive, shift that token.  If negative, reduce the rule whose
+number is the opposite.  If YYTABLE_NINF, syntax error.]])
+
+$1([check], [b4_check])
+
+$1([stos], [b4_stos],
+   [[YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+symbol of state STATE-NUM.]])
+
+$1([r1], [b4_r1],
+   [[YYR1[YYN] -- Symbol number of symbol that rule YYN derives.]])
+
+$1([r2], [b4_r2],
+   [[YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.]])
+])
+
+
+# b4_parser_tables_declare
+# b4_parser_tables_define
+# ------------------------
+# Define/declare the (deterministic) parser tables.
+m4_define([b4_parser_tables_declare],
+[b4_integral_parser_tables_map([b4_integral_parser_table_declare])])
+
+m4_define([b4_parser_tables_define],
+[b4_integral_parser_tables_map([b4_integral_parser_table_define])])
+
+
+
+## ------------------ ##
+## Decoding options.  ##
+## ------------------ ##
+
+# b4_flag_if(FLAG, IF-TRUE, IF-FALSE)
+# -----------------------------------
+# Run IF-TRUE if b4_FLAG_flag is 1, IF-FALSE if FLAG is 0, otherwise fail.
+m4_define([b4_flag_if],
+[m4_case(b4_$1_flag,
+         [0], [$3],
+         [1], [$2],
+         [m4_fatal([invalid $1 value: ]b4_$1_flag)])])
+
+
+# b4_define_flag_if(FLAG)
+# -----------------------
+# Define "b4_FLAG_if(IF-TRUE, IF-FALSE)" that depends on the
+# value of the Boolean FLAG.
+m4_define([b4_define_flag_if],
+[_b4_define_flag_if($[1], $[2], [$1])])
+
+# _b4_define_flag_if($1, $2, FLAG)
+# --------------------------------
+# Work around the impossibility to define macros inside macros,
+# because issuing '[$1]' is not possible in M4.  GNU M4 should provide
+# $$1 a la M5/TeX.
+m4_define([_b4_define_flag_if],
+[m4_if([$1$2], $[1]$[2], [],
+       [m4_fatal([$0: Invalid arguments: $@])])dnl
+m4_define([b4_$3_if],
+          [b4_flag_if([$3], [$1], [$2])])])
+
+
+# b4_FLAG_if(IF-TRUE, IF-FALSE)
+# -----------------------------
+# Expand IF-TRUE, if FLAG is true, IF-FALSE otherwise.
+b4_define_flag_if([defines])            # Whether headers are requested.
+b4_define_flag_if([glr])                # Whether a GLR parser is requested.
+b4_define_flag_if([nondeterministic])   # Whether conflicts should be handled.
+b4_define_flag_if([token_table])        # Whether yytoken_table is demanded.
+b4_define_flag_if([yacc])               # Whether POSIX Yacc is emulated.
+
+
+## --------- ##
+## Symbols.  ##
+## --------- ##
+
+# In order to unify the handling of the various aspects of symbols
+# (tag, type_name, whether terminal, etc.), bison.exe defines one
+# macro per (token, field), where field can has_id, id, etc.: see
+# src/output.c:prepare_symbols_definitions().
+#
+# The various FIELDS are:
+#
+# - has_id: 0 or 1.
+#   Whether the symbol has an id.
+# - id: string
+#   If has_id, the id.  Guaranteed to be usable as a C identifier.
+#   Prefixed by api.token.prefix if defined.
+# - tag: string.
+#   A representat of the symbol.  Can be 'foo', 'foo.id', '"foo"' etc.
+# - user_number: integer
+#   The assigned (external) number as used by yylex.
+# - is_token: 0 or 1
+#   Whether this is a terminal symbol.
+# - number: integer
+#   The internalized number (used after yytranslate).
+# - has_type: 0, 1
+#   Whether has a semantic value.
+# - type_tag: string
+#   When api.value.type=union, the generated name for the union member.
+#   yytype_INT etc. for symbols that has_id, otherwise yytype_1 etc.
+# - type
+#   If it has a semantic value, its type tag, or, if variant are used,
+#   its type.
+#   In the case of api.value.type=union, type is the real type (e.g. int).
+# - has_printer: 0, 1
+# - printer: string
+# - printer_file: string
+# - printer_line: integer
+#   If the symbol has a printer, everything about it.
+# - has_destructor, destructor, destructor_file, destructor_line
+#   Likewise.
+#
+# The following macros provide access to these values.
+
+# b4_symbol_(NUM, FIELD)
+# ----------------------
+# Recover a FIELD about symbol #NUM.  Thanks to m4_indir, fails if
+# undefined.
+m4_define([b4_symbol_],
+[m4_indir([b4_symbol($1, $2)])])
+
+
+# b4_symbol(NUM, FIELD)
+# ---------------------
+# Recover a FIELD about symbol #NUM.  Thanks to m4_indir, fails if
+# undefined.  If FIELD = id, prepend the token prefix.
+m4_define([b4_symbol],
+[m4_case([$2],
+         [id],    [m4_do([b4_percent_define_get([api.token.prefix])],
+                         [b4_symbol_([$1], [id])])],
+         [b4_symbol_($@)])])
+
+
+# b4_symbol_if(NUM, FIELD, IF-TRUE, IF-FALSE)
+# -------------------------------------------
+# If FIELD about symbol #NUM is 1 expand IF-TRUE, if is 0, expand IF-FALSE.
+# Otherwise an error.
+m4_define([b4_symbol_if],
+[m4_case(b4_symbol([$1], [$2]),
+         [1], [$3],
+         [0], [$4],
+         [m4_fatal([$0: field $2 of $1 is not a Boolean:] b4_symbol([$1], [$2]))])])
+
+
+# b4_symbol_tag_comment(SYMBOL-NUM)
+# ---------------------------------
+# Issue a comment giving the tag of symbol NUM.
+m4_define([b4_symbol_tag_comment],
+[b4_comment([b4_symbol([$1], [tag])])
+])
+
+
+# b4_symbol_action_location(SYMBOL-NUM, KIND)
+# -------------------------------------------
+# Report the location of the KIND action as FILE:LINE.
+m4_define([b4_symbol_action_location],
+[b4_symbol([$1], [$2_file]):b4_syncline([b4_symbol([$1], [$2_line])])])
+
+
+# b4_symbol_action(SYMBOL-NUM, KIND)
+# ----------------------------------
+# Run the action KIND (destructor or printer) for SYMBOL-NUM.
+# Same as in C, but using references instead of pointers.
+m4_define([b4_symbol_action],
+[b4_symbol_if([$1], [has_$2],
+[b4_dollar_pushdef([(*yyvaluep)],
+                   b4_symbol_if([$1], [has_type],
+                                [m4_dquote(b4_symbol([$1], [type]))]),
+                   [(*yylocationp)])dnl
+    b4_symbol_case_([$1])[]dnl
+b4_syncline([b4_symbol([$1], [$2_line])], ["b4_symbol([$1], [$2_file])"])
+      b4_symbol([$1], [$2])
+b4_syncline([@oline@], [@ofile@])
+        break;
+
+b4_dollar_popdef[]dnl
+])])
+
+
+# b4_symbol_destructor(SYMBOL-NUM)
+# b4_symbol_printer(SYMBOL-NUM)
+# --------------------------------
+m4_define([b4_symbol_destructor], [b4_symbol_action([$1], [destructor])])
+m4_define([b4_symbol_printer],    [b4_symbol_action([$1], [printer])])
+
+
+# b4_symbol_actions(KIND, [TYPE = yytype])
+# ----------------------------------------
+# Emit the symbol actions for KIND ("printer" or "destructor").
+# Dispatch on TYPE.
+m4_define([b4_symbol_actions],
+[m4_pushdef([b4_actions_], m4_expand([b4_symbol_foreach([b4_symbol_$1])]))dnl
+m4_ifval(m4_defn([b4_actions_]),
+[switch (m4_default([$2], [yytype]))
+    {
+      m4_defn([b4_actions_])
+      default:
+        break;
+    }dnl
+],
+[YYUSE (m4_default([$2], [yytype]));])dnl
+m4_popdef([b4_actions_])dnl
+])
+
+# b4_symbol_case_(SYMBOL-NUM)
+# ---------------------------
+# Issue a "case NUM" for SYMBOL-NUM.
+m4_define([b4_symbol_case_],
+[case b4_symbol([$1], [number]): b4_symbol_tag_comment([$1])])
+])
+
+
+# b4_symbol_foreach(MACRO)
+# ------------------------
+# Invoke MACRO(SYMBOL-NUM) for each SYMBOL-NUM.
+m4_define([b4_symbol_foreach],
+          [m4_map([$1], m4_defn([b4_symbol_numbers]))])
+
+# b4_symbol_map(MACRO)
+# --------------------
+# Return a list (possibly empty elements) of MACRO invoked for each
+# SYMBOL-NUM.
+m4_define([b4_symbol_map],
+[m4_map_args_sep([$1(], [)], [,], b4_symbol_numbers)])
+
+
+# b4_token_visible_if(NUM, IF-TRUE, IF-FALSE)
+# -------------------------------------------
+# Whether NUM denotes a token that has an exported definition (i.e.,
+# shows in enum yytokentype).
+m4_define([b4_token_visible_if],
+[b4_symbol_if([$1], [is_token],
+              [b4_symbol_if([$1], [has_id], [$2], [$3])],
+              [$3])])
+
+# b4_token_has_definition(NUM)
+# ----------------------------
+# 1 if NUM is visible, nothing otherwise.
+m4_define([b4_token_has_definition],
+[b4_token_visible_if([$1], [1])])
+
+# b4_any_token_visible_if([IF-TRUE], [IF-FALSE])
+# ----------------------------------------------
+# Whether there is a token that needs to be defined.
+m4_define([b4_any_token_visible_if],
+[m4_ifval(b4_symbol_foreach([b4_token_has_definition]),
+          [$1], [$2])])
+
+
+# b4_token_format(FORMAT, NUM)
+# ----------------------------
+m4_define([b4_token_format],
+[b4_token_visible_if([$2],
+[m4_quote(m4_format([$1],
+                     [b4_symbol([$2], [id])],
+                     [b4_symbol([$2], [user_number])]))])])
+
+
+## ------- ##
+## Types.  ##
+## ------- ##
+
+# b4_type_action_(NUMS)
+# ---------------------
+# Run actions for the symbol NUMS that all have the same type-name.
+# Skip NUMS that have no type-name.
+#
+# To specify the action to run, define b4_dollar_dollar(NUMBER,
+# TAG, TYPE).
+m4_define([b4_type_action_],
+[b4_symbol_if([$1], [has_type],
+[m4_map([      b4_symbol_case_], [$@])[]dnl
+        b4_dollar_dollar([b4_symbol([$1], [number])],
+                         [b4_symbol([$1], [tag])],
+                         [b4_symbol([$1], [type])]);
+        break;
+
+])])
+
+# b4_type_foreach(MACRO)
+# ----------------------
+# Invoke MACRO(SYMBOL-NUMS) for each set of SYMBOL-NUMS for each type set.
+m4_define([b4_type_foreach],
+          [m4_map([$1], m4_defn([b4_type_names]))])
+
+
+
+## ----------- ##
+## Synclines.  ##
+## ----------- ##
+
+# b4_basename(NAME)
+# -----------------
+# Similar to POSIX basename; the differences don't matter here.
+# Beware that NAME is not evaluated.
+m4_define([b4_basename],
+[m4_bpatsubst([$1], [^.*/\([^/]+\)/*$], [\1])])
+
+
+# b4_syncline(LINE, FILE)
+# -----------------------
+m4_define([b4_syncline],
+[b4_flag_if([synclines],
+[b4_sync_start([$1], [$2]) b4_sync_end([__line__],
+                                       [b4_basename(m4_quote(__file__))])[]dnl
+])])
+
+# b4_sync_start(LINE, FILE)
+# -----------------------
+# Syncline for the new place.  Typically a directive for the compiler.
+m4_define([b4_sync_start], [b4_comment([$2:$1])])
+
+# b4_sync_end(LINE, FILE)
+# -----------------------
+# Syncline for the current place, which ends.  Typically a comment
+# left for the reader.
+m4_define([b4_sync_end],   [b4_comment([$2:$1])])
+
+
+# b4_user_code(USER-CODE)
+# -----------------------
+# Emit code from the user, ending it with synclines.
+m4_define([b4_user_code],
+[$1
+b4_syncline([@oline@], [@ofile@])])
+
+
+# b4_define_user_code(MACRO)
+# --------------------------
+# From b4_MACRO, build b4_user_MACRO that includes the synclines.
+m4_define([b4_define_user_code],
+[m4_define([b4_user_$1],
+[b4_user_code([b4_$1])])])
+
+
+# b4_user_actions
+# b4_user_initial_action
+# b4_user_post_prologue
+# b4_user_pre_prologue
+# b4_user_union_members
+# ----------------------
+# Macros that issue user code, ending with synclines.
+b4_define_user_code([actions])
+b4_define_user_code([initial_action])
+b4_define_user_code([post_prologue])
+b4_define_user_code([pre_prologue])
+b4_define_user_code([union_members])
+
+
+# b4_check_user_names(WHAT, USER-LIST, BISON-NAMESPACE)
+# -----------------------------------------------------
+# Complain if any name of type WHAT is used by the user (as recorded in
+# USER-LIST) but is not used by Bison (as recorded by macros in the
+# namespace BISON-NAMESPACE).
+#
+# USER-LIST must expand to a list specifying all user occurrences of all names
+# of type WHAT.   Each item in the list must be a triplet specifying one
+# occurrence: name, start boundary, and end boundary.  Empty string names are
+# fine.  An empty list is fine.
+#
+# For example, to define b4_foo_user_names to be used for USER-LIST with three
+# name occurrences and with correct quoting:
+#
+#   m4_define([b4_foo_user_names],
+#             [[[[[[bar]], [[parser.y:1.7]], [[parser.y:1.16]]]],
+#               [[[[bar]], [[parser.y:5.7]], [[parser.y:5.16]]]],
+#               [[[[baz]], [[parser.y:8.7]], [[parser.y:8.16]]]]]])
+#
+# The macro BISON-NAMESPACE(bar) must be defined iff the name bar of type WHAT
+# is used by Bison (in the front-end or in the skeleton).  Empty string names
+# are fine, but it would be ugly for Bison to actually use one.
+#
+# For example, to use b4_foo_bison_names for BISON-NAMESPACE and define that
+# the names bar and baz are used by Bison:
+#
+#   m4_define([b4_foo_bison_names(bar)])
+#   m4_define([b4_foo_bison_names(baz)])
+#
+# To invoke b4_check_user_names with TYPE foo, with USER-LIST
+# b4_foo_user_names, with BISON-NAMESPACE b4_foo_bison_names, and with correct
+# quoting:
+#
+#   b4_check_user_names([[foo]], [b4_foo_user_names],
+#                       [[b4_foo_bison_names]])
+m4_define([b4_check_user_names],
+[m4_foreach([b4_occurrence], $2,
+[m4_pushdef([b4_occurrence], b4_occurrence)dnl
+m4_pushdef([b4_user_name], m4_car(b4_occurrence))dnl
+m4_pushdef([b4_start], m4_car(m4_shift(b4_occurrence)))dnl
+m4_pushdef([b4_end], m4_shift(m4_shift(b4_occurrence)))dnl
+m4_ifndef($3[(]m4_quote(b4_user_name)[)],
+          [b4_complain_at([b4_start], [b4_end],
+                          [[%s '%s' is not used]],
+                          [$1], [b4_user_name])])[]dnl
+m4_popdef([b4_occurrence])dnl
+m4_popdef([b4_user_name])dnl
+m4_popdef([b4_start])dnl
+m4_popdef([b4_end])dnl
+])])
+
+
+
+## --------------------- ##
+## b4_percent_define_*.  ##
+## --------------------- ##
+
+
+# b4_percent_define_use(VARIABLE)
+# -------------------------------
+# Declare that VARIABLE was used.
+m4_define([b4_percent_define_use],
+[m4_define([b4_percent_define_bison_variables(]$1[)])dnl
+])
+
+# b4_percent_define_get(VARIABLE, [DEFAULT])
+# ------------------------------------------
+# Mimic muscle_percent_define_get in ../src/muscle-tab.h.  That is, if
+# the %define variable VARIABLE is defined, emit its value.  Contrary
+# to its C counterpart, return DEFAULT otherwise.  Also, record
+# Bison's usage of VARIABLE by defining
+# b4_percent_define_bison_variables(VARIABLE).
+#
+# For example:
+#
+#   b4_percent_define_get([[foo]])
+m4_define([b4_percent_define_get],
+[b4_percent_define_use([$1])dnl
+b4_percent_define_ifdef_([$1],
+                         [m4_indir([b4_percent_define(]$1[)])],
+                         [$2])])
+
+# b4_percent_define_get_loc(VARIABLE)
+# -----------------------------------
+# Mimic muscle_percent_define_get_loc in ../src/muscle-tab.h exactly.  That is,
+# if the %define variable VARIABLE is undefined, complain fatally since that's
+# a Bison or skeleton error.  Otherwise, return its definition location in a
+# form approriate for the first two arguments of b4_warn_at, b4_complain_at, or
+# b4_fatal_at.  Don't record this as a Bison usage of VARIABLE as there's no
+# reason to suspect that the user-supplied value has yet influenced the output.
+#
+# For example:
+#
+#   b4_complain_at(b4_percent_define_get_loc([[foo]]), [[invalid foo]])
+m4_define([b4_percent_define_get_loc],
+[m4_ifdef([b4_percent_define_loc(]$1[)],
+          [m4_pushdef([b4_loc], m4_indir([b4_percent_define_loc(]$1[)]))dnl
+b4_loc[]dnl
+m4_popdef([b4_loc])],
+          [b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
+
+# b4_percent_define_get_kind(VARIABLE)
+# ------------------------------------
+# Get the kind (code, keyword, string) of VARIABLE, i.e., how its
+# value was defined (braces, not delimiters, quotes).
+#
+# If the %define variable VARIABLE is undefined, complain fatally
+# since that's a Bison or skeleton error.  Don't record this as a
+# Bison usage of VARIABLE as there's no reason to suspect that the
+# user-supplied value has yet influenced the output.
+m4_define([b4_percent_define_get_kind],
+[m4_ifdef([b4_percent_define_kind(]$1[)],
+          [m4_indir([b4_percent_define_kind(]$1[)])],
+          [b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
+
+# b4_percent_define_get_syncline(VARIABLE)
+# ----------------------------------------
+# Mimic muscle_percent_define_get_syncline in ../src/muscle-tab.h exactly.
+# That is, if the %define variable VARIABLE is undefined, complain fatally
+# since that's a Bison or skeleton error.  Otherwise, return its definition
+# location as a b4_syncline invocation.  Don't record this as a Bison usage of
+# VARIABLE as there's no reason to suspect that the user-supplied value has yet
+# influenced the output.
+#
+# For example:
+#
+#   b4_percent_define_get_syncline([[foo]])
+m4_define([b4_percent_define_get_syncline],
+[m4_ifdef([b4_percent_define_syncline(]$1[)],
+          [m4_indir([b4_percent_define_syncline(]$1[)])],
+          [b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
+
+# b4_percent_define_ifdef_(VARIABLE, IF-TRUE, [IF-FALSE])
+# ------------------------------------------------------
+# If the %define variable VARIABLE is defined, expand IF-TRUE, else expand
+# IF-FALSE.  Don't record usage of VARIABLE.
+#
+# For example:
+#
+#   b4_percent_define_ifdef_([[foo]], [[it's defined]], [[it's undefined]])
+m4_define([b4_percent_define_ifdef_],
+[m4_ifdef([b4_percent_define(]$1[)],
+          [$2],
+          [$3])])
+
+# b4_percent_define_ifdef(VARIABLE, IF-TRUE, [IF-FALSE])
+# ------------------------------------------------------
+# Mimic muscle_percent_define_ifdef in ../src/muscle-tab.h exactly.  That is,
+# if the %define variable VARIABLE is defined, expand IF-TRUE, else expand
+# IF-FALSE.  Also, record Bison's usage of VARIABLE by defining
+# b4_percent_define_bison_variables(VARIABLE).
+#
+# For example:
+#
+#   b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
+m4_define([b4_percent_define_ifdef],
+[b4_percent_define_ifdef_([$1],
+                         [b4_percent_define_use([$1])$2],
+                         [$3])])
+
+
+## --------- ##
+## Options.  ##
+## --------- ##
+
+
+# b4_percent_define_flag_if(VARIABLE, IF-TRUE, [IF-FALSE])
+# --------------------------------------------------------
+# Mimic muscle_percent_define_flag_if in ../src/muscle-tab.h exactly.  That is,
+# if the %define variable VARIABLE is defined to "" or "true", expand IF-TRUE.
+# If it is defined to "false", expand IF-FALSE.  Complain if it is undefined
+# (a Bison or skeleton error since the default value should have been set
+# already) or defined to any other value (possibly a user error).  Also, record
+# Bison's usage of VARIABLE by defining
+# b4_percent_define_bison_variables(VARIABLE).
+#
+# For example:
+#
+#   b4_percent_define_flag_if([[foo]], [[it's true]], [[it's false]])
+m4_define([b4_percent_define_flag_if],
+[b4_percent_define_ifdef([$1],
+  [m4_case(b4_percent_define_get([$1]),
+           [], [$2], [true], [$2], [false], [$3],
+           [m4_expand_once([b4_complain_at(b4_percent_define_get_loc([$1]),
+                                           [[invalid value for %%define Boolean variable '%s']],
+                                           [$1])],
+                           [[b4_percent_define_flag_if($1)]])])],
+  [b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
+
+
+# b4_percent_define_default(VARIABLE, DEFAULT, [KIND = keyword])
+# --------------------------------------------------------------
+# Mimic muscle_percent_define_default in ../src/muscle-tab.h exactly.  That is,
+# if the %define variable VARIABLE is undefined, set its value to DEFAULT.
+# Don't record this as a Bison usage of VARIABLE as there's no reason to
+# suspect that the value has yet influenced the output.
+#
+# For example:
+#
+#   b4_percent_define_default([[foo]], [[default value]])
+m4_define([b4_percent_define_default],
+[b4_percent_define_ifdef_([$1], [],
+           [m4_define([b4_percent_define(]$1[)], [$2])dnl
+            m4_define([b4_percent_define_kind(]$1[)],
+                      [m4_default([$3], [keyword])])dnl
+            m4_define([b4_percent_define_loc(]$1[)],
+                      [[[[<skeleton default value>:-1.-1]],
+                        [[<skeleton default value>:-1.-1]]]])dnl
+            m4_define([b4_percent_define_syncline(]$1[)], [[]])])])
+
+
+# b4_percent_define_if_define(NAME, [VARIABLE = NAME])
+# ----------------------------------------------------
+# Define b4_NAME_if that executes its $1 or $2 depending whether
+# VARIABLE was %defined.  The characters '.' and `-' in VARIABLE are mapped
+# to '_'.
+m4_define([b4_percent_define_if_define_],
+[m4_define(m4_bpatsubst([b4_$1_if], [[-.]], [_]),
+           [b4_percent_define_flag_if(m4_default([$2], [$1]),
+                                      [$3], [$4])])])
+m4_define([b4_percent_define_if_define],
+[b4_percent_define_default([m4_default([$2], [$1])], [[false]])
+b4_percent_define_if_define_([$1], [$2], $[1], $[2])])
+
+
+# b4_percent_define_check_kind(VARIABLE, KIND, [DIAGNOSTIC = complain])
+# ---------------------------------------------------------------------
+m4_define([b4_percent_define_check_kind],
+[b4_percent_define_ifdef_([$1],
+  [m4_if(b4_percent_define_get_kind([$1]), [$2], [],
+    [b4_error([m4_default([$3], [complain])],
+              b4_percent_define_get_loc([$1]),
+              [m4_case([$2],
+                 [code], [[%%define variable '%s' requires '{...}' values]],
+                 [keyword], [[%%define variable '%s' requires keyword values]],
+                 [string], [[%%define variable '%s' requires '"..."' values]])],
+              [$1])])])dnl
+])
+
+
+# b4_percent_define_check_values(VALUES)
+# --------------------------------------
+# Mimic muscle_percent_define_check_values in ../src/muscle-tab.h exactly
+# except that the VALUES structure is more appropriate for M4.  That is, VALUES
+# is a list of sublists of strings.  For each sublist, the first string is the
+# name of a %define variable, and all remaining strings in that sublist are the
+# valid values for that variable.  Complain if such a variable is undefined (a
+# Bison error since the default value should have been set already) or defined
+# to any other value (possibly a user error).  Don't record this as a Bison
+# usage of the variable as there's no reason to suspect that the value has yet
+# influenced the output.
+#
+# For example:
+#
+#   b4_percent_define_check_values([[[[foo]], [[foo-value1]], [[foo-value2]]]],
+#                                  [[[[bar]], [[bar-value1]]]])
+m4_define([b4_percent_define_check_values],
+[m4_foreach([b4_sublist], m4_quote($@),
+            [_b4_percent_define_check_values(b4_sublist)])])
+
+m4_define([_b4_percent_define_check_values],
+[b4_percent_define_ifdef_([$1],
+  [b4_percent_define_check_kind(]$1[, [keyword], [deprecated])dnl
+   m4_pushdef([b4_good_value], [0])dnl
+   m4_if($#, 1, [],
+         [m4_foreach([b4_value], m4_dquote(m4_shift($@)),
+                     [m4_if(m4_indir([b4_percent_define(]$1[)]), b4_value,
+                            [m4_define([b4_good_value], [1])])])])dnl
+   m4_if(b4_good_value, [0],
+         [b4_complain_at(b4_percent_define_get_loc([$1]),
+                         [[invalid value for %%define variable '%s': '%s']],
+                         [$1],
+                         m4_dquote(m4_indir([b4_percent_define(]$1[)])))
+          m4_foreach([b4_value], m4_dquote(m4_shift($@)),
+                     [b4_error([[note]], b4_percent_define_get_loc([$1]), []
+                                     [[accepted value: '%s']],
+                                     m4_dquote(b4_value))])])dnl
+   m4_popdef([b4_good_value])],
+  [b4_fatal([[$0: undefined %%define variable '%s']], [$1])])])
+
+# b4_percent_code_get([QUALIFIER])
+# --------------------------------
+# If any %code blocks for QUALIFIER are defined, emit them beginning with a
+# comment and ending with synclines and a newline.  If QUALIFIER is not
+# specified or empty, do this for the unqualified %code blocks.  Also, record
+# Bison's usage of QUALIFIER (if specified) by defining
+# b4_percent_code_bison_qualifiers(QUALIFIER).
+#
+# For example, to emit any unqualified %code blocks followed by any %code
+# blocks for the qualifier foo:
+#
+#   b4_percent_code_get
+#   b4_percent_code_get([[foo]])
+m4_define([b4_percent_code_get],
+[m4_pushdef([b4_macro_name], [[b4_percent_code(]$1[)]])dnl
+m4_ifval([$1], [m4_define([b4_percent_code_bison_qualifiers(]$1[)])])dnl
+m4_ifdef(b4_macro_name,
+[b4_comment([m4_if([$#], [0], [[Unqualified %code]],
+                   [["%code ]$1["]])[ blocks.]])
+b4_user_code([m4_indir(b4_macro_name)])
+])dnl
+m4_popdef([b4_macro_name])])
+
+# b4_percent_code_ifdef(QUALIFIER, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------
+# If any %code blocks for QUALIFIER (or unqualified %code blocks if
+# QUALIFIER is empty) are defined, expand IF-TRUE, else expand IF-FALSE.
+# Also, record Bison's usage of QUALIFIER (if specified) by defining
+# b4_percent_code_bison_qualifiers(QUALIFIER).
+m4_define([b4_percent_code_ifdef],
+[m4_ifdef([b4_percent_code(]$1[)],
+          [m4_ifval([$1], [m4_define([b4_percent_code_bison_qualifiers(]$1[)])])$2],
+          [$3])])
+
+
+## ------------------ ##
+## Common variables.  ##
+## ------------------ ##
+
+
+# b4_parse_assert_if([IF-ASSERTIONS-ARE-USED], [IF-NOT])
+# b4_parse_trace_if([IF-DEBUG-TRACES-ARE-ENABLED], [IF-NOT])
+# b4_token_ctor_if([IF-YYLEX-RETURNS-A-TOKEN], [IF-NOT])
+# ----------------------------------------------
+b4_percent_define_if_define([token_ctor], [api.token.constructor])
+b4_percent_define_if_define([locations])     # Whether locations are tracked.
+b4_percent_define_if_define([parse.assert])
+b4_percent_define_if_define([parse.trace])
+
+
+# b4_bison_locations_if([IF-TRUE])
+# --------------------------------
+# Expand IF-TRUE if using locations, and using the default location
+# type.
+m4_define([b4_bison_locations_if],
+[b4_locations_if([b4_percent_define_ifdef([[api.location.type]], [], [$1])])])
+
+
+# b4_error_verbose_if([IF-ERRORS-ARE-VERBOSE], [IF-NOT])
+# ------------------------------------------------------
+# Map %define parse.error "(simple|verbose)" to b4_error_verbose_if and
+# b4_error_verbose_flag.
+b4_percent_define_default([[parse.error]], [[simple]])
+b4_percent_define_check_values([[[[parse.error]],
+                                 [[simple]], [[verbose]]]])
+m4_define([b4_error_verbose_flag],
+          [m4_case(b4_percent_define_get([[parse.error]]),
+                   [simple],  [[0]],
+                   [verbose], [[1]])])
+b4_define_flag_if([error_verbose])
+
+# yytoken_table is needed to support verbose errors.
+b4_error_verbose_if([m4_define([b4_token_table_flag], [1])])
+
+
+# b4_variant_if([IF-VARIANT-ARE-USED], [IF-NOT])
+# ----------------------------------------------
+b4_percent_define_if_define([variant])
+m4_define([b4_variant_flag], [[0]])
+b4_percent_define_ifdef([[api.value.type]],
+   [m4_case(b4_percent_define_get_kind([[api.value.type]]), [keyword],
+            [m4_case(b4_percent_define_get([[api.value.type]]), [variant],
+                    [m4_define([b4_variant_flag], [[1]])])])])
+b4_define_flag_if([variant])
+
+
+## ----------------------------------------------------------- ##
+## After processing the skeletons, check that all the user's   ##
+## %define variables and %code qualifiers were used by Bison.  ##
+## ----------------------------------------------------------- ##
+
+m4_define([b4_check_user_names_wrap],
+[m4_ifdef([b4_percent_]$1[_user_]$2[s],
+          [b4_check_user_names([[%]$1 $2],
+                               [b4_percent_]$1[_user_]$2[s],
+                               [[b4_percent_]$1[_bison_]$2[s]])])])
+
+m4_wrap_lifo([
+b4_check_user_names_wrap([[define]], [[variable]])
+b4_check_user_names_wrap([[code]], [[qualifier]])
+])
+
+
+## ---------------- ##
+## Default values.  ##
+## ---------------- ##
+
+# m4_define_default([b4_lex_param], [])   dnl breaks other skeletons
+m4_define_default([b4_pre_prologue], [])
+m4_define_default([b4_post_prologue], [])
+m4_define_default([b4_epilogue], [])
+m4_define_default([b4_parse_param], [])
+
+# The initial column and line.
+m4_define_default([b4_location_initial_column], [1])
+m4_define_default([b4_location_initial_line],   [1])
+
+
+## --------------- ##
+## Sanity checks.  ##
+## --------------- ##
+
+# api.location.prefix={...} (Java and C++).
+b4_percent_define_check_kind([api.location.type], [code], [deprecated])
+
+# api.position.prefix={...} (Java).
+b4_percent_define_check_kind([api.position.type], [code], [deprecated])
+
+# api.prefix >< %name-prefix.
+b4_percent_define_check_kind([api.prefix], [code], [deprecated])
+b4_percent_define_ifdef([api.prefix],
+[m4_ifdef([b4_prefix],
+[b4_complain_at(b4_percent_define_get_loc([api.prefix]),
+                [['%s' and '%s' cannot be used together]],
+                [%name-prefix],
+                [%define api.prefix])])])
+
+# api.token.prefix={...}
+# Make it a warning for those who used betas of Bison 3.0.
+b4_percent_define_check_kind([api.token.prefix], [code], [deprecated])
+
+# api.value.type >< %union.
+b4_percent_define_ifdef([api.value.type],
+[m4_ifdef([b4_union_members],
+[b4_complain_at(b4_percent_define_get_loc([api.value.type]),
+                [['%s' and '%s' cannot be used together]],
+                [%union],
+                [%define api.value.type])])])
+
+# api.value.type=union >< %yacc.
+b4_percent_define_ifdef([api.value.type],
+[m4_if(b4_percent_define_get([api.value.type]), [union],
+[b4_yacc_if(dnl
+[b4_complain_at(b4_percent_define_get_loc([api.value.type]),
+                [['%s' and '%s' cannot be used together]],
+                [%yacc],
+                [%define api.value.type "union"])])])])

+ 26 - 26
contrib/tools/bison/bison/data/c++-skel.m4

@@ -1,26 +1,26 @@
-                                                            -*- Autoconf -*- 
- 
-# C++ skeleton dispatching for Bison. 
- 
-# Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc. 
- 
-# This program is free software: you can redistribute it and/or modify 
-# it under the terms of the GNU General Public License as published by 
-# the Free Software Foundation, either version 3 of the License, or 
-# (at your option) any later version. 
-# 
-# This program is distributed in the hope that it will be useful, 
-# but WITHOUT ANY WARRANTY; without even the implied warranty of 
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
-# GNU General Public License for more details. 
-# 
-# You should have received a copy of the GNU General Public License 
-# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
- 
-b4_glr_if(             [m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])]) 
-b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])]) 
- 
-m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.cc]]) 
-m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"]) 
- 
-m4_include(b4_used_skeleton) 
+                                                            -*- Autoconf -*-
+
+# C++ skeleton dispatching for Bison.
+
+# Copyright (C) 2006-2007, 2009-2013 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+b4_glr_if(             [m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])])
+b4_nondeterministic_if([m4_define([b4_used_skeleton], [b4_pkgdatadir/[glr.cc]])])
+
+m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.cc]])
+m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
+
+m4_include(b4_used_skeleton)

+ 544 - 544
contrib/tools/bison/bison/data/c++.m4

@@ -1,544 +1,544 @@
-                                                            -*- Autoconf -*- 
- 
-# C++ skeleton for Bison 
- 
-# Copyright (C) 2002-2013 Free Software Foundation, Inc. 
- 
-# This program is free software: you can redistribute it and/or modify 
-# it under the terms of the GNU General Public License as published by 
-# the Free Software Foundation, either version 3 of the License, or 
-# (at your option) any later version. 
-# 
-# This program is distributed in the hope that it will be useful, 
-# but WITHOUT ANY WARRANTY; without even the implied warranty of 
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
-# GNU General Public License for more details. 
-# 
-# You should have received a copy of the GNU General Public License 
-# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
- 
-m4_include(b4_pkgdatadir/[c.m4]) 
- 
-# b4_comment(TEXT, [PREFIX]) 
-# -------------------------- 
-# Put TEXT in comment. Prefix all the output lines with PREFIX. 
-m4_define([b4_comment], 
-[b4_comment_([$1], [$2// ], [$2// ])]) 
- 
-## -------- ## 
-## Checks.  ## 
-## -------- ## 
- 
-b4_percent_define_check_kind([api.namespace], [code], [deprecated]) 
-b4_percent_define_check_kind([parser_class_name], [code], [deprecated]) 
- 
-## ---------------- ## 
-## Default values.  ## 
-## ---------------- ## 
- 
-b4_percent_define_default([[parser_class_name]], [[parser]]) 
- 
-# Don't do that so that we remember whether we're using a user 
-# request, or the default value. 
-# 
-# b4_percent_define_default([[api.location.type]], [[location]]) 
- 
-b4_percent_define_default([[filename_type]], [[std::string]]) 
-# Make it a warning for those who used betas of Bison 3.0. 
-b4_percent_define_default([[api.namespace]], m4_defn([b4_prefix])) 
- 
-b4_percent_define_default([[global_tokens_and_yystype]], [[false]]) 
-b4_percent_define_default([[define_location_comparison]], 
-                          [m4_if(b4_percent_define_get([[filename_type]]), 
-                                 [std::string], [[true]], [[false]])]) 
- 
- 
- 
-## ----------- ## 
-## Namespace.  ## 
-## ----------- ## 
- 
-m4_define([b4_namespace_ref], [b4_percent_define_get([[api.namespace]])]) 
- 
- 
-# Don't permit an empty b4_namespace_ref.  Any '::parser::foo' appended to it 
-# would compile as an absolute reference with 'parser' in the global namespace. 
-# b4_namespace_open would open an anonymous namespace and thus establish 
-# internal linkage.  This would compile.  However, it's cryptic, and internal 
-# linkage for the parser would be specified in all translation units that 
-# include the header, which is always generated.  If we ever need to permit 
-# internal linkage somehow, surely we can find a cleaner approach. 
-m4_if(m4_bregexp(b4_namespace_ref, [^[	 ]*$]), [-1], [], 
-[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]), 
-                [[namespace reference is empty]])]) 
- 
-# Instead of assuming the C++ compiler will do it, Bison should reject any 
-# invalid b4_namepsace_ref that would be converted to a valid 
-# b4_namespace_open.  The problem is that Bison doesn't always output 
-# b4_namespace_ref to uncommented code but should reserve the ability to do so 
-# in future releases without risking breaking any existing user grammars. 
-# Specifically, don't allow empty names as b4_namespace_open would just convert 
-# those into anonymous namespaces, and that might tempt some users. 
-m4_if(m4_bregexp(b4_namespace_ref, [::[	 ]*::]), [-1], [], 
-[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]), 
-                [[namespace reference has consecutive "::"]])]) 
-m4_if(m4_bregexp(b4_namespace_ref, [::[	 ]*$]), [-1], [], 
-[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]), 
-                [[namespace reference has a trailing "::"]])]) 
- 
-m4_define([b4_namespace_open], 
-[b4_user_code([b4_percent_define_get_syncline([[api.namespace]]) 
-[namespace ]m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref), 
-                                                [^\(.\)[	 ]*::], [\1])), 
-                         [::], [ { namespace ])[ {]])]) 
- 
-m4_define([b4_namespace_close], 
-[b4_user_code([b4_percent_define_get_syncline([[api.namespace]]) 
-m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]), 
-                                    [^\(.\)[	 ]*\(::\)?\([^][:]\|:[^:]\)*], 
-                                    [\1])), 
-             [::\([^][:]\|:[^:]\)*], [} ])[} // ]b4_namespace_ref])]) 
- 
- 
-# b4_token_enums 
-# -------------- 
-# Output the definition of the tokens as enums. 
-m4_define([b4_token_enums], 
-[[enum yytokentype 
-      { 
-        ]m4_join([, 
-        ], 
-                 b4_symbol_map([b4_token_enum]))[ 
-      };]dnl 
-]) 
- 
- 
- 
- 
-## ----------------- ## 
-## Semantic Values.  ## 
-## ----------------- ## 
- 
- 
- 
-# b4_value_type_declare 
-# --------------------- 
-# Declare semantic_type. 
-m4_define([b4_value_type_declare], 
-[b4_value_type_setup[]dnl 
-[    /// Symbol semantic values. 
-]m4_bmatch(b4_percent_define_get_kind([[api.value.type]]), 
-[code], 
-[[    typedef ]b4_percent_define_get([[api.value.type]])[ semantic_type;]], 
-[m4_bmatch(b4_percent_define_get([[api.value.type]]), 
-[union\|union-directive], 
-[[    union semantic_type 
-    { 
-    ]b4_user_union_members[ 
-    };]])])dnl 
-]) 
- 
- 
-# b4_public_types_declare 
-# ----------------------- 
-# Define the public types: token, semantic value, location, and so forth. 
-# Depending on %define token_lex, may be output in the header or source file. 
-m4_define([b4_public_types_declare], 
-[[#ifndef ]b4_api_PREFIX[STYPE 
-]b4_value_type_declare[ 
-#else 
-    typedef ]b4_api_PREFIX[STYPE semantic_type; 
-#endif]b4_locations_if([ 
-    /// Symbol locations. 
-    typedef b4_percent_define_get([[api.location.type]], 
-                                  [[location]]) location_type;])[ 
- 
-    /// Syntax errors thrown from user actions. 
-    struct syntax_error : std::runtime_error 
-    { 
-      syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m);]b4_locations_if([ 
-      location_type location;])[ 
-    }; 
- 
-    /// Tokens. 
-    struct token 
-    { 
-      ]b4_token_enums[ 
-    }; 
- 
-    /// (External) token type, as returned by yylex. 
-    typedef token::yytokentype token_type; 
- 
-    /// Internal symbol number. 
-    typedef int symbol_number_type; 
- 
-    /// Internal symbol number for tokens (subsumed by symbol_number_type). 
-    typedef ]b4_int_type_for([b4_translate])[ token_number_type; 
- 
-    /// A complete symbol. 
-    /// 
-    /// Expects its Base type to provide access to the symbol type 
-    /// via type_get(). 
-    /// 
-    /// Provide access to semantic value]b4_locations_if([ and location])[. 
-    template <typename Base> 
-    struct basic_symbol : Base 
-    { 
-      /// Alias to Base. 
-      typedef Base super_type; 
- 
-      /// Default constructor. 
-      basic_symbol (); 
- 
-      /// Copy constructor. 
-      basic_symbol (const basic_symbol& other); 
-]b4_variant_if([[ 
-      /// Constructor for valueless symbols, and symbols from each type. 
-]b4_type_foreach([b4_basic_symbol_constructor_declare])], [[ 
-      /// Constructor for valueless symbols. 
-      basic_symbol (typename Base::kind_type t]b4_locations_if([, 
-                    const location_type& l])[);]])[ 
- 
-      /// Constructor for symbols with semantic value. 
-      basic_symbol (typename Base::kind_type t, 
-                    const semantic_type& v]b4_locations_if([, 
-                    const location_type& l])[); 
- 
-      ~basic_symbol (); 
- 
-      /// Destructive move, \a s is emptied into this. 
-      void move (basic_symbol& s); 
- 
-      /// The semantic value. 
-      semantic_type value;]b4_locations_if([ 
- 
-      /// The location. 
-      location_type location;])[ 
- 
-    private: 
-      /// Assignment operator. 
-      basic_symbol& operator= (const basic_symbol& other); 
-    }; 
- 
-    /// Type access provider for token (enum) based symbols. 
-    struct by_type 
-    { 
-      /// Default constructor. 
-      by_type (); 
- 
-      /// Copy constructor. 
-      by_type (const by_type& other); 
- 
-      /// The symbol type as needed by the constructor. 
-      typedef token_type kind_type; 
- 
-      /// Constructor from (external) token numbers. 
-      by_type (kind_type t); 
- 
-      /// Steal the symbol type from \a that. 
-      void move (by_type& that); 
- 
-      /// The (internal) type number (corresponding to \a type). 
-      /// -1 when this symbol is empty. 
-      symbol_number_type type_get () const; 
- 
-      /// The token. 
-      token_type token () const; 
- 
-      enum { empty = 0 }; 
- 
-      /// The symbol type. 
-      /// -1 when this symbol is empty. 
-      token_number_type type; 
-    }; 
- 
-    /// "External" symbols: returned by the scanner. 
-    typedef basic_symbol<by_type> symbol_type; 
- 
-]b4_symbol_constructor_declare]) 
- 
- 
-# b4_public_types_define 
-# ---------------------- 
-# Provide the implementation needed by the public types. 
-m4_define([b4_public_types_define], 
-[[  inline 
-  ]b4_parser_class_name[::syntax_error::syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m) 
-    : std::runtime_error (m)]b4_locations_if([ 
-    , location (l)])[ 
-  {} 
- 
-  // basic_symbol. 
-  template <typename Base> 
-  inline 
-  ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol () 
-    : value () 
-  {} 
- 
-  template <typename Base> 
-  inline 
-  ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& other) 
-    : Base (other) 
-    , value ()]b4_locations_if([ 
-    , location (other.location)])[ 
-  { 
-    ]b4_variant_if([b4_symbol_variant([other.type_get ()], [value], [copy], 
-                                      [other.value])], 
-                   [value = other.value;])[ 
-  } 
- 
- 
-  template <typename Base> 
-  inline 
-  ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join( 
-          [typename Base::kind_type t], 
-          [const semantic_type& v], 
-          b4_locations_if([const location_type& l]))[) 
-    : Base (t) 
-    , value (]b4_variant_if([], [v])[)]b4_locations_if([ 
-    , location (l)])[ 
-  {]b4_variant_if([[ 
-    (void) v; 
-    ]b4_symbol_variant([this->type_get ()], [value], [copy], [v])])[} 
- 
-]b4_variant_if([[ 
-  // Implementation of basic_symbol constructor for each type. 
-]b4_type_foreach([b4_basic_symbol_constructor_define])], [[ 
-  /// Constructor for valueless symbols. 
-  template <typename Base> 
-  inline 
-  ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join( 
-          [typename Base::kind_type t], 
-          b4_locations_if([const location_type& l]))[) 
-    : Base (t) 
-    , value ()]b4_locations_if([ 
-    , location (l)])[ 
-  {}]])[ 
- 
-  template <typename Base> 
-  inline 
-  ]b4_parser_class_name[::basic_symbol<Base>::~basic_symbol () 
-  {]b4_variant_if([[ 
-    // User destructor. 
-    symbol_number_type yytype = this->type_get (); 
-    switch (yytype) 
-    { 
-]b4_symbol_foreach([b4_symbol_destructor])dnl 
-[   default: 
-      break; 
-    } 
- 
-    // Type destructor. 
-  ]b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[ 
-  } 
- 
-  template <typename Base> 
-  inline 
-  void 
-  ]b4_parser_class_name[::basic_symbol<Base>::move (basic_symbol& s) 
-  { 
-    super_type::move(s); 
-    ]b4_variant_if([b4_symbol_variant([this->type_get ()], [value], [move], 
-                                      [s.value])], 
-                   [value = s.value;])[]b4_locations_if([ 
-    location = s.location;])[ 
-  } 
- 
-  // by_type. 
-  inline 
-  ]b4_parser_class_name[::by_type::by_type () 
-     : type (empty) 
-  {} 
- 
-  inline 
-  ]b4_parser_class_name[::by_type::by_type (const by_type& other) 
-    : type (other.type) 
-  {} 
- 
-  inline 
-  ]b4_parser_class_name[::by_type::by_type (token_type t) 
-    : type (yytranslate_ (t)) 
-  {} 
- 
-  inline 
-  void 
-  ]b4_parser_class_name[::by_type::move (by_type& that) 
-  { 
-    type = that.type; 
-    that.type = empty; 
-  } 
- 
-  inline 
-  int 
-  ]b4_parser_class_name[::by_type::type_get () const 
-  { 
-    return type; 
-  } 
-]b4_token_ctor_if([[ 
-  inline 
-  ]b4_parser_class_name[::token_type 
-  ]b4_parser_class_name[::by_type::token () const 
-  { 
-    // YYTOKNUM[NUM] -- (External) token number corresponding to the 
-    // (internal) symbol number NUM (which must be that of a token).  */ 
-    static 
-    const ]b4_int_type_for([b4_toknum])[ 
-    yytoken_number_[] = 
-    { 
-  ]b4_toknum[ 
-    }; 
-    return static_cast<token_type> (yytoken_number_[type]); 
-  } 
-]])[]dnl 
-b4_symbol_constructor_define]) 
- 
- 
-# b4_symbol_constructor_declare 
-# b4_symbol_constructor_define 
-# ----------------------------- 
-# Declare/define symbol constructors for all the value types. 
-# Use at class-level.  Redefined in variant.hh. 
-m4_define([b4_symbol_constructor_declare], []) 
-m4_define([b4_symbol_constructor_define], []) 
- 
- 
-# b4_yytranslate_define 
-# --------------------- 
-# Define yytranslate_.  Sometimes used in the header file, 
-# sometimes in the cc file. 
-m4_define([b4_yytranslate_define], 
-[[  // Symbol number corresponding to token number t. 
-  inline 
-  ]b4_parser_class_name[::token_number_type 
-  ]b4_parser_class_name[::yytranslate_ (]b4_token_ctor_if([token_type], 
-                                                          [int])[ t) 
-  { 
-    static 
-    const token_number_type 
-    translate_table[] = 
-    { 
-]b4_translate[ 
-    }; 
-    const unsigned int user_token_number_max_ = ]b4_user_token_number_max[; 
-    const token_number_type undef_token_ = ]b4_undef_token_number[; 
- 
-    if (static_cast<int>(t) <= yyeof_) 
-      return yyeof_; 
-    else if (static_cast<unsigned int> (t) <= user_token_number_max_) 
-      return translate_table[t]; 
-    else 
-      return undef_token_; 
-  } 
-]]) 
- 
- 
-# b4_lhs_value([TYPE]) 
-# -------------------- 
-# Expansion of $<TYPE>$. 
-m4_define([b4_lhs_value], 
-[b4_symbol_value([yyval], [$1])]) 
- 
- 
-# b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) 
-# -------------------------------------- 
-# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH 
-# symbols on RHS. 
-m4_define([b4_rhs_value], 
-[b4_symbol_value([yysemantic_stack_@{($1) - ($2)@}], [$3])]) 
- 
- 
-# b4_lhs_location() 
-# ----------------- 
-# Expansion of @$. 
-m4_define([b4_lhs_location], 
-[(yyloc)]) 
- 
- 
-# b4_rhs_location(RULE-LENGTH, NUM) 
-# --------------------------------- 
-# Expansion of @NUM, where the current rule has RULE-LENGTH symbols 
-# on RHS. 
-m4_define([b4_rhs_location], 
-[(yylocation_stack_@{($1) - ($2)@})]) 
- 
- 
-# b4_parse_param_decl 
-# ------------------- 
-# Extra formal arguments of the constructor. 
-# Change the parameter names from "foo" into "foo_yyarg", so that 
-# there is no collision bw the user chosen attribute name, and the 
-# argument name in the constructor. 
-m4_define([b4_parse_param_decl], 
-[m4_ifset([b4_parse_param], 
-          [m4_map_sep([b4_parse_param_decl_1], [, ], [b4_parse_param])])]) 
- 
-m4_define([b4_parse_param_decl_1], 
-[$1_yyarg]) 
- 
- 
- 
-# b4_parse_param_cons 
-# ------------------- 
-# Extra initialisations of the constructor. 
-m4_define([b4_parse_param_cons], 
-          [m4_ifset([b4_parse_param], 
-                    [ 
-      b4_cc_constructor_calls(b4_parse_param)])]) 
-m4_define([b4_cc_constructor_calls], 
-          [m4_map_sep([b4_cc_constructor_call], [, 
-      ], [$@])]) 
-m4_define([b4_cc_constructor_call], 
-          [$2 ($2_yyarg)]) 
- 
-# b4_parse_param_vars 
-# ------------------- 
-# Extra instance variables. 
-m4_define([b4_parse_param_vars], 
-          [m4_ifset([b4_parse_param], 
-                    [ 
-    // User arguments. 
-b4_cc_var_decls(b4_parse_param)])]) 
-m4_define([b4_cc_var_decls], 
-          [m4_map_sep([b4_cc_var_decl], [ 
-], [$@])]) 
-m4_define([b4_cc_var_decl], 
-          [    $1;]) 
- 
- 
-## ---------## 
-## Values.  ## 
-## ---------## 
- 
-# b4_yylloc_default_define 
-# ------------------------ 
-# Define YYLLOC_DEFAULT. 
-m4_define([b4_yylloc_default_define], 
-[[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. 
-   If N is 0, then set CURRENT to the empty location which ends 
-   the previous symbol: RHS[0] (always defined).  */ 
- 
-# ifndef YYLLOC_DEFAULT 
-#  define YYLLOC_DEFAULT(Current, Rhs, N)                               \ 
-    do                                                                  \ 
-      if (N)                                                            \ 
-        {                                                               \ 
-          (Current).begin  = YYRHSLOC (Rhs, 1).begin;                   \ 
-          (Current).end    = YYRHSLOC (Rhs, N).end;                     \ 
-        }                                                               \ 
-      else                                                              \ 
-        {                                                               \ 
-          (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end;      \ 
-        }                                                               \ 
-    while (/*CONSTCOND*/ false) 
-# endif 
-]]) 
- 
-## -------- ## 
-## Checks.  ## 
-## -------- ## 
- 
-b4_token_ctor_if([b4_variant_if([], 
-  [b4_fatal_at(b4_percent_define_get_loc(api.token.constructor), 
-               [cannot use '%s' without '%s'], 
-               [%define api.token.constructor], 
-               [%define api.value.type variant]))])]) 
+                                                            -*- Autoconf -*-
+
+# C++ skeleton for Bison
+
+# Copyright (C) 2002-2013 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+m4_include(b4_pkgdatadir/[c.m4])
+
+# b4_comment(TEXT, [PREFIX])
+# --------------------------
+# Put TEXT in comment. Prefix all the output lines with PREFIX.
+m4_define([b4_comment],
+[b4_comment_([$1], [$2// ], [$2// ])])
+
+## -------- ##
+## Checks.  ##
+## -------- ##
+
+b4_percent_define_check_kind([api.namespace], [code], [deprecated])
+b4_percent_define_check_kind([parser_class_name], [code], [deprecated])
+
+## ---------------- ##
+## Default values.  ##
+## ---------------- ##
+
+b4_percent_define_default([[parser_class_name]], [[parser]])
+
+# Don't do that so that we remember whether we're using a user
+# request, or the default value.
+#
+# b4_percent_define_default([[api.location.type]], [[location]])
+
+b4_percent_define_default([[filename_type]], [[std::string]])
+# Make it a warning for those who used betas of Bison 3.0.
+b4_percent_define_default([[api.namespace]], m4_defn([b4_prefix]))
+
+b4_percent_define_default([[global_tokens_and_yystype]], [[false]])
+b4_percent_define_default([[define_location_comparison]],
+                          [m4_if(b4_percent_define_get([[filename_type]]),
+                                 [std::string], [[true]], [[false]])])
+
+
+
+## ----------- ##
+## Namespace.  ##
+## ----------- ##
+
+m4_define([b4_namespace_ref], [b4_percent_define_get([[api.namespace]])])
+
+
+# Don't permit an empty b4_namespace_ref.  Any '::parser::foo' appended to it
+# would compile as an absolute reference with 'parser' in the global namespace.
+# b4_namespace_open would open an anonymous namespace and thus establish
+# internal linkage.  This would compile.  However, it's cryptic, and internal
+# linkage for the parser would be specified in all translation units that
+# include the header, which is always generated.  If we ever need to permit
+# internal linkage somehow, surely we can find a cleaner approach.
+m4_if(m4_bregexp(b4_namespace_ref, [^[	 ]*$]), [-1], [],
+[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
+                [[namespace reference is empty]])])
+
+# Instead of assuming the C++ compiler will do it, Bison should reject any
+# invalid b4_namepsace_ref that would be converted to a valid
+# b4_namespace_open.  The problem is that Bison doesn't always output
+# b4_namespace_ref to uncommented code but should reserve the ability to do so
+# in future releases without risking breaking any existing user grammars.
+# Specifically, don't allow empty names as b4_namespace_open would just convert
+# those into anonymous namespaces, and that might tempt some users.
+m4_if(m4_bregexp(b4_namespace_ref, [::[	 ]*::]), [-1], [],
+[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
+                [[namespace reference has consecutive "::"]])])
+m4_if(m4_bregexp(b4_namespace_ref, [::[	 ]*$]), [-1], [],
+[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
+                [[namespace reference has a trailing "::"]])])
+
+m4_define([b4_namespace_open],
+[b4_user_code([b4_percent_define_get_syncline([[api.namespace]])
+[namespace ]m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref),
+                                                [^\(.\)[	 ]*::], [\1])),
+                         [::], [ { namespace ])[ {]])])
+
+m4_define([b4_namespace_close],
+[b4_user_code([b4_percent_define_get_syncline([[api.namespace]])
+m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]),
+                                    [^\(.\)[	 ]*\(::\)?\([^][:]\|:[^:]\)*],
+                                    [\1])),
+             [::\([^][:]\|:[^:]\)*], [} ])[} // ]b4_namespace_ref])])
+
+
+# b4_token_enums
+# --------------
+# Output the definition of the tokens as enums.
+m4_define([b4_token_enums],
+[[enum yytokentype
+      {
+        ]m4_join([,
+        ],
+                 b4_symbol_map([b4_token_enum]))[
+      };]dnl
+])
+
+
+
+
+## ----------------- ##
+## Semantic Values.  ##
+## ----------------- ##
+
+
+
+# b4_value_type_declare
+# ---------------------
+# Declare semantic_type.
+m4_define([b4_value_type_declare],
+[b4_value_type_setup[]dnl
+[    /// Symbol semantic values.
+]m4_bmatch(b4_percent_define_get_kind([[api.value.type]]),
+[code],
+[[    typedef ]b4_percent_define_get([[api.value.type]])[ semantic_type;]],
+[m4_bmatch(b4_percent_define_get([[api.value.type]]),
+[union\|union-directive],
+[[    union semantic_type
+    {
+    ]b4_user_union_members[
+    };]])])dnl
+])
+
+
+# b4_public_types_declare
+# -----------------------
+# Define the public types: token, semantic value, location, and so forth.
+# Depending on %define token_lex, may be output in the header or source file.
+m4_define([b4_public_types_declare],
+[[#ifndef ]b4_api_PREFIX[STYPE
+]b4_value_type_declare[
+#else
+    typedef ]b4_api_PREFIX[STYPE semantic_type;
+#endif]b4_locations_if([
+    /// Symbol locations.
+    typedef b4_percent_define_get([[api.location.type]],
+                                  [[location]]) location_type;])[
+
+    /// Syntax errors thrown from user actions.
+    struct syntax_error : std::runtime_error
+    {
+      syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m);]b4_locations_if([
+      location_type location;])[
+    };
+
+    /// Tokens.
+    struct token
+    {
+      ]b4_token_enums[
+    };
+
+    /// (External) token type, as returned by yylex.
+    typedef token::yytokentype token_type;
+
+    /// Internal symbol number.
+    typedef int symbol_number_type;
+
+    /// Internal symbol number for tokens (subsumed by symbol_number_type).
+    typedef ]b4_int_type_for([b4_translate])[ token_number_type;
+
+    /// A complete symbol.
+    ///
+    /// Expects its Base type to provide access to the symbol type
+    /// via type_get().
+    ///
+    /// Provide access to semantic value]b4_locations_if([ and location])[.
+    template <typename Base>
+    struct basic_symbol : Base
+    {
+      /// Alias to Base.
+      typedef Base super_type;
+
+      /// Default constructor.
+      basic_symbol ();
+
+      /// Copy constructor.
+      basic_symbol (const basic_symbol& other);
+]b4_variant_if([[
+      /// Constructor for valueless symbols, and symbols from each type.
+]b4_type_foreach([b4_basic_symbol_constructor_declare])], [[
+      /// Constructor for valueless symbols.
+      basic_symbol (typename Base::kind_type t]b4_locations_if([,
+                    const location_type& l])[);]])[
+
+      /// Constructor for symbols with semantic value.
+      basic_symbol (typename Base::kind_type t,
+                    const semantic_type& v]b4_locations_if([,
+                    const location_type& l])[);
+
+      ~basic_symbol ();
+
+      /// Destructive move, \a s is emptied into this.
+      void move (basic_symbol& s);
+
+      /// The semantic value.
+      semantic_type value;]b4_locations_if([
+
+      /// The location.
+      location_type location;])[
+
+    private:
+      /// Assignment operator.
+      basic_symbol& operator= (const basic_symbol& other);
+    };
+
+    /// Type access provider for token (enum) based symbols.
+    struct by_type
+    {
+      /// Default constructor.
+      by_type ();
+
+      /// Copy constructor.
+      by_type (const by_type& other);
+
+      /// The symbol type as needed by the constructor.
+      typedef token_type kind_type;
+
+      /// Constructor from (external) token numbers.
+      by_type (kind_type t);
+
+      /// Steal the symbol type from \a that.
+      void move (by_type& that);
+
+      /// The (internal) type number (corresponding to \a type).
+      /// -1 when this symbol is empty.
+      symbol_number_type type_get () const;
+
+      /// The token.
+      token_type token () const;
+
+      enum { empty = 0 };
+
+      /// The symbol type.
+      /// -1 when this symbol is empty.
+      token_number_type type;
+    };
+
+    /// "External" symbols: returned by the scanner.
+    typedef basic_symbol<by_type> symbol_type;
+
+]b4_symbol_constructor_declare])
+
+
+# b4_public_types_define
+# ----------------------
+# Provide the implementation needed by the public types.
+m4_define([b4_public_types_define],
+[[  inline
+  ]b4_parser_class_name[::syntax_error::syntax_error (]b4_locations_if([const location_type& l, ])[const std::string& m)
+    : std::runtime_error (m)]b4_locations_if([
+    , location (l)])[
+  {}
+
+  // basic_symbol.
+  template <typename Base>
+  inline
+  ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol ()
+    : value ()
+  {}
+
+  template <typename Base>
+  inline
+  ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
+    : Base (other)
+    , value ()]b4_locations_if([
+    , location (other.location)])[
+  {
+    ]b4_variant_if([b4_symbol_variant([other.type_get ()], [value], [copy],
+                                      [other.value])],
+                   [value = other.value;])[
+  }
+
+
+  template <typename Base>
+  inline
+  ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
+          [typename Base::kind_type t],
+          [const semantic_type& v],
+          b4_locations_if([const location_type& l]))[)
+    : Base (t)
+    , value (]b4_variant_if([], [v])[)]b4_locations_if([
+    , location (l)])[
+  {]b4_variant_if([[
+    (void) v;
+    ]b4_symbol_variant([this->type_get ()], [value], [copy], [v])])[}
+
+]b4_variant_if([[
+  // Implementation of basic_symbol constructor for each type.
+]b4_type_foreach([b4_basic_symbol_constructor_define])], [[
+  /// Constructor for valueless symbols.
+  template <typename Base>
+  inline
+  ]b4_parser_class_name[::basic_symbol<Base>::basic_symbol (]b4_join(
+          [typename Base::kind_type t],
+          b4_locations_if([const location_type& l]))[)
+    : Base (t)
+    , value ()]b4_locations_if([
+    , location (l)])[
+  {}]])[
+
+  template <typename Base>
+  inline
+  ]b4_parser_class_name[::basic_symbol<Base>::~basic_symbol ()
+  {]b4_variant_if([[
+    // User destructor.
+    symbol_number_type yytype = this->type_get ();
+    switch (yytype)
+    {
+]b4_symbol_foreach([b4_symbol_destructor])dnl
+[   default:
+      break;
+    }
+
+    // Type destructor.
+  ]b4_symbol_variant([[yytype]], [[value]], [[template destroy]])])[
+  }
+
+  template <typename Base>
+  inline
+  void
+  ]b4_parser_class_name[::basic_symbol<Base>::move (basic_symbol& s)
+  {
+    super_type::move(s);
+    ]b4_variant_if([b4_symbol_variant([this->type_get ()], [value], [move],
+                                      [s.value])],
+                   [value = s.value;])[]b4_locations_if([
+    location = s.location;])[
+  }
+
+  // by_type.
+  inline
+  ]b4_parser_class_name[::by_type::by_type ()
+     : type (empty)
+  {}
+
+  inline
+  ]b4_parser_class_name[::by_type::by_type (const by_type& other)
+    : type (other.type)
+  {}
+
+  inline
+  ]b4_parser_class_name[::by_type::by_type (token_type t)
+    : type (yytranslate_ (t))
+  {}
+
+  inline
+  void
+  ]b4_parser_class_name[::by_type::move (by_type& that)
+  {
+    type = that.type;
+    that.type = empty;
+  }
+
+  inline
+  int
+  ]b4_parser_class_name[::by_type::type_get () const
+  {
+    return type;
+  }
+]b4_token_ctor_if([[
+  inline
+  ]b4_parser_class_name[::token_type
+  ]b4_parser_class_name[::by_type::token () const
+  {
+    // YYTOKNUM[NUM] -- (External) token number corresponding to the
+    // (internal) symbol number NUM (which must be that of a token).  */
+    static
+    const ]b4_int_type_for([b4_toknum])[
+    yytoken_number_[] =
+    {
+  ]b4_toknum[
+    };
+    return static_cast<token_type> (yytoken_number_[type]);
+  }
+]])[]dnl
+b4_symbol_constructor_define])
+
+
+# b4_symbol_constructor_declare
+# b4_symbol_constructor_define
+# -----------------------------
+# Declare/define symbol constructors for all the value types.
+# Use at class-level.  Redefined in variant.hh.
+m4_define([b4_symbol_constructor_declare], [])
+m4_define([b4_symbol_constructor_define], [])
+
+
+# b4_yytranslate_define
+# ---------------------
+# Define yytranslate_.  Sometimes used in the header file,
+# sometimes in the cc file.
+m4_define([b4_yytranslate_define],
+[[  // Symbol number corresponding to token number t.
+  inline
+  ]b4_parser_class_name[::token_number_type
+  ]b4_parser_class_name[::yytranslate_ (]b4_token_ctor_if([token_type],
+                                                          [int])[ t)
+  {
+    static
+    const token_number_type
+    translate_table[] =
+    {
+]b4_translate[
+    };
+    const unsigned int user_token_number_max_ = ]b4_user_token_number_max[;
+    const token_number_type undef_token_ = ]b4_undef_token_number[;
+
+    if (static_cast<int>(t) <= yyeof_)
+      return yyeof_;
+    else if (static_cast<unsigned int> (t) <= user_token_number_max_)
+      return translate_table[t];
+    else
+      return undef_token_;
+  }
+]])
+
+
+# b4_lhs_value([TYPE])
+# --------------------
+# Expansion of $<TYPE>$.
+m4_define([b4_lhs_value],
+[b4_symbol_value([yyval], [$1])])
+
+
+# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
+# --------------------------------------
+# Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
+# symbols on RHS.
+m4_define([b4_rhs_value],
+[b4_symbol_value([yysemantic_stack_@{($1) - ($2)@}], [$3])])
+
+
+# b4_lhs_location()
+# -----------------
+# Expansion of @$.
+m4_define([b4_lhs_location],
+[(yyloc)])
+
+
+# b4_rhs_location(RULE-LENGTH, NUM)
+# ---------------------------------
+# Expansion of @NUM, where the current rule has RULE-LENGTH symbols
+# on RHS.
+m4_define([b4_rhs_location],
+[(yylocation_stack_@{($1) - ($2)@})])
+
+
+# b4_parse_param_decl
+# -------------------
+# Extra formal arguments of the constructor.
+# Change the parameter names from "foo" into "foo_yyarg", so that
+# there is no collision bw the user chosen attribute name, and the
+# argument name in the constructor.
+m4_define([b4_parse_param_decl],
+[m4_ifset([b4_parse_param],
+          [m4_map_sep([b4_parse_param_decl_1], [, ], [b4_parse_param])])])
+
+m4_define([b4_parse_param_decl_1],
+[$1_yyarg])
+
+
+
+# b4_parse_param_cons
+# -------------------
+# Extra initialisations of the constructor.
+m4_define([b4_parse_param_cons],
+          [m4_ifset([b4_parse_param],
+                    [
+      b4_cc_constructor_calls(b4_parse_param)])])
+m4_define([b4_cc_constructor_calls],
+          [m4_map_sep([b4_cc_constructor_call], [,
+      ], [$@])])
+m4_define([b4_cc_constructor_call],
+          [$2 ($2_yyarg)])
+
+# b4_parse_param_vars
+# -------------------
+# Extra instance variables.
+m4_define([b4_parse_param_vars],
+          [m4_ifset([b4_parse_param],
+                    [
+    // User arguments.
+b4_cc_var_decls(b4_parse_param)])])
+m4_define([b4_cc_var_decls],
+          [m4_map_sep([b4_cc_var_decl], [
+], [$@])])
+m4_define([b4_cc_var_decl],
+          [    $1;])
+
+
+## ---------##
+## Values.  ##
+## ---------##
+
+# b4_yylloc_default_define
+# ------------------------
+# Define YYLLOC_DEFAULT.
+m4_define([b4_yylloc_default_define],
+[[/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+   If N is 0, then set CURRENT to the empty location which ends
+   the previous symbol: RHS[0] (always defined).  */
+
+# ifndef YYLLOC_DEFAULT
+#  define YYLLOC_DEFAULT(Current, Rhs, N)                               \
+    do                                                                  \
+      if (N)                                                            \
+        {                                                               \
+          (Current).begin  = YYRHSLOC (Rhs, 1).begin;                   \
+          (Current).end    = YYRHSLOC (Rhs, N).end;                     \
+        }                                                               \
+      else                                                              \
+        {                                                               \
+          (Current).begin = (Current).end = YYRHSLOC (Rhs, 0).end;      \
+        }                                                               \
+    while (/*CONSTCOND*/ false)
+# endif
+]])
+
+## -------- ##
+## Checks.  ##
+## -------- ##
+
+b4_token_ctor_if([b4_variant_if([],
+  [b4_fatal_at(b4_percent_define_get_loc(api.token.constructor),
+               [cannot use '%s' without '%s'],
+               [%define api.token.constructor],
+               [%define api.value.type variant]))])])

+ 65 - 65
contrib/tools/bison/bison/data/c-like.m4

@@ -1,65 +1,65 @@
-                                                            -*- Autoconf -*- 
- 
-# Common code for C-like languages (C, C++, Java, etc.) 
- 
-# Copyright (C) 2012-2013 Free Software Foundation, Inc. 
- 
-# This program is free software: you can redistribute it and/or modify 
-# it under the terms of the GNU General Public License as published by 
-# the Free Software Foundation, either version 3 of the License, or 
-# (at your option) any later version. 
-# 
-# This program is distributed in the hope that it will be useful, 
-# but WITHOUT ANY WARRANTY; without even the implied warranty of 
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
-# GNU General Public License for more details. 
-# 
-# You should have received a copy of the GNU General Public License 
-# along with this program.  If not, see <http://www.gnu.org/licenses/>. 
- 
-# b4_comment_(TEXT, OPEN, CONTINUE, END) 
-# -------------------------------------- 
-# Put TEXT in comment.  Avoid trailing spaces: don't indent empty lines. 
-# Avoid adding indentation to the first line, as the indentation comes 
-# from OPEN.  That's why we don't patsubst([$1], [^\(.\)], [   \1]). 
-# 
-# Prefix all the output lines with PREFIX. 
-m4_define([b4_comment_], 
-[$2[]m4_bpatsubst(m4_expand([[$1]]), [ 
-\(.\)], [ 
-$3\1])$4]) 
- 
- 
-# b4_comment(TEXT, [PREFIX]) 
-# -------------------------- 
-# Put TEXT in comment.  Prefix all the output lines with PREFIX. 
-m4_define([b4_comment], 
-[b4_comment_([$1], [$2/* ], [$2   ], [  */])]) 
- 
- 
- 
- 
-# b4_dollar_dollar_(VALUE, FIELD, DEFAULT-FIELD) 
-# ---------------------------------------------- 
-# If FIELD (or DEFAULT-FIELD) is non-null, return "VALUE.FIELD", 
-# otherwise just VALUE.  Be sure to pass "(VALUE)" is VALUE is a 
-# pointer. 
-m4_define([b4_dollar_dollar_], 
-[b4_symbol_value([$1], 
-                 m4_if([$2], [[]], 
-                       [[$3]], [[$2]]))]) 
- 
-# b4_dollar_pushdef(VALUE-POINTER, DEFAULT-FIELD, LOCATION) 
-# b4_dollar_popdef 
-# --------------------------------------------------------- 
-# Define b4_dollar_dollar for VALUE and DEFAULT-FIELD, 
-# and b4_at_dollar for LOCATION. 
-m4_define([b4_dollar_pushdef], 
-[m4_pushdef([b4_dollar_dollar], 
-            [b4_dollar_dollar_([$1], m4_dquote($][1), [$2])])dnl 
-m4_pushdef([b4_at_dollar], [$3])dnl 
-]) 
-m4_define([b4_dollar_popdef], 
-[m4_popdef([b4_at_dollar])dnl 
-m4_popdef([b4_dollar_dollar])dnl 
-]) 
+                                                            -*- Autoconf -*-
+
+# Common code for C-like languages (C, C++, Java, etc.)
+
+# Copyright (C) 2012-2013 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# b4_comment_(TEXT, OPEN, CONTINUE, END)
+# --------------------------------------
+# Put TEXT in comment.  Avoid trailing spaces: don't indent empty lines.
+# Avoid adding indentation to the first line, as the indentation comes
+# from OPEN.  That's why we don't patsubst([$1], [^\(.\)], [   \1]).
+#
+# Prefix all the output lines with PREFIX.
+m4_define([b4_comment_],
+[$2[]m4_bpatsubst(m4_expand([[$1]]), [
+\(.\)], [
+$3\1])$4])
+
+
+# b4_comment(TEXT, [PREFIX])
+# --------------------------
+# Put TEXT in comment.  Prefix all the output lines with PREFIX.
+m4_define([b4_comment],
+[b4_comment_([$1], [$2/* ], [$2   ], [  */])])
+
+
+
+
+# b4_dollar_dollar_(VALUE, FIELD, DEFAULT-FIELD)
+# ----------------------------------------------
+# If FIELD (or DEFAULT-FIELD) is non-null, return "VALUE.FIELD",
+# otherwise just VALUE.  Be sure to pass "(VALUE)" is VALUE is a
+# pointer.
+m4_define([b4_dollar_dollar_],
+[b4_symbol_value([$1],
+                 m4_if([$2], [[]],
+                       [[$3]], [[$2]]))])
+
+# b4_dollar_pushdef(VALUE-POINTER, DEFAULT-FIELD, LOCATION)
+# b4_dollar_popdef
+# ---------------------------------------------------------
+# Define b4_dollar_dollar for VALUE and DEFAULT-FIELD,
+# and b4_at_dollar for LOCATION.
+m4_define([b4_dollar_pushdef],
+[m4_pushdef([b4_dollar_dollar],
+            [b4_dollar_dollar_([$1], m4_dquote($][1), [$2])])dnl
+m4_pushdef([b4_at_dollar], [$3])dnl
+])
+m4_define([b4_dollar_popdef],
+[m4_popdef([b4_at_dollar])dnl
+m4_popdef([b4_dollar_dollar])dnl
+])

Some files were not shown because too many files changed in this diff