home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / epmgcc32.zip / nrxparse.e < prev    next >
Text File  |  1996-12-07  |  3KB  |  70 lines

  1. /*
  2. ╔══════════════════════════════════════════════════════════════════════════════╗
  3. ║ What's it called: EPMGCC  V3.20                                              ║
  4. ║                                                                              ║
  5. ║ What does it do:  The E source code for the GCC-Interface for EPM.           ║
  6. ║                   This file contains the code for the error parser of        ║
  7. ║                   compile time errors issued by NetRexxC.                    ║
  8. ║                   This module is linked seperately to allow the user to      ║
  9. ║                   change the error-parser during runtime. See the            ║
  10. ║                   documentation for details.                                 ║
  11. ║                                                                              ║
  12. ║ Who and When:     B. Bablok 12/93 - 12/96                                    ║
  13. ║                                                                              ║
  14. ╚══════════════════════════════════════════════════════════════════════════════╝
  15. */
  16. DEFC gcc_parse_error =
  17.    UNIVERSAL gcc_error_file_id, gcc_other_file_id, gcc_error_file,
  18.              gcc_line2index, gcc_index2err, gcc_error_index
  19.  
  20.    parse_all = ARG(1) <> ''
  21.    error_no = 0
  22.  
  23.    WHILE (.line <= .last) DO           -- iterate until a "true" error is found
  24.      GETLINE  line
  25.  
  26.       IF LEFTSTR(line,1) <> "[" THEN
  27.          lineno = 'junk'
  28.       ELSE
  29.          PARSE VALUE line WITH "[" filename lineno col len "]" gcc_message
  30.       ENDIF
  31.  
  32.      IF NOT ISNUM(lineno) THEN
  33.        IF .line = .last THEN
  34.           IF NOT parse_all THEN
  35.              ACTIVATEFILE gcc_other_file_id
  36.              SAYERROR "No more errors!"
  37.           ELSE
  38.              DO_ARRAY 2, gcc_line2index, 0, error_no
  39.              DO_ARRAY 2, gcc_index2err, 0, error_no
  40.           ENDIF
  41.           RETURN
  42.        ELSE                           -- try the next line
  43.          "+1"
  44.        ENDIF
  45.  
  46.      ELSEIF NOT parse_all THEN                              -- found an error
  47.        "EDIT" TRANSLATE(filename,'\','/') "'gcc_setpos "lineno col len"'"
  48.        SAYERROR gcc_message
  49.        RETURN
  50.  
  51.      ELSE
  52.        error_no = error_no + 1
  53.        DO_ARRAY 2, gcc_line2index, .line, error_no
  54.        DO_ARRAY 2, gcc_index2err, 'line.'error_no, lineno
  55.        DO_ARRAY 2, gcc_index2err, 'col.'error_no, col
  56.        DO_ARRAY 2, gcc_index2err, 'len.'error_no, len
  57.        DO_ARRAY 2, gcc_index2err, 'file.'error_no, filename
  58.        DO_ARRAY 2, gcc_index2err, 'msg.'error_no, gcc_message
  59.        line = .line
  60.        DO_ARRAY 2, gcc_index2err, 'orig.'error_no, line
  61.        IF .line = .last THEN
  62.           DO_ARRAY 2, gcc_line2index, 0, error_no
  63.           DO_ARRAY 2, gcc_index2err, 0, error_no
  64.           RETURN
  65.        ELSE
  66.          "+1"
  67.        ENDIF
  68.      ENDIF
  69.    ENDWHILE
  70.