Subversion Repositories Kolibri OS

Rev

Rev 7107 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. (*
  2.     BSD 2-Clause License
  3.  
  4.     Copyright (c) 2018, 2019, Anton Krotov
  5.     All rights reserved.
  6. *)
  7.  
  8. MODULE ERRORS;
  9.  
  10. IMPORT C := CONSOLE, UTILS;
  11.  
  12.  
  13. PROCEDURE hintmsg* (name: ARRAY OF CHAR; line, col, hint: INTEGER);
  14. BEGIN
  15.     IF hint = 0 THEN
  16.         C.String("  hint ("); C.Int(line); C.String(":"); C.Int(col); C.String(")");
  17.         C.String(" variable '"); C.String(name); C.StringLn("' never used")
  18.     END
  19. END hintmsg;
  20.  
  21.  
  22. PROCEDURE errormsg* (fname: ARRAY OF CHAR; line, col, errno: INTEGER);
  23. VAR
  24.     str: ARRAY 80 OF CHAR;
  25.  
  26. BEGIN
  27.     C.Ln;
  28.     C.String("  error ("); C.Int(line); C.String(":"); C.Int(col); C.String(") ");
  29.  
  30.     CASE errno OF
  31.     |  1: str := "missing 'H' or 'X'"
  32.     |  2: str := "missing scale"
  33.     |  3: str := "unclosed string"
  34.     |  4: str := "illegal character"
  35.     |  5: str := "string too long"
  36.     |  6: str := "identifier too long"
  37.     |  7: str := "number too long"
  38.     |  8..12: str := "number too large"
  39.  
  40.     | 21: str := "'MODULE' expected"
  41.     | 22: str := "identifier expected"
  42.     | 23: str := "module name does not match file name"
  43.     | 24: str := "';' expected"
  44.     | 25: str := "identifier does not match module name"
  45.     | 26: str := "'.' expected"
  46.     | 27: str := "'END' expected"
  47.     | 28: str := "',', ';' or ':=' expected"
  48.     | 29: str := "module not found"
  49.     | 30: str := "multiply defined identifier"
  50.     | 31: str := "recursive import"
  51.     | 32: str := "'=' expected"
  52.     | 33: str := "')' expected"
  53.     | 34: str := "syntax error in expression"
  54.     | 35: str := "'}' expected"
  55.     | 36: str := "incompatible operand"
  56.     | 37: str := "incompatible operands"
  57.     | 38: str := "'RETURN' expected"
  58.     | 39: str := "integer overflow"
  59.     | 40: str := "floating point overflow"
  60.     | 41: str := "not enough floating point registers; simplify expression"
  61.     | 42: str := "out of range 0..255"
  62.     | 43: str := "expression is not an integer"
  63.     | 44: str := "out of range 0..MAXSET"
  64.     | 45: str := "division by zero"
  65.     | 46: str := "integer division by zero"
  66.     | 47: str := "'OF' or ',' expected"
  67.     | 48: str := "undeclared identifier"
  68.     | 49: str := "type expected"
  69.     | 50: str := "recursive type definition"
  70.     | 51: str := "illegal value of constant"
  71.     | 52: str := "not a record type"
  72.     | 53: str := "':' expected"
  73.     | 54: str := "need to import SYSTEM"
  74.     | 55: str := "pointer type not defined"
  75.     | 56: str := "out of range 0..MAXSET"
  76.     | 57: str := "'TO' expected"
  77.     | 58: str := "not a record type"
  78.     | 59: str := "this expression cannot be a procedure"
  79.     | 60: str := "identifier does not match procedure name"
  80.     | 61: str := "illegally marked identifier"
  81.     | 62: str := "expression should be constant"
  82.     | 63: str := "'stdcall', 'ccall', 'ccall16', 'windows' or 'linux' expected"
  83.     | 64: str := "'(' expected"
  84.     | 65: str := "',' expected"
  85.     | 66: str := "incompatible parameter"
  86.     | 67: str := "'OF' expected"
  87.     | 68: str := "type expected"
  88.     | 69: str := "result type of procedure is not a basic type"
  89.     | 70: str := "import not supported"
  90.     | 71: str := "']' expected"
  91.     | 72: str := "expression is not BOOLEAN"
  92.     | 73: str := "not a record"
  93.     | 74: str := "undefined record field"
  94.     | 75: str := "not an array"
  95.     | 76: str := "expression is not an integer"
  96.     | 77: str := "not a pointer"
  97.     | 78: str := "type guard not allowed"
  98.     | 79: str := "not a type"
  99.     | 80: str := "not a record type"
  100.     | 81: str := "not a pointer type"
  101.     | 82: str := "type guard not allowed"
  102.     | 83: str := "index out of range"
  103.     | 84: str := "dimension too large"
  104.     | 85: str := "procedure must have level 0"
  105.     | 86: str := "not a procedure"
  106.     | 87: str := "incompatible expression (RETURN)"
  107.     | 88: str := "'THEN' expected"
  108.     | 89: str := "'DO' expected"
  109.     | 90: str := "'UNTIL' expected"
  110.     | 91: str := "incompatible assignment"
  111.     | 92: str := "procedure call of a function"
  112.     | 93: str := "not a variable"
  113.     | 94: str := "read only variable"
  114.     | 95: str := "invalid type of expression (CASE)"
  115.     | 96: str := "':=' expected"
  116.     | 97: str := "not INTEGER variable"
  117.     | 98: str := "illegal value of constant (0)"
  118.     | 99: str := "incompatible label"
  119.     |100: str := "multiply defined label"
  120.     |101: str := "too large parameter of WCHR"
  121.     |102: str := "label expected"
  122.     |103: str := "illegal value of constant"
  123.     |104: str := "type too large"
  124.     |105: str := "access to intermediate variables not allowed"
  125.     |106: str := "qualified identifier expected"
  126.     |107: str := "too large parameter of CHR"
  127.     |108: str := "a variable or a procedure expected"
  128.     |109: str := "expression should be constant"
  129.     |110: str := "'noalign' expected"
  130.     |111: str := "record [noalign] cannot have a base type"
  131.     |112: str := "record [noalign] cannot be a base type"
  132.     |113: str := "result type of procedure should not be REAL"
  133.     |114: str := "identifiers 'lib_init' and 'version' are reserved"
  134.     |115: str := "recursive constant definition"
  135.     |116: str := "procedure too deep nested"
  136.     |117: str := "'stdcall64', 'win64', 'systemv', 'windows' or 'linux' expected"
  137.     |118: str := "this flag for Windows only"
  138.     |119: str := "this flag for Linux only"
  139.     |120: str := "too many formal parameters"
  140.     END;
  141.     C.StringLn(str);
  142.     C.String("  file:  ");  C.StringLn(fname);
  143.     UTILS.Exit(1)
  144. END errormsg;
  145.  
  146.  
  147. PROCEDURE error1* (s1: ARRAY OF CHAR);
  148. BEGIN
  149.     C.Ln;
  150.     C.StringLn(s1);
  151.     UTILS.Exit(1)
  152. END error1;
  153.  
  154.  
  155. PROCEDURE error3* (s1, s2, s3: ARRAY OF CHAR);
  156. BEGIN
  157.     C.Ln;
  158.     C.String(s1); C.String(s2); C.StringLn(s3);
  159.     UTILS.Exit(1)
  160. END error3;
  161.  
  162.  
  163. PROCEDURE error5* (s1, s2, s3, s4, s5: ARRAY OF CHAR);
  164. BEGIN
  165.     C.Ln;
  166.     C.String(s1); C.String(s2); C.String(s3); C.String(s4); C.StringLn(s5);
  167.     UTILS.Exit(1)
  168. END error5;
  169.  
  170.  
  171. END ERRORS.