} // CallStopParsing

    // --- storage of errors found on compilation ---

    private static void EnterMessage(EoWKind knd, int line, int col, String msg)
    {
        ErrorWarn eow, prveow, nxteow;

        eowCnt[(int)knd]++;
        eow           = new ErrorWarn();
        eow.kind      = knd;
        eow.info      = new ErrorWarnInfo();
        eow.info.line = line;
        eow.info.col  = col;
        eow.info.msg  = msg;
        prveow        = null;
        nxteow        = eowl;
        while (nxteow != null && nxteow.info.line <= line)
        {
            prveow = nxteow;
            nxteow = nxteow.next;
        } // while
        while (nxteow != null && nxteow.info.line == line && nxteow.info.col <= col)
        {
            prveow = nxteow;
            nxteow = nxteow.next;
        } // while
        if (prveow == null)
        {
            eowl = eow;
        }
        else
        {
            prveow.next = eow;
        }
        eow.next = nxteow;
    } // EnterMessage
Exemplo n.º 2
0
    private static ErrorWarnInfo GetMessage(bool first, EoWKind knd)
    {
        ErrorWarn     eow  = null;
        ErrorWarnInfo eowi = null;

        if (first)
        {
            eow = eowl;
        }
        else
        {
            eow = curEoW[(int)knd].next;
        }
        while (eow != null && eow.kind != knd)
        {
            eow = eow.next;
        }
        curEoW[(int)knd] = eow;
        if (eow == null)
        {
            eowi      = new ErrorWarnInfo();
            eowi.msg  = "";
            eowi.line = 0;
            eowi.col  = 0;
        }
        else
        {
            eowi = eow.info;
        }
        return(eowi);
    } // GetMessage
Exemplo n.º 3
0
    } // CallStopParsing

    // --- storage of errors found on compilation ---

    private static void EnterMessage(EoWKind knd, int line, int col, String msg)
    {
        ErrorWarn eow, prveow, nxteow;

        eowCnt[(int)knd]++;
        if (REPORT_EOW_TO_CONSOLE)
        {
            Console.Write("(" + line + ", " + col + "): ");
            switch (knd)
            {
            case EoWKind.lexErr:
                Console.Write("+LEX+");
                break;

            case EoWKind.synErr:
                Console.Write("*SYN*");
                break;

            case EoWKind.semErr:
                Console.Write("#SEM#");
                break;

            case EoWKind.warn:
                Console.Write("!WRN!");
                break;
            } // switch
            Console.Write(" " + msg);
        }     // if
        eow           = new ErrorWarn();
        eow.kind      = knd;
        eow.info      = new ErrorWarnInfo();
        eow.info.line = line;
        eow.info.col  = col;
        eow.info.msg  = msg;
        prveow        = null;
        nxteow        = eowl;
        while (nxteow != null && nxteow.info.line <= line)
        {
            prveow = nxteow;
            nxteow = nxteow.next;
        } // while
        while (nxteow != null && nxteow.info.line == line && nxteow.info.col <= col)
        {
            prveow = nxteow;
            nxteow = nxteow.next;
        } // while
        if (prveow == null)
        {
            eowl = eow;
        }
        else
        {
            prveow.next = eow;
        }
        eow.next = nxteow;
    } // EnterMessage
Exemplo n.º 4
0
    } // EnterMessage

    private static void CheckForLimits(EoWKind knd, int line, int col)
    {
        if (knd == EoWKind.lexErr || knd == EoWKind.synErr || knd == EoWKind.semErr)
        {
            numOfErrs++;
            if (numOfErrs == MAXNUMOFERRS)
            {
                Warning(line, col, "too many errors, parsing stopped");
                CallStopParsing();
            } // if
        }
        else  // knd == EoWKind.warn
        {
            numOfWarns++;
            if (numOfWarns == MAXNUMOFWARNS)
            {
                Warning(line, col, "too many warnings, parsing stopped");
                CallStopParsing();
            } // if
        }     // else
    }         // CheckForLimits
Exemplo n.º 5
0
 private static ErrorWarnInfo GetMessage(bool first, EoWKind knd) {
   ErrorWarn eow = null;
   ErrorWarnInfo eowi = null;
   if (first)
     eow = eowl;
   else
     eow = curEoW[(int)knd].next;
   while (eow != null && eow.kind != knd)
     eow = eow.next;
   curEoW[(int)knd] = eow;
   if (eow == null) {
     eowi = new ErrorWarnInfo();
     eowi.msg = "";
     eowi.line = 0;
     eowi.col = 0;
   } else
     eowi = eow.info;
   return eowi;
 } // GetMessage
Exemplo n.º 6
0
  } // EnterMessage

  private static void CheckForLimits(EoWKind knd, int line, int col) {
    if (knd == EoWKind.lexErr || knd == EoWKind.synErr || knd == EoWKind.semErr) {
      numOfErrs++;
      if (numOfErrs == MAXNUMOFERRS) {
        Warning(line, col, "too many errors, parsing stopped");
        CallStopParsing();
      } // if
    } else { // knd == EoWKind.warn
      numOfWarns++;
      if (numOfWarns == MAXNUMOFWARNS) {
        Warning(line, col, "too many warnings, parsing stopped");
        CallStopParsing();
      } // if
    } // else
  } // CheckForLimits
Exemplo n.º 7
0
  } // CallStopParsing


  // --- storage of errors found on compilation ---

  private static void EnterMessage(EoWKind knd, int line, int col, String msg) {
    ErrorWarn eow, prveow, nxteow;
    eowCnt[(int)knd]++;
    eow = new ErrorWarn();
    eow.kind = knd;
    eow.info = new ErrorWarnInfo();
    eow.info.line = line;
    eow.info.col = col;
    eow.info.msg = msg;
    prveow = null;
    nxteow = eowl;
    while (nxteow != null && nxteow.info.line <= line) {
      prveow = nxteow;
      nxteow = nxteow.next;
    } // while
    while (nxteow != null && nxteow.info.line == line && nxteow.info.col <= col) {
      prveow = nxteow;
      nxteow = nxteow.next;
    } // while
    if (prveow == null)
      eowl = eow;
    else
      prveow.next = eow;
    eow.next = nxteow;
  } // EnterMessage