LCOV - code coverage report
Current view: top level - /mnt/build/buildbot/bld/build-lcov/gcc/m2/gm2-compiler-boot - M2MetaError.c (source / functions) Coverage Total Hit
Test: gcc.info Lines: 55.9 % 1611 900
Test Date: 2025-10-18 14:39:06 Functions: 56.9 % 137 78
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :             : /* do not edit automatically generated by mc from M2MetaError.  */
       2                 :             : /* M2MetaError.mod provides a set of high level error routines.
       3                 :             : 
       4                 :             : Copyright (C) 2008-2025 Free Software Foundation, Inc.
       5                 :             : Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
       6                 :             : 
       7                 :             : This file is part of GNU Modula-2.
       8                 :             : 
       9                 :             : GNU Modula-2 is free software; you can redistribute it and/or modify
      10                 :             : it under the terms of the GNU General Public License as published by
      11                 :             : the Free Software Foundation; either version 3, or (at your option)
      12                 :             : any later version.
      13                 :             : 
      14                 :             : GNU Modula-2 is distributed in the hope that it will be useful, but
      15                 :             : WITHOUT ANY WARRANTY; without even the implied warranty of
      16                 :             : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      17                 :             : General Public License for more details.
      18                 :             : 
      19                 :             : You should have received a copy of the GNU General Public License
      20                 :             : along with GNU Modula-2; see the file COPYING3.  If not see
      21                 :             : <http://www.gnu.org/licenses/>.  */
      22                 :             : 
      23                 :             : #include "config.h"
      24                 :             : #include "system.h"
      25                 :             : #include "gcc-consolidation.h"
      26                 :             : 
      27                 :             : #include <stdbool.h>
      28                 :             : #   if !defined (PROC_D)
      29                 :             : #      define PROC_D
      30                 :             :        typedef void (*PROC_t) (void);
      31                 :             :        typedef struct { PROC_t proc; } PROC;
      32                 :             : #   endif
      33                 :             : 
      34                 :             : #   if !defined (TRUE)
      35                 :             : #      define TRUE (1==1)
      36                 :             : #   endif
      37                 :             : 
      38                 :             : #   if !defined (FALSE)
      39                 :             : #      define FALSE (1==0)
      40                 :             : #   endif
      41                 :             : 
      42                 :             : #   include "GStorage.h"
      43                 :             : #   include "Gmcrts.h"
      44                 :             : #include <safe-ctype.h>
      45                 :             : #if defined(__cplusplus)
      46                 :             : #   undef NULL
      47                 :             : #   define NULL 0
      48                 :             : #endif
      49                 :             : #define _M2MetaError_C
      50                 :             : 
      51                 :             : #include "GM2MetaError.h"
      52                 :             : #   include "GM2Base.h"
      53                 :             : #   include "GNameKey.h"
      54                 :             : #   include "GStrLib.h"
      55                 :             : #   include "GM2LexBuf.h"
      56                 :             : #   include "GM2Error.h"
      57                 :             : #   include "GFIO.h"
      58                 :             : #   include "GSFIO.h"
      59                 :             : #   include "GStringConvert.h"
      60                 :             : #   include "GM2Printf.h"
      61                 :             : #   include "GM2Options.h"
      62                 :             : #   include "GStrCase.h"
      63                 :             : #   include "Glibc.h"
      64                 :             : #   include "GSYSTEM.h"
      65                 :             : #   include "GM2Debug.h"
      66                 :             : #   include "GStorage.h"
      67                 :             : #   include "GM2StackSpell.h"
      68                 :             : #   include "GIndexing.h"
      69                 :             : #   include "GDynamicStrings.h"
      70                 :             : #   include "GSymbolTable.h"
      71                 :             : #   include "GM2ColorString.h"
      72                 :             : #   include "GM2RTS.h"
      73                 :             : 
      74                 :             : #   define MaxStack 10
      75                 :             : #   define Debugging false
      76                 :             : #   define ColorDebug false
      77                 :             : typedef struct M2MetaError_GetTokProcedure_p M2MetaError_GetTokProcedure;
      78                 :             : 
      79                 :             : typedef struct M2MetaError_errorBlock_r M2MetaError_errorBlock;
      80                 :             : 
      81                 :             : typedef struct M2MetaError__T1_a M2MetaError__T1;
      82                 :             : 
      83                 :             : typedef struct M2MetaError__T2_r M2MetaError__T2;
      84                 :             : 
      85                 :             : typedef M2MetaError__T2 *M2MetaError_dictionaryEntry;
      86                 :             : 
      87                 :             : typedef enum {M2MetaError_none, M2MetaError_error, M2MetaError_warning, M2MetaError_note, M2MetaError_chained, M2MetaError_aborta} M2MetaError_errorType;
      88                 :             : 
      89                 :             : typedef enum {M2MetaError_unsetColor, M2MetaError_noColor, M2MetaError_quoteColor, M2MetaError_filenameColor, M2MetaError_errorColor, M2MetaError_warningColor, M2MetaError_noteColor, M2MetaError_keywordColor, M2MetaError_locusColor, M2MetaError_insertColor, M2MetaError_deleteColor, M2MetaError_typeColor, M2MetaError_range1Color, M2MetaError_range2Color} M2MetaError_colorType;
      90                 :             : 
      91                 :             : typedef unsigned int (*M2MetaError_GetTokProcedure_t) (unsigned int);
      92                 :             : struct M2MetaError_GetTokProcedure_p { M2MetaError_GetTokProcedure_t proc; };
      93                 :             : 
      94                 :             : struct M2MetaError__T1_a { M2MetaError_colorType array[MaxStack+1]; };
      95                 :             : struct M2MetaError__T2_r {
      96                 :             :                            DynamicStrings_String key;
      97                 :             :                            DynamicStrings_String value;
      98                 :             :                            M2MetaError_dictionaryEntry next;
      99                 :             :                          };
     100                 :             : 
     101                 :             : struct M2MetaError_errorBlock_r {
     102                 :             :                                   bool useError;
     103                 :             :                                   M2Error_Error e;
     104                 :             :                                   M2MetaError_errorType type;
     105                 :             :                                   DynamicStrings_String out;
     106                 :             :                                   DynamicStrings_String in;
     107                 :             :                                   unsigned int highplus1;
     108                 :             :                                   int len;
     109                 :             :                                   int ini;
     110                 :             :                                   bool vowel;
     111                 :             :                                   bool importHint;
     112                 :             :                                   bool exportHint;
     113                 :             :                                   bool withStackHint;
     114                 :             :                                   bool glyph;
     115                 :             :                                   bool chain;
     116                 :             :                                   bool root;
     117                 :             :                                   bool quotes;
     118                 :             :                                   bool positive;
     119                 :             :                                   M2MetaError_colorType currentCol;
     120                 :             :                                   M2MetaError_colorType beginCol;
     121                 :             :                                   M2MetaError_colorType endCol;
     122                 :             :                                   M2MetaError__T1 colorStack;
     123                 :             :                                   unsigned int stackPtr;
     124                 :             :                                 };
     125                 :             : 
     126                 :             : static M2Error_Error lastRoot;
     127                 :             : static M2MetaError_colorType lastColor;
     128                 :             : static bool seenAbort;
     129                 :             : static Indexing_Index dictionary;
     130                 :             : static Indexing_Index outputStack;
     131                 :             : static M2MetaError_dictionaryEntry freeEntry;
     132                 :             : extern "C" void M2MetaError_MetaError0 (const char *m_, unsigned int _m_high);
     133                 :             : extern "C" void M2MetaError_MetaError1 (const char *m_, unsigned int _m_high, unsigned int s);
     134                 :             : extern "C" void M2MetaError_MetaError2 (const char *m_, unsigned int _m_high, unsigned int s1, unsigned int s2);
     135                 :             : extern "C" void M2MetaError_MetaError3 (const char *m_, unsigned int _m_high, unsigned int s1, unsigned int s2, unsigned int s3);
     136                 :             : extern "C" void M2MetaError_MetaError4 (const char *m_, unsigned int _m_high, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int s4);
     137                 :             : 
     138                 :             : /*
     139                 :             :    wrapErrors -
     140                 :             : */
     141                 :             : 
     142                 :             : extern "C" void M2MetaError_MetaErrors1 (const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, unsigned int s);
     143                 :             : 
     144                 :             : /*
     145                 :             :    wrapErrors -
     146                 :             : */
     147                 :             : 
     148                 :             : extern "C" void M2MetaError_MetaErrors2 (const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, unsigned int s1, unsigned int s2);
     149                 :             : 
     150                 :             : /*
     151                 :             :    wrapErrors -
     152                 :             : */
     153                 :             : 
     154                 :             : extern "C" void M2MetaError_MetaErrors3 (const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, unsigned int s1, unsigned int s2, unsigned int s3);
     155                 :             : 
     156                 :             : /*
     157                 :             :    wrapErrors -
     158                 :             : */
     159                 :             : 
     160                 :             : extern "C" void M2MetaError_MetaErrors4 (const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int s4);
     161                 :             : extern "C" void M2MetaError_MetaErrorT0 (unsigned int tok, const char *m_, unsigned int _m_high);
     162                 :             : extern "C" void M2MetaError_MetaErrorT1 (unsigned int tok, const char *m_, unsigned int _m_high, unsigned int s);
     163                 :             : extern "C" void M2MetaError_MetaErrorT2 (unsigned int tok, const char *m_, unsigned int _m_high, unsigned int s1, unsigned int s2);
     164                 :             : extern "C" void M2MetaError_MetaErrorT3 (unsigned int tok, const char *m_, unsigned int _m_high, unsigned int s1, unsigned int s2, unsigned int s3);
     165                 :             : extern "C" void M2MetaError_MetaErrorT4 (unsigned int tok, const char *m_, unsigned int _m_high, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int s4);
     166                 :             : 
     167                 :             : /*
     168                 :             :    wrapErrors -
     169                 :             : */
     170                 :             : 
     171                 :             : extern "C" void M2MetaError_MetaErrorsT1 (unsigned int tok, const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, unsigned int s);
     172                 :             : 
     173                 :             : /*
     174                 :             :    wrapErrors -
     175                 :             : */
     176                 :             : 
     177                 :             : extern "C" void M2MetaError_MetaErrorsT2 (unsigned int tok, const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, unsigned int s1, unsigned int s2);
     178                 :             : 
     179                 :             : /*
     180                 :             :    wrapErrors -
     181                 :             : */
     182                 :             : 
     183                 :             : extern "C" void M2MetaError_MetaErrorsT3 (unsigned int tok, const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, unsigned int s1, unsigned int s2, unsigned int s3);
     184                 :             : 
     185                 :             : /*
     186                 :             :    wrapErrors -
     187                 :             : */
     188                 :             : 
     189                 :             : extern "C" void M2MetaError_MetaErrorsT4 (unsigned int tok, const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int s4);
     190                 :             : 
     191                 :             : /*
     192                 :             :    wrapErrors -
     193                 :             : */
     194                 :             : 
     195                 :             : extern "C" void M2MetaError_MetaErrorString0 (DynamicStrings_String m);
     196                 :             : 
     197                 :             : /*
     198                 :             :    wrapErrors -
     199                 :             : */
     200                 :             : 
     201                 :             : extern "C" void M2MetaError_MetaErrorString1 (DynamicStrings_String m, unsigned int s);
     202                 :             : 
     203                 :             : /*
     204                 :             :    wrapErrors -
     205                 :             : */
     206                 :             : 
     207                 :             : extern "C" void M2MetaError_MetaErrorString2 (DynamicStrings_String m, unsigned int s1, unsigned int s2);
     208                 :             : 
     209                 :             : /*
     210                 :             :    wrapErrors -
     211                 :             : */
     212                 :             : 
     213                 :             : extern "C" void M2MetaError_MetaErrorString3 (DynamicStrings_String m, unsigned int s1, unsigned int s2, unsigned int s3);
     214                 :             : 
     215                 :             : /*
     216                 :             :    wrapErrors -
     217                 :             : */
     218                 :             : 
     219                 :             : extern "C" void M2MetaError_MetaErrorString4 (DynamicStrings_String m, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int s4);
     220                 :             : extern "C" void M2MetaError_MetaErrorStringT0 (unsigned int tok, DynamicStrings_String m);
     221                 :             : extern "C" void M2MetaError_MetaErrorStringT1 (unsigned int tok, DynamicStrings_String m, unsigned int s);
     222                 :             : extern "C" void M2MetaError_MetaErrorStringT2 (unsigned int tok, DynamicStrings_String m, unsigned int s1, unsigned int s2);
     223                 :             : extern "C" void M2MetaError_MetaErrorStringT3 (unsigned int tok, DynamicStrings_String m, unsigned int s1, unsigned int s2, unsigned int s3);
     224                 :             : extern "C" void M2MetaError_MetaErrorStringT4 (unsigned int tok, DynamicStrings_String m, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int s4);
     225                 :             : 
     226                 :             : /*
     227                 :             :    MetaErrorN1 -
     228                 :             : */
     229                 :             : 
     230                 :             : extern "C" void M2MetaError_MetaErrorN1 (const char *m_, unsigned int _m_high, NameKey_Name n);
     231                 :             : 
     232                 :             : /*
     233                 :             :    MetaErrorN2 -
     234                 :             : */
     235                 :             : 
     236                 :             : extern "C" void M2MetaError_MetaErrorN2 (const char *m_, unsigned int _m_high, NameKey_Name n1, NameKey_Name n2);
     237                 :             : 
     238                 :             : /*
     239                 :             :    MetaErrorNT0 - generate an error message at tok using format.
     240                 :             : */
     241                 :             : 
     242                 :             : extern "C" void M2MetaError_MetaErrorNT0 (unsigned int tok, const char *format_, unsigned int _format_high);
     243                 :             : 
     244                 :             : /*
     245                 :             :    MetaErrorNT1 - generate an error message at tok using format and name.
     246                 :             :                   The format should contain %a for name substitution.
     247                 :             : */
     248                 :             : 
     249                 :             : extern "C" void M2MetaError_MetaErrorNT1 (unsigned int tok, const char *format_, unsigned int _format_high, NameKey_Name name);
     250                 :             : extern "C" void M2MetaError_MetaErrorNT2 (unsigned int tok, const char *format_, unsigned int _format_high, NameKey_Name name1, NameKey_Name name2);
     251                 :             : 
     252                 :             : /*
     253                 :             :    wrapString - return a string which has been formatted with the specifier codes.
     254                 :             :                 Color is disabled.  The result string is returned.
     255                 :             : */
     256                 :             : 
     257                 :             : extern "C" DynamicStrings_String M2MetaError_MetaString0 (DynamicStrings_String m);
     258                 :             : 
     259                 :             : /*
     260                 :             :    wrapString - return a string which has been formatted with the specifier codes.
     261                 :             :                 Color is disabled.  The result string is returned.
     262                 :             : */
     263                 :             : 
     264                 :             : extern "C" DynamicStrings_String M2MetaError_MetaString1 (DynamicStrings_String m, unsigned int s);
     265                 :             : 
     266                 :             : /*
     267                 :             :    wrapString - return a string which has been formatted with the specifier codes.
     268                 :             :                 Color is disabled.  The result string is returned.
     269                 :             : */
     270                 :             : 
     271                 :             : extern "C" DynamicStrings_String M2MetaError_MetaString2 (DynamicStrings_String m, unsigned int s1, unsigned int s2);
     272                 :             : 
     273                 :             : /*
     274                 :             :    wrapString - return a string which has been formatted with the specifier codes.
     275                 :             :                 Color is disabled.  The result string is returned.
     276                 :             : */
     277                 :             : 
     278                 :             : extern "C" DynamicStrings_String M2MetaError_MetaString3 (DynamicStrings_String m, unsigned int s1, unsigned int s2, unsigned int s3);
     279                 :             : 
     280                 :             : /*
     281                 :             :    wrapString - return a string which has been formatted with the specifier codes.
     282                 :             :                 Color is disabled.  The result string is returned.
     283                 :             : */
     284                 :             : 
     285                 :             : extern "C" DynamicStrings_String M2MetaError_MetaString4 (DynamicStrings_String m, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int s4);
     286                 :             : 
     287                 :             : /*
     288                 :             :    MetaErrorDecl - if sym is a variable or parameter then generate a
     289                 :             :                    declaration error or warning message.  If error is
     290                 :             :                    FALSE then a warning is issued.
     291                 :             : */
     292                 :             : 
     293                 :             : extern "C" void M2MetaError_MetaErrorDecl (unsigned int sym, bool error);
     294                 :             : 
     295                 :             : /*
     296                 :             :    pushOutput -
     297                 :             : */
     298                 :             : 
     299                 :             : static void pushOutput (M2MetaError_errorBlock *eb);
     300                 :             : 
     301                 :             : /*
     302                 :             :    readWord - reads and returns a word delimited by '}' it uses '%' as
     303                 :             :               the escape character.
     304                 :             : */
     305                 :             : 
     306                 :             : static DynamicStrings_String readWord (M2MetaError_errorBlock *eb);
     307                 :             : 
     308                 :             : /*
     309                 :             :    addEntry -
     310                 :             : */
     311                 :             : 
     312                 :             : static void addEntry (DynamicStrings_String key, DynamicStrings_String value);
     313                 :             : 
     314                 :             : /*
     315                 :             :    popOutput -
     316                 :             : */
     317                 :             : 
     318                 :             : static void popOutput (M2MetaError_errorBlock *eb);
     319                 :             : 
     320                 :             : /*
     321                 :             :    newEntry -
     322                 :             : */
     323                 :             : 
     324                 :             : static M2MetaError_dictionaryEntry newEntry (void);
     325                 :             : 
     326                 :             : /*
     327                 :             :    killEntry - dispose e and delete any strings.
     328                 :             : */
     329                 :             : 
     330                 :             : static void killEntry (M2MetaError_dictionaryEntry e);
     331                 :             : 
     332                 :             : /*
     333                 :             :    resetDictionary - remove all entries in the dictionary.
     334                 :             : */
     335                 :             : 
     336                 :             : static void resetDictionary (void);
     337                 :             : 
     338                 :             : /*
     339                 :             :    lookupString - lookup and return a duplicate of the string value for key s.
     340                 :             :                   NIL is returned if the key s is unknown.
     341                 :             : */
     342                 :             : 
     343                 :             : static DynamicStrings_String lookupString (DynamicStrings_String s);
     344                 :             : 
     345                 :             : /*
     346                 :             :    lookupDefine - looks up the word in the input string (ending with '}').
     347                 :             :                   It uses this word as a key into the dictionary and returns
     348                 :             :                   the entry.
     349                 :             : */
     350                 :             : 
     351                 :             : static DynamicStrings_String lookupDefine (M2MetaError_errorBlock *eb);
     352                 :             : 
     353                 :             : /*
     354                 :             :    processDefine - place contents of dictionary entry name onto the output string.
     355                 :             : */
     356                 :             : 
     357                 :             : static void processDefine (M2MetaError_errorBlock *eb);
     358                 :             : 
     359                 :             : /*
     360                 :             :    lookupColor - looks up the color enum from the string.
     361                 :             : */
     362                 :             : 
     363                 :             : static M2MetaError_colorType lookupColor (DynamicStrings_String s);
     364                 :             : 
     365                 :             : /*
     366                 :             :    readColor -
     367                 :             : */
     368                 :             : 
     369                 :             : static M2MetaError_colorType readColor (M2MetaError_errorBlock *eb);
     370                 :             : 
     371                 :             : /*
     372                 :             :    keyword - copy characters until the '}' in the input string and convert them to
     373                 :             :              the keyword color/font.
     374                 :             : */
     375                 :             : 
     376                 :             : static void keyword (M2MetaError_errorBlock *eb);
     377                 :             : 
     378                 :             : /*
     379                 :             :    filename - copy characters until the '}' in the input string and convert them to
     380                 :             :               the filename color/font.
     381                 :             : */
     382                 :             : 
     383                 :             : static void filename (M2MetaError_errorBlock *eb);
     384                 :             : 
     385                 :             : /*
     386                 :             :    pushColor -
     387                 :             : */
     388                 :             : 
     389                 :             : static void pushColor (M2MetaError_errorBlock *eb);
     390                 :             : 
     391                 :             : /*
     392                 :             :    popColor -
     393                 :             : */
     394                 :             : 
     395                 :             : static void popColor (M2MetaError_errorBlock *eb);
     396                 :             : 
     397                 :             : /*
     398                 :             :    initErrorBlock - initialise an error block with the, input, string.
     399                 :             : */
     400                 :             : 
     401                 :             : static void initErrorBlock (M2MetaError_errorBlock *eb, DynamicStrings_String input, const unsigned int *sym_, unsigned int _sym_high);
     402                 :             : 
     403                 :             : /*
     404                 :             :    push - performs a push from the oldblock to the newblock.
     405                 :             :           It copies all fields except the output string.
     406                 :             : */
     407                 :             : 
     408                 :             : static void push (M2MetaError_errorBlock *newblock, M2MetaError_errorBlock oldblock);
     409                 :             : 
     410                 :             : /*
     411                 :             :    pop - copies contents of fromblock into toblock.  It only copies the error
     412                 :             :          handle if the toblock.e is NIL.
     413                 :             : */
     414                 :             : 
     415                 :             : static void pop (M2MetaError_errorBlock *toblock, M2MetaError_errorBlock *fromblock);
     416                 :             : 
     417                 :             : /*
     418                 :             :    OutOpenQuote -
     419                 :             : */
     420                 :             : 
     421                 :             : static void OutOpenQuote (M2MetaError_errorBlock *eb);
     422                 :             : 
     423                 :             : /*
     424                 :             :    OutCloseQuote -
     425                 :             : */
     426                 :             : 
     427                 :             : static void OutCloseQuote (M2MetaError_errorBlock *eb);
     428                 :             : 
     429                 :             : /*
     430                 :             :    findColorType - return the color of the string.  This is determined by the first
     431                 :             :                    occurrance of an error, warning or note marker.  An error message
     432                 :             :                    is assumed to either be: a keyword category, error category, note
     433                 :             :                    category, warning category or to be chained from a previous error.
     434                 :             : */
     435                 :             : 
     436                 :             : static M2MetaError_colorType findColorType (DynamicStrings_String s);
     437                 :             : 
     438                 :             : /*
     439                 :             :    killErrorBlock - deallocates the dynamic strings associated with the error block.
     440                 :             : */
     441                 :             : 
     442                 :             : static void killErrorBlock (M2MetaError_errorBlock *eb);
     443                 :             : 
     444                 :             : /*
     445                 :             :    InternalFormat - produces an informative internal error.
     446                 :             : */
     447                 :             : 
     448                 :             : static void InternalFormat (M2MetaError_errorBlock eb, const char *m_, unsigned int _m_high, unsigned int line);
     449                 :             : 
     450                 :             : /*
     451                 :             :    x - checks to see that a=b.
     452                 :             : */
     453                 :             : 
     454                 :             : static DynamicStrings_String x (DynamicStrings_String a, DynamicStrings_String b);
     455                 :             : 
     456                 :             : /*
     457                 :             :    IsWhite - returns TRUE if, ch, is a space.
     458                 :             : */
     459                 :             : 
     460                 :             : static bool IsWhite (char ch);
     461                 :             : 
     462                 :             : /*
     463                 :             :    skip - skips over this level input until the next '}'.
     464                 :             : */
     465                 :             : 
     466                 :             : static void skip (M2MetaError_errorBlock *sb);
     467                 :             : 
     468                 :             : /*
     469                 :             :    ifNonNulThen := [ ':' ebnf ] =:
     470                 :             : */
     471                 :             : 
     472                 :             : static void ifNonNulThen (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high);
     473                 :             : 
     474                 :             : /*
     475                 :             :    doNumber -
     476                 :             : */
     477                 :             : 
     478                 :             : static void doNumber (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol);
     479                 :             : 
     480                 :             : /*
     481                 :             :    doCount -
     482                 :             : */
     483                 :             : 
     484                 :             : static void doCount (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol);
     485                 :             : 
     486                 :             : /*
     487                 :             :    doCount -
     488                 :             : */
     489                 :             : 
     490                 :             : static void doAscii (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol);
     491                 :             : 
     492                 :             : /*
     493                 :             :    unquotedKeyword -
     494                 :             : */
     495                 :             : 
     496                 :             : static void unquotedKeyword (M2MetaError_errorBlock *eb);
     497                 :             : 
     498                 :             : /*
     499                 :             :    OutArray -
     500                 :             : */
     501                 :             : 
     502                 :             : static void OutArray (M2MetaError_errorBlock *eb, const char *a_, unsigned int _a_high);
     503                 :             : 
     504                 :             : /*
     505                 :             :    OutGlyphS - outputs a string of glyphs.
     506                 :             : */
     507                 :             : 
     508                 :             : static void OutGlyphS (M2MetaError_errorBlock *eb, DynamicStrings_String s);
     509                 :             : 
     510                 :             : /*
     511                 :             :    empty - returns TRUE if the output string is empty.
     512                 :             :            It ignores color changes.
     513                 :             : */
     514                 :             : 
     515                 :             : static bool empty (M2MetaError_errorBlock *eb);
     516                 :             : 
     517                 :             : /*
     518                 :             :    checkVowel - checks to see if the from block word starts with
     519                 :             :                 a vowel and if so adds an n to the to block output.
     520                 :             : */
     521                 :             : 
     522                 :             : static void checkVowel (M2MetaError_errorBlock *to, M2MetaError_errorBlock from);
     523                 :             : 
     524                 :             : /*
     525                 :             :    isVowel - returns TRUE if ch is a, e, i, o or u.
     526                 :             : */
     527                 :             : 
     528                 :             : static bool isVowel (char ch);
     529                 :             : 
     530                 :             : /*
     531                 :             :    clear - remove the output string.
     532                 :             : */
     533                 :             : 
     534                 :             : static void clear (M2MetaError_errorBlock *eb);
     535                 :             : 
     536                 :             : /*
     537                 :             :    clear - remove the output string.
     538                 :             : */
     539                 :             : 
     540                 :             : static void doName (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol);
     541                 :             : 
     542                 :             : /*
     543                 :             :    clear - remove the output string.
     544                 :             : */
     545                 :             : 
     546                 :             : static void doQualified (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol);
     547                 :             : 
     548                 :             : /*
     549                 :             :    doType - returns a string containing the type name of
     550                 :             :             sym.
     551                 :             : */
     552                 :             : 
     553                 :             : static void doType (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol);
     554                 :             : 
     555                 :             : /*
     556                 :             :    doSkipType - will skip all pseudonym types.  It also
     557                 :             :                 returns the type symbol found and name.
     558                 :             : */
     559                 :             : 
     560                 :             : static void doSkipType (M2MetaError_errorBlock eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol);
     561                 :             : 
     562                 :             : /*
     563                 :             :    doGetType - attempts to get the type of sym[bol].
     564                 :             : */
     565                 :             : 
     566                 :             : static void doGetType (M2MetaError_errorBlock *eb, unsigned int *sym, unsigned int _sym_high, unsigned int bol);
     567                 :             : 
     568                 :             : /*
     569                 :             :    doGetSkipType - will skip all pseudonym types.  It also
     570                 :             :                    returns the type symbol found and name.
     571                 :             : */
     572                 :             : 
     573                 :             : static void doGetSkipType (M2MetaError_errorBlock *eb, unsigned int *sym, unsigned int _sym_high, unsigned int bol);
     574                 :             : 
     575                 :             : /*
     576                 :             :    doChain -
     577                 :             : */
     578                 :             : 
     579                 :             : static void doChain (M2MetaError_errorBlock *eb, unsigned int tok);
     580                 :             : 
     581                 :             : /*
     582                 :             :    doError - creates and returns an error note.
     583                 :             : */
     584                 :             : 
     585                 :             : static void doError (M2MetaError_errorBlock *eb, unsigned int tok);
     586                 :             : 
     587                 :             : /*
     588                 :             :    defaultError - adds the default error location to, tok, if one has not already been
     589                 :             :                   assigned.
     590                 :             : */
     591                 :             : 
     592                 :             : static void defaultError (M2MetaError_errorBlock *eb, unsigned int tok);
     593                 :             : 
     594                 :             : /*
     595                 :             :    chooseError - choose the error kind dependant upon type.
     596                 :             :                  Either an error, warning or note will be generated.
     597                 :             : */
     598                 :             : 
     599                 :             : static void chooseError (M2MetaError_errorBlock *eb, unsigned int tok);
     600                 :             : 
     601                 :             : /*
     602                 :             :    doErrorScopeModule -
     603                 :             : */
     604                 :             : 
     605                 :             : static void doErrorScopeModule (M2MetaError_errorBlock *eb, unsigned int sym);
     606                 :             : 
     607                 :             : /*
     608                 :             :    doErrorScopeForward -
     609                 :             : */
     610                 :             : 
     611                 :             : static void doErrorScopeForward (M2MetaError_errorBlock *eb, unsigned int sym);
     612                 :             : 
     613                 :             : /*
     614                 :             :    doErrorScopeMod - potentially create an error referring to the definition
     615                 :             :                      module, fall back to the implementation or program module if
     616                 :             :                      there is no declaration in the definition module.
     617                 :             : */
     618                 :             : 
     619                 :             : static void doErrorScopeMod (M2MetaError_errorBlock *eb, unsigned int sym);
     620                 :             : 
     621                 :             : /*
     622                 :             :    doErrorScopeFor - potentially create an error referring to the
     623                 :             :                      forward declaration, definition module, fall back
     624                 :             :                      to the implementation or program module if
     625                 :             :                      there is no declaration in the definition module.
     626                 :             : */
     627                 :             : 
     628                 :             : static void doErrorScopeFor (M2MetaError_errorBlock *eb, unsigned int sym);
     629                 :             : static void declaredMod (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol);
     630                 :             : 
     631                 :             : /*
     632                 :             :    doErrorScopeDefinition - use the declaration in the definitio module if one is available.
     633                 :             : */
     634                 :             : 
     635                 :             : static void doErrorScopeDefinition (M2MetaError_errorBlock *eb, unsigned int sym);
     636                 :             : 
     637                 :             : /*
     638                 :             :    doErrorScopeDef - potentially create an error referring to the definition
     639                 :             :                      module, fall back to the implementation or program module if
     640                 :             :                      there is no declaration in the definition module.
     641                 :             : */
     642                 :             : 
     643                 :             : static void doErrorScopeDef (M2MetaError_errorBlock *eb, unsigned int sym);
     644                 :             : static void declaredDef (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol);
     645                 :             : static void declaredFor (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol);
     646                 :             : 
     647                 :             : /*
     648                 :             :    doErrorScopeProc - determine the location for the error or warning from
     649                 :             :                       the default declaration.  For example parameters can be
     650                 :             :                       declared in definition, forward or in modules (proper procedure).
     651                 :             :                       Use GetVarParamTok to obtain a variable or parameter location.
     652                 :             : */
     653                 :             : 
     654                 :             : static void doErrorScopeProc (M2MetaError_errorBlock *eb, unsigned int sym, M2MetaError_GetTokProcedure GetVarParamTok);
     655                 :             : static void declaredVar (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol);
     656                 :             : static void declaredType (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol);
     657                 :             : static void declaredFull (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol);
     658                 :             : 
     659                 :             : /*
     660                 :             :    used - creates an error note where sym[bol] was first used.
     661                 :             : */
     662                 :             : 
     663                 :             : static void used (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol);
     664                 :             : 
     665                 :             : /*
     666                 :             :    symDesc -
     667                 :             : */
     668                 :             : 
     669                 :             : static DynamicStrings_String symDesc (unsigned int sym);
     670                 :             : 
     671                 :             : /*
     672                 :             :    doDesc -
     673                 :             : */
     674                 :             : 
     675                 :             : static void doDesc (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol);
     676                 :             : 
     677                 :             : /*
     678                 :             :    op := {'!'|'a'|'c'|'d'|'k'|'n'|'p'|'q'|'s'|'t'|'u'|'v'|
     679                 :             :           'A'|'B'|'C'|'D'|'E'|'F'|'G'|'H'|'K'|'M'|'N'|
     680                 :             :           'O'|'P'|'Q'|'R'|'S'|'T'|'U'|'V'|'W'|'X'|'Y'|'Z'|
     681                 :             :           '&' } then =:
     682                 :             : */
     683                 :             : 
     684                 :             : static void op (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol);
     685                 :             : 
     686                 :             : /*
     687                 :             :    continuation := {':'|'1'|'2'|'3'|'4'|'i'|'s'|'x'|'w'} =:
     688                 :             : */
     689                 :             : 
     690                 :             : static void continuation (M2MetaError_errorBlock *eb, unsigned int *sym, unsigned int _sym_high, unsigned int bol);
     691                 :             : 
     692                 :             : /*
     693                 :             :    percenttoken := '%' (
     694                 :             :                          '1'        % doOperand(1) %
     695                 :             :                              op
     696                 :             :                        | '2'        % doOperand(2) %
     697                 :             :                              op
     698                 :             :                        | '3'        % doOperand(3) %
     699                 :             :                              op
     700                 :             :                        | '4'        % doOperand(4) %
     701                 :             :                              op
     702                 :             :                        )
     703                 :             :                        } =:
     704                 :             : */
     705                 :             : 
     706                 :             : static void percenttoken (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high);
     707                 :             : 
     708                 :             : /*
     709                 :             :    IsPunct - returns TRUE if ch is a punctuation character.
     710                 :             : */
     711                 :             : 
     712                 :             : static bool IsPunct (char ch);
     713                 :             : 
     714                 :             : /*
     715                 :             :    JoinSentances - join s onto eb.  It removes trailing
     716                 :             :                    spaces from eb if s starts with a punctuation
     717                 :             :                    character.
     718                 :             : */
     719                 :             : 
     720                 :             : static void JoinSentances (M2MetaError_errorBlock *eb, DynamicStrings_String s);
     721                 :             : 
     722                 :             : /*
     723                 :             :    SpellHint -
     724                 :             : */
     725                 :             : 
     726                 :             : static void SpellHint (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol);
     727                 :             : 
     728                 :             : /*
     729                 :             :    AddImportsHint -
     730                 :             : */
     731                 :             : 
     732                 :             : static void AddImportsHint (M2MetaError_errorBlock *eb);
     733                 :             : 
     734                 :             : /*
     735                 :             :    AddExportsHint -
     736                 :             : */
     737                 :             : 
     738                 :             : static void AddExportsHint (M2MetaError_errorBlock *eb);
     739                 :             : 
     740                 :             : /*
     741                 :             :    AddWithStackHint -
     742                 :             : */
     743                 :             : 
     744                 :             : static void AddWithStackHint (M2MetaError_errorBlock *eb);
     745                 :             : 
     746                 :             : /*
     747                 :             :    changeColor - changes to color, c.
     748                 :             : */
     749                 :             : 
     750                 :             : static void changeColor (M2MetaError_errorBlock *eb, M2MetaError_colorType c);
     751                 :             : 
     752                 :             : /*
     753                 :             :    shutdownColor - shutdown existing color if it exists.
     754                 :             : */
     755                 :             : 
     756                 :             : static void shutdownColor (M2MetaError_errorBlock *eb);
     757                 :             : 
     758                 :             : /*
     759                 :             :    flushColor - flushes any outstanding color change.
     760                 :             : */
     761                 :             : 
     762                 :             : static void flushColor (M2MetaError_errorBlock *eb);
     763                 :             : 
     764                 :             : /*
     765                 :             :    emitColorGCC -
     766                 :             : */
     767                 :             : 
     768                 :             : static void emitColorGCC (M2MetaError_errorBlock *eb, M2MetaError_colorType c);
     769                 :             : 
     770                 :             : /*
     771                 :             :    emitColorTag -
     772                 :             : */
     773                 :             : 
     774                 :             : static void emitColorTag (M2MetaError_errorBlock *eb, M2MetaError_colorType c);
     775                 :             : 
     776                 :             : /*
     777                 :             :    emitColor - adds the appropriate color string to the output string.
     778                 :             : */
     779                 :             : 
     780                 :             : static void emitColor (M2MetaError_errorBlock *eb, M2MetaError_colorType c);
     781                 :             : 
     782                 :             : /*
     783                 :             :    openQuote -
     784                 :             : */
     785                 :             : 
     786                 :             : static DynamicStrings_String openQuote (DynamicStrings_String s);
     787                 :             : 
     788                 :             : /*
     789                 :             :    closeQuote -
     790                 :             : */
     791                 :             : 
     792                 :             : static DynamicStrings_String closeQuote (DynamicStrings_String s);
     793                 :             : 
     794                 :             : /*
     795                 :             :    colorEnd -
     796                 :             : */
     797                 :             : 
     798                 :             : static DynamicStrings_String colorEnd (DynamicStrings_String s);
     799                 :             : 
     800                 :             : /*
     801                 :             :    copyChar - copies a character from in string to out string.
     802                 :             : */
     803                 :             : 
     804                 :             : static void copyChar (M2MetaError_errorBlock *eb);
     805                 :             : 
     806                 :             : /*
     807                 :             :    copyKeywordChar - copies a character from in string to out string
     808                 :             :                      it will convert the character to lower case if the
     809                 :             :                      -fm2-lower-case option was specified.
     810                 :             : */
     811                 :             : 
     812                 :             : static void copyKeywordChar (M2MetaError_errorBlock *eb);
     813                 :             : 
     814                 :             : /*
     815                 :             :    percent := '%' anych           % copy anych %
     816                 :             :             =:
     817                 :             : */
     818                 :             : 
     819                 :             : static void percent (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high);
     820                 :             : 
     821                 :             : /*
     822                 :             :    lbra := '{' [ '!' ] percenttoken '}' =:
     823                 :             : */
     824                 :             : 
     825                 :             : static void lbra (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high);
     826                 :             : 
     827                 :             : /*
     828                 :             :    lbra := '{' [ '!' ] percenttoken '}' =:
     829                 :             : */
     830                 :             : 
     831                 :             : static void stop (void);
     832                 :             : 
     833                 :             : /*
     834                 :             :    lbra := '{' [ '!' ] percenttoken '}' =:
     835                 :             : */
     836                 :             : 
     837                 :             : static void checkMe (void);
     838                 :             : 
     839                 :             : /*
     840                 :             :    dumpErrorType -
     841                 :             : */
     842                 :             : 
     843                 :             : static void dumpErrorType (M2MetaError_errorType e);
     844                 :             : 
     845                 :             : /*
     846                 :             :    dumpColorType -
     847                 :             : */
     848                 :             : 
     849                 :             : static void dumpColorType (M2MetaError_colorType c);
     850                 :             : 
     851                 :             : /*
     852                 :             :    dump -
     853                 :             : 
     854                 :             : */
     855                 :             : 
     856                 :             : static void dump (M2MetaError_errorBlock eb);
     857                 :             : 
     858                 :             : /*
     859                 :             :    ebnf := { percent
     860                 :             :              | lbra
     861                 :             :              | any                    % copy ch %
     862                 :             :            }
     863                 :             :          =:
     864                 :             : */
     865                 :             : 
     866                 :             : static void ebnf (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high);
     867                 :             : 
     868                 :             : /*
     869                 :             :    wrapErrors -
     870                 :             : */
     871                 :             : 
     872                 :             : static void wrapErrors (unsigned int tok, const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, const unsigned int *sym_, unsigned int _sym_high);
     873                 :             : 
     874                 :             : /*
     875                 :             :    checkAbort - checks to see if the boolean flag seenAbort has been set,
     876                 :             :                 if so it flushes all existing errors and terminates.
     877                 :             : */
     878                 :             : 
     879                 :             : static void checkAbort (void);
     880                 :             : 
     881                 :             : /*
     882                 :             :    translate -
     883                 :             : */
     884                 :             : 
     885                 :             : static DynamicStrings_String translate (DynamicStrings_String m, DynamicStrings_String s, int *i, NameKey_Name name);
     886                 :             : 
     887                 :             : /*
     888                 :             :    wrapString - return a string which has been formatted with the specifier codes.
     889                 :             :                 Color is disabled.  The result string is returned.
     890                 :             : */
     891                 :             : 
     892                 :             : static DynamicStrings_String wrapString (DynamicStrings_String m, const unsigned int *sym_, unsigned int _sym_high);
     893                 :             : 
     894                 :             : 
     895                 :             : /*
     896                 :             :    pushOutput -
     897                 :             : */
     898                 :             : 
     899                 :           0 : static void pushOutput (M2MetaError_errorBlock *eb)
     900                 :             : {
     901                 :           0 :   Indexing_PutIndice (outputStack, (Indexing_HighIndice (outputStack))+1, reinterpret_cast <void *> ((*eb).out));
     902                 :           0 :   (*eb).out = DynamicStrings_InitString ((const char *) "", 0);
     903                 :           0 :   (*eb).glyph = false;
     904                 :           0 : }
     905                 :             : 
     906                 :             : 
     907                 :             : /*
     908                 :             :    readWord - reads and returns a word delimited by '}' it uses '%' as
     909                 :             :               the escape character.
     910                 :             : */
     911                 :             : 
     912                 :           0 : static DynamicStrings_String readWord (M2MetaError_errorBlock *eb)
     913                 :             : {
     914                 :           0 :   DynamicStrings_String word;
     915                 :             : 
     916                 :           0 :   word = DynamicStrings_InitString ((const char *) "", 0);
     917                 :           0 :   while (((*eb).ini < (*eb).len) && ((DynamicStrings_char ((*eb).in, (*eb).ini)) != '}'))
     918                 :             :     {
     919                 :           0 :       if ((DynamicStrings_char ((*eb).in, (*eb).ini)) == '%')
     920                 :             :         {
     921                 :           0 :           (*eb).ini += 1;
     922                 :             :         }
     923                 :           0 :       word = DynamicStrings_ConCatChar (word, DynamicStrings_char ((*eb).in, (*eb).ini));
     924                 :           0 :       (*eb).ini += 1;
     925                 :             :     }
     926                 :           0 :   return word;
     927                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
     928                 :             :   __builtin_unreachable ();
     929                 :             : }
     930                 :             : 
     931                 :             : 
     932                 :             : /*
     933                 :             :    addEntry -
     934                 :             : */
     935                 :             : 
     936                 :           0 : static void addEntry (DynamicStrings_String key, DynamicStrings_String value)
     937                 :             : {
     938                 :           0 :   M2MetaError_dictionaryEntry e;
     939                 :           0 :   DynamicStrings_String s;
     940                 :           0 :   unsigned int i;
     941                 :             : 
     942                 :           0 :   s = lookupString (key);
     943                 :           0 :   if (s == NULL)
     944                 :             :     {
     945                 :           0 :       e = newEntry ();
     946                 :           0 :       e->key = key;
     947                 :           0 :       e->value = value;
     948                 :           0 :       Indexing_PutIndice (dictionary, (Indexing_HighIndice (dictionary))+1, reinterpret_cast <void *> (e));
     949                 :             :     }
     950                 :             :   else
     951                 :             :     {
     952                 :             :       i = 1;
     953                 :           0 :       while (i <= (Indexing_HighIndice (dictionary)))
     954                 :             :         {
     955                 :           0 :           e = static_cast<M2MetaError_dictionaryEntry> (Indexing_GetIndice (dictionary, i));
     956                 :           0 :           if (DynamicStrings_Equal (e->key, key))
     957                 :             :             {
     958                 :           0 :               e->value = DynamicStrings_KillString (e->value);
     959                 :           0 :               e->value = value;
     960                 :           0 :               return;
     961                 :             :             }
     962                 :           0 :           i += 1;
     963                 :             :         }
     964                 :             :     }
     965                 :             : }
     966                 :             : 
     967                 :             : 
     968                 :             : /*
     969                 :             :    popOutput -
     970                 :             : */
     971                 :             : 
     972                 :           0 : static void popOutput (M2MetaError_errorBlock *eb)
     973                 :             : {
     974                 :           0 :   DynamicStrings_String key;
     975                 :           0 :   DynamicStrings_String previous;
     976                 :             : 
     977                 :           0 :   if ((Indexing_HighIndice (outputStack)) >= 1)
     978                 :             :     {
     979                 :           0 :       previous = static_cast<DynamicStrings_String> (Indexing_GetIndice (outputStack, Indexing_HighIndice (outputStack)));
     980                 :           0 :       Indexing_DeleteIndice (outputStack, Indexing_HighIndice (outputStack));
     981                 :           0 :       key = readWord (eb);
     982                 :           0 :       addEntry (key, (*eb).out);
     983                 :           0 :       (*eb).out = previous;
     984                 :             :     }
     985                 :           0 : }
     986                 :             : 
     987                 :             : 
     988                 :             : /*
     989                 :             :    newEntry -
     990                 :             : */
     991                 :             : 
     992                 :           0 : static M2MetaError_dictionaryEntry newEntry (void)
     993                 :             : {
     994                 :           0 :   M2MetaError_dictionaryEntry e;
     995                 :             : 
     996                 :           0 :   if (freeEntry == NULL)
     997                 :             :     {
     998                 :           0 :       Storage_ALLOCATE ((void **) &e, sizeof (M2MetaError__T2));
     999                 :             :     }
    1000                 :             :   else
    1001                 :             :     {
    1002                 :           0 :       e = freeEntry;
    1003                 :           0 :       freeEntry = freeEntry->next;
    1004                 :             :     }
    1005                 :           0 :   e->key = static_cast<DynamicStrings_String> (NULL);
    1006                 :           0 :   e->value = static_cast<DynamicStrings_String> (NULL);
    1007                 :           0 :   e->next = NULL;
    1008                 :           0 :   return e;
    1009                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1010                 :             :   __builtin_unreachable ();
    1011                 :             : }
    1012                 :             : 
    1013                 :             : 
    1014                 :             : /*
    1015                 :             :    killEntry - dispose e and delete any strings.
    1016                 :             : */
    1017                 :             : 
    1018                 :           0 : static void killEntry (M2MetaError_dictionaryEntry e)
    1019                 :             : {
    1020                 :           0 :   e->next = freeEntry;
    1021                 :           0 :   freeEntry = e;
    1022                 :           0 :   if (e->key != NULL)
    1023                 :             :     {
    1024                 :           0 :       e->key = DynamicStrings_KillString (e->key);
    1025                 :             :     }
    1026                 :           0 :   if (e->value != NULL)
    1027                 :             :     {
    1028                 :           0 :       e->value = DynamicStrings_KillString (e->value);
    1029                 :             :     }
    1030                 :           0 : }
    1031                 :             : 
    1032                 :             : 
    1033                 :             : /*
    1034                 :             :    resetDictionary - remove all entries in the dictionary.
    1035                 :             : */
    1036                 :             : 
    1037                 :           0 : static void resetDictionary (void)
    1038                 :             : {
    1039                 :           0 :   unsigned int i;
    1040                 :           0 :   M2MetaError_dictionaryEntry e;
    1041                 :             : 
    1042                 :           0 :   i = 1;
    1043                 :           0 :   while (i <= (Indexing_HighIndice (dictionary)))
    1044                 :             :     {
    1045                 :           0 :       e = static_cast<M2MetaError_dictionaryEntry> (Indexing_GetIndice (dictionary, i));
    1046                 :           0 :       killEntry (e);
    1047                 :           0 :       i += 1;
    1048                 :             :     }
    1049                 :           0 :   dictionary = Indexing_KillIndex (dictionary);
    1050                 :           0 :   dictionary = Indexing_InitIndex (1);
    1051                 :           0 : }
    1052                 :             : 
    1053                 :             : 
    1054                 :             : /*
    1055                 :             :    lookupString - lookup and return a duplicate of the string value for key s.
    1056                 :             :                   NIL is returned if the key s is unknown.
    1057                 :             : */
    1058                 :             : 
    1059                 :           0 : static DynamicStrings_String lookupString (DynamicStrings_String s)
    1060                 :             : {
    1061                 :           0 :   unsigned int i;
    1062                 :           0 :   M2MetaError_dictionaryEntry e;
    1063                 :             : 
    1064                 :           0 :   i = 1;
    1065                 :           0 :   while (i <= (Indexing_HighIndice (dictionary)))
    1066                 :             :     {
    1067                 :           0 :       e = static_cast<M2MetaError_dictionaryEntry> (Indexing_GetIndice (dictionary, i));
    1068                 :           0 :       if (DynamicStrings_Equal (e->key, s))
    1069                 :             :         {
    1070                 :           0 :           return DynamicStrings_Dup (e->value);
    1071                 :             :         }
    1072                 :           0 :       i += 1;
    1073                 :             :     }
    1074                 :             :   return static_cast<DynamicStrings_String> (NULL);
    1075                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1076                 :             :   __builtin_unreachable ();
    1077                 :             : }
    1078                 :             : 
    1079                 :             : 
    1080                 :             : /*
    1081                 :             :    lookupDefine - looks up the word in the input string (ending with '}').
    1082                 :             :                   It uses this word as a key into the dictionary and returns
    1083                 :             :                   the entry.
    1084                 :             : */
    1085                 :             : 
    1086                 :           0 : static DynamicStrings_String lookupDefine (M2MetaError_errorBlock *eb)
    1087                 :             : {
    1088                 :           0 :   DynamicStrings_String s;
    1089                 :             : 
    1090                 :           0 :   s = DynamicStrings_InitString ((const char *) "", 0);
    1091                 :           0 :   while (((*eb).ini < (*eb).len) && ((DynamicStrings_char ((*eb).in, (*eb).ini)) != '}'))
    1092                 :             :     {
    1093                 :           0 :       if ((DynamicStrings_char ((*eb).in, (*eb).ini)) == '%')
    1094                 :             :         {
    1095                 :           0 :           (*eb).ini += 1;
    1096                 :             :         }
    1097                 :           0 :       s = DynamicStrings_ConCatChar (s, DynamicStrings_char ((*eb).in, (*eb).ini));
    1098                 :           0 :       (*eb).ini += 1;
    1099                 :             :     }
    1100                 :           0 :   s = lookupString (s);
    1101                 :           0 :   if (s == NULL)
    1102                 :             :     {
    1103                 :           0 :       s = DynamicStrings_InitString ((const char *) "", 0);
    1104                 :             :     }
    1105                 :           0 :   return s;
    1106                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1107                 :             :   __builtin_unreachable ();
    1108                 :             : }
    1109                 :             : 
    1110                 :             : 
    1111                 :             : /*
    1112                 :             :    processDefine - place contents of dictionary entry name onto the output string.
    1113                 :             : */
    1114                 :             : 
    1115                 :           0 : static void processDefine (M2MetaError_errorBlock *eb)
    1116                 :             : {
    1117                 :           0 :   (*eb).out = DynamicStrings_ConCat ((*eb).out, lookupDefine (eb));
    1118                 :           0 : }
    1119                 :             : 
    1120                 :             : 
    1121                 :             : /*
    1122                 :             :    lookupColor - looks up the color enum from the string.
    1123                 :             : */
    1124                 :             : 
    1125                 :           0 : static M2MetaError_colorType lookupColor (DynamicStrings_String s)
    1126                 :             : {
    1127                 :           0 :   if (DynamicStrings_EqualArray (s, (const char *) "filename", 8))
    1128                 :             :     {
    1129                 :             :       return M2MetaError_filenameColor;
    1130                 :             :     }
    1131                 :           0 :   else if (DynamicStrings_EqualArray (s, (const char *) "quote", 5))
    1132                 :             :     {
    1133                 :             :       /* avoid dangling else.  */
    1134                 :             :       return M2MetaError_quoteColor;
    1135                 :             :     }
    1136                 :           0 :   else if (DynamicStrings_EqualArray (s, (const char *) "error", 5))
    1137                 :             :     {
    1138                 :             :       /* avoid dangling else.  */
    1139                 :             :       return M2MetaError_errorColor;
    1140                 :             :     }
    1141                 :           0 :   else if (DynamicStrings_EqualArray (s, (const char *) "warning", 7))
    1142                 :             :     {
    1143                 :             :       /* avoid dangling else.  */
    1144                 :             :       return M2MetaError_warningColor;
    1145                 :             :     }
    1146                 :           0 :   else if (DynamicStrings_EqualArray (s, (const char *) "note", 4))
    1147                 :             :     {
    1148                 :             :       /* avoid dangling else.  */
    1149                 :             :       return M2MetaError_warningColor;
    1150                 :             :     }
    1151                 :           0 :   else if (DynamicStrings_EqualArray (s, (const char *) "locus", 5))
    1152                 :             :     {
    1153                 :             :       /* avoid dangling else.  */
    1154                 :             :       return M2MetaError_locusColor;
    1155                 :             :     }
    1156                 :           0 :   else if (DynamicStrings_EqualArray (s, (const char *) "insert", 6))
    1157                 :             :     {
    1158                 :             :       /* avoid dangling else.  */
    1159                 :             :       return M2MetaError_insertColor;
    1160                 :             :     }
    1161                 :           0 :   else if (DynamicStrings_EqualArray (s, (const char *) "delete", 6))
    1162                 :             :     {
    1163                 :             :       /* avoid dangling else.  */
    1164                 :             :       return M2MetaError_deleteColor;
    1165                 :             :     }
    1166                 :           0 :   else if (DynamicStrings_EqualArray (s, (const char *) "type", 4))
    1167                 :             :     {
    1168                 :             :       /* avoid dangling else.  */
    1169                 :             :       return M2MetaError_typeColor;
    1170                 :             :     }
    1171                 :           0 :   else if (DynamicStrings_EqualArray (s, (const char *) "range1", 6))
    1172                 :             :     {
    1173                 :             :       /* avoid dangling else.  */
    1174                 :             :       return M2MetaError_range1Color;
    1175                 :             :     }
    1176                 :           0 :   else if (DynamicStrings_EqualArray (s, (const char *) "range2", 6))
    1177                 :             :     {
    1178                 :             :       /* avoid dangling else.  */
    1179                 :           0 :       return M2MetaError_range2Color;
    1180                 :             :     }
    1181                 :             :   return M2MetaError_noColor;
    1182                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1183                 :             :   __builtin_unreachable ();
    1184                 :             : }
    1185                 :             : 
    1186                 :             : 
    1187                 :             : /*
    1188                 :             :    readColor -
    1189                 :             : */
    1190                 :             : 
    1191                 :           0 : static M2MetaError_colorType readColor (M2MetaError_errorBlock *eb)
    1192                 :             : {
    1193                 :           0 :   DynamicStrings_String s;
    1194                 :           0 :   M2MetaError_colorType c;
    1195                 :             : 
    1196                 :           0 :   s = DynamicStrings_InitString ((const char *) "", 0);
    1197                 :           0 :   while (((*eb).ini < (*eb).len) && ((DynamicStrings_char ((*eb).in, (*eb).ini)) != '}'))
    1198                 :             :     {
    1199                 :           0 :       if ((DynamicStrings_char ((*eb).in, (*eb).ini)) == '%')
    1200                 :             :         {
    1201                 :           0 :           (*eb).ini += 1;
    1202                 :             :         }
    1203                 :           0 :       s = DynamicStrings_ConCatChar (s, DynamicStrings_char ((*eb).in, (*eb).ini));
    1204                 :           0 :       (*eb).ini += 1;
    1205                 :             :     }
    1206                 :           0 :   c = lookupColor (s);
    1207                 :           0 :   s = DynamicStrings_KillString (s);
    1208                 :           0 :   return c;
    1209                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1210                 :             :   __builtin_unreachable ();
    1211                 :             : }
    1212                 :             : 
    1213                 :             : 
    1214                 :             : /*
    1215                 :             :    keyword - copy characters until the '}' in the input string and convert them to
    1216                 :             :              the keyword color/font.
    1217                 :             : */
    1218                 :             : 
    1219                 :        1172 : static void keyword (M2MetaError_errorBlock *eb)
    1220                 :             : {
    1221                 :        1172 :   if (TOUPPER (DynamicStrings_char ((*eb).in, (*eb).ini)) == 'K')
    1222                 :             :     {
    1223                 :        1172 :       (*eb).ini += 1;
    1224                 :        1172 :       pushColor (eb);
    1225                 :        1172 :       changeColor (eb, M2MetaError_keywordColor);
    1226                 :        6236 :       while (((*eb).ini < (*eb).len) && ((DynamicStrings_char ((*eb).in, (*eb).ini)) != '}'))
    1227                 :             :         {
    1228                 :        5064 :           if (Debugging)
    1229                 :             :             {
    1230                 :             :               dump ((*eb));
    1231                 :             :             }
    1232                 :        5064 :           if ((DynamicStrings_char ((*eb).in, (*eb).ini)) == '%')
    1233                 :             :             {
    1234                 :          12 :               (*eb).ini += 1;
    1235                 :             :             }
    1236                 :        5064 :           copyKeywordChar (eb);
    1237                 :        5064 :           (*eb).ini += 1;
    1238                 :             :         }
    1239                 :        1172 :       popColor (eb);
    1240                 :             :     }
    1241                 :             :   else
    1242                 :             :     {
    1243                 :           0 :       M2Error_InternalError ((const char *) "expecting index to be on the K for keyword", 42);
    1244                 :             :     }
    1245                 :        1172 : }
    1246                 :             : 
    1247                 :             : 
    1248                 :             : /*
    1249                 :             :    filename - copy characters until the '}' in the input string and convert them to
    1250                 :             :               the filename color/font.
    1251                 :             : */
    1252                 :             : 
    1253                 :           0 : static void filename (M2MetaError_errorBlock *eb)
    1254                 :             : {
    1255                 :           0 :   if (TOUPPER (DynamicStrings_char ((*eb).in, (*eb).ini)) == 'F')
    1256                 :             :     {
    1257                 :           0 :       (*eb).ini += 1;
    1258                 :           0 :       pushColor (eb);
    1259                 :           0 :       changeColor (eb, M2MetaError_filenameColor);
    1260                 :           0 :       while (((*eb).ini < (*eb).len) && ((DynamicStrings_char ((*eb).in, (*eb).ini)) != '}'))
    1261                 :             :         {
    1262                 :           0 :           if (Debugging)
    1263                 :             :             {
    1264                 :             :               dump ((*eb));
    1265                 :             :             }
    1266                 :           0 :           if ((DynamicStrings_char ((*eb).in, (*eb).ini)) == '%')
    1267                 :             :             {
    1268                 :           0 :               (*eb).ini += 1;
    1269                 :             :             }
    1270                 :           0 :           copyChar (eb);
    1271                 :           0 :           (*eb).ini += 1;
    1272                 :             :         }
    1273                 :           0 :       popColor (eb);
    1274                 :             :     }
    1275                 :             :   else
    1276                 :             :     {
    1277                 :           0 :       M2Error_InternalError ((const char *) "expecting index to be on the F for filename", 43);
    1278                 :             :     }
    1279                 :           0 : }
    1280                 :             : 
    1281                 :             : 
    1282                 :             : /*
    1283                 :             :    pushColor -
    1284                 :             : */
    1285                 :             : 
    1286                 :       52388 : static void pushColor (M2MetaError_errorBlock *eb)
    1287                 :             : {
    1288                 :       52388 :   if ((*eb).stackPtr > MaxStack)
    1289                 :             :     {
    1290                 :           0 :       M2RTS_HALT (-1);
    1291                 :             :       __builtin_unreachable ();
    1292                 :             :     }
    1293                 :             :   else
    1294                 :             :     {
    1295                 :       52388 :       (*eb).colorStack.array[(*eb).stackPtr] = (*eb).currentCol;
    1296                 :       52388 :       (*eb).stackPtr += 1;
    1297                 :             :     }
    1298                 :       52388 : }
    1299                 :             : 
    1300                 :             : 
    1301                 :             : /*
    1302                 :             :    popColor -
    1303                 :             : */
    1304                 :             : 
    1305                 :       13440 : static void popColor (M2MetaError_errorBlock *eb)
    1306                 :             : {
    1307                 :       13440 :   if ((*eb).stackPtr > 0)
    1308                 :             :     {
    1309                 :       13440 :       (*eb).stackPtr -= 1;
    1310                 :             :     }
    1311                 :             :   else
    1312                 :             :     {
    1313                 :           0 :       M2RTS_HALT (-1);
    1314                 :             :       __builtin_unreachable ();
    1315                 :             :     }
    1316                 :       13440 :   (*eb).currentCol = (*eb).colorStack.array[(*eb).stackPtr];
    1317                 :       13440 :   if ((*eb).currentCol == M2MetaError_unsetColor)
    1318                 :             :     {
    1319                 :           0 :       (*eb).currentCol = M2MetaError_noColor;
    1320                 :             :     }
    1321                 :       13440 : }
    1322                 :             : 
    1323                 :             : 
    1324                 :             : /*
    1325                 :             :    initErrorBlock - initialise an error block with the, input, string.
    1326                 :             : */
    1327                 :             : 
    1328                 :       16545 : static void initErrorBlock (M2MetaError_errorBlock *eb, DynamicStrings_String input, const unsigned int *sym_, unsigned int _sym_high)
    1329                 :             : {
    1330                 :       16545 :   unsigned int sym[_sym_high+1];
    1331                 :             : 
    1332                 :             :   /* make a local copy of each unbounded array.  */
    1333                 :       16545 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    1334                 :             : 
    1335                 :       16545 :   (*eb).useError = true;
    1336                 :       16545 :   (*eb).e = static_cast<M2Error_Error> (NULL);
    1337                 :       16545 :   (*eb).type = M2MetaError_error;  /* Default to the error color.  */
    1338                 :       33090 :   (*eb).out = DynamicStrings_InitString ((const char *) "", 0);  /* Default to the error color.  */
    1339                 :       16545 :   (*eb).in = input;
    1340                 :       16545 :   (*eb).highplus1 = _sym_high+1;
    1341                 :       16545 :   (*eb).len = DynamicStrings_Length (input);
    1342                 :       16545 :   (*eb).ini = 0;
    1343                 :       16545 :   (*eb).glyph = false;  /* Nothing to output yet.  */
    1344                 :       16545 :   (*eb).vowel = false;  /* Check for a vowel when outputing string?  */
    1345                 :       16545 :   (*eb).importHint = false;  /* Check for a vowel when outputing string?  */
    1346                 :       16545 :   (*eb).exportHint = false;
    1347                 :       16545 :   (*eb).withStackHint = false;
    1348                 :       16545 :   (*eb).quotes = true;
    1349                 :       16545 :   (*eb).positive = true;
    1350                 :       16545 :   (*eb).root = false;
    1351                 :       16545 :   (*eb).chain = false;
    1352                 :       16545 :   (*eb).currentCol = findColorType (input);
    1353                 :       16545 :   (*eb).beginCol = M2MetaError_unsetColor;
    1354                 :       16545 :   (*eb).endCol = M2MetaError_unsetColor;
    1355                 :       16545 :   (*eb).stackPtr = 0;
    1356                 :       16545 : }
    1357                 :             : 
    1358                 :             : 
    1359                 :             : /*
    1360                 :             :    push - performs a push from the oldblock to the newblock.
    1361                 :             :           It copies all fields except the output string.
    1362                 :             : */
    1363                 :             : 
    1364                 :       41938 : static void push (M2MetaError_errorBlock *newblock, M2MetaError_errorBlock oldblock)
    1365                 :             : {
    1366                 :       41938 :   pushColor (&oldblock);  /* save the current color.  */
    1367                 :       41938 :   (*newblock) = oldblock;  /* copy all the fields.  */
    1368                 :       41938 :   (*newblock).out = static_cast<DynamicStrings_String> (NULL);  /* must do this before a clear as we have copied the address.  */
    1369                 :       41938 :   clear (newblock);  /* must do this before a clear as we have copied the address.  */
    1370                 :       41938 :   (*newblock).quotes = true;
    1371                 :       41938 : }
    1372                 :             : 
    1373                 :             : 
    1374                 :             : /*
    1375                 :             :    pop - copies contents of fromblock into toblock.  It only copies the error
    1376                 :             :          handle if the toblock.e is NIL.
    1377                 :             : */
    1378                 :             : 
    1379                 :       41938 : static void pop (M2MetaError_errorBlock *toblock, M2MetaError_errorBlock *fromblock)
    1380                 :             : {
    1381                 :       41938 :   M2MetaError_colorType c;
    1382                 :             : 
    1383                 :       41938 :   checkVowel (toblock, (*fromblock));
    1384                 :       41938 :   if (empty (fromblock))
    1385                 :             :     {
    1386                 :        2990 :       (*toblock).stackPtr = (*fromblock).stackPtr;
    1387                 :        2990 :       (*toblock).colorStack = (*fromblock).colorStack;
    1388                 :        2990 :       popColor (toblock);  /* Lastly restore the color from the push start.  */
    1389                 :             :     }
    1390                 :             :   else
    1391                 :             :     {
    1392                 :       38948 :       if ((*fromblock).quotes)
    1393                 :             :         {
    1394                 :             :           /* The string needs to be quoted.  */
    1395                 :       29670 :           if ((*toblock).currentCol == M2MetaError_unsetColor)
    1396                 :             :             {
    1397                 :             :               /* The caller has not yet assigned a color, so use the callee color at the end.  */
    1398                 :           0 :               OutOpenQuote (toblock);
    1399                 :           0 :               OutGlyphS (toblock, (*fromblock).out);
    1400                 :           0 :               OutCloseQuote (toblock);
    1401                 :           0 :               changeColor (toblock, (*fromblock).currentCol);
    1402                 :             :             }
    1403                 :             :           else
    1404                 :             :             {
    1405                 :       29670 :               shutdownColor (fromblock);
    1406                 :             :               /* The caller has assigned a color, so use it after the new string.  */
    1407                 :       29670 :               c = (*toblock).currentCol;
    1408                 :       29670 :               OutOpenQuote (toblock);
    1409                 :       29670 :               OutGlyphS (toblock, (*fromblock).out);
    1410                 :       29670 :               OutCloseQuote (toblock);
    1411                 :       29670 :               (*toblock).currentCol = c;
    1412                 :             :             }
    1413                 :             :         }
    1414                 :             :       else
    1415                 :             :         {
    1416                 :        9278 :           if ((*toblock).currentCol == M2MetaError_unsetColor)
    1417                 :             :             {
    1418                 :           0 :               JoinSentances (toblock, (*fromblock).out);
    1419                 :           0 :               (*toblock).endCol = (*fromblock).endCol;
    1420                 :           0 :               changeColor (toblock, (*fromblock).endCol);
    1421                 :             :             }
    1422                 :             :           else
    1423                 :             :             {
    1424                 :        9278 :               pushColor (toblock);
    1425                 :        9278 :               JoinSentances (toblock, (*fromblock).out);
    1426                 :        9278 :               (*toblock).endCol = (*fromblock).endCol;
    1427                 :        9278 :               popColor (toblock);
    1428                 :             :             }
    1429                 :             :         }
    1430                 :             :     }
    1431                 :       41938 :   if ((*toblock).e == NULL)
    1432                 :             :     {
    1433                 :       41632 :       (*toblock).e = (*fromblock).e;
    1434                 :             :     }
    1435                 :       41938 :   (*toblock).chain = (*fromblock).chain;
    1436                 :       41938 :   (*toblock).root = (*fromblock).root;
    1437                 :       41938 :   (*toblock).ini = (*fromblock).ini;
    1438                 :       41938 :   (*toblock).type = (*fromblock).type;  /* It might have been changed by the callee.  */
    1439                 :       41938 : }
    1440                 :             : 
    1441                 :             : 
    1442                 :             : /*
    1443                 :             :    OutOpenQuote -
    1444                 :             : */
    1445                 :             : 
    1446                 :       29670 : static void OutOpenQuote (M2MetaError_errorBlock *eb)
    1447                 :             : {
    1448                 :       29670 :   (*eb).currentCol = M2MetaError_noColor;
    1449                 :       29670 :   flushColor (eb);
    1450                 :       59340 :   (*eb).out = DynamicStrings_ConCat ((*eb).out, openQuote (DynamicStrings_InitString ((const char *) "", 0)));
    1451                 :       29670 : }
    1452                 :             : 
    1453                 :             : 
    1454                 :             : /*
    1455                 :             :    OutCloseQuote -
    1456                 :             : */
    1457                 :             : 
    1458                 :       29670 : static void OutCloseQuote (M2MetaError_errorBlock *eb)
    1459                 :             : {
    1460                 :       59340 :   (*eb).out = DynamicStrings_ConCat ((*eb).out, closeQuote (DynamicStrings_InitString ((const char *) "", 0)));
    1461                 :       29670 :   (*eb).currentCol = M2MetaError_noColor;
    1462                 :       29670 :   (*eb).endCol = M2MetaError_noColor;
    1463                 :       29670 : }
    1464                 :             : 
    1465                 :             : 
    1466                 :             : /*
    1467                 :             :    findColorType - return the color of the string.  This is determined by the first
    1468                 :             :                    occurrance of an error, warning or note marker.  An error message
    1469                 :             :                    is assumed to either be: a keyword category, error category, note
    1470                 :             :                    category, warning category or to be chained from a previous error.
    1471                 :             : */
    1472                 :             : 
    1473                 :       16587 : static M2MetaError_colorType findColorType (DynamicStrings_String s)
    1474                 :             : {
    1475                 :       16587 :   unsigned int i;
    1476                 :             : 
    1477                 :       16587 :   i = 0;
    1478                 :      749957 :   while (i < (DynamicStrings_Length (s)))
    1479                 :             :     {
    1480                 :      746571 :       if ((DynamicStrings_char (s, static_cast<int> (i))) == '{')
    1481                 :             :         {
    1482                 :       19685 :           i += 1;
    1483                 :       19685 :           if ((DynamicStrings_char (s, static_cast<int> (i))) == '%')
    1484                 :             :             {
    1485                 :       19685 :               i += 1;
    1486                 :       57226 :               while ((i < (DynamicStrings_Length (s))) && ((DynamicStrings_char (s, static_cast<int> (i))) != '}'))
    1487                 :             :                 {
    1488                 :       50742 :                   if ((DynamicStrings_char (s, static_cast<int> (i))) == '%')
    1489                 :             :                     {
    1490                 :          66 :                       i += 1;
    1491                 :             :                     }
    1492                 :       50742 :                   switch (DynamicStrings_char (s, static_cast<int> (i)))
    1493                 :             :                     {
    1494                 :             :                       case 'K':
    1495                 :             :                         return M2MetaError_errorColor;  /* keyword errors start with the fatal error color.  */
    1496                 :             :                         break;
    1497                 :             : 
    1498                 :             :                       case 'E':
    1499                 :             :                         return M2MetaError_errorColor;  /* keyword errors start with the fatal error color.  */
    1500                 :             :                         break;
    1501                 :             : 
    1502                 :             :                       case 'A':
    1503                 :             :                         return M2MetaError_errorColor;
    1504                 :             :                         break;
    1505                 :             : 
    1506                 :             :                       case 'O':
    1507                 :             :                         return M2MetaError_noteColor;
    1508                 :       11020 :                         break;
    1509                 :             : 
    1510                 :       11020 :                       case 'W':
    1511                 :       11020 :                         return M2MetaError_warningColor;
    1512                 :         186 :                         break;
    1513                 :             : 
    1514                 :         186 :                       case 'C':
    1515                 :         186 :                         return lastColor;
    1516                 :       37541 :                         break;
    1517                 :             : 
    1518                 :             : 
    1519                 :       37541 :                       default:
    1520                 :       37541 :                         break;
    1521                 :             :                     }
    1522                 :       37541 :                   i += 1;
    1523                 :             :                 }
    1524                 :             :             }
    1525                 :             :         }
    1526                 :      733370 :       i += 1;
    1527                 :             :     }
    1528                 :             :   return M2MetaError_errorColor;  /* default to the error color.  */
    1529                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1530                 :             :   __builtin_unreachable ();
    1531                 :             : }
    1532                 :             : 
    1533                 :             : 
    1534                 :             : /*
    1535                 :             :    killErrorBlock - deallocates the dynamic strings associated with the error block.
    1536                 :             : */
    1537                 :             : 
    1538                 :       16545 : static void killErrorBlock (M2MetaError_errorBlock *eb)
    1539                 :             : {
    1540                 :       16545 :   (*eb).out = DynamicStrings_KillString ((*eb).out);
    1541                 :       16545 :   (*eb).in = DynamicStrings_KillString ((*eb).in);
    1542                 :       16545 : }
    1543                 :             : 
    1544                 :             : 
    1545                 :             : /*
    1546                 :             :    InternalFormat - produces an informative internal error.
    1547                 :             : */
    1548                 :             : 
    1549                 :           0 : static void InternalFormat (M2MetaError_errorBlock eb, const char *m_, unsigned int _m_high, unsigned int line)
    1550                 :             : {
    1551                 :           0 :   char m[_m_high+1];
    1552                 :             : 
    1553                 :             :   /* make a local copy of each unbounded array.  */
    1554                 :           0 :   memcpy (m, m_, _m_high+1);
    1555                 :             : 
    1556                 :           0 :   M2Printf_printf1 ((const char *) "M2MetaError.mod:%d:internalformat error detected\\n", 50, (const unsigned char *) &line, (sizeof (line)-1));
    1557                 :           0 :   dump (eb);
    1558                 :           0 :   M2Error_InternalError ((const char *) m, _m_high);
    1559                 :           0 : }
    1560                 :             : 
    1561                 :             : 
    1562                 :             : /*
    1563                 :             :    x - checks to see that a=b.
    1564                 :             : */
    1565                 :             : 
    1566                 :     1517567 : static DynamicStrings_String x (DynamicStrings_String a, DynamicStrings_String b)
    1567                 :             : {
    1568                 :           0 :   if (a != b)
    1569                 :             :     {
    1570                 :           0 :       M2Error_InternalError ((const char *) "different string returned", 25);
    1571                 :             :     }
    1572                 :           0 :   return a;
    1573                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1574                 :             :   __builtin_unreachable ();
    1575                 :             : }
    1576                 :             : 
    1577                 :             : 
    1578                 :             : /*
    1579                 :             :    IsWhite - returns TRUE if, ch, is a space.
    1580                 :             : */
    1581                 :             : 
    1582                 :           0 : static bool IsWhite (char ch)
    1583                 :             : {
    1584                 :           0 :   return ch == ' ';
    1585                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1586                 :             :   __builtin_unreachable ();
    1587                 :             : }
    1588                 :             : 
    1589                 :             : 
    1590                 :             : /*
    1591                 :             :    skip - skips over this level input until the next '}'.
    1592                 :             : */
    1593                 :             : 
    1594                 :        1226 : static void skip (M2MetaError_errorBlock *sb)
    1595                 :             : {
    1596                 :        1226 :   int level;
    1597                 :             : 
    1598                 :        1226 :   level = 0;
    1599                 :       20828 :   while ((*sb).ini < (*sb).len)
    1600                 :             :     {
    1601                 :       20828 :       if ((level == 0) && ((DynamicStrings_char ((*sb).in, (*sb).ini)) == '}'))
    1602                 :             :         {
    1603                 :             :           return;
    1604                 :             :         }
    1605                 :       19602 :       if ((DynamicStrings_char ((*sb).in, (*sb).ini)) == '}')
    1606                 :             :         {
    1607                 :        3036 :           level -= 1;
    1608                 :             :         }
    1609                 :       16566 :       else if ((DynamicStrings_char ((*sb).in, (*sb).ini)) == '{')
    1610                 :             :         {
    1611                 :             :           /* avoid dangling else.  */
    1612                 :        3036 :           level += 1;
    1613                 :             :         }
    1614                 :       19602 :       (*sb).ini += 1;
    1615                 :             :     }
    1616                 :             : }
    1617                 :             : 
    1618                 :             : 
    1619                 :             : /*
    1620                 :             :    ifNonNulThen := [ ':' ebnf ] =:
    1621                 :             : */
    1622                 :             : 
    1623                 :        6830 : static void ifNonNulThen (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high)
    1624                 :             : {
    1625                 :        6830 :   unsigned int sym[_sym_high+1];
    1626                 :             : 
    1627                 :             :   /* make a local copy of each unbounded array.  */
    1628                 :        6830 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    1629                 :             : 
    1630                 :        6830 :   if ((DynamicStrings_char ((*eb).in, (*eb).ini)) == ':')
    1631                 :             :     {
    1632                 :        6830 :       (*eb).ini += 1;
    1633                 :        6830 :       if ((*eb).positive)
    1634                 :             :         {
    1635                 :             :           /* avoid dangling else.  */
    1636                 :        1100 :           if ((empty (eb)) && ((DynamicStrings_Length ((*eb).out)) != 0))
    1637                 :             :             {
    1638                 :           0 :               M2Printf_printf0 ((const char *) "inconsistency found\\n", 21);
    1639                 :           0 :               dump ((*eb));
    1640                 :             :             }
    1641                 :        6704 :           if (empty (eb))
    1642                 :             :             {
    1643                 :        1100 :               if (Debugging)
    1644                 :             :                 {
    1645                 :             :                   M2Printf_printf0 ((const char *) "empty expression, skip\\n", 24);
    1646                 :             :                 }
    1647                 :        1100 :               clear (eb);
    1648                 :             :               /* skip over this level of input text.  */
    1649                 :        1100 :               skip (eb);
    1650                 :             :             }
    1651                 :             :           else
    1652                 :             :             {
    1653                 :        5604 :               if (Debugging)
    1654                 :             :                 {
    1655                 :             :                   dump ((*eb));
    1656                 :             :                   M2Printf_printf0 ((const char *) "non empty expression, clear and continue\\n", 42);
    1657                 :             :                 }
    1658                 :        5604 :               clear (eb);
    1659                 :        5604 :               if (Debugging)
    1660                 :             :                 {
    1661                 :             :                   dump ((*eb));
    1662                 :             :                   M2Printf_printf0 ((const char *) "cleared, continue\\n", 19);
    1663                 :             :                   dump ((*eb));
    1664                 :             :                 }
    1665                 :             :               /* carry on processing input text.  */
    1666                 :        5604 :               ebnf (eb, (const unsigned int *) sym, _sym_high);
    1667                 :        5604 :               if (Debugging)
    1668                 :             :                 {
    1669                 :             :                   M2Printf_printf0 ((const char *) "evaluated\\n", 11);
    1670                 :             :                   dump ((*eb));
    1671                 :             :                 }
    1672                 :             :             }
    1673                 :             :         }
    1674                 :             :       else
    1675                 :             :         {
    1676                 :         126 :           if (empty (eb))
    1677                 :             :             {
    1678                 :           0 :               clear (eb);
    1679                 :             :               /* carry on processing input text.  */
    1680                 :           0 :               ebnf (eb, (const unsigned int *) sym, _sym_high);
    1681                 :             :             }
    1682                 :             :           else
    1683                 :             :             {
    1684                 :         126 :               clear (eb);
    1685                 :             :               /* skip over this level of input text.  */
    1686                 :         126 :               skip (eb);
    1687                 :             :             }
    1688                 :             :         }
    1689                 :        6830 :       if (((*eb).ini < (*eb).len) && ((DynamicStrings_char ((*eb).in, (*eb).ini)) != '}'))
    1690                 :             :         {
    1691                 :           0 :           InternalFormat ((*eb), (const char *) "expecting to see }", 18, 863);
    1692                 :             :         }
    1693                 :             :     }
    1694                 :        6830 : }
    1695                 :             : 
    1696                 :             : 
    1697                 :             : /*
    1698                 :             :    doNumber -
    1699                 :             : */
    1700                 :             : 
    1701                 :           0 : static void doNumber (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol)
    1702                 :             : {
    1703                 :           0 :   unsigned int sym[_sym_high+1];
    1704                 :             : 
    1705                 :             :   /* make a local copy of each unbounded array.  */
    1706                 :           0 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    1707                 :             : 
    1708                 :           0 :   if (empty (eb))
    1709                 :             :     {
    1710                 :           0 :       (*eb).quotes = false;
    1711                 :           0 :       OutGlyphS (eb, StringConvert_ctos (sym[bol], 0, ' '));
    1712                 :             :     }
    1713                 :           0 : }
    1714                 :             : 
    1715                 :             : 
    1716                 :             : /*
    1717                 :             :    doCount -
    1718                 :             : */
    1719                 :             : 
    1720                 :        2136 : static void doCount (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol)
    1721                 :             : {
    1722                 :        2136 :   unsigned int sym[_sym_high+1];
    1723                 :             : 
    1724                 :             :   /* make a local copy of each unbounded array.  */
    1725                 :        2136 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    1726                 :             : 
    1727                 :        2136 :   if (empty (eb))
    1728                 :             :     {
    1729                 :        2136 :       (*eb).quotes = false;
    1730                 :        2136 :       OutGlyphS (eb, StringConvert_ctos (sym[bol], 0, ' '));
    1731                 :        2136 :       if (((sym[bol] % 100) >= 11) && ((sym[bol] % 100) <= 13))
    1732                 :             :         {
    1733                 :           0 :           OutGlyphS (eb, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "th", 2)));
    1734                 :             :         }
    1735                 :             : 
    1736                 :             :       else {
    1737                 :        2136 :         switch (sym[bol] % 10)
    1738                 :             :           {
    1739                 :        1728 :             case 1:
    1740                 :        1728 :               OutGlyphS (eb, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "st", 2)));
    1741                 :        1728 :               break;
    1742                 :             : 
    1743                 :         348 :             case 2:
    1744                 :         348 :               OutGlyphS (eb, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "nd", 2)));
    1745                 :         348 :               break;
    1746                 :             : 
    1747                 :          24 :             case 3:
    1748                 :          24 :               OutGlyphS (eb, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "rd", 2)));
    1749                 :          24 :               break;
    1750                 :             : 
    1751                 :             : 
    1752                 :          36 :             default:
    1753                 :          36 :               OutGlyphS (eb, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "th", 2)));
    1754                 :          36 :               break;
    1755                 :             :           }
    1756                 :             :       }
    1757                 :             :     }
    1758                 :        4272 : }
    1759                 :             : 
    1760                 :             : 
    1761                 :             : /*
    1762                 :             :    doCount -
    1763                 :             : */
    1764                 :             : 
    1765                 :       34896 : static void doAscii (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol)
    1766                 :             : {
    1767                 :       34896 :   unsigned int sym[_sym_high+1];
    1768                 :             : 
    1769                 :             :   /* make a local copy of each unbounded array.  */
    1770                 :       34896 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    1771                 :             : 
    1772                 :       34854 :   if ((((sym[bol] == SymbolTable_NulSym) || (! (empty (eb)))) || (SymbolTable_IsTemporary (sym[bol]))) || (SymbolTable_IsNameAnonymous (sym[bol])))
    1773                 :             :     {
    1774                 :         156 :       return;
    1775                 :             :     }
    1776                 :             :   else
    1777                 :             :     {
    1778                 :       34740 :       OutGlyphS (eb, DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (SymbolTable_GetSymName (sym[bol]))));
    1779                 :             :     }
    1780                 :       34896 : }
    1781                 :             : 
    1782                 :             : 
    1783                 :             : /*
    1784                 :             :    unquotedKeyword -
    1785                 :             : */
    1786                 :             : 
    1787                 :         626 : static void unquotedKeyword (M2MetaError_errorBlock *eb)
    1788                 :             : {
    1789                 :         626 :   (*eb).quotes = false;
    1790                 :           0 :   keyword (eb);
    1791                 :           0 : }
    1792                 :             : 
    1793                 :             : 
    1794                 :             : /*
    1795                 :             :    OutArray -
    1796                 :             : */
    1797                 :             : 
    1798                 :          78 : static void OutArray (M2MetaError_errorBlock *eb, const char *a_, unsigned int _a_high)
    1799                 :             : {
    1800                 :          78 :   char a[_a_high+1];
    1801                 :             : 
    1802                 :             :   /* make a local copy of each unbounded array.  */
    1803                 :          78 :   memcpy (a, a_, _a_high+1);
    1804                 :             : 
    1805                 :          78 :   OutGlyphS (eb, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) a, _a_high)));
    1806                 :          78 : }
    1807                 :             : 
    1808                 :             : 
    1809                 :             : /*
    1810                 :             :    OutGlyphS - outputs a string of glyphs.
    1811                 :             : */
    1812                 :             : 
    1813                 :       69858 : static void OutGlyphS (M2MetaError_errorBlock *eb, DynamicStrings_String s)
    1814                 :             : {
    1815                 :       69858 :   if ((DynamicStrings_Length (s)) > 0)
    1816                 :             :     {
    1817                 :       69858 :       flushColor (eb);
    1818                 :       69858 :       checkMe ();
    1819                 :       69858 :       (*eb).glyph = true;
    1820                 :       69858 :       (*eb).out = DynamicStrings_ConCat ((*eb).out, s);
    1821                 :             :     }
    1822                 :       69858 : }
    1823                 :             : 
    1824                 :             : 
    1825                 :             : /*
    1826                 :             :    empty - returns TRUE if the output string is empty.
    1827                 :             :            It ignores color changes.
    1828                 :             : */
    1829                 :             : 
    1830                 :      155556 : static bool empty (M2MetaError_errorBlock *eb)
    1831                 :             : {
    1832                 :       86858 :   return ! (*eb).glyph;
    1833                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1834                 :             :   __builtin_unreachable ();
    1835                 :             : }
    1836                 :             : 
    1837                 :             : 
    1838                 :             : /*
    1839                 :             :    checkVowel - checks to see if the from block word starts with
    1840                 :             :                 a vowel and if so adds an n to the to block output.
    1841                 :             : */
    1842                 :             : 
    1843                 :       41938 : static void checkVowel (M2MetaError_errorBlock *to, M2MetaError_errorBlock from)
    1844                 :             : {
    1845                 :       41938 :   if (from.vowel && (! (empty (&from))))
    1846                 :             :     {
    1847                 :         180 :       if (isVowel (DynamicStrings_char (from.out, 0)))
    1848                 :             :         {
    1849                 :          24 :           if ((DynamicStrings_Length ((*to).out)) > 0)
    1850                 :             :             {
    1851                 :          24 :               (*to).out = DynamicStrings_RemoveWhitePostfix (DynamicStrings_Mark ((*to).out));
    1852                 :          24 :               (*to).out = DynamicStrings_ConCat ((*to).out, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "n ", 2)));
    1853                 :          24 :               from.vowel = false;
    1854                 :             :             }
    1855                 :             :         }
    1856                 :             :     }
    1857                 :       41938 : }
    1858                 :             : 
    1859                 :             : 
    1860                 :             : /*
    1861                 :             :    isVowel - returns TRUE if ch is a, e, i, o or u.
    1862                 :             : */
    1863                 :             : 
    1864                 :         180 : static bool isVowel (char ch)
    1865                 :             : {
    1866                 :         180 :   return ((((ch == 'a') || (ch == 'e')) || (ch == 'i')) || (ch == 'o')) || (ch == 'u');
    1867                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    1868                 :             :   __builtin_unreachable ();
    1869                 :             : }
    1870                 :             : 
    1871                 :             : 
    1872                 :             : /*
    1873                 :             :    clear - remove the output string.
    1874                 :             : */
    1875                 :             : 
    1876                 :       48768 : static void clear (M2MetaError_errorBlock *eb)
    1877                 :             : {
    1878                 :       48768 :   (*eb).out = DynamicStrings_KillString ((*eb).out);
    1879                 :       48768 :   (*eb).out = DynamicStrings_InitString ((const char *) "", 0);
    1880                 :       48768 :   (*eb).glyph = false;
    1881                 :       48768 :   (*eb).beginCol = M2MetaError_unsetColor;
    1882                 :       48768 :   (*eb).quotes = false;
    1883                 :       48768 : }
    1884                 :             : 
    1885                 :             : 
    1886                 :             : /*
    1887                 :             :    clear - remove the output string.
    1888                 :             : */
    1889                 :             : 
    1890                 :       28630 : static void doName (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol)
    1891                 :             : {
    1892                 :       28630 :   unsigned int sym[_sym_high+1];
    1893                 :             : 
    1894                 :             :   /* make a local copy of each unbounded array.  */
    1895                 :       28630 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    1896                 :             : 
    1897                 :       23110 :   if ((((! (empty (eb))) || (sym[bol] == SymbolTable_NulSym)) || (SymbolTable_IsTemporary (sym[bol]))) || (SymbolTable_IsNameAnonymous (sym[bol])))
    1898                 :             :     {
    1899                 :        8390 :       return;
    1900                 :             :     }
    1901                 :             :   else
    1902                 :             :     {
    1903                 :       20240 :       if (sym[bol] == M2Base_ZType)
    1904                 :             :         {
    1905                 :          60 :           (*eb).quotes = false;
    1906                 :          60 :           OutArray (eb, (const char *) "the ZType", 9);
    1907                 :             :         }
    1908                 :       20180 :       else if (sym[bol] == M2Base_RType)
    1909                 :             :         {
    1910                 :             :           /* avoid dangling else.  */
    1911                 :          18 :           (*eb).quotes = false;
    1912                 :          18 :           OutArray (eb, (const char *) "the RType", 9);
    1913                 :             :         }
    1914                 :             :       else
    1915                 :             :         {
    1916                 :             :           /* avoid dangling else.  */
    1917                 :       20162 :           doAscii (eb, (const unsigned int *) sym, _sym_high, bol);
    1918                 :             :         }
    1919                 :             :     }
    1920                 :       28630 : }
    1921                 :             : 
    1922                 :             : 
    1923                 :             : /*
    1924                 :             :    clear - remove the output string.
    1925                 :             : */
    1926                 :             : 
    1927                 :           0 : static void doQualified (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol)
    1928                 :             : {
    1929                 :           0 :   typedef struct doQualified__T3_a doQualified__T3;
    1930                 :             : 
    1931                 :           0 :   struct doQualified__T3_a { unsigned int array[1+1]; };
    1932                 :           0 :   doQualified__T3 mod;
    1933                 :           0 :   unsigned int sym[_sym_high+1];
    1934                 :             : 
    1935                 :             :   /* make a local copy of each unbounded array.  */
    1936                 :           0 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    1937                 :             : 
    1938                 :           0 :   if ((((! (empty (eb))) || (sym[bol] == SymbolTable_NulSym)) || (SymbolTable_IsTemporary (sym[bol]))) || (SymbolTable_IsNameAnonymous (sym[bol])))
    1939                 :             :     {
    1940                 :           0 :       return;
    1941                 :             :     }
    1942                 :             :   else
    1943                 :             :     {
    1944                 :           0 :       mod.array[0] = SymbolTable_GetScope (sym[bol]);
    1945                 :           0 :       if ((SymbolTable_IsDefImp (mod.array[0])) && (SymbolTable_IsExported (mod.array[0], sym[bol])))
    1946                 :             :         {
    1947                 :           0 :           doAscii (eb, (const unsigned int *) &mod.array[0], 1, 0);
    1948                 :           0 :           OutArray (eb, (const char *) ".", 1);
    1949                 :           0 :           OutGlyphS (eb, DynamicStrings_Mark (DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (SymbolTable_GetSymName (sym[bol])))));
    1950                 :             :         }
    1951                 :             :       else
    1952                 :             :         {
    1953                 :           0 :           doAscii (eb, (const unsigned int *) sym, _sym_high, bol);
    1954                 :             :         }
    1955                 :             :     }
    1956                 :           0 : }
    1957                 :             : 
    1958                 :             : 
    1959                 :             : /*
    1960                 :             :    doType - returns a string containing the type name of
    1961                 :             :             sym.
    1962                 :             : */
    1963                 :             : 
    1964                 :       14716 : static void doType (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol)
    1965                 :             : {
    1966                 :       14716 :   unsigned int sym[_sym_high+1];
    1967                 :             : 
    1968                 :             :   /* make a local copy of each unbounded array.  */
    1969                 :       14716 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    1970                 :             : 
    1971                 :       14710 :   if ((! (empty (eb))) || (sym[bol] == SymbolTable_NulSym))
    1972                 :             :     {
    1973                 :           6 :       return;
    1974                 :             :     }
    1975                 :             :   else
    1976                 :             :     {
    1977                 :       14710 :       const_cast<unsigned int *>(sym)[bol] = SymbolTable_GetType (sym[bol]);
    1978                 :       14710 :       doAscii (eb, (const unsigned int *) sym, _sym_high, bol);
    1979                 :             :     }
    1980                 :       14716 : }
    1981                 :             : 
    1982                 :             : 
    1983                 :             : /*
    1984                 :             :    doSkipType - will skip all pseudonym types.  It also
    1985                 :             :                 returns the type symbol found and name.
    1986                 :             : */
    1987                 :             : 
    1988                 :        9462 : static void doSkipType (M2MetaError_errorBlock eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol)
    1989                 :             : {
    1990                 :        9462 :   unsigned int sym[_sym_high+1];
    1991                 :             : 
    1992                 :             :   /* make a local copy of each unbounded array.  */
    1993                 :        9462 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    1994                 :             : 
    1995                 :          24 :   if ((! (empty (&eb))) || (sym[bol] == SymbolTable_NulSym))
    1996                 :             :     {
    1997                 :        9438 :       return;
    1998                 :             :     }
    1999                 :             :   else
    2000                 :             :     {
    2001                 :          24 :       const_cast<unsigned int *>(sym)[bol] = SymbolTable_SkipType (sym[bol]);
    2002                 :          24 :       while ((SymbolTable_IsType (sym[bol])) && (((SymbolTable_GetSymName (sym[bol])) == NameKey_NulName) || (SymbolTable_IsNameAnonymous (sym[bol]))))
    2003                 :             :         {
    2004                 :           0 :           const_cast<unsigned int *>(sym)[bol] = SymbolTable_GetType (sym[bol]);
    2005                 :             :         }
    2006                 :          24 :       doAscii (&eb, (const unsigned int *) sym, _sym_high, bol);
    2007                 :             :     }
    2008                 :        9462 : }
    2009                 :             : 
    2010                 :             : 
    2011                 :             : /*
    2012                 :             :    doGetType - attempts to get the type of sym[bol].
    2013                 :             : */
    2014                 :             : 
    2015                 :           0 : static void doGetType (M2MetaError_errorBlock *eb, unsigned int *sym, unsigned int _sym_high, unsigned int bol)
    2016                 :             : {
    2017                 :           0 :   if (((bol > _sym_high) || (! (empty (eb)))) || (sym[bol] == SymbolTable_NulSym))
    2018                 :             :     {
    2019                 :             :       return;
    2020                 :             :     }
    2021                 :             :   else
    2022                 :             :     {
    2023                 :           0 :       const_cast<unsigned int *>(sym)[bol] = SymbolTable_GetType (sym[bol]);
    2024                 :             :     }
    2025                 :             : }
    2026                 :             : 
    2027                 :             : 
    2028                 :             : /*
    2029                 :             :    doGetSkipType - will skip all pseudonym types.  It also
    2030                 :             :                    returns the type symbol found and name.
    2031                 :             : */
    2032                 :             : 
    2033                 :           0 : static void doGetSkipType (M2MetaError_errorBlock *eb, unsigned int *sym, unsigned int _sym_high, unsigned int bol)
    2034                 :             : {
    2035                 :           0 :   unsigned int prev;
    2036                 :             : 
    2037                 :           0 :   if (((bol > _sym_high) || (! (empty (eb)))) || (sym[bol] == SymbolTable_NulSym))
    2038                 :             :     {
    2039                 :             :       return;
    2040                 :             :     }
    2041                 :             :   else
    2042                 :             :     {
    2043                 :           0 :       do {
    2044                 :           0 :         prev = sym[bol];
    2045                 :           0 :         const_cast<unsigned int *>(sym)[bol] = SymbolTable_SkipType (sym[bol]);
    2046                 :           0 :         if (((SymbolTable_IsType (sym[bol])) && (((SymbolTable_GetSymName (sym[bol])) == NameKey_NulName) || (SymbolTable_IsNameAnonymous (sym[bol])))) && ((SymbolTable_GetType (sym[bol])) != SymbolTable_NulSym))
    2047                 :             :           {
    2048                 :           0 :             const_cast<unsigned int *>(sym)[bol] = SymbolTable_GetType (sym[bol]);
    2049                 :             :           }
    2050                 :           0 :       } while (! (sym[bol] == prev));
    2051                 :             :     }
    2052                 :             : }
    2053                 :             : 
    2054                 :             : 
    2055                 :             : /*
    2056                 :             :    doChain -
    2057                 :             : */
    2058                 :             : 
    2059                 :         162 : static void doChain (M2MetaError_errorBlock *eb, unsigned int tok)
    2060                 :             : {
    2061                 :         162 :   if (lastRoot == NULL)
    2062                 :             :     {
    2063                 :           0 :       M2Error_InternalError ((const char *) "should not be chaining an error onto an empty error note", 56);
    2064                 :             :     }
    2065                 :             :   else
    2066                 :             :     {
    2067                 :         162 :       (*eb).e = M2Error_ChainError (tok, lastRoot);
    2068                 :             :     }
    2069                 :         162 : }
    2070                 :             : 
    2071                 :             : 
    2072                 :             : /*
    2073                 :             :    doError - creates and returns an error note.
    2074                 :             : */
    2075                 :             : 
    2076                 :        3088 : static void doError (M2MetaError_errorBlock *eb, unsigned int tok)
    2077                 :             : {
    2078                 :           0 :   if ((*eb).useError)
    2079                 :             :     {
    2080                 :        3088 :       chooseError (eb, tok);
    2081                 :             :     }
    2082                 :           0 : }
    2083                 :             : 
    2084                 :             : 
    2085                 :             : /*
    2086                 :             :    defaultError - adds the default error location to, tok, if one has not already been
    2087                 :             :                   assigned.
    2088                 :             : */
    2089                 :             : 
    2090                 :        3082 : static void defaultError (M2MetaError_errorBlock *eb, unsigned int tok)
    2091                 :             : {
    2092                 :        3082 :   if ((*eb).e == NULL)
    2093                 :             :     {
    2094                 :        2262 :       doError (eb, tok);
    2095                 :             :     }
    2096                 :        3082 : }
    2097                 :             : 
    2098                 :             : 
    2099                 :             : /*
    2100                 :             :    chooseError - choose the error kind dependant upon type.
    2101                 :             :                  Either an error, warning or note will be generated.
    2102                 :             : */
    2103                 :             : 
    2104                 :        3088 : static void chooseError (M2MetaError_errorBlock *eb, unsigned int tok)
    2105                 :             : {
    2106                 :        3088 :   if ((*eb).chain)
    2107                 :             :     {
    2108                 :          48 :       doChain (eb, tok);
    2109                 :             :     }
    2110                 :             :   else
    2111                 :             :     {
    2112                 :        3040 :       switch ((*eb).type)
    2113                 :             :         {
    2114                 :         114 :           case M2MetaError_chained:
    2115                 :         114 :             doChain (eb, tok);
    2116                 :         114 :             break;
    2117                 :             : 
    2118                 :        2307 :           case M2MetaError_none:
    2119                 :        2307 :           case M2MetaError_aborta:
    2120                 :        2307 :           case M2MetaError_error:
    2121                 :        2307 :             if ((*eb).e == NULL)
    2122                 :             :               {
    2123                 :        2307 :                 (*eb).e = M2Error_NewError (tok);
    2124                 :             :               }
    2125                 :             :             else
    2126                 :             :               {
    2127                 :           0 :                 (*eb).e = M2Error_MoveError ((*eb).e, tok);
    2128                 :             :               }
    2129                 :             :             break;
    2130                 :             : 
    2131                 :         600 :           case M2MetaError_warning:
    2132                 :         600 :             if ((*eb).e == NULL)
    2133                 :             :               {
    2134                 :         600 :                 (*eb).e = M2Error_NewWarning (tok);
    2135                 :             :               }
    2136                 :             :             else
    2137                 :             :               {
    2138                 :           0 :                 (*eb).e = M2Error_MoveError ((*eb).e, tok);
    2139                 :             :               }
    2140                 :             :             break;
    2141                 :             : 
    2142                 :          19 :           case M2MetaError_note:
    2143                 :          19 :             if ((*eb).e == NULL)
    2144                 :             :               {
    2145                 :          19 :                 (*eb).e = M2Error_NewNote (tok);
    2146                 :             :               }
    2147                 :             :             else
    2148                 :             :               {
    2149                 :           0 :                 (*eb).e = M2Error_MoveError ((*eb).e, tok);
    2150                 :             :               }
    2151                 :             :             break;
    2152                 :             : 
    2153                 :             : 
    2154                 :           0 :           default:
    2155                 :           0 :             M2Error_InternalError ((const char *) "unexpected enumeration value", 28);
    2156                 :        3088 :             break;
    2157                 :             :         }
    2158                 :             :     }
    2159                 :        3088 :   if ((*eb).root)
    2160                 :             :     {
    2161                 :          42 :       lastRoot = (*eb).e;
    2162                 :          42 :       lastColor = findColorType ((*eb).in);
    2163                 :             :     }
    2164                 :        3088 :   (*eb).e = M2Error_SetColor ((*eb).e);
    2165                 :        3088 : }
    2166                 :             : 
    2167                 :             : 
    2168                 :             : /*
    2169                 :             :    doErrorScopeModule -
    2170                 :             : */
    2171                 :             : 
    2172                 :          36 : static void doErrorScopeModule (M2MetaError_errorBlock *eb, unsigned int sym)
    2173                 :             : {
    2174                 :          36 :   unsigned int scope;
    2175                 :             : 
    2176                 :          36 :   scope = SymbolTable_GetScope (sym);
    2177                 :          36 :   if (SymbolTable_IsModule (scope))
    2178                 :             :     {
    2179                 :          30 :       if (SymbolTable_IsInnerModule (scope))
    2180                 :             :         {
    2181                 :           0 :           doError (eb, SymbolTable_GetDeclaredMod (sym));
    2182                 :             :         }
    2183                 :             :       else
    2184                 :             :         {
    2185                 :          30 :           doError (eb, SymbolTable_GetDeclaredMod (sym));
    2186                 :             :         }
    2187                 :             :     }
    2188                 :             :   else
    2189                 :             :     {
    2190                 :           6 :       M2Debug_Assert (SymbolTable_IsDefImp (scope));
    2191                 :             :       /* if this fails then we need to skip to the outer scope.
    2192                 :             :          REPEAT
    2193                 :             :             OuterModule := GetScope(OuterModule)
    2194                 :             :          UNTIL GetScope(OuterModule)=NulSym.  */
    2195                 :           6 :       if ((SymbolTable_GetDeclaredModule (sym)) == M2LexBuf_UnknownTokenNo)
    2196                 :             :         {
    2197                 :           0 :           doError (eb, SymbolTable_GetDeclaredDef (sym));
    2198                 :             :         }
    2199                 :             :       else
    2200                 :             :         {
    2201                 :           6 :           doError (eb, SymbolTable_GetDeclaredMod (sym));
    2202                 :             :         }
    2203                 :             :     }
    2204                 :          36 : }
    2205                 :             : 
    2206                 :             : 
    2207                 :             : /*
    2208                 :             :    doErrorScopeForward -
    2209                 :             : */
    2210                 :             : 
    2211                 :           0 : static void doErrorScopeForward (M2MetaError_errorBlock *eb, unsigned int sym)
    2212                 :             : {
    2213                 :           0 :   unsigned int scope;
    2214                 :             : 
    2215                 :           0 :   scope = SymbolTable_GetScope (sym);
    2216                 :           0 :   if (SymbolTable_IsModule (scope))
    2217                 :             :     {
    2218                 :           0 :       if (SymbolTable_IsInnerModule (scope))
    2219                 :             :         {
    2220                 :           0 :           doError (eb, SymbolTable_GetDeclaredFor (sym));
    2221                 :             :         }
    2222                 :             :       else
    2223                 :             :         {
    2224                 :           0 :           doError (eb, SymbolTable_GetDeclaredFor (sym));
    2225                 :             :         }
    2226                 :             :     }
    2227                 :             :   else
    2228                 :             :     {
    2229                 :           0 :       M2Debug_Assert (SymbolTable_IsDefImp (scope));
    2230                 :             :       /* if this fails then we need to skip to the outer scope.
    2231                 :             :          REPEAT
    2232                 :             :             OuterModule := GetScope(OuterModule)
    2233                 :             :          UNTIL GetScope(OuterModule)=NulSym.  */
    2234                 :           0 :       if ((SymbolTable_GetDeclaredModule (sym)) == M2LexBuf_UnknownTokenNo)
    2235                 :             :         {
    2236                 :           0 :           doError (eb, SymbolTable_GetDeclaredDef (sym));
    2237                 :             :         }
    2238                 :             :       else
    2239                 :             :         {
    2240                 :           0 :           doError (eb, SymbolTable_GetDeclaredFor (sym));
    2241                 :             :         }
    2242                 :             :     }
    2243                 :           0 : }
    2244                 :             : 
    2245                 :             : 
    2246                 :             : /*
    2247                 :             :    doErrorScopeMod - potentially create an error referring to the definition
    2248                 :             :                      module, fall back to the implementation or program module if
    2249                 :             :                      there is no declaration in the definition module.
    2250                 :             : */
    2251                 :             : 
    2252                 :          58 : static void doErrorScopeMod (M2MetaError_errorBlock *eb, unsigned int sym)
    2253                 :             : {
    2254                 :          58 :   unsigned int scope;
    2255                 :             : 
    2256                 :          58 :   scope = SymbolTable_GetScope (sym);
    2257                 :          58 :   if (scope == SymbolTable_NulSym)
    2258                 :             :     {
    2259                 :          22 :       M2Error_EnterErrorScope (static_cast<M2Error_ErrorScope> (NULL));
    2260                 :          22 :       doError (eb, SymbolTable_GetDeclaredMod (sym));
    2261                 :             :     }
    2262                 :             :   else
    2263                 :             :     {
    2264                 :          36 :       M2Error_EnterErrorScope (SymbolTable_GetErrorScope (scope));
    2265                 :          36 :       if (SymbolTable_IsProcedure (scope))
    2266                 :             :         {
    2267                 :           0 :           doError (eb, SymbolTable_GetDeclaredMod (sym));
    2268                 :             :         }
    2269                 :             :       else
    2270                 :             :         {
    2271                 :          36 :           doErrorScopeModule (eb, sym);
    2272                 :             :         }
    2273                 :             :     }
    2274                 :          58 :   M2Error_LeaveErrorScope ();
    2275                 :          58 : }
    2276                 :             : 
    2277                 :             : 
    2278                 :             : /*
    2279                 :             :    doErrorScopeFor - potentially create an error referring to the
    2280                 :             :                      forward declaration, definition module, fall back
    2281                 :             :                      to the implementation or program module if
    2282                 :             :                      there is no declaration in the definition module.
    2283                 :             : */
    2284                 :             : 
    2285                 :           0 : static void doErrorScopeFor (M2MetaError_errorBlock *eb, unsigned int sym)
    2286                 :             : {
    2287                 :           0 :   unsigned int scope;
    2288                 :             : 
    2289                 :           0 :   scope = SymbolTable_GetScope (sym);
    2290                 :           0 :   if (scope == SymbolTable_NulSym)
    2291                 :             :     {
    2292                 :           0 :       M2Error_EnterErrorScope (static_cast<M2Error_ErrorScope> (NULL));
    2293                 :           0 :       doError (eb, SymbolTable_GetDeclaredFor (sym));
    2294                 :             :     }
    2295                 :             :   else
    2296                 :             :     {
    2297                 :           0 :       M2Error_EnterErrorScope (SymbolTable_GetErrorScope (scope));
    2298                 :           0 :       if (SymbolTable_IsProcedure (scope))
    2299                 :             :         {
    2300                 :           0 :           doError (eb, SymbolTable_GetDeclaredFor (sym));
    2301                 :             :         }
    2302                 :             :       else
    2303                 :             :         {
    2304                 :           0 :           doErrorScopeForward (eb, sym);
    2305                 :             :         }
    2306                 :             :     }
    2307                 :           0 :   M2Error_LeaveErrorScope ();
    2308                 :           0 : }
    2309                 :             : 
    2310                 :          58 : static void declaredMod (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol)
    2311                 :             : {
    2312                 :          58 :   unsigned int sym[_sym_high+1];
    2313                 :             : 
    2314                 :             :   /* make a local copy of each unbounded array.  */
    2315                 :          58 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    2316                 :             : 
    2317                 :             :   /* 
    2318                 :             :    doDeclaredMod - creates an error note where sym[bol] was declared.
    2319                 :             :   */
    2320                 :          58 :   if (bol <= _sym_high)
    2321                 :             :     {
    2322                 :          58 :       doErrorScopeMod (eb, sym[bol]);
    2323                 :             :     }
    2324                 :          58 : }
    2325                 :             : 
    2326                 :             : 
    2327                 :             : /*
    2328                 :             :    doErrorScopeDefinition - use the declaration in the definitio module if one is available.
    2329                 :             : */
    2330                 :             : 
    2331                 :         402 : static void doErrorScopeDefinition (M2MetaError_errorBlock *eb, unsigned int sym)
    2332                 :             : {
    2333                 :         402 :   unsigned int scope;
    2334                 :             : 
    2335                 :         402 :   scope = SymbolTable_GetScope (sym);
    2336                 :         402 :   if (SymbolTable_IsModule (scope))
    2337                 :             :     {
    2338                 :             :       /* No definition module for a program module.  */
    2339                 :         402 :       doError (eb, SymbolTable_GetDeclaredMod (sym));
    2340                 :             :     }
    2341                 :             :   else
    2342                 :             :     {
    2343                 :           0 :       M2Debug_Assert (SymbolTable_IsDefImp (scope));
    2344                 :           0 :       if ((SymbolTable_GetDeclaredDefinition (sym)) == M2LexBuf_UnknownTokenNo)
    2345                 :             :         {
    2346                 :             :           /* Fall back to the implementation module if no declaration exists
    2347                 :             :             in the definition module.  */
    2348                 :           0 :           doError (eb, SymbolTable_GetDeclaredMod (sym));
    2349                 :             :         }
    2350                 :             :       else
    2351                 :             :         {
    2352                 :           0 :           doError (eb, SymbolTable_GetDeclaredDef (sym));
    2353                 :             :         }
    2354                 :             :     }
    2355                 :         402 : }
    2356                 :             : 
    2357                 :             : 
    2358                 :             : /*
    2359                 :             :    doErrorScopeDef - potentially create an error referring to the definition
    2360                 :             :                      module, fall back to the implementation or program module if
    2361                 :             :                      there is no declaration in the definition module.
    2362                 :             : */
    2363                 :             : 
    2364                 :         432 : static void doErrorScopeDef (M2MetaError_errorBlock *eb, unsigned int sym)
    2365                 :             : {
    2366                 :         432 :   unsigned int scope;
    2367                 :             : 
    2368                 :         432 :   scope = SymbolTable_GetScope (sym);
    2369                 :         432 :   if (scope == SymbolTable_NulSym)
    2370                 :             :     {
    2371                 :           0 :       M2Error_EnterErrorScope (static_cast<M2Error_ErrorScope> (NULL));
    2372                 :           0 :       doError (eb, SymbolTable_GetDeclaredFor (sym));
    2373                 :             :     }
    2374                 :             :   else
    2375                 :             :     {
    2376                 :         432 :       M2Error_EnterErrorScope (SymbolTable_GetErrorScope (scope));
    2377                 :         432 :       if (SymbolTable_IsProcedure (scope))
    2378                 :             :         {
    2379                 :          30 :           doError (eb, SymbolTable_GetDeclaredDef (sym));
    2380                 :             :         }
    2381                 :             :       else
    2382                 :             :         {
    2383                 :         402 :           doErrorScopeDefinition (eb, sym);
    2384                 :             :         }
    2385                 :             :     }
    2386                 :         432 :   M2Error_LeaveErrorScope ();
    2387                 :         432 : }
    2388                 :             : 
    2389                 :         432 : static void declaredDef (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol)
    2390                 :             : {
    2391                 :         432 :   unsigned int sym[_sym_high+1];
    2392                 :             : 
    2393                 :             :   /* make a local copy of each unbounded array.  */
    2394                 :         432 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    2395                 :             : 
    2396                 :             :   /* 
    2397                 :             :    doDeclaredDef - creates an error note where sym[bol] was declared.
    2398                 :             :   */
    2399                 :         432 :   if (bol <= _sym_high)
    2400                 :             :     {
    2401                 :         432 :       doErrorScopeDef (eb, sym[bol]);
    2402                 :             :     }
    2403                 :         432 : }
    2404                 :             : 
    2405                 :           0 : static void declaredFor (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol)
    2406                 :             : {
    2407                 :           0 :   unsigned int sym[_sym_high+1];
    2408                 :             : 
    2409                 :             :   /* make a local copy of each unbounded array.  */
    2410                 :           0 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    2411                 :             : 
    2412                 :             :   /* 
    2413                 :             :    doDeclaredFor - creates an error note where sym[bol] was declared.
    2414                 :             :   */
    2415                 :           0 :   if (bol <= _sym_high)
    2416                 :             :     {
    2417                 :           0 :       doErrorScopeFor (eb, sym[bol]);
    2418                 :             :     }
    2419                 :           0 : }
    2420                 :             : 
    2421                 :             : 
    2422                 :             : /*
    2423                 :             :    doErrorScopeProc - determine the location for the error or warning from
    2424                 :             :                       the default declaration.  For example parameters can be
    2425                 :             :                       declared in definition, forward or in modules (proper procedure).
    2426                 :             :                       Use GetVarParamTok to obtain a variable or parameter location.
    2427                 :             : */
    2428                 :             : 
    2429                 :         156 : static void doErrorScopeProc (M2MetaError_errorBlock *eb, unsigned int sym, M2MetaError_GetTokProcedure GetVarParamTok)
    2430                 :             : {
    2431                 :         156 :   unsigned int scope;
    2432                 :             : 
    2433                 :         156 :   scope = SymbolTable_GetScope (sym);
    2434                 :         156 :   if (scope == SymbolTable_NulSym)
    2435                 :             :     {
    2436                 :           0 :       M2Error_EnterErrorScope (static_cast<M2Error_ErrorScope> (NULL));
    2437                 :           0 :       doError (eb, SymbolTable_GetDeclaredDef (sym));
    2438                 :             :     }
    2439                 :             :   else
    2440                 :             :     {
    2441                 :         156 :       M2Error_EnterErrorScope (SymbolTable_GetErrorScope (scope));
    2442                 :         156 :       if ((SymbolTable_IsVar (sym)) || (SymbolTable_IsParameter (sym)))
    2443                 :             :         {
    2444                 :         156 :           doError (eb, (unsigned int ) ((*GetVarParamTok.proc) (sym)));
    2445                 :             :         }
    2446                 :           0 :       else if (SymbolTable_IsProcedure (scope))
    2447                 :             :         {
    2448                 :             :           /* avoid dangling else.  */
    2449                 :           0 :           doError (eb, SymbolTable_GetDeclaredDef (sym));
    2450                 :             :         }
    2451                 :           0 :       else if (SymbolTable_IsModule (scope))
    2452                 :             :         {
    2453                 :             :           /* avoid dangling else.  */
    2454                 :           0 :           doError (eb, SymbolTable_GetDeclaredMod (sym));
    2455                 :             :         }
    2456                 :             :       else
    2457                 :             :         {
    2458                 :             :           /* avoid dangling else.  */
    2459                 :           0 :           M2Debug_Assert (SymbolTable_IsDefImp (scope));
    2460                 :           0 :           if ((SymbolTable_GetDeclaredDefinition (sym)) == M2LexBuf_UnknownTokenNo)
    2461                 :             :             {
    2462                 :           0 :               doError (eb, SymbolTable_GetDeclaredMod (sym));
    2463                 :             :             }
    2464                 :             :           else
    2465                 :             :             {
    2466                 :           0 :               doError (eb, SymbolTable_GetDeclaredDef (sym));
    2467                 :             :             }
    2468                 :             :         }
    2469                 :             :     }
    2470                 :         156 :   M2Error_LeaveErrorScope ();
    2471                 :         156 : }
    2472                 :             : 
    2473                 :          96 : static void declaredVar (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol)
    2474                 :             : {
    2475                 :          96 :   unsigned int sym[_sym_high+1];
    2476                 :             : 
    2477                 :             :   /* make a local copy of each unbounded array.  */
    2478                 :          96 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    2479                 :             : 
    2480                 :             :   /* 
    2481                 :             :    doDeclaredVar - creates an error note where sym[bol] was declared.
    2482                 :             :   */
    2483                 :          96 :   if (bol <= _sym_high)
    2484                 :             :     {
    2485                 :          96 :       doErrorScopeProc (eb, sym[bol], (M2MetaError_GetTokProcedure) {(M2MetaError_GetTokProcedure_t) SymbolTable_GetVarDeclTok});
    2486                 :             :     }
    2487                 :          96 : }
    2488                 :             : 
    2489                 :           0 : static void declaredType (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol)
    2490                 :             : {
    2491                 :           0 :   unsigned int sym[_sym_high+1];
    2492                 :             : 
    2493                 :             :   /* make a local copy of each unbounded array.  */
    2494                 :           0 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    2495                 :             : 
    2496                 :             :   /* 
    2497                 :             :    doDeclaredType - creates an error note where sym[bol] was declared.
    2498                 :             :   */
    2499                 :           0 :   if (bol <= _sym_high)
    2500                 :             :     {
    2501                 :           0 :       doErrorScopeProc (eb, sym[bol], (M2MetaError_GetTokProcedure) {(M2MetaError_GetTokProcedure_t) SymbolTable_GetVarDeclTypeTok});
    2502                 :             :     }
    2503                 :           0 : }
    2504                 :             : 
    2505                 :          60 : static void declaredFull (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol)
    2506                 :             : {
    2507                 :          60 :   unsigned int sym[_sym_high+1];
    2508                 :             : 
    2509                 :             :   /* make a local copy of each unbounded array.  */
    2510                 :          60 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    2511                 :             : 
    2512                 :             :   /* 
    2513                 :             :    doDeclaredFull - creates an error note where sym[bol] was declared.
    2514                 :             :   */
    2515                 :          60 :   if (bol <= _sym_high)
    2516                 :             :     {
    2517                 :          60 :       doErrorScopeProc (eb, sym[bol], (M2MetaError_GetTokProcedure) {(M2MetaError_GetTokProcedure_t) SymbolTable_GetVarDeclFullTok});
    2518                 :             :     }
    2519                 :          60 : }
    2520                 :             : 
    2521                 :             : 
    2522                 :             : /*
    2523                 :             :    used - creates an error note where sym[bol] was first used.
    2524                 :             : */
    2525                 :             : 
    2526                 :         180 : static void used (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol)
    2527                 :             : {
    2528                 :         180 :   unsigned int sym[_sym_high+1];
    2529                 :             : 
    2530                 :             :   /* make a local copy of each unbounded array.  */
    2531                 :         180 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    2532                 :             : 
    2533                 :         180 :   if (bol <= _sym_high)
    2534                 :             :     {
    2535                 :         180 :       doError (eb, SymbolTable_GetFirstUsed (sym[bol]));
    2536                 :             :     }
    2537                 :         180 : }
    2538                 :             : 
    2539                 :             : 
    2540                 :             : /*
    2541                 :             :    symDesc -
    2542                 :             : */
    2543                 :             : 
    2544                 :        1098 : static DynamicStrings_String symDesc (unsigned int sym)
    2545                 :             : {
    2546                 :        1098 :   if (SymbolTable_IsConstLit (sym))
    2547                 :             :     {
    2548                 :           6 :       return DynamicStrings_InitString ((const char *) "constant literal", 16);
    2549                 :             :     }
    2550                 :        1092 :   else if (SymbolTable_IsConstSet (sym))
    2551                 :             :     {
    2552                 :             :       /* avoid dangling else.  */
    2553                 :          48 :       return DynamicStrings_InitString ((const char *) "constant set", 12);
    2554                 :             :     }
    2555                 :        1044 :   else if (SymbolTable_IsConstructor (sym))
    2556                 :             :     {
    2557                 :             :       /* avoid dangling else.  */
    2558                 :          12 :       return DynamicStrings_InitString ((const char *) "constructor", 11);
    2559                 :             :     }
    2560                 :        1032 :   else if (SymbolTable_IsConst (sym))
    2561                 :             :     {
    2562                 :             :       /* avoid dangling else.  */
    2563                 :          24 :       return DynamicStrings_InitString ((const char *) "constant", 8);
    2564                 :             :     }
    2565                 :        1008 :   else if (SymbolTable_IsArray (sym))
    2566                 :             :     {
    2567                 :             :       /* avoid dangling else.  */
    2568                 :          72 :       return DynamicStrings_InitString ((const char *) "array", 5);
    2569                 :             :     }
    2570                 :         936 :   else if (SymbolTable_IsVar (sym))
    2571                 :             :     {
    2572                 :             :       /* avoid dangling else.  */
    2573                 :         624 :       if (SymbolTable_IsTemporary (sym))
    2574                 :             :         {
    2575                 :         432 :           return DynamicStrings_InitString ((const char *) "expression", 10);
    2576                 :             :         }
    2577                 :             :       else
    2578                 :             :         {
    2579                 :         192 :           return DynamicStrings_InitString ((const char *) "variable", 8);
    2580                 :             :         }
    2581                 :             :     }
    2582                 :         312 :   else if (SymbolTable_IsEnumeration (sym))
    2583                 :             :     {
    2584                 :             :       /* avoid dangling else.  */
    2585                 :           6 :       return DynamicStrings_InitString ((const char *) "enumeration type", 16);
    2586                 :             :     }
    2587                 :         306 :   else if (SymbolTable_IsFieldEnumeration (sym))
    2588                 :             :     {
    2589                 :             :       /* avoid dangling else.  */
    2590                 :           0 :       return DynamicStrings_InitString ((const char *) "enumeration field", 17);
    2591                 :             :     }
    2592                 :         306 :   else if (SymbolTable_IsUnbounded (sym))
    2593                 :             :     {
    2594                 :             :       /* avoid dangling else.  */
    2595                 :          24 :       return DynamicStrings_InitString ((const char *) "unbounded parameter", 19);
    2596                 :             :     }
    2597                 :         282 :   else if (SymbolTable_IsProcType (sym))
    2598                 :             :     {
    2599                 :             :       /* avoid dangling else.  */
    2600                 :          18 :       return DynamicStrings_InitString ((const char *) "procedure type", 14);
    2601                 :             :     }
    2602                 :         264 :   else if (M2Base_IsPseudoBaseFunction (sym))
    2603                 :             :     {
    2604                 :             :       /* avoid dangling else.  */
    2605                 :           6 :       return DynamicStrings_InitString ((const char *) "standard function procedure", 27);
    2606                 :             :     }
    2607                 :         258 :   else if (M2Base_IsPseudoBaseProcedure (sym))
    2608                 :             :     {
    2609                 :             :       /* avoid dangling else.  */
    2610                 :           0 :       return DynamicStrings_InitString ((const char *) "standard procedure", 18);
    2611                 :             :     }
    2612                 :         258 :   else if (SymbolTable_IsProcedure (sym))
    2613                 :             :     {
    2614                 :             :       /* avoid dangling else.  */
    2615                 :          18 :       return DynamicStrings_InitString ((const char *) "procedure", 9);
    2616                 :             :     }
    2617                 :         240 :   else if (SymbolTable_IsPointer (sym))
    2618                 :             :     {
    2619                 :             :       /* avoid dangling else.  */
    2620                 :           0 :       return DynamicStrings_InitString ((const char *) "pointer", 7);
    2621                 :             :     }
    2622                 :         240 :   else if (SymbolTable_IsParameter (sym))
    2623                 :             :     {
    2624                 :             :       /* avoid dangling else.  */
    2625                 :          18 :       if (SymbolTable_IsParameterVar (sym))
    2626                 :             :         {
    2627                 :          12 :           return DynamicStrings_InitString ((const char *) "var parameter", 13);
    2628                 :             :         }
    2629                 :             :       else
    2630                 :             :         {
    2631                 :           6 :           return DynamicStrings_InitString ((const char *) "parameter", 9);
    2632                 :             :         }
    2633                 :             :     }
    2634                 :         222 :   else if (SymbolTable_IsType (sym))
    2635                 :             :     {
    2636                 :             :       /* avoid dangling else.  */
    2637                 :           0 :       if (SymbolTable_IsHiddenType (sym))
    2638                 :             :         {
    2639                 :           0 :           return DynamicStrings_InitString ((const char *) "opaque type", 11);
    2640                 :             :         }
    2641                 :             :       else
    2642                 :             :         {
    2643                 :           0 :           return DynamicStrings_InitString ((const char *) "type", 4);
    2644                 :             :         }
    2645                 :             :     }
    2646                 :         222 :   else if (SymbolTable_IsRecord (sym))
    2647                 :             :     {
    2648                 :             :       /* avoid dangling else.  */
    2649                 :           6 :       return DynamicStrings_InitString ((const char *) "record", 6);
    2650                 :             :     }
    2651                 :         216 :   else if (SymbolTable_IsRecordField (sym))
    2652                 :             :     {
    2653                 :             :       /* avoid dangling else.  */
    2654                 :           0 :       return DynamicStrings_InitString ((const char *) "record field", 12);
    2655                 :             :     }
    2656                 :         216 :   else if (SymbolTable_IsVarient (sym))
    2657                 :             :     {
    2658                 :             :       /* avoid dangling else.  */
    2659                 :           0 :       return DynamicStrings_InitString ((const char *) "varient record", 14);
    2660                 :             :     }
    2661                 :         216 :   else if (SymbolTable_IsModule (sym))
    2662                 :             :     {
    2663                 :             :       /* avoid dangling else.  */
    2664                 :           0 :       return DynamicStrings_InitString ((const char *) "module", 6);
    2665                 :             :     }
    2666                 :         216 :   else if (SymbolTable_IsDefImp (sym))
    2667                 :             :     {
    2668                 :             :       /* avoid dangling else.  */
    2669                 :           0 :       return DynamicStrings_InitString ((const char *) "definition or implementation module", 35);
    2670                 :             :     }
    2671                 :         216 :   else if (SymbolTable_IsSet (sym))
    2672                 :             :     {
    2673                 :             :       /* avoid dangling else.  */
    2674                 :          72 :       return DynamicStrings_InitString ((const char *) "set", 3);
    2675                 :             :     }
    2676                 :         144 :   else if (SymbolTable_IsUnknown (sym))
    2677                 :             :     {
    2678                 :             :       /* avoid dangling else.  */
    2679                 :          18 :       return DynamicStrings_InitString ((const char *) "unknown", 7);
    2680                 :             :     }
    2681                 :         126 :   else if (SymbolTable_IsSubrange (sym))
    2682                 :             :     {
    2683                 :             :       /* avoid dangling else.  */
    2684                 :         126 :       return DynamicStrings_InitString ((const char *) "subrange", 8);
    2685                 :             :     }
    2686                 :             :   else
    2687                 :             :     {
    2688                 :             :       /* avoid dangling else.  */
    2689                 :           0 :       return DynamicStrings_InitString ((const char *) "", 0);
    2690                 :             :     }
    2691                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    2692                 :             :   __builtin_unreachable ();
    2693                 :             : }
    2694                 :             : 
    2695                 :             : 
    2696                 :             : /*
    2697                 :             :    doDesc -
    2698                 :             : */
    2699                 :             : 
    2700                 :        9008 : static void doDesc (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol)
    2701                 :             : {
    2702                 :        9008 :   unsigned int sym[_sym_high+1];
    2703                 :             : 
    2704                 :             :   /* make a local copy of each unbounded array.  */
    2705                 :        9008 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    2706                 :             : 
    2707                 :        9008 :   if (empty (eb))
    2708                 :             :     {
    2709                 :        1098 :       OutGlyphS (eb, symDesc (sym[bol]));
    2710                 :        1098 :       if (! (empty (eb)))
    2711                 :             :         {
    2712                 :        1098 :           (*eb).quotes = false;
    2713                 :             :         }
    2714                 :             :     }
    2715                 :        9008 : }
    2716                 :             : 
    2717                 :             : 
    2718                 :             : /*
    2719                 :             :    op := {'!'|'a'|'c'|'d'|'k'|'n'|'p'|'q'|'s'|'t'|'u'|'v'|
    2720                 :             :           'A'|'B'|'C'|'D'|'E'|'F'|'G'|'H'|'K'|'M'|'N'|
    2721                 :             :           'O'|'P'|'Q'|'R'|'S'|'T'|'U'|'V'|'W'|'X'|'Y'|'Z'|
    2722                 :             :           '&' } then =:
    2723                 :             : */
    2724                 :             : 
    2725                 :       41938 : static void op (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol)
    2726                 :             : {
    2727                 :       41938 :   unsigned int sym[_sym_high+1];
    2728                 :             : 
    2729                 :             :   /* make a local copy of each unbounded array.  */
    2730                 :       41938 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    2731                 :             : 
    2732                 :      128205 :   while (((*eb).ini < (*eb).len) && ((DynamicStrings_char ((*eb).in, (*eb).ini)) != '}'))
    2733                 :             :     {
    2734                 :       86267 :       if (Debugging)
    2735                 :             :         {
    2736                 :             :           M2Printf_printf0 ((const char *) "while loop in op\\n", 18);
    2737                 :             :           dump ((*eb));
    2738                 :             :         }
    2739                 :       86267 :       switch (DynamicStrings_char ((*eb).in, (*eb).ini))
    2740                 :             :         {
    2741                 :           0 :           case '!':
    2742                 :           0 :             (*eb).positive = ! (*eb).positive;
    2743                 :           0 :             break;
    2744                 :             : 
    2745                 :       28630 :           case 'a':
    2746                 :       28630 :             doName (eb, (const unsigned int *) sym, _sym_high, bol);
    2747                 :       28630 :             break;
    2748                 :             : 
    2749                 :           0 :           case 'c':
    2750                 :           0 :             (*eb).currentCol = readColor (eb);
    2751                 :           0 :             (*eb).ini -= 1;
    2752                 :           0 :             break;
    2753                 :             : 
    2754                 :        9008 :           case 'd':
    2755                 :        9008 :             doDesc (eb, (const unsigned int *) sym, _sym_high, bol);
    2756                 :        9008 :             break;
    2757                 :             : 
    2758                 :         626 :           case 'k':
    2759                 :         626 :             unquotedKeyword (eb);
    2760                 :         626 :             (*eb).ini -= 1;
    2761                 :         626 :             break;
    2762                 :             : 
    2763                 :           0 :           case 'n':
    2764                 :           0 :             doNumber (eb, (const unsigned int *) sym, _sym_high, bol);
    2765                 :           0 :             break;
    2766                 :             : 
    2767                 :           0 :           case 'p':
    2768                 :           0 :             popColor (eb);
    2769                 :           0 :             break;
    2770                 :             : 
    2771                 :           0 :           case 'q':
    2772                 :           0 :             doQualified (eb, (const unsigned int *) sym, _sym_high, bol);
    2773                 :           0 :             break;
    2774                 :             : 
    2775                 :        9462 :           case 's':
    2776                 :        9462 :             doSkipType ((*eb), (const unsigned int *) sym, _sym_high, bol);
    2777                 :        9462 :             break;
    2778                 :             : 
    2779                 :       14716 :           case 't':
    2780                 :       14716 :             doType (eb, (const unsigned int *) sym, _sym_high, bol);
    2781                 :       14716 :             break;
    2782                 :             : 
    2783                 :           0 :           case 'u':
    2784                 :           0 :             (*eb).quotes = false;
    2785                 :           0 :             break;
    2786                 :             : 
    2787                 :         180 :           case 'v':
    2788                 :         180 :             (*eb).vowel = true;
    2789                 :         180 :             break;
    2790                 :             : 
    2791                 :          88 :           case 'A':
    2792                 :          88 :             (*eb).type = M2MetaError_aborta;
    2793                 :          88 :             seenAbort = true;
    2794                 :          88 :             break;
    2795                 :             : 
    2796                 :           0 :           case 'B':
    2797                 :           0 :             declaredType (eb, (const unsigned int *) sym, _sym_high, bol);
    2798                 :           0 :             break;
    2799                 :             : 
    2800                 :          42 :           case 'C':
    2801                 :          42 :             (*eb).chain = true;
    2802                 :          42 :             break;
    2803                 :             : 
    2804                 :         432 :           case 'D':
    2805                 :         432 :             declaredDef (eb, (const unsigned int *) sym, _sym_high, bol);
    2806                 :         432 :             break;
    2807                 :             : 
    2808                 :        1898 :           case 'E':
    2809                 :        1898 :             (*eb).type = M2MetaError_error;
    2810                 :        1898 :             break;
    2811                 :             : 
    2812                 :           0 :           case 'F':
    2813                 :           0 :             filename (eb);
    2814                 :           0 :             (*eb).ini -= 1;
    2815                 :           0 :             break;
    2816                 :             : 
    2817                 :           0 :           case 'G':
    2818                 :           0 :             declaredFor (eb, (const unsigned int *) sym, _sym_high, bol);
    2819                 :           0 :             break;
    2820                 :             : 
    2821                 :          60 :           case 'H':
    2822                 :          60 :             declaredFull (eb, (const unsigned int *) sym, _sym_high, bol);
    2823                 :          60 :             break;
    2824                 :             : 
    2825                 :         546 :           case 'K':
    2826                 :         546 :             keyword (eb);
    2827                 :         546 :             (*eb).ini -= 1;
    2828                 :         546 :             break;
    2829                 :             : 
    2830                 :          58 :           case 'M':
    2831                 :          58 :             declaredMod (eb, (const unsigned int *) sym, _sym_high, bol);
    2832                 :          58 :             break;
    2833                 :             : 
    2834                 :        2136 :           case 'N':
    2835                 :        2136 :             doCount (eb, (const unsigned int *) sym, _sym_high, bol);
    2836                 :        2136 :             break;
    2837                 :             : 
    2838                 :          19 :           case 'O':
    2839                 :          19 :             (*eb).type = M2MetaError_note;
    2840                 :          19 :             break;
    2841                 :             : 
    2842                 :           0 :           case 'P':
    2843                 :           0 :             pushColor (eb);
    2844                 :           0 :             break;
    2845                 :             : 
    2846                 :           0 :           case 'Q':
    2847                 :           0 :             resetDictionary ();
    2848                 :           0 :             break;
    2849                 :             : 
    2850                 :          42 :           case 'R':
    2851                 :          42 :             (*eb).root = true;
    2852                 :          42 :             break;
    2853                 :             : 
    2854                 :           0 :           case 'S':
    2855                 :           0 :             doGetSkipType (eb, (unsigned int *) sym, _sym_high, bol);
    2856                 :           0 :             break;
    2857                 :             : 
    2858                 :           0 :           case 'T':
    2859                 :           0 :             doGetType (eb, (unsigned int *) sym, _sym_high, bol);
    2860                 :           0 :             break;
    2861                 :             : 
    2862                 :         180 :           case 'U':
    2863                 :         180 :             used (eb, (const unsigned int *) sym, _sym_high, bol);
    2864                 :         180 :             break;
    2865                 :             : 
    2866                 :          96 :           case 'V':
    2867                 :          96 :             declaredVar (eb, (const unsigned int *) sym, _sym_high, bol);
    2868                 :          96 :             break;
    2869                 :             : 
    2870                 :       11020 :           case 'W':
    2871                 :       11020 :             (*eb).type = M2MetaError_warning;
    2872                 :       11020 :             break;
    2873                 :             : 
    2874                 :           0 :           case 'X':
    2875                 :           0 :             pushOutput (eb);
    2876                 :           0 :             break;
    2877                 :             : 
    2878                 :           0 :           case 'Y':
    2879                 :           0 :             processDefine (eb);
    2880                 :           0 :             break;
    2881                 :             : 
    2882                 :           0 :           case 'Z':
    2883                 :           0 :             popOutput (eb);
    2884                 :           0 :             break;
    2885                 :             : 
    2886                 :         198 :           case '&':
    2887                 :         198 :             continuation (eb, (unsigned int *) sym, _sym_high, bol);
    2888                 :         198 :             (*eb).ini -= 1;
    2889                 :         198 :             break;
    2890                 :             : 
    2891                 :        6830 :           case ':':
    2892                 :        6830 :             ifNonNulThen (eb, (const unsigned int *) sym, _sym_high);
    2893                 :        6830 :             (*eb).ini -= 1;
    2894                 :        6830 :             break;
    2895                 :             : 
    2896                 :           0 :           case '1':
    2897                 :           0 :             M2Error_InternalError ((const char *) "incorrect format spec, expecting %1 rather than % spec 1", 56);
    2898                 :           0 :             break;
    2899                 :             : 
    2900                 :           0 :           case '2':
    2901                 :           0 :             M2Error_InternalError ((const char *) "incorrect format spec, expecting %2 rather than % spec 2", 56);
    2902                 :           0 :             break;
    2903                 :             : 
    2904                 :           0 :           case '3':
    2905                 :           0 :             M2Error_InternalError ((const char *) "incorrect format spec, expecting %3 rather than % spec 3", 56);
    2906                 :           0 :             break;
    2907                 :             : 
    2908                 :           0 :           case '4':
    2909                 :           0 :             M2Error_InternalError ((const char *) "incorrect format spec, expecting %4 rather than % spec 4", 56);
    2910                 :           0 :             break;
    2911                 :             : 
    2912                 :             : 
    2913                 :           0 :           default:
    2914                 :           0 :             InternalFormat ((*eb), (const char *) "expecting one of [akqtdnpsuCDEFGKNOPQRSTUWXYZ:<>%]", 50, 1789);
    2915                 :             :             break;
    2916                 :             :         }
    2917                 :       86267 :       (*eb).ini += 1;
    2918                 :             :     }
    2919                 :       41938 :   if (Debugging)
    2920                 :             :     {
    2921                 :             :       M2Printf_printf0 ((const char *) "finishing op\\n", 14);
    2922                 :             :       dump ((*eb));
    2923                 :             :     }
    2924                 :       41938 : }
    2925                 :             : 
    2926                 :             : 
    2927                 :             : /*
    2928                 :             :    continuation := {':'|'1'|'2'|'3'|'4'|'i'|'s'|'x'|'w'} =:
    2929                 :             : */
    2930                 :             : 
    2931                 :         198 : static void continuation (M2MetaError_errorBlock *eb, unsigned int *sym, unsigned int _sym_high, unsigned int bol)
    2932                 :             : {
    2933                 :         198 :   M2Debug_Assert (((*eb).ini < (*eb).len) && ((DynamicStrings_char ((*eb).in, (*eb).ini)) == '&'));
    2934                 :         198 :   (*eb).ini += 1;
    2935                 :         396 :   while (((*eb).ini < (*eb).len) && ((DynamicStrings_char ((*eb).in, (*eb).ini)) != '}'))
    2936                 :             :     {
    2937                 :         198 :       switch (DynamicStrings_char ((*eb).in, (*eb).ini))
    2938                 :             :         {
    2939                 :           0 :           case ':':
    2940                 :           0 :             ifNonNulThen (eb, (const unsigned int *) sym, _sym_high);
    2941                 :           0 :             (*eb).ini -= 1;
    2942                 :           0 :             break;
    2943                 :             : 
    2944                 :           0 :           case '1':
    2945                 :           0 :             M2Error_InternalError ((const char *) "incorrect format spec, expecting %1 rather than % spec 1", 56);
    2946                 :           0 :             break;
    2947                 :             : 
    2948                 :           0 :           case '2':
    2949                 :           0 :             M2Error_InternalError ((const char *) "incorrect format spec, expecting %2 rather than % spec 2", 56);
    2950                 :           0 :             break;
    2951                 :             : 
    2952                 :           0 :           case '3':
    2953                 :           0 :             M2Error_InternalError ((const char *) "incorrect format spec, expecting %3 rather than % spec 3", 56);
    2954                 :           0 :             break;
    2955                 :             : 
    2956                 :           0 :           case '4':
    2957                 :           0 :             M2Error_InternalError ((const char *) "incorrect format spec, expecting %4 rather than % spec 4", 56);
    2958                 :           0 :             break;
    2959                 :             : 
    2960                 :           0 :           case 'i':
    2961                 :           0 :             AddImportsHint (eb);
    2962                 :           0 :             break;
    2963                 :             : 
    2964                 :         198 :           case 's':
    2965                 :         198 :             SpellHint (eb, (const unsigned int *) sym, _sym_high, bol);
    2966                 :         198 :             break;
    2967                 :             : 
    2968                 :           0 :           case 'x':
    2969                 :           0 :             AddExportsHint (eb);
    2970                 :           0 :             break;
    2971                 :             : 
    2972                 :           0 :           case 'w':
    2973                 :           0 :             AddWithStackHint (eb);
    2974                 :           0 :             break;
    2975                 :             : 
    2976                 :             : 
    2977                 :           0 :           default:
    2978                 :           0 :             InternalFormat ((*eb), (const char *) "expecting one of [:1234isxw]", 28, 1826);
    2979                 :             :             break;
    2980                 :             :         }
    2981                 :         198 :       (*eb).ini += 1;
    2982                 :             :     }
    2983                 :         198 :   if (((*eb).ini < (*eb).len) && ((DynamicStrings_char ((*eb).in, (*eb).ini)) != '}'))
    2984                 :             :     {
    2985                 :           0 :       (*eb).ini -= 1;
    2986                 :             :     }
    2987                 :         198 : }
    2988                 :             : 
    2989                 :             : 
    2990                 :             : /*
    2991                 :             :    percenttoken := '%' (
    2992                 :             :                          '1'        % doOperand(1) %
    2993                 :             :                              op
    2994                 :             :                        | '2'        % doOperand(2) %
    2995                 :             :                              op
    2996                 :             :                        | '3'        % doOperand(3) %
    2997                 :             :                              op
    2998                 :             :                        | '4'        % doOperand(4) %
    2999                 :             :                              op
    3000                 :             :                        )
    3001                 :             :                        } =:
    3002                 :             : */
    3003                 :             : 
    3004                 :       41938 : static void percenttoken (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high)
    3005                 :             : {
    3006                 :       41938 :   unsigned int sym[_sym_high+1];
    3007                 :             : 
    3008                 :             :   /* make a local copy of each unbounded array.  */
    3009                 :       41938 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    3010                 :             : 
    3011                 :       41938 :   if ((DynamicStrings_char ((*eb).in, (*eb).ini)) == '%')
    3012                 :             :     {
    3013                 :       41938 :       (*eb).ini += 1;
    3014                 :       41938 :       switch (DynamicStrings_char ((*eb).in, (*eb).ini))
    3015                 :             :         {
    3016                 :       24739 :           case '1':
    3017                 :       24739 :             (*eb).ini += 1;
    3018                 :       24739 :             op (eb, (const unsigned int *) sym, _sym_high, 0);
    3019                 :       24739 :             break;
    3020                 :             : 
    3021                 :       13479 :           case '2':
    3022                 :       13479 :             (*eb).ini += 1;
    3023                 :       13479 :             op (eb, (const unsigned int *) sym, _sym_high, 1);
    3024                 :       13479 :             break;
    3025                 :             : 
    3026                 :        2052 :           case '3':
    3027                 :        2052 :             (*eb).ini += 1;
    3028                 :        2052 :             op (eb, (const unsigned int *) sym, _sym_high, 2);
    3029                 :        2052 :             break;
    3030                 :             : 
    3031                 :         228 :           case '4':
    3032                 :         228 :             (*eb).ini += 1;
    3033                 :         228 :             op (eb, (const unsigned int *) sym, _sym_high, 3);
    3034                 :         228 :             break;
    3035                 :             : 
    3036                 :             : 
    3037                 :        1440 :           default:
    3038                 :        1440 :             op (eb, (const unsigned int *) sym, _sym_high, 0);
    3039                 :        1440 :             break;
    3040                 :             :         }
    3041                 :       41938 :       if (((*eb).ini < (*eb).len) && ((DynamicStrings_char ((*eb).in, (*eb).ini)) != '}'))
    3042                 :             :         {
    3043                 :           0 :           InternalFormat ((*eb), (const char *) "expecting to see }", 18, 1872);
    3044                 :             :         }
    3045                 :             :     }
    3046                 :       41938 : }
    3047                 :             : 
    3048                 :             : 
    3049                 :             : /*
    3050                 :             :    IsPunct - returns TRUE if ch is a punctuation character.
    3051                 :             : */
    3052                 :             : 
    3053                 :        9314 : static bool IsPunct (char ch)
    3054                 :             : {
    3055                 :        9314 :   return ((((((((ch == '.') || (ch == ',')) || (ch == ':')) || (ch == ';')) || (ch == '!')) || (ch == '(')) || (ch == ')')) || (ch == '[')) || (ch == ']');
    3056                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    3057                 :             :   __builtin_unreachable ();
    3058                 :             : }
    3059                 :             : 
    3060                 :             : 
    3061                 :             : /*
    3062                 :             :    JoinSentances - join s onto eb.  It removes trailing
    3063                 :             :                    spaces from eb if s starts with a punctuation
    3064                 :             :                    character.
    3065                 :             : */
    3066                 :             : 
    3067                 :        9464 : static void JoinSentances (M2MetaError_errorBlock *eb, DynamicStrings_String s)
    3068                 :             : {
    3069                 :        9464 :   int i;
    3070                 :             : 
    3071                 :        9464 :   if ((s != NULL) && ((DynamicStrings_Length (s)) > 0))
    3072                 :             :     {
    3073                 :        9314 :       if (IsPunct (DynamicStrings_char (s, 0)))
    3074                 :             :         {
    3075                 :          72 :           (*eb).out = DynamicStrings_RemoveWhitePostfix ((*eb).out);
    3076                 :             :         }
    3077                 :        9314 :       flushColor (eb);
    3078                 :        9314 :       (*eb).out = DynamicStrings_ConCat ((*eb).out, s);
    3079                 :        9314 :       (*eb).glyph = true;
    3080                 :        9314 :       (*eb).quotes = false;
    3081                 :             :     }
    3082                 :        9464 : }
    3083                 :             : 
    3084                 :             : 
    3085                 :             : /*
    3086                 :             :    SpellHint -
    3087                 :             : */
    3088                 :             : 
    3089                 :         198 : static void SpellHint (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high, unsigned int bol)
    3090                 :             : {
    3091                 :         198 :   unsigned int sym[_sym_high+1];
    3092                 :             : 
    3093                 :             :   /* make a local copy of each unbounded array.  */
    3094                 :         198 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    3095                 :             : 
    3096                 :         198 :   if ((bol <= _sym_high) && (SymbolTable_IsUnknown (sym[bol])))
    3097                 :             :     {
    3098                 :         186 :       JoinSentances (eb, M2StackSpell_GetSpellHint (sym[bol]));
    3099                 :             :     }
    3100                 :         198 : }
    3101                 :             : 
    3102                 :             : 
    3103                 :             : /*
    3104                 :             :    AddImportsHint -
    3105                 :             : */
    3106                 :             : 
    3107                 :           0 : static void AddImportsHint (M2MetaError_errorBlock *eb)
    3108                 :             : {
    3109                 :           0 :   (*eb).importHint = true;
    3110                 :           0 : }
    3111                 :             : 
    3112                 :             : 
    3113                 :             : /*
    3114                 :             :    AddExportsHint -
    3115                 :             : */
    3116                 :             : 
    3117                 :           0 : static void AddExportsHint (M2MetaError_errorBlock *eb)
    3118                 :             : {
    3119                 :           0 :   (*eb).exportHint = true;
    3120                 :           0 : }
    3121                 :             : 
    3122                 :             : 
    3123                 :             : /*
    3124                 :             :    AddWithStackHint -
    3125                 :             : */
    3126                 :             : 
    3127                 :           0 : static void AddWithStackHint (M2MetaError_errorBlock *eb)
    3128                 :             : {
    3129                 :           0 :   (*eb).withStackHint = true;
    3130                 :           0 : }
    3131                 :             : 
    3132                 :             : 
    3133                 :             : /*
    3134                 :             :    changeColor - changes to color, c.
    3135                 :             : */
    3136                 :             : 
    3137                 :        1172 : static void changeColor (M2MetaError_errorBlock *eb, M2MetaError_colorType c)
    3138                 :             : {
    3139                 :        1172 :   (*eb).currentCol = c;
    3140                 :        1172 : }
    3141                 :             : 
    3142                 :             : 
    3143                 :             : /*
    3144                 :             :    shutdownColor - shutdown existing color if it exists.
    3145                 :             : */
    3146                 :             : 
    3147                 :      105712 : static void shutdownColor (M2MetaError_errorBlock *eb)
    3148                 :             : {
    3149                 :      105712 :   if (((*eb).endCol != M2MetaError_unsetColor) && ((*eb).endCol != M2MetaError_noColor))
    3150                 :             :     {
    3151                 :      135490 :       (*eb).out = colorEnd ((*eb).out);
    3152                 :       67745 :       (*eb).endCol = M2MetaError_noColor;
    3153                 :             :     }
    3154                 :      105712 : }
    3155                 :             : 
    3156                 :             : 
    3157                 :             : /*
    3158                 :             :    flushColor - flushes any outstanding color change.
    3159                 :             : */
    3160                 :             : 
    3161                 :     1659493 : static void flushColor (M2MetaError_errorBlock *eb)
    3162                 :             : {
    3163                 :     1659493 :   if ((*eb).endCol != (*eb).currentCol)
    3164                 :             :     {
    3165                 :       76042 :       shutdownColor (eb);
    3166                 :       76042 :       if ((*eb).endCol != (*eb).currentCol)
    3167                 :             :         {
    3168                 :       78426 :           emitColor (eb, (*eb).currentCol);
    3169                 :       39213 :           (*eb).endCol = (*eb).currentCol;
    3170                 :             :         }
    3171                 :       76042 :       if ((*eb).beginCol == M2MetaError_unsetColor)
    3172                 :             :         {
    3173                 :       23263 :           (*eb).beginCol = (*eb).currentCol;
    3174                 :             :         }
    3175                 :             :     }
    3176                 :     1659493 : }
    3177                 :             : 
    3178                 :             : 
    3179                 :             : /*
    3180                 :             :    emitColorGCC -
    3181                 :             : */
    3182                 :             : 
    3183                 :       39213 : static void emitColorGCC (M2MetaError_errorBlock *eb, M2MetaError_colorType c)
    3184                 :             : {
    3185                 :       39213 :   switch (c)
    3186                 :             :     {
    3187                 :             :       case M2MetaError_unsetColor:
    3188                 :             :         break;
    3189                 :             : 
    3190                 :         398 :       case M2MetaError_noColor:
    3191                 :         398 :         (*eb).out = M2ColorString_endColor ((*eb).out);
    3192                 :         398 :         break;
    3193                 :             : 
    3194                 :           0 :       case M2MetaError_quoteColor:
    3195                 :           0 :         (*eb).out = M2ColorString_quoteColor ((*eb).out);
    3196                 :           0 :         break;
    3197                 :             : 
    3198                 :           0 :       case M2MetaError_filenameColor:
    3199                 :           0 :         (*eb).out = M2ColorString_filenameColor ((*eb).out);
    3200                 :           0 :         break;
    3201                 :             : 
    3202                 :       11079 :       case M2MetaError_errorColor:
    3203                 :       11079 :         (*eb).out = M2ColorString_errorColor ((*eb).out);
    3204                 :       11079 :         break;
    3205                 :             : 
    3206                 :       26518 :       case M2MetaError_warningColor:
    3207                 :       26518 :         (*eb).out = M2ColorString_warningColor ((*eb).out);
    3208                 :       26518 :         break;
    3209                 :             : 
    3210                 :          46 :       case M2MetaError_noteColor:
    3211                 :          46 :         (*eb).out = M2ColorString_noteColor ((*eb).out);
    3212                 :          46 :         break;
    3213                 :             : 
    3214                 :        1172 :       case M2MetaError_keywordColor:
    3215                 :        1172 :         (*eb).out = M2ColorString_locusColor ((*eb).out);
    3216                 :        1172 :         break;
    3217                 :             : 
    3218                 :           0 :       case M2MetaError_locusColor:
    3219                 :           0 :         (*eb).out = M2ColorString_locusColor ((*eb).out);
    3220                 :           0 :         break;
    3221                 :             : 
    3222                 :           0 :       case M2MetaError_insertColor:
    3223                 :           0 :         (*eb).out = M2ColorString_insertColor ((*eb).out);
    3224                 :           0 :         break;
    3225                 :             : 
    3226                 :           0 :       case M2MetaError_deleteColor:
    3227                 :           0 :         (*eb).out = M2ColorString_deleteColor ((*eb).out);
    3228                 :           0 :         break;
    3229                 :             : 
    3230                 :           0 :       case M2MetaError_typeColor:
    3231                 :           0 :         (*eb).out = M2ColorString_typeColor ((*eb).out);
    3232                 :           0 :         break;
    3233                 :             : 
    3234                 :           0 :       case M2MetaError_range1Color:
    3235                 :           0 :         (*eb).out = M2ColorString_range1Color ((*eb).out);
    3236                 :           0 :         break;
    3237                 :             : 
    3238                 :           0 :       case M2MetaError_range2Color:
    3239                 :           0 :         (*eb).out = M2ColorString_range2Color ((*eb).out);
    3240                 :           0 :         break;
    3241                 :             : 
    3242                 :             : 
    3243                 :           0 :       default:
    3244                 :           0 :         CaseException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/M2MetaError.def", 20, 1);
    3245                 :           0 :         __builtin_unreachable ();
    3246                 :             :     }
    3247                 :       39213 : }
    3248                 :             : 
    3249                 :             : 
    3250                 :             : /*
    3251                 :             :    emitColorTag -
    3252                 :             : */
    3253                 :             : 
    3254                 :           0 : static void emitColorTag (M2MetaError_errorBlock *eb, M2MetaError_colorType c)
    3255                 :             : {
    3256                 :           0 :   DynamicStrings_String s;
    3257                 :             : 
    3258                 :           0 :   switch (c)
    3259                 :             :     {
    3260                 :           0 :       case M2MetaError_unsetColor:
    3261                 :           0 :         s = DynamicStrings_InitString ((const char *) "<unset>", 7);
    3262                 :           0 :         break;
    3263                 :             : 
    3264                 :           0 :       case M2MetaError_noColor:
    3265                 :           0 :         s = DynamicStrings_InitString ((const char *) "<nocol>", 7);
    3266                 :           0 :         stop ();
    3267                 :           0 :         break;
    3268                 :             : 
    3269                 :           0 :       case M2MetaError_quoteColor:
    3270                 :           0 :         s = DynamicStrings_InitString ((const char *) "<quote>", 7);
    3271                 :           0 :         break;
    3272                 :             : 
    3273                 :           0 :       case M2MetaError_filenameColor:
    3274                 :           0 :         s = DynamicStrings_InitString ((const char *) "<filename>", 10);
    3275                 :           0 :         break;
    3276                 :             : 
    3277                 :           0 :       case M2MetaError_errorColor:
    3278                 :           0 :         s = DynamicStrings_InitString ((const char *) "<error>", 7);
    3279                 :           0 :         break;
    3280                 :             : 
    3281                 :           0 :       case M2MetaError_warningColor:
    3282                 :           0 :         s = DynamicStrings_InitString ((const char *) "<warn>", 6);
    3283                 :           0 :         break;
    3284                 :             : 
    3285                 :           0 :       case M2MetaError_noteColor:
    3286                 :           0 :         s = DynamicStrings_InitString ((const char *) "<note>", 6);
    3287                 :           0 :         break;
    3288                 :             : 
    3289                 :           0 :       case M2MetaError_keywordColor:
    3290                 :           0 :         s = DynamicStrings_InitString ((const char *) "<key>", 5);
    3291                 :           0 :         break;
    3292                 :             : 
    3293                 :           0 :       case M2MetaError_locusColor:
    3294                 :           0 :         s = DynamicStrings_InitString ((const char *) "<locus>", 7);
    3295                 :           0 :         break;
    3296                 :             : 
    3297                 :           0 :       case M2MetaError_insertColor:
    3298                 :           0 :         s = DynamicStrings_InitString ((const char *) "<insert>", 8);
    3299                 :           0 :         break;
    3300                 :             : 
    3301                 :           0 :       case M2MetaError_deleteColor:
    3302                 :           0 :         s = DynamicStrings_InitString ((const char *) "<delete>", 8);
    3303                 :           0 :         break;
    3304                 :             : 
    3305                 :           0 :       case M2MetaError_typeColor:
    3306                 :           0 :         s = DynamicStrings_InitString ((const char *) "<type>", 6);
    3307                 :           0 :         break;
    3308                 :             : 
    3309                 :           0 :       case M2MetaError_range1Color:
    3310                 :           0 :         s = DynamicStrings_InitString ((const char *) "<range1>", 8);
    3311                 :           0 :         break;
    3312                 :             : 
    3313                 :           0 :       case M2MetaError_range2Color:
    3314                 :           0 :         s = DynamicStrings_InitString ((const char *) "<range2>", 8);
    3315                 :           0 :         break;
    3316                 :             : 
    3317                 :             : 
    3318                 :           0 :       default:
    3319                 :           0 :         CaseException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/M2MetaError.def", 20, 1);
    3320                 :           0 :         __builtin_unreachable ();
    3321                 :             :     }
    3322                 :           0 :   (*eb).out = DynamicStrings_ConCat ((*eb).out, DynamicStrings_Mark (s));
    3323                 :           0 : }
    3324                 :             : 
    3325                 :             : 
    3326                 :             : /*
    3327                 :             :    emitColor - adds the appropriate color string to the output string.
    3328                 :             : */
    3329                 :             : 
    3330                 :       39213 : static void emitColor (M2MetaError_errorBlock *eb, M2MetaError_colorType c)
    3331                 :             : {
    3332                 :       39213 :   if (ColorDebug)
    3333                 :             :     {
    3334                 :             :       emitColorTag (eb, c);
    3335                 :             :     }
    3336                 :             :   else
    3337                 :             :     {
    3338                 :       39213 :       emitColorGCC (eb, c);
    3339                 :             :     }
    3340                 :           0 : }
    3341                 :             : 
    3342                 :             : 
    3343                 :             : /*
    3344                 :             :    openQuote -
    3345                 :             : */
    3346                 :             : 
    3347                 :       29670 : static DynamicStrings_String openQuote (DynamicStrings_String s)
    3348                 :             : {
    3349                 :       29670 :   if (ColorDebug)
    3350                 :             :     {
    3351                 :             :       return DynamicStrings_ConCat (s, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "<openquote>", 11)));
    3352                 :             :     }
    3353                 :             :   else
    3354                 :             :     {
    3355                 :       29670 :       return M2ColorString_quoteOpen (s);
    3356                 :             :     }
    3357                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    3358                 :             :   __builtin_unreachable ();
    3359                 :             : }
    3360                 :             : 
    3361                 :             : 
    3362                 :             : /*
    3363                 :             :    closeQuote -
    3364                 :             : */
    3365                 :             : 
    3366                 :       29670 : static DynamicStrings_String closeQuote (DynamicStrings_String s)
    3367                 :             : {
    3368                 :       29670 :   if (ColorDebug)
    3369                 :             :     {
    3370                 :             :       return DynamicStrings_ConCat (s, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "<closequote>", 12)));
    3371                 :             :     }
    3372                 :             :   else
    3373                 :             :     {
    3374                 :       29670 :       return M2ColorString_quoteClose (s);
    3375                 :             :     }
    3376                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    3377                 :             :   __builtin_unreachable ();
    3378                 :             : }
    3379                 :             : 
    3380                 :             : 
    3381                 :             : /*
    3382                 :             :    colorEnd -
    3383                 :             : */
    3384                 :             : 
    3385                 :       67745 : static DynamicStrings_String colorEnd (DynamicStrings_String s)
    3386                 :             : {
    3387                 :       67745 :   stop ();
    3388                 :       67745 :   if (ColorDebug)
    3389                 :             :     {
    3390                 :             :       return DynamicStrings_ConCat (s, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "<nocol>", 7)));
    3391                 :             :     }
    3392                 :             :   else
    3393                 :             :     {
    3394                 :       67745 :       return M2ColorString_endColor (s);
    3395                 :             :     }
    3396                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    3397                 :             :   __builtin_unreachable ();
    3398                 :             : }
    3399                 :             : 
    3400                 :             : 
    3401                 :             : /*
    3402                 :             :    copyChar - copies a character from in string to out string.
    3403                 :             : */
    3404                 :             : 
    3405                 :     1512503 : static void copyChar (M2MetaError_errorBlock *eb)
    3406                 :             : {
    3407                 :     1512503 :   if ((*eb).ini < (*eb).len)
    3408                 :             :     {
    3409                 :     1512503 :       flushColor (eb);
    3410                 :     1512503 :       checkMe ();
    3411                 :     1512503 :       (*eb).glyph = true;
    3412                 :     1512503 :       (*eb).out = x ((*eb).out, DynamicStrings_ConCatChar ((*eb).out, DynamicStrings_char ((*eb).in, (*eb).ini)));
    3413                 :             :     }
    3414                 :     1512503 : }
    3415                 :             : 
    3416                 :             : 
    3417                 :             : /*
    3418                 :             :    copyKeywordChar - copies a character from in string to out string
    3419                 :             :                      it will convert the character to lower case if the
    3420                 :             :                      -fm2-lower-case option was specified.
    3421                 :             : */
    3422                 :             : 
    3423                 :        5064 : static void copyKeywordChar (M2MetaError_errorBlock *eb)
    3424                 :             : {
    3425                 :        5064 :   char ch;
    3426                 :             : 
    3427                 :        5064 :   if ((*eb).ini < (*eb).len)
    3428                 :             :     {
    3429                 :        5064 :       flushColor (eb);
    3430                 :        5064 :       ch = DynamicStrings_char ((*eb).in, (*eb).ini);
    3431                 :        5064 :       if (M2Options_LowerCaseKeywords)
    3432                 :             :         {
    3433                 :           0 :           ch = StrCase_Lower (ch);
    3434                 :             :         }
    3435                 :        5064 :       (*eb).glyph = true;
    3436                 :        5064 :       (*eb).out = x ((*eb).out, DynamicStrings_ConCatChar ((*eb).out, ch));
    3437                 :             :     }
    3438                 :        5064 : }
    3439                 :             : 
    3440                 :             : 
    3441                 :             : /*
    3442                 :             :    percent := '%' anych           % copy anych %
    3443                 :             :             =:
    3444                 :             : */
    3445                 :             : 
    3446                 :           6 : static void percent (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high)
    3447                 :             : {
    3448                 :           6 :   unsigned int sym[_sym_high+1];
    3449                 :             : 
    3450                 :             :   /* make a local copy of each unbounded array.  */
    3451                 :           6 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    3452                 :             : 
    3453                 :           6 :   if ((DynamicStrings_char ((*eb).in, (*eb).ini)) == '%')
    3454                 :             :     {
    3455                 :           6 :       (*eb).ini += 1;
    3456                 :           6 :       if ((*eb).ini < (*eb).len)
    3457                 :             :         {
    3458                 :             :           /* avoid gcc warning by using compound statement even if not strictly necessary.  */
    3459                 :           6 :           if ((DynamicStrings_char ((*eb).in, (*eb).ini)) == '<')
    3460                 :             :             {
    3461                 :             :               /* %< is a quotation symbol.  */
    3462                 :           0 :               pushColor (eb);
    3463                 :           0 :               (*eb).currentCol = M2MetaError_noColor;
    3464                 :           0 :               flushColor (eb);
    3465                 :           0 :               changeColor (eb, M2MetaError_quoteColor);
    3466                 :           0 :               (*eb).endCol = M2MetaError_quoteColor;  /* the openQuote will change the color.  */
    3467                 :             :               /* OutGlyphS performs a flush and we are emitting the open quote glyph.  */
    3468                 :           0 :               OutGlyphS (eb, openQuote (DynamicStrings_InitString ((const char *) "", 0)));
    3469                 :             :             }
    3470                 :           6 :           else if ((DynamicStrings_char ((*eb).in, (*eb).ini)) == '>')
    3471                 :             :             {
    3472                 :             :               /* avoid dangling else.  */
    3473                 :           0 :               OutGlyphS (eb, closeQuote (DynamicStrings_InitString ((const char *) "", 0)));
    3474                 :           0 :               (*eb).endCol = M2MetaError_noColor;  /* closeQuote also turns off color.  */
    3475                 :           0 :               popColor (eb);  /* closeQuote also turns off color.  */
    3476                 :             :             }
    3477                 :             :           else
    3478                 :             :             {
    3479                 :             :               /* avoid dangling else.  */
    3480                 :           6 :               copyChar (eb);
    3481                 :             :             }
    3482                 :             :         }
    3483                 :             :     }
    3484                 :           6 : }
    3485                 :             : 
    3486                 :             : 
    3487                 :             : /*
    3488                 :             :    lbra := '{' [ '!' ] percenttoken '}' =:
    3489                 :             : */
    3490                 :             : 
    3491                 :       41938 : static void lbra (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high)
    3492                 :             : {
    3493                 :       41938 :   unsigned int sym[_sym_high+1];
    3494                 :             : 
    3495                 :             :   /* make a local copy of each unbounded array.  */
    3496                 :       41938 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    3497                 :             : 
    3498                 :       41938 :   if ((DynamicStrings_char ((*eb).in, (*eb).ini)) == '{')
    3499                 :             :     {
    3500                 :       41938 :       (*eb).positive = true;
    3501                 :       41938 :       (*eb).ini += 1;
    3502                 :       41938 :       if ((DynamicStrings_char ((*eb).in, (*eb).ini)) == '!')
    3503                 :             :         {
    3504                 :         126 :           (*eb).positive = false;
    3505                 :         126 :           (*eb).ini += 1;
    3506                 :             :         }
    3507                 :       41938 :       if ((DynamicStrings_char ((*eb).in, (*eb).ini)) != '%')
    3508                 :             :         {
    3509                 :           0 :           InternalFormat ((*eb), (const char *) "expecting to see %", 18, 2213);
    3510                 :             :         }
    3511                 :       41938 :       percenttoken (eb, (const unsigned int *) sym, _sym_high);
    3512                 :       41938 :       if (((*eb).ini < (*eb).len) && ((DynamicStrings_char ((*eb).in, (*eb).ini)) != '}'))
    3513                 :             :         {
    3514                 :           0 :           InternalFormat ((*eb), (const char *) "expecting to see }", 18, 2218);
    3515                 :             :         }
    3516                 :             :     }
    3517                 :       41938 : }
    3518                 :             : 
    3519                 :             : 
    3520                 :             : /*
    3521                 :             :    lbra := '{' [ '!' ] percenttoken '}' =:
    3522                 :             : */
    3523                 :             : 
    3524                 :           0 : static void stop (void)
    3525                 :             : {
    3526                 :           0 : }
    3527                 :             : 
    3528                 :             : 
    3529                 :             : /*
    3530                 :             :    lbra := '{' [ '!' ] percenttoken '}' =:
    3531                 :             : */
    3532                 :             : 
    3533                 :           0 : static void checkMe (void)
    3534                 :             : {
    3535                 :           0 : }
    3536                 :             : 
    3537                 :             : 
    3538                 :             : /*
    3539                 :             :    dumpErrorType -
    3540                 :             : */
    3541                 :             : 
    3542                 :           0 : static void dumpErrorType (M2MetaError_errorType e)
    3543                 :             : {
    3544                 :           0 :   switch (e)
    3545                 :             :     {
    3546                 :           0 :       case M2MetaError_none:
    3547                 :           0 :         M2Printf_printf0 ((const char *) "none", 4);
    3548                 :           0 :         break;
    3549                 :             : 
    3550                 :           0 :       case M2MetaError_error:
    3551                 :           0 :         M2Printf_printf0 ((const char *) "error", 5);
    3552                 :           0 :         break;
    3553                 :             : 
    3554                 :           0 :       case M2MetaError_warning:
    3555                 :           0 :         M2Printf_printf0 ((const char *) "warning", 7);
    3556                 :           0 :         break;
    3557                 :             : 
    3558                 :           0 :       case M2MetaError_note:
    3559                 :           0 :         M2Printf_printf0 ((const char *) "note", 4);
    3560                 :           0 :         break;
    3561                 :             : 
    3562                 :           0 :       case M2MetaError_chained:
    3563                 :           0 :         M2Printf_printf0 ((const char *) "chained", 7);
    3564                 :           0 :         break;
    3565                 :             : 
    3566                 :           0 :       case M2MetaError_aborta:
    3567                 :           0 :         M2Printf_printf0 ((const char *) "abort", 5);
    3568                 :           0 :         break;
    3569                 :             : 
    3570                 :             : 
    3571                 :           0 :       default:
    3572                 :           0 :         CaseException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/M2MetaError.def", 20, 1);
    3573                 :           0 :         __builtin_unreachable ();
    3574                 :             :     }
    3575                 :           0 : }
    3576                 :             : 
    3577                 :             : 
    3578                 :             : /*
    3579                 :             :    dumpColorType -
    3580                 :             : */
    3581                 :             : 
    3582                 :           0 : static void dumpColorType (M2MetaError_colorType c)
    3583                 :             : {
    3584                 :           0 :   switch (c)
    3585                 :             :     {
    3586                 :           0 :       case M2MetaError_unsetColor:
    3587                 :           0 :         M2Printf_printf0 ((const char *) "unsetColor", 10);
    3588                 :           0 :         break;
    3589                 :             : 
    3590                 :           0 :       case M2MetaError_noColor:
    3591                 :           0 :         M2Printf_printf0 ((const char *) "noColor", 7);
    3592                 :           0 :         break;
    3593                 :             : 
    3594                 :           0 :       case M2MetaError_quoteColor:
    3595                 :           0 :         M2Printf_printf0 ((const char *) "quoteColor", 10);
    3596                 :           0 :         break;
    3597                 :             : 
    3598                 :           0 :       case M2MetaError_filenameColor:
    3599                 :           0 :         M2Printf_printf0 ((const char *) "filenameColor", 13);
    3600                 :           0 :         break;
    3601                 :             : 
    3602                 :           0 :       case M2MetaError_errorColor:
    3603                 :           0 :         M2Printf_printf0 ((const char *) "errorColor", 10);
    3604                 :           0 :         break;
    3605                 :             : 
    3606                 :           0 :       case M2MetaError_warningColor:
    3607                 :           0 :         M2Printf_printf0 ((const char *) "warningColor", 12);
    3608                 :           0 :         break;
    3609                 :             : 
    3610                 :           0 :       case M2MetaError_noteColor:
    3611                 :           0 :         M2Printf_printf0 ((const char *) "noteColor", 9);
    3612                 :           0 :         break;
    3613                 :             : 
    3614                 :           0 :       case M2MetaError_keywordColor:
    3615                 :           0 :         M2Printf_printf0 ((const char *) "keywordColor", 12);
    3616                 :           0 :         break;
    3617                 :             : 
    3618                 :           0 :       case M2MetaError_locusColor:
    3619                 :           0 :         M2Printf_printf0 ((const char *) "locusColor", 10);
    3620                 :           0 :         break;
    3621                 :             : 
    3622                 :           0 :       case M2MetaError_insertColor:
    3623                 :           0 :         M2Printf_printf0 ((const char *) "insertColor", 11);
    3624                 :           0 :         break;
    3625                 :             : 
    3626                 :           0 :       case M2MetaError_deleteColor:
    3627                 :           0 :         M2Printf_printf0 ((const char *) "deleteColor", 11);
    3628                 :           0 :         break;
    3629                 :             : 
    3630                 :           0 :       case M2MetaError_typeColor:
    3631                 :           0 :         M2Printf_printf0 ((const char *) "typeColor", 9);
    3632                 :           0 :         break;
    3633                 :             : 
    3634                 :           0 :       case M2MetaError_range1Color:
    3635                 :           0 :         M2Printf_printf0 ((const char *) "range1Color", 11);
    3636                 :           0 :         break;
    3637                 :             : 
    3638                 :           0 :       case M2MetaError_range2Color:
    3639                 :           0 :         M2Printf_printf0 ((const char *) "range2Color", 11);
    3640                 :           0 :         break;
    3641                 :             : 
    3642                 :             : 
    3643                 :           0 :       default:
    3644                 :           0 :         CaseException ("/home/worker/buildworker/tiber-lcov/build/gcc/m2/gm2-compiler/M2MetaError.def", 20, 1);
    3645                 :           0 :         __builtin_unreachable ();
    3646                 :             :     }
    3647                 :           0 : }
    3648                 :             : 
    3649                 :             : 
    3650                 :             : /*
    3651                 :             :    dump -
    3652                 :             : 
    3653                 :             : */
    3654                 :             : 
    3655                 :           0 : static void dump (M2MetaError_errorBlock eb)
    3656                 :             : {
    3657                 :           0 :   char ch;
    3658                 :           0 :   unsigned int l;
    3659                 :           0 :   int i;
    3660                 :             : 
    3661                 :           0 :   l = DynamicStrings_Length (eb.out);
    3662                 :           0 :   M2Printf_printf0 ((const char *) "\\n\\nerrorBlock\\n", 16);
    3663                 :           0 :   M2Printf_printf0 ((const char *) "\\ntype      = ", 14);
    3664                 :           0 :   dumpErrorType (eb.type);
    3665                 :           0 :   M2Printf_printf1 ((const char *) "\\nout       = |%s|", 18, (const unsigned char *) &eb.out, (sizeof (eb.out)-1));
    3666                 :           0 :   M2Printf_printf1 ((const char *) "\\nin        = |%s|", 18, (const unsigned char *) &eb.in, (sizeof (eb.in)-1));
    3667                 :           0 :   M2Printf_printf1 ((const char *) "\\nLength (out) = %d", 19, (const unsigned char *) &l, (sizeof (l)-1));
    3668                 :           0 :   M2Printf_printf1 ((const char *) "\\nlen       = %d", 16, (const unsigned char *) &eb.len, (sizeof (eb.len)-1));
    3669                 :           0 :   M2Printf_printf1 ((const char *) "\\nhighplus1 = %d", 16, (const unsigned char *) &eb.highplus1, (sizeof (eb.highplus1)-1));
    3670                 :             :   /* printf1 ("
    3671                 :             :   glyph     = %d", eb.glyph) ;
    3672                 :             :    printf1 ("
    3673                 :             :   quotes    = %d", eb.quotes) ;
    3674                 :             :    printf1 ("
    3675                 :             :   positive  = %d", eb.positive) ;
    3676                 :             :   */
    3677                 :           0 :   M2Printf_printf0 ((const char *) "\\nbeginCol  = ", 14);
    3678                 :           0 :   dumpColorType (eb.beginCol);
    3679                 :           0 :   M2Printf_printf0 ((const char *) "\\nendCol    = ", 14);
    3680                 :           0 :   dumpColorType (eb.endCol);
    3681                 :           0 :   M2Printf_printf0 ((const char *) "\\ncurrentCol = ", 15);
    3682                 :           0 :   dumpColorType (eb.currentCol);
    3683                 :           0 :   M2Printf_printf1 ((const char *) "\\nini        = %d", 17, (const unsigned char *) &eb.ini, (sizeof (eb.ini)-1));
    3684                 :           0 :   if (eb.ini < eb.len)
    3685                 :             :     {
    3686                 :           0 :       ch = DynamicStrings_char (eb.in, eb.ini);
    3687                 :           0 :       M2Printf_printf1 ((const char *) "\\ncurrent char = %c", 19, (const unsigned char *) &ch, (sizeof (ch)-1));
    3688                 :           0 :       M2Printf_printf1 ((const char *) "\\n%s\\n", 6, (const unsigned char *) &eb.in, (sizeof (eb.in)-1));
    3689                 :           0 :       i = 0;
    3690                 :           0 :       while (i < eb.ini)
    3691                 :             :         {
    3692                 :           0 :           M2Printf_printf0 ((const char *) " ", 1);
    3693                 :           0 :           i += 1;
    3694                 :             :         }
    3695                 :           0 :       M2Printf_printf0 ((const char *) "^\\n", 3);
    3696                 :             :     }
    3697                 :           0 :   M2Printf_printf0 ((const char *) "\\n", 2);
    3698                 :           0 : }
    3699                 :             : 
    3700                 :             : 
    3701                 :             : /*
    3702                 :             :    ebnf := { percent
    3703                 :             :              | lbra
    3704                 :             :              | any                    % copy ch %
    3705                 :             :            }
    3706                 :             :          =:
    3707                 :             : */
    3708                 :             : 
    3709                 :       22149 : static void ebnf (M2MetaError_errorBlock *eb, const unsigned int *sym_, unsigned int _sym_high)
    3710                 :             : {
    3711                 :       22149 :   M2MetaError_errorBlock nb;
    3712                 :       22149 :   unsigned int sym[_sym_high+1];
    3713                 :             : 
    3714                 :             :   /* make a local copy of each unbounded array.  */
    3715                 :       22149 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    3716                 :             : 
    3717                 :       22149 :   if (Debugging)
    3718                 :             :     {
    3719                 :             :       M2Printf_printf0 ((const char *) "top of ebnf\\n", 13);
    3720                 :             :       dump ((*eb));
    3721                 :             :     }
    3722                 :     1578878 :   while ((*eb).ini < (*eb).len)
    3723                 :             :     {
    3724                 :     1562339 :       if (Debugging)
    3725                 :             :         {
    3726                 :             :           M2Printf_printf0 ((const char *) "while loop ebnf\\n", 17);
    3727                 :             :           dump ((*eb));
    3728                 :             :         }
    3729                 :     1562339 :       switch (DynamicStrings_char ((*eb).in, (*eb).ini))
    3730                 :             :         {
    3731                 :           0 :           case '!':
    3732                 :           0 :             (*eb).positive = ! (*eb).positive;
    3733                 :           0 :             break;
    3734                 :             : 
    3735                 :           6 :           case '%':
    3736                 :           6 :             percent (eb, (const unsigned int *) sym, _sym_high);
    3737                 :           6 :             break;
    3738                 :             : 
    3739                 :       41938 :           case '{':
    3740                 :       41938 :             push (&nb, (*eb));
    3741                 :       41938 :             lbra (&nb, (const unsigned int *) sym, _sym_high);
    3742                 :       41938 :             pop (eb, &nb);
    3743                 :       41938 :             if (((*eb).ini < (*eb).len) && ((DynamicStrings_char ((*eb).in, (*eb).ini)) != '}'))
    3744                 :             :               {
    3745                 :           0 :                 InternalFormat ((*eb), (const char *) "expecting to see }", 18, 2350);
    3746                 :             :               }
    3747                 :             :             break;
    3748                 :             : 
    3749                 :        5610 :           case '}':
    3750                 :        5610 :             return;
    3751                 :     1514785 :             break;
    3752                 :             : 
    3753                 :             : 
    3754                 :     1514785 :           default:
    3755                 :     1514785 :             if (((((IsWhite (DynamicStrings_char ((*eb).in, (*eb).ini))) && ((DynamicStrings_Length ((*eb).out)) > 0)) && (! (IsWhite (DynamicStrings_char ((*eb).out, -1))))) || (! (IsWhite (DynamicStrings_char ((*eb).in, (*eb).ini))))) && ((*eb).highplus1 > 0))
    3756                 :             :               {
    3757                 :     1512497 :                 (*eb).quotes = false;  /* copying a normal character, don't quote the result.  */
    3758                 :     1512497 :                 copyChar (eb);  /* copying a normal character, don't quote the result.  */
    3759                 :             :               }
    3760                 :             :             break;
    3761                 :             :         }
    3762                 :     1556729 :       (*eb).ini += 1;
    3763                 :             :     }
    3764                 :       16539 :   (*eb).currentCol = M2MetaError_noColor;
    3765                 :       16539 :   flushColor (eb);
    3766                 :       16539 :   if (Debugging)
    3767                 :             :     {
    3768                 :             :       M2Printf_printf0 ((const char *) "finishing ebnf\\n", 16);
    3769                 :             :       dump ((*eb));
    3770                 :             :     }
    3771                 :       22149 : }
    3772                 :             : 
    3773                 :             : 
    3774                 :             : /*
    3775                 :             :    wrapErrors -
    3776                 :             : */
    3777                 :             : 
    3778                 :         114 : static void wrapErrors (unsigned int tok, const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, const unsigned int *sym_, unsigned int _sym_high)
    3779                 :             : {
    3780                 :         114 :   M2MetaError_errorBlock eb;
    3781                 :         114 :   char m1[_m1_high+1];
    3782                 :         114 :   char m2[_m2_high+1];
    3783                 :         114 :   unsigned int sym[_sym_high+1];
    3784                 :             : 
    3785                 :             :   /* make a local copy of each unbounded array.  */
    3786                 :         114 :   memcpy (m1, m1_, _m1_high+1);
    3787                 :         114 :   memcpy (m2, m2_, _m2_high+1);
    3788                 :         114 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    3789                 :             : 
    3790                 :         114 :   initErrorBlock (&eb, DynamicStrings_InitString ((const char *) m1, _m1_high), (const unsigned int *) sym, _sym_high);
    3791                 :         114 :   ebnf (&eb, (const unsigned int *) sym, _sym_high);
    3792                 :         114 :   flushColor (&eb);
    3793                 :         114 :   defaultError (&eb, tok);
    3794                 :         114 :   lastRoot = eb.e;
    3795                 :         114 :   M2Error_ErrorString (eb.e, DynamicStrings_Dup (eb.out));
    3796                 :         114 :   killErrorBlock (&eb);
    3797                 :         114 :   initErrorBlock (&eb, DynamicStrings_InitString ((const char *) m2, _m2_high), (const unsigned int *) sym, _sym_high);
    3798                 :         114 :   eb.type = M2MetaError_chained;
    3799                 :         114 :   ebnf (&eb, (const unsigned int *) sym, _sym_high);
    3800                 :         114 :   flushColor (&eb);
    3801                 :         114 :   defaultError (&eb, tok);
    3802                 :         114 :   M2Error_ErrorString (eb.e, DynamicStrings_Dup (eb.out));
    3803                 :         114 :   killErrorBlock (&eb);
    3804                 :         114 : }
    3805                 :             : 
    3806                 :             : 
    3807                 :             : /*
    3808                 :             :    checkAbort - checks to see if the boolean flag seenAbort has been set,
    3809                 :             :                 if so it flushes all existing errors and terminates.
    3810                 :             : */
    3811                 :             : 
    3812                 :        2854 : static void checkAbort (void)
    3813                 :             : {
    3814                 :        2854 :   if (seenAbort)
    3815                 :             :     {
    3816                 :          88 :       M2Error_FlushWarnings ();
    3817                 :          88 :       M2Error_FlushErrors ();
    3818                 :             :     }
    3819                 :        2766 : }
    3820                 :             : 
    3821                 :             : 
    3822                 :             : /*
    3823                 :             :    translate -
    3824                 :             : */
    3825                 :             : 
    3826                 :           0 : static DynamicStrings_String translate (DynamicStrings_String m, DynamicStrings_String s, int *i, NameKey_Name name)
    3827                 :             : {
    3828                 :           0 :   int l;
    3829                 :           0 :   char ch;
    3830                 :             : 
    3831                 :           0 :   l = DynamicStrings_Length (m);
    3832                 :           0 :   while (((*i) >= 0) && ((*i) < l))
    3833                 :             :     {
    3834                 :           0 :       ch = DynamicStrings_char (m, (*i));
    3835                 :           0 :       if ((ch == '%') && ((*i) < l))
    3836                 :             :         {
    3837                 :           0 :           (*i) += 1;
    3838                 :           0 :           ch = DynamicStrings_char (m, (*i));
    3839                 :           0 :           (*i) += 1;
    3840                 :           0 :           if (ch == 'a')
    3841                 :             :             {
    3842                 :           0 :               s = DynamicStrings_ConCat (s, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "%<", 2)));
    3843                 :           0 :               s = DynamicStrings_ConCat (s, DynamicStrings_Mark (DynamicStrings_InitStringCharStar (NameKey_KeyToCharStar (name))));
    3844                 :           0 :               s = DynamicStrings_ConCat (s, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "%>", 2)));
    3845                 :           0 :               return s;
    3846                 :             :             }
    3847                 :           0 :           s = DynamicStrings_ConCatChar (s, '%');
    3848                 :             :         }
    3849                 :           0 :       s = DynamicStrings_ConCatChar (s, ch);
    3850                 :           0 :       (*i) += 1;
    3851                 :             :     }
    3852                 :             :   return s;
    3853                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    3854                 :             :   __builtin_unreachable ();
    3855                 :             : }
    3856                 :             : 
    3857                 :             : 
    3858                 :             : /*
    3859                 :             :    wrapString - return a string which has been formatted with the specifier codes.
    3860                 :             :                 Color is disabled.  The result string is returned.
    3861                 :             : */
    3862                 :             : 
    3863                 :       13463 : static DynamicStrings_String wrapString (DynamicStrings_String m, const unsigned int *sym_, unsigned int _sym_high)
    3864                 :             : {
    3865                 :       13463 :   M2MetaError_errorBlock eb;
    3866                 :       13463 :   DynamicStrings_String s;
    3867                 :       13463 :   bool old;
    3868                 :       13463 :   unsigned int sym[_sym_high+1];
    3869                 :             : 
    3870                 :             :   /* make a local copy of each unbounded array.  */
    3871                 :       13463 :   memcpy (sym, sym_, (_sym_high+1) * sizeof (unsigned int));
    3872                 :             : 
    3873                 :       26926 :   old = M2ColorString_SetEnableColor (false);
    3874                 :       13463 :   initErrorBlock (&eb, DynamicStrings_Dup (m), (const unsigned int *) sym, _sym_high);
    3875                 :       13463 :   eb.useError = false;
    3876                 :       13463 :   ebnf (&eb, (const unsigned int *) sym, _sym_high);
    3877                 :       13463 :   flushColor (&eb);
    3878                 :       13463 :   s = DynamicStrings_Dup (eb.out);
    3879                 :       13463 :   killErrorBlock (&eb);
    3880                 :       13463 :   old = M2ColorString_SetEnableColor (old);
    3881                 :       13463 :   return s;
    3882                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    3883                 :             :   __builtin_unreachable ();
    3884                 :       13463 : }
    3885                 :             : 
    3886                 :           0 : extern "C" void M2MetaError_MetaError0 (const char *m_, unsigned int _m_high)
    3887                 :             : {
    3888                 :           0 :   char m[_m_high+1];
    3889                 :             : 
    3890                 :             :   /* make a local copy of each unbounded array.  */
    3891                 :           0 :   memcpy (m, m_, _m_high+1);
    3892                 :             : 
    3893                 :           0 :   M2MetaError_MetaErrorT0 (M2LexBuf_GetTokenNo (), (const char *) m, _m_high);
    3894                 :           0 : }
    3895                 :             : 
    3896                 :         412 : extern "C" void M2MetaError_MetaError1 (const char *m_, unsigned int _m_high, unsigned int s)
    3897                 :             : {
    3898                 :         412 :   char m[_m_high+1];
    3899                 :             : 
    3900                 :             :   /* make a local copy of each unbounded array.  */
    3901                 :         412 :   memcpy (m, m_, _m_high+1);
    3902                 :             : 
    3903                 :         412 :   M2MetaError_MetaErrorT1 (M2LexBuf_GetTokenNo (), (const char *) m, _m_high, s);
    3904                 :         412 : }
    3905                 :             : 
    3906                 :          18 : extern "C" void M2MetaError_MetaError2 (const char *m_, unsigned int _m_high, unsigned int s1, unsigned int s2)
    3907                 :             : {
    3908                 :          18 :   char m[_m_high+1];
    3909                 :             : 
    3910                 :             :   /* make a local copy of each unbounded array.  */
    3911                 :          18 :   memcpy (m, m_, _m_high+1);
    3912                 :             : 
    3913                 :          18 :   M2MetaError_MetaErrorT2 (M2LexBuf_GetTokenNo (), (const char *) m, _m_high, s1, s2);
    3914                 :          18 : }
    3915                 :             : 
    3916                 :           0 : extern "C" void M2MetaError_MetaError3 (const char *m_, unsigned int _m_high, unsigned int s1, unsigned int s2, unsigned int s3)
    3917                 :             : {
    3918                 :           0 :   char m[_m_high+1];
    3919                 :             : 
    3920                 :             :   /* make a local copy of each unbounded array.  */
    3921                 :           0 :   memcpy (m, m_, _m_high+1);
    3922                 :             : 
    3923                 :           0 :   M2MetaError_MetaErrorT3 (M2LexBuf_GetTokenNo (), (const char *) m, _m_high, s1, s2, s3);
    3924                 :           0 : }
    3925                 :             : 
    3926                 :           0 : extern "C" void M2MetaError_MetaError4 (const char *m_, unsigned int _m_high, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int s4)
    3927                 :             : {
    3928                 :           0 :   char m[_m_high+1];
    3929                 :             : 
    3930                 :             :   /* make a local copy of each unbounded array.  */
    3931                 :           0 :   memcpy (m, m_, _m_high+1);
    3932                 :             : 
    3933                 :           0 :   M2MetaError_MetaErrorT4 (M2LexBuf_GetTokenNo (), (const char *) m, _m_high, s1, s2, s3, s4);
    3934                 :           0 : }
    3935                 :             : 
    3936                 :             : 
    3937                 :             : /*
    3938                 :             :    wrapErrors -
    3939                 :             : */
    3940                 :             : 
    3941                 :          18 : extern "C" void M2MetaError_MetaErrors1 (const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, unsigned int s)
    3942                 :             : {
    3943                 :          18 :   char m1[_m1_high+1];
    3944                 :          18 :   char m2[_m2_high+1];
    3945                 :             : 
    3946                 :             :   /* make a local copy of each unbounded array.  */
    3947                 :          18 :   memcpy (m1, m1_, _m1_high+1);
    3948                 :          18 :   memcpy (m2, m2_, _m2_high+1);
    3949                 :             : 
    3950                 :          18 :   M2MetaError_MetaErrorsT1 (M2LexBuf_GetTokenNo (), (const char *) m1, _m1_high, (const char *) m2, _m2_high, s);
    3951                 :          18 : }
    3952                 :             : 
    3953                 :             : 
    3954                 :             : /*
    3955                 :             :    wrapErrors -
    3956                 :             : */
    3957                 :             : 
    3958                 :           6 : extern "C" void M2MetaError_MetaErrors2 (const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, unsigned int s1, unsigned int s2)
    3959                 :             : {
    3960                 :           6 :   char m1[_m1_high+1];
    3961                 :           6 :   char m2[_m2_high+1];
    3962                 :             : 
    3963                 :             :   /* make a local copy of each unbounded array.  */
    3964                 :           6 :   memcpy (m1, m1_, _m1_high+1);
    3965                 :           6 :   memcpy (m2, m2_, _m2_high+1);
    3966                 :             : 
    3967                 :           6 :   M2MetaError_MetaErrorsT2 (M2LexBuf_GetTokenNo (), (const char *) m1, _m1_high, (const char *) m2, _m2_high, s1, s2);
    3968                 :           6 : }
    3969                 :             : 
    3970                 :             : 
    3971                 :             : /*
    3972                 :             :    wrapErrors -
    3973                 :             : */
    3974                 :             : 
    3975                 :           0 : extern "C" void M2MetaError_MetaErrors3 (const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, unsigned int s1, unsigned int s2, unsigned int s3)
    3976                 :             : {
    3977                 :           0 :   char m1[_m1_high+1];
    3978                 :           0 :   char m2[_m2_high+1];
    3979                 :             : 
    3980                 :             :   /* make a local copy of each unbounded array.  */
    3981                 :           0 :   memcpy (m1, m1_, _m1_high+1);
    3982                 :           0 :   memcpy (m2, m2_, _m2_high+1);
    3983                 :             : 
    3984                 :           0 :   M2MetaError_MetaErrorsT3 (M2LexBuf_GetTokenNo (), (const char *) m1, _m1_high, (const char *) m2, _m2_high, s1, s2, s3);
    3985                 :           0 : }
    3986                 :             : 
    3987                 :             : 
    3988                 :             : /*
    3989                 :             :    wrapErrors -
    3990                 :             : */
    3991                 :             : 
    3992                 :           0 : extern "C" void M2MetaError_MetaErrors4 (const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int s4)
    3993                 :             : {
    3994                 :           0 :   char m1[_m1_high+1];
    3995                 :           0 :   char m2[_m2_high+1];
    3996                 :             : 
    3997                 :             :   /* make a local copy of each unbounded array.  */
    3998                 :           0 :   memcpy (m1, m1_, _m1_high+1);
    3999                 :           0 :   memcpy (m2, m2_, _m2_high+1);
    4000                 :             : 
    4001                 :           0 :   M2MetaError_MetaErrorsT4 (M2LexBuf_GetTokenNo (), (const char *) m1, _m1_high, (const char *) m2, _m2_high, s1, s2, s3, s4);
    4002                 :           0 : }
    4003                 :             : 
    4004                 :          52 : extern "C" void M2MetaError_MetaErrorT0 (unsigned int tok, const char *m_, unsigned int _m_high)
    4005                 :             : {
    4006                 :          52 :   char m[_m_high+1];
    4007                 :             : 
    4008                 :             :   /* make a local copy of each unbounded array.  */
    4009                 :          52 :   memcpy (m, m_, _m_high+1);
    4010                 :             : 
    4011                 :          52 :   M2MetaError_MetaErrorStringT0 (tok, DynamicStrings_InitString ((const char *) m, _m_high));
    4012                 :          52 : }
    4013                 :             : 
    4014                 :        1152 : extern "C" void M2MetaError_MetaErrorT1 (unsigned int tok, const char *m_, unsigned int _m_high, unsigned int s)
    4015                 :             : {
    4016                 :        1152 :   char m[_m_high+1];
    4017                 :             : 
    4018                 :             :   /* make a local copy of each unbounded array.  */
    4019                 :        1152 :   memcpy (m, m_, _m_high+1);
    4020                 :             : 
    4021                 :        1152 :   M2MetaError_MetaErrorStringT1 (tok, DynamicStrings_InitString ((const char *) m, _m_high), s);
    4022                 :        1152 : }
    4023                 :             : 
    4024                 :         531 : extern "C" void M2MetaError_MetaErrorT2 (unsigned int tok, const char *m_, unsigned int _m_high, unsigned int s1, unsigned int s2)
    4025                 :             : {
    4026                 :         531 :   char m[_m_high+1];
    4027                 :             : 
    4028                 :             :   /* make a local copy of each unbounded array.  */
    4029                 :         531 :   memcpy (m, m_, _m_high+1);
    4030                 :             : 
    4031                 :         531 :   M2MetaError_MetaErrorStringT2 (tok, DynamicStrings_InitString ((const char *) m, _m_high), s1, s2);
    4032                 :         531 : }
    4033                 :             : 
    4034                 :          60 : extern "C" void M2MetaError_MetaErrorT3 (unsigned int tok, const char *m_, unsigned int _m_high, unsigned int s1, unsigned int s2, unsigned int s3)
    4035                 :             : {
    4036                 :          60 :   char m[_m_high+1];
    4037                 :             : 
    4038                 :             :   /* make a local copy of each unbounded array.  */
    4039                 :          60 :   memcpy (m, m_, _m_high+1);
    4040                 :             : 
    4041                 :          60 :   M2MetaError_MetaErrorStringT3 (tok, DynamicStrings_InitString ((const char *) m, _m_high), s1, s2, s3);
    4042                 :          60 : }
    4043                 :             : 
    4044                 :          12 : extern "C" void M2MetaError_MetaErrorT4 (unsigned int tok, const char *m_, unsigned int _m_high, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int s4)
    4045                 :             : {
    4046                 :          12 :   char m[_m_high+1];
    4047                 :             : 
    4048                 :             :   /* make a local copy of each unbounded array.  */
    4049                 :          12 :   memcpy (m, m_, _m_high+1);
    4050                 :             : 
    4051                 :          12 :   M2MetaError_MetaErrorStringT4 (tok, DynamicStrings_InitString ((const char *) m, _m_high), s1, s2, s3, s4);
    4052                 :          12 : }
    4053                 :             : 
    4054                 :             : 
    4055                 :             : /*
    4056                 :             :    wrapErrors -
    4057                 :             : */
    4058                 :             : 
    4059                 :          18 : extern "C" void M2MetaError_MetaErrorsT1 (unsigned int tok, const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, unsigned int s)
    4060                 :             : {
    4061                 :          18 :   typedef struct MetaErrorsT1__T4_a MetaErrorsT1__T4;
    4062                 :             : 
    4063                 :          18 :   struct MetaErrorsT1__T4_a { unsigned int array[0+1]; };
    4064                 :          18 :   MetaErrorsT1__T4 sym;
    4065                 :          18 :   char m1[_m1_high+1];
    4066                 :          18 :   char m2[_m2_high+1];
    4067                 :             : 
    4068                 :             :   /* make a local copy of each unbounded array.  */
    4069                 :          18 :   memcpy (m1, m1_, _m1_high+1);
    4070                 :          18 :   memcpy (m2, m2_, _m2_high+1);
    4071                 :             : 
    4072                 :          18 :   sym.array[0] = s;
    4073                 :          18 :   wrapErrors (tok, (const char *) m1, _m1_high, (const char *) m2, _m2_high, (const unsigned int *) &sym.array[0], 0);
    4074                 :          18 : }
    4075                 :             : 
    4076                 :             : 
    4077                 :             : /*
    4078                 :             :    wrapErrors -
    4079                 :             : */
    4080                 :             : 
    4081                 :          96 : extern "C" void M2MetaError_MetaErrorsT2 (unsigned int tok, const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, unsigned int s1, unsigned int s2)
    4082                 :             : {
    4083                 :          96 :   typedef struct MetaErrorsT2__T5_a MetaErrorsT2__T5;
    4084                 :             : 
    4085                 :          96 :   struct MetaErrorsT2__T5_a { unsigned int array[1+1]; };
    4086                 :          96 :   MetaErrorsT2__T5 sym;
    4087                 :          96 :   char m1[_m1_high+1];
    4088                 :          96 :   char m2[_m2_high+1];
    4089                 :             : 
    4090                 :             :   /* make a local copy of each unbounded array.  */
    4091                 :          96 :   memcpy (m1, m1_, _m1_high+1);
    4092                 :          96 :   memcpy (m2, m2_, _m2_high+1);
    4093                 :             : 
    4094                 :          96 :   sym.array[0] = s1;
    4095                 :          96 :   sym.array[1] = s2;
    4096                 :          96 :   wrapErrors (tok, (const char *) m1, _m1_high, (const char *) m2, _m2_high, (const unsigned int *) &sym.array[0], 1);
    4097                 :          96 : }
    4098                 :             : 
    4099                 :             : 
    4100                 :             : /*
    4101                 :             :    wrapErrors -
    4102                 :             : */
    4103                 :             : 
    4104                 :           0 : extern "C" void M2MetaError_MetaErrorsT3 (unsigned int tok, const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, unsigned int s1, unsigned int s2, unsigned int s3)
    4105                 :             : {
    4106                 :           0 :   typedef struct MetaErrorsT3__T6_a MetaErrorsT3__T6;
    4107                 :             : 
    4108                 :           0 :   struct MetaErrorsT3__T6_a { unsigned int array[2+1]; };
    4109                 :           0 :   MetaErrorsT3__T6 sym;
    4110                 :           0 :   char m1[_m1_high+1];
    4111                 :           0 :   char m2[_m2_high+1];
    4112                 :             : 
    4113                 :             :   /* make a local copy of each unbounded array.  */
    4114                 :           0 :   memcpy (m1, m1_, _m1_high+1);
    4115                 :           0 :   memcpy (m2, m2_, _m2_high+1);
    4116                 :             : 
    4117                 :           0 :   sym.array[0] = s1;
    4118                 :           0 :   sym.array[1] = s2;
    4119                 :           0 :   sym.array[2] = s3;
    4120                 :           0 :   wrapErrors (tok, (const char *) m1, _m1_high, (const char *) m2, _m2_high, (const unsigned int *) &sym.array[0], 2);
    4121                 :           0 : }
    4122                 :             : 
    4123                 :             : 
    4124                 :             : /*
    4125                 :             :    wrapErrors -
    4126                 :             : */
    4127                 :             : 
    4128                 :           0 : extern "C" void M2MetaError_MetaErrorsT4 (unsigned int tok, const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int s4)
    4129                 :             : {
    4130                 :           0 :   typedef struct MetaErrorsT4__T7_a MetaErrorsT4__T7;
    4131                 :             : 
    4132                 :           0 :   struct MetaErrorsT4__T7_a { unsigned int array[3+1]; };
    4133                 :           0 :   MetaErrorsT4__T7 sym;
    4134                 :           0 :   char m1[_m1_high+1];
    4135                 :           0 :   char m2[_m2_high+1];
    4136                 :             : 
    4137                 :             :   /* make a local copy of each unbounded array.  */
    4138                 :           0 :   memcpy (m1, m1_, _m1_high+1);
    4139                 :           0 :   memcpy (m2, m2_, _m2_high+1);
    4140                 :             : 
    4141                 :           0 :   sym.array[0] = s1;
    4142                 :           0 :   sym.array[1] = s2;
    4143                 :           0 :   sym.array[2] = s3;
    4144                 :           0 :   sym.array[3] = s4;
    4145                 :           0 :   wrapErrors (tok, (const char *) m1, _m1_high, (const char *) m2, _m2_high, (const unsigned int *) &sym.array[0], 3);
    4146                 :           0 : }
    4147                 :             : 
    4148                 :             : 
    4149                 :             : /*
    4150                 :             :    wrapErrors -
    4151                 :             : */
    4152                 :             : 
    4153                 :           0 : extern "C" void M2MetaError_MetaErrorString0 (DynamicStrings_String m)
    4154                 :             : {
    4155                 :           0 :   M2MetaError_MetaErrorStringT0 (M2LexBuf_GetTokenNo (), m);
    4156                 :           0 : }
    4157                 :             : 
    4158                 :             : 
    4159                 :             : /*
    4160                 :             :    wrapErrors -
    4161                 :             : */
    4162                 :             : 
    4163                 :           0 : extern "C" void M2MetaError_MetaErrorString1 (DynamicStrings_String m, unsigned int s)
    4164                 :             : {
    4165                 :           0 :   M2MetaError_MetaErrorStringT1 (M2LexBuf_GetTokenNo (), m, s);
    4166                 :           0 : }
    4167                 :             : 
    4168                 :             : 
    4169                 :             : /*
    4170                 :             :    wrapErrors -
    4171                 :             : */
    4172                 :             : 
    4173                 :           0 : extern "C" void M2MetaError_MetaErrorString2 (DynamicStrings_String m, unsigned int s1, unsigned int s2)
    4174                 :             : {
    4175                 :           0 :   M2MetaError_MetaErrorStringT2 (M2LexBuf_GetTokenNo (), m, s1, s2);
    4176                 :           0 : }
    4177                 :             : 
    4178                 :             : 
    4179                 :             : /*
    4180                 :             :    wrapErrors -
    4181                 :             : */
    4182                 :             : 
    4183                 :         132 : extern "C" void M2MetaError_MetaErrorString3 (DynamicStrings_String m, unsigned int s1, unsigned int s2, unsigned int s3)
    4184                 :             : {
    4185                 :         132 :   M2MetaError_MetaErrorStringT3 (M2LexBuf_GetTokenNo (), m, s1, s2, s3);
    4186                 :         132 : }
    4187                 :             : 
    4188                 :             : 
    4189                 :             : /*
    4190                 :             :    wrapErrors -
    4191                 :             : */
    4192                 :             : 
    4193                 :           0 : extern "C" void M2MetaError_MetaErrorString4 (DynamicStrings_String m, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int s4)
    4194                 :             : {
    4195                 :           0 :   M2MetaError_MetaErrorStringT4 (M2LexBuf_GetTokenNo (), m, s1, s2, s3, s4);
    4196                 :           0 : }
    4197                 :             : 
    4198                 :         424 : extern "C" void M2MetaError_MetaErrorStringT0 (unsigned int tok, DynamicStrings_String m)
    4199                 :             : {
    4200                 :         424 :   typedef struct MetaErrorStringT0__T8_a MetaErrorStringT0__T8;
    4201                 :             : 
    4202                 :         424 :   struct MetaErrorStringT0__T8_a { unsigned int array[0+1]; };
    4203                 :         424 :   M2MetaError_errorBlock eb;
    4204                 :         424 :   MetaErrorStringT0__T8 sym;
    4205                 :             : 
    4206                 :         424 :   sym.array[0] = SymbolTable_NulSym;
    4207                 :         424 :   initErrorBlock (&eb, m, (const unsigned int *) &sym.array[0], 0);
    4208                 :         424 :   ebnf (&eb, (const unsigned int *) &sym.array[0], 0);
    4209                 :         424 :   flushColor (&eb);
    4210                 :         424 :   defaultError (&eb, tok);
    4211                 :         424 :   M2Error_ErrorString (eb.e, DynamicStrings_Dup (eb.out));
    4212                 :         424 :   killErrorBlock (&eb);
    4213                 :         424 :   checkAbort ();
    4214                 :         412 : }
    4215                 :             : 
    4216                 :        1616 : extern "C" void M2MetaError_MetaErrorStringT1 (unsigned int tok, DynamicStrings_String m, unsigned int s)
    4217                 :             : {
    4218                 :        1616 :   typedef struct MetaErrorStringT1__T9_a MetaErrorStringT1__T9;
    4219                 :             : 
    4220                 :        1616 :   struct MetaErrorStringT1__T9_a { unsigned int array[0+1]; };
    4221                 :        1616 :   M2MetaError_errorBlock eb;
    4222                 :        1616 :   MetaErrorStringT1__T9 sym;
    4223                 :             : 
    4224                 :        1616 :   sym.array[0] = s;
    4225                 :        1616 :   initErrorBlock (&eb, m, (const unsigned int *) &sym.array[0], 0);
    4226                 :        1616 :   ebnf (&eb, (const unsigned int *) &sym.array[0], 0);
    4227                 :        1616 :   flushColor (&eb);
    4228                 :        1616 :   defaultError (&eb, tok);
    4229                 :        1616 :   M2Error_ErrorString (eb.e, DynamicStrings_Dup (eb.out));
    4230                 :        1616 :   killErrorBlock (&eb);
    4231                 :        1616 :   checkAbort ();
    4232                 :        1540 : }
    4233                 :             : 
    4234                 :         610 : extern "C" void M2MetaError_MetaErrorStringT2 (unsigned int tok, DynamicStrings_String m, unsigned int s1, unsigned int s2)
    4235                 :             : {
    4236                 :         610 :   typedef struct MetaErrorStringT2__T10_a MetaErrorStringT2__T10;
    4237                 :             : 
    4238                 :         610 :   struct MetaErrorStringT2__T10_a { unsigned int array[1+1]; };
    4239                 :         610 :   M2MetaError_errorBlock eb;
    4240                 :         610 :   MetaErrorStringT2__T10 sym;
    4241                 :             : 
    4242                 :         610 :   sym.array[0] = s1;
    4243                 :         610 :   sym.array[1] = s2;
    4244                 :         610 :   initErrorBlock (&eb, m, (const unsigned int *) &sym.array[0], 1);
    4245                 :         610 :   ebnf (&eb, (const unsigned int *) &sym.array[0], 1);
    4246                 :         610 :   flushColor (&eb);
    4247                 :         610 :   defaultError (&eb, tok);
    4248                 :         610 :   M2Error_ErrorString (eb.e, DynamicStrings_Dup (eb.out));
    4249                 :         610 :   killErrorBlock (&eb);
    4250                 :         610 :   checkAbort ();
    4251                 :         610 : }
    4252                 :             : 
    4253                 :         192 : extern "C" void M2MetaError_MetaErrorStringT3 (unsigned int tok, DynamicStrings_String m, unsigned int s1, unsigned int s2, unsigned int s3)
    4254                 :             : {
    4255                 :         192 :   typedef struct MetaErrorStringT3__T11_a MetaErrorStringT3__T11;
    4256                 :             : 
    4257                 :         192 :   struct MetaErrorStringT3__T11_a { unsigned int array[2+1]; };
    4258                 :         192 :   M2MetaError_errorBlock eb;
    4259                 :         192 :   MetaErrorStringT3__T11 sym;
    4260                 :             : 
    4261                 :         192 :   sym.array[0] = s1;
    4262                 :         192 :   sym.array[1] = s2;
    4263                 :         192 :   sym.array[2] = s3;
    4264                 :         192 :   initErrorBlock (&eb, m, (const unsigned int *) &sym.array[0], 2);
    4265                 :         192 :   eb.highplus1 = 2+1;
    4266                 :         192 :   ebnf (&eb, (const unsigned int *) &sym.array[0], 2);
    4267                 :         192 :   flushColor (&eb);
    4268                 :         192 :   defaultError (&eb, tok);
    4269                 :         192 :   M2Error_ErrorString (eb.e, DynamicStrings_Dup (eb.out));
    4270                 :         192 :   killErrorBlock (&eb);
    4271                 :         192 :   checkAbort ();
    4272                 :         192 : }
    4273                 :             : 
    4274                 :          12 : extern "C" void M2MetaError_MetaErrorStringT4 (unsigned int tok, DynamicStrings_String m, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int s4)
    4275                 :             : {
    4276                 :          12 :   typedef struct MetaErrorStringT4__T12_a MetaErrorStringT4__T12;
    4277                 :             : 
    4278                 :          12 :   struct MetaErrorStringT4__T12_a { unsigned int array[3+1]; };
    4279                 :          12 :   M2MetaError_errorBlock eb;
    4280                 :          12 :   MetaErrorStringT4__T12 sym;
    4281                 :             : 
    4282                 :          12 :   sym.array[0] = s1;
    4283                 :          12 :   sym.array[1] = s2;
    4284                 :          12 :   sym.array[2] = s3;
    4285                 :          12 :   sym.array[3] = s4;
    4286                 :          12 :   initErrorBlock (&eb, m, (const unsigned int *) &sym.array[0], 3);
    4287                 :          12 :   ebnf (&eb, (const unsigned int *) &sym.array[0], 3);
    4288                 :          12 :   flushColor (&eb);
    4289                 :          12 :   defaultError (&eb, tok);
    4290                 :          12 :   M2Error_ErrorString (eb.e, DynamicStrings_Dup (eb.out));
    4291                 :          12 :   killErrorBlock (&eb);
    4292                 :          12 :   checkAbort ();
    4293                 :          12 : }
    4294                 :             : 
    4295                 :             : 
    4296                 :             : /*
    4297                 :             :    MetaErrorN1 -
    4298                 :             : */
    4299                 :             : 
    4300                 :           0 : extern "C" void M2MetaError_MetaErrorN1 (const char *m_, unsigned int _m_high, NameKey_Name n)
    4301                 :             : {
    4302                 :           0 :   char m[_m_high+1];
    4303                 :             : 
    4304                 :             :   /* make a local copy of each unbounded array.  */
    4305                 :           0 :   memcpy (m, m_, _m_high+1);
    4306                 :             : 
    4307                 :           0 :   M2MetaError_MetaErrorNT1 (M2LexBuf_GetTokenNo (), (const char *) m, _m_high, n);
    4308                 :           0 : }
    4309                 :             : 
    4310                 :             : 
    4311                 :             : /*
    4312                 :             :    MetaErrorN2 -
    4313                 :             : */
    4314                 :             : 
    4315                 :           0 : extern "C" void M2MetaError_MetaErrorN2 (const char *m_, unsigned int _m_high, NameKey_Name n1, NameKey_Name n2)
    4316                 :             : {
    4317                 :           0 :   char m[_m_high+1];
    4318                 :             : 
    4319                 :             :   /* make a local copy of each unbounded array.  */
    4320                 :           0 :   memcpy (m, m_, _m_high+1);
    4321                 :             : 
    4322                 :           0 :   M2MetaError_MetaErrorNT2 (M2LexBuf_GetTokenNo (), (const char *) m, _m_high, n1, n2);
    4323                 :           0 : }
    4324                 :             : 
    4325                 :             : 
    4326                 :             : /*
    4327                 :             :    MetaErrorNT0 - generate an error message at tok using format.
    4328                 :             : */
    4329                 :             : 
    4330                 :           0 : extern "C" void M2MetaError_MetaErrorNT0 (unsigned int tok, const char *format_, unsigned int _format_high)
    4331                 :             : {
    4332                 :           0 :   char format[_format_high+1];
    4333                 :             : 
    4334                 :             :   /* make a local copy of each unbounded array.  */
    4335                 :           0 :   memcpy (format, format_, _format_high+1);
    4336                 :             : 
    4337                 :           0 :   M2MetaError_MetaErrorStringT0 (tok, DynamicStrings_InitString ((const char *) format, _format_high));
    4338                 :           0 : }
    4339                 :             : 
    4340                 :             : 
    4341                 :             : /*
    4342                 :             :    MetaErrorNT1 - generate an error message at tok using format and name.
    4343                 :             :                   The format should contain %a for name substitution.
    4344                 :             : */
    4345                 :             : 
    4346                 :           0 : extern "C" void M2MetaError_MetaErrorNT1 (unsigned int tok, const char *format_, unsigned int _format_high, NameKey_Name name)
    4347                 :             : {
    4348                 :           0 :   int i;
    4349                 :           0 :   DynamicStrings_String s;
    4350                 :           0 :   DynamicStrings_String fmt;
    4351                 :           0 :   char format[_format_high+1];
    4352                 :             : 
    4353                 :             :   /* make a local copy of each unbounded array.  */
    4354                 :           0 :   memcpy (format, format_, _format_high+1);
    4355                 :             : 
    4356                 :           0 :   i = 0;
    4357                 :           0 :   fmt = DynamicStrings_InitString ((const char *) format, _format_high);
    4358                 :           0 :   s = DynamicStrings_InitString ((const char *) "", 0);
    4359                 :           0 :   s = translate (fmt, s, &i, name);
    4360                 :           0 :   M2MetaError_MetaErrorStringT0 (tok, s);
    4361                 :           0 :   fmt = DynamicStrings_KillString (fmt);
    4362                 :           0 : }
    4363                 :             : 
    4364                 :           0 : extern "C" void M2MetaError_MetaErrorNT2 (unsigned int tok, const char *format_, unsigned int _format_high, NameKey_Name name1, NameKey_Name name2)
    4365                 :             : {
    4366                 :           0 :   int i;
    4367                 :           0 :   DynamicStrings_String s;
    4368                 :           0 :   DynamicStrings_String fmt;
    4369                 :           0 :   char format[_format_high+1];
    4370                 :             : 
    4371                 :             :   /* make a local copy of each unbounded array.  */
    4372                 :           0 :   memcpy (format, format_, _format_high+1);
    4373                 :             : 
    4374                 :             :   /* 
    4375                 :             :    MetaErrorNT1 - generate an error message at tok using format, name1
    4376                 :             :                   and name2.  The format should contain two occurances of %a
    4377                 :             :                   for name substitution.
    4378                 :             :   */
    4379                 :           0 :   i = 0;
    4380                 :           0 :   fmt = DynamicStrings_InitString ((const char *) format, _format_high);
    4381                 :           0 :   s = DynamicStrings_InitString ((const char *) "", 0);
    4382                 :           0 :   s = translate (fmt, s, &i, name1);
    4383                 :           0 :   s = translate (fmt, s, &i, name2);
    4384                 :           0 :   M2MetaError_MetaErrorStringT0 (tok, s);
    4385                 :           0 :   fmt = DynamicStrings_KillString (fmt);
    4386                 :           0 : }
    4387                 :             : 
    4388                 :             : 
    4389                 :             : /*
    4390                 :             :    wrapString - return a string which has been formatted with the specifier codes.
    4391                 :             :                 Color is disabled.  The result string is returned.
    4392                 :             : */
    4393                 :             : 
    4394                 :          18 : extern "C" DynamicStrings_String M2MetaError_MetaString0 (DynamicStrings_String m)
    4395                 :             : {
    4396                 :          18 :   typedef struct MetaString0__T13_a MetaString0__T13;
    4397                 :             : 
    4398                 :          18 :   struct MetaString0__T13_a { unsigned int array[0+1]; };
    4399                 :          18 :   MetaString0__T13 sym;
    4400                 :             : 
    4401                 :          18 :   sym.array[0] = SymbolTable_NulSym;
    4402                 :          18 :   return wrapString (m, (const unsigned int *) &sym.array[0], 0);
    4403                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    4404                 :             :   __builtin_unreachable ();
    4405                 :             : }
    4406                 :             : 
    4407                 :             : 
    4408                 :             : /*
    4409                 :             :    wrapString - return a string which has been formatted with the specifier codes.
    4410                 :             :                 Color is disabled.  The result string is returned.
    4411                 :             : */
    4412                 :             : 
    4413                 :          66 : extern "C" DynamicStrings_String M2MetaError_MetaString1 (DynamicStrings_String m, unsigned int s)
    4414                 :             : {
    4415                 :          66 :   typedef struct MetaString1__T14_a MetaString1__T14;
    4416                 :             : 
    4417                 :          66 :   struct MetaString1__T14_a { unsigned int array[0+1]; };
    4418                 :          66 :   MetaString1__T14 sym;
    4419                 :             : 
    4420                 :          66 :   sym.array[0] = s;
    4421                 :          66 :   return wrapString (m, (const unsigned int *) &sym.array[0], 0);
    4422                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    4423                 :             :   __builtin_unreachable ();
    4424                 :             : }
    4425                 :             : 
    4426                 :             : 
    4427                 :             : /*
    4428                 :             :    wrapString - return a string which has been formatted with the specifier codes.
    4429                 :             :                 Color is disabled.  The result string is returned.
    4430                 :             : */
    4431                 :             : 
    4432                 :         576 : extern "C" DynamicStrings_String M2MetaError_MetaString2 (DynamicStrings_String m, unsigned int s1, unsigned int s2)
    4433                 :             : {
    4434                 :         576 :   typedef struct MetaString2__T15_a MetaString2__T15;
    4435                 :             : 
    4436                 :         576 :   struct MetaString2__T15_a { unsigned int array[1+1]; };
    4437                 :         576 :   MetaString2__T15 sym;
    4438                 :             : 
    4439                 :         576 :   sym.array[0] = s1;
    4440                 :         576 :   sym.array[1] = s2;
    4441                 :         576 :   return wrapString (m, (const unsigned int *) &sym.array[0], 1);
    4442                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    4443                 :             :   __builtin_unreachable ();
    4444                 :             : }
    4445                 :             : 
    4446                 :             : 
    4447                 :             : /*
    4448                 :             :    wrapString - return a string which has been formatted with the specifier codes.
    4449                 :             :                 Color is disabled.  The result string is returned.
    4450                 :             : */
    4451                 :             : 
    4452                 :       12695 : extern "C" DynamicStrings_String M2MetaError_MetaString3 (DynamicStrings_String m, unsigned int s1, unsigned int s2, unsigned int s3)
    4453                 :             : {
    4454                 :       12695 :   typedef struct MetaString3__T16_a MetaString3__T16;
    4455                 :             : 
    4456                 :       12695 :   struct MetaString3__T16_a { unsigned int array[2+1]; };
    4457                 :       12695 :   MetaString3__T16 sym;
    4458                 :             : 
    4459                 :       12695 :   sym.array[0] = s1;
    4460                 :       12695 :   sym.array[1] = s2;
    4461                 :       12695 :   sym.array[2] = s3;
    4462                 :       12695 :   return wrapString (m, (const unsigned int *) &sym.array[0], 2);
    4463                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    4464                 :             :   __builtin_unreachable ();
    4465                 :             : }
    4466                 :             : 
    4467                 :             : 
    4468                 :             : /*
    4469                 :             :    wrapString - return a string which has been formatted with the specifier codes.
    4470                 :             :                 Color is disabled.  The result string is returned.
    4471                 :             : */
    4472                 :             : 
    4473                 :         108 : extern "C" DynamicStrings_String M2MetaError_MetaString4 (DynamicStrings_String m, unsigned int s1, unsigned int s2, unsigned int s3, unsigned int s4)
    4474                 :             : {
    4475                 :         108 :   typedef struct MetaString4__T17_a MetaString4__T17;
    4476                 :             : 
    4477                 :         108 :   struct MetaString4__T17_a { unsigned int array[3+1]; };
    4478                 :         108 :   MetaString4__T17 sym;
    4479                 :             : 
    4480                 :         108 :   sym.array[0] = s1;
    4481                 :         108 :   sym.array[1] = s2;
    4482                 :         108 :   sym.array[2] = s3;
    4483                 :         108 :   sym.array[3] = s4;
    4484                 :         108 :   return wrapString (m, (const unsigned int *) &sym.array[0], 3);
    4485                 :             :   /* static analysis guarentees a RETURN statement will be used before here.  */
    4486                 :             :   __builtin_unreachable ();
    4487                 :             : }
    4488                 :             : 
    4489                 :             : 
    4490                 :             : /*
    4491                 :             :    MetaErrorDecl - if sym is a variable or parameter then generate a
    4492                 :             :                    declaration error or warning message.  If error is
    4493                 :             :                    FALSE then a warning is issued.
    4494                 :             : */
    4495                 :             : 
    4496                 :         264 : extern "C" void M2MetaError_MetaErrorDecl (unsigned int sym, bool error)
    4497                 :             : {
    4498                 :         264 :   if ((sym != SymbolTable_NulSym) && (SymbolTable_IsVar (sym)))
    4499                 :             :     {
    4500                 :             :       /* avoid gcc warning by using compound statement even if not strictly necessary.  */
    4501                 :         222 :       if (error)
    4502                 :             :         {
    4503                 :         222 :           if (SymbolTable_IsVarAParam (sym))
    4504                 :             :             {
    4505                 :           0 :               M2MetaError_MetaErrorT1 (SymbolTable_GetVarDeclFullTok (sym), (const char *) "parameter declaration for {%1ad}", 32, sym);
    4506                 :             :             }
    4507                 :             :           else
    4508                 :             :             {
    4509                 :         222 :               M2MetaError_MetaErrorT1 (SymbolTable_GetVarDeclFullTok (sym), (const char *) "variable declaration for {%1ad}", 31, sym);
    4510                 :             :             }
    4511                 :             :         }
    4512                 :             :       else
    4513                 :             :         {
    4514                 :           0 :           if (SymbolTable_IsVarAParam (sym))
    4515                 :             :             {
    4516                 :           0 :               M2MetaError_MetaErrorT1 (SymbolTable_GetVarDeclFullTok (sym), (const char *) "parameter declaration for {%1Wad}", 33, sym);
    4517                 :             :             }
    4518                 :             :           else
    4519                 :             :             {
    4520                 :           0 :               M2MetaError_MetaErrorT1 (SymbolTable_GetVarDeclFullTok (sym), (const char *) "variable declaration for {%1Wad}", 32, sym);
    4521                 :             :             }
    4522                 :             :         }
    4523                 :             :     }
    4524                 :         264 : }
    4525                 :             : 
    4526                 :       15506 : extern "C" void _M2_M2MetaError_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
    4527                 :             : {
    4528                 :       15506 :   lastRoot = static_cast<M2Error_Error> (NULL);
    4529                 :       15506 :   lastColor = M2MetaError_noColor;
    4530                 :       15506 :   seenAbort = false;
    4531                 :       15506 :   outputStack = Indexing_InitIndex (1);
    4532                 :       15506 :   dictionary = Indexing_InitIndex (1);
    4533                 :       15506 :   freeEntry = NULL;
    4534                 :       15506 : }
    4535                 :             : 
    4536                 :           0 : extern "C" void _M2_M2MetaError_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
    4537                 :             : {
    4538                 :           0 : }
        

Generated by: LCOV version 2.1-beta

LCOV profile is generated on x86_64 machine using following configure options: configure --disable-bootstrap --enable-coverage=opt --enable-languages=c,c++,fortran,go,jit,lto,rust,m2 --enable-host-shared. GCC test suite is run with the built compiler.