forked from KolibriOS/kolibrios
82d72daa76
git-svn-id: svn://kolibrios.org@7597 a494cfbc-eb01-0410-851d-a64ba20cac60
171 lines
5.8 KiB
Plaintext
171 lines
5.8 KiB
Plaintext
(*
|
|
BSD 2-Clause License
|
|
|
|
Copyright (c) 2018, 2019, Anton Krotov
|
|
All rights reserved.
|
|
*)
|
|
|
|
MODULE ERRORS;
|
|
|
|
IMPORT C := CONSOLE, UTILS;
|
|
|
|
|
|
PROCEDURE hintmsg* (name: ARRAY OF CHAR; line, col, hint: INTEGER);
|
|
BEGIN
|
|
IF hint = 0 THEN
|
|
C.String(" hint ("); C.Int(line); C.String(":"); C.Int(col); C.String(")");
|
|
C.String(" variable '"); C.String(name); C.StringLn("' never used")
|
|
END
|
|
END hintmsg;
|
|
|
|
|
|
PROCEDURE errormsg* (fname: ARRAY OF CHAR; line, col, errno: INTEGER);
|
|
VAR
|
|
str: ARRAY 80 OF CHAR;
|
|
|
|
BEGIN
|
|
C.Ln;
|
|
C.String(" error ("); C.Int(line); C.String(":"); C.Int(col); C.String(") ");
|
|
|
|
CASE errno OF
|
|
| 1: str := "missing 'H' or 'X'"
|
|
| 2: str := "missing scale"
|
|
| 3: str := "unclosed string"
|
|
| 4: str := "illegal character"
|
|
| 5: str := "string too long"
|
|
| 6: str := "identifier too long"
|
|
| 7: str := "number too long"
|
|
| 8..12: str := "number too large"
|
|
|
|
| 21: str := "'MODULE' expected"
|
|
| 22: str := "identifier expected"
|
|
| 23: str := "module name does not match file name"
|
|
| 24: str := "';' expected"
|
|
| 25: str := "identifier does not match module name"
|
|
| 26: str := "'.' expected"
|
|
| 27: str := "'END' expected"
|
|
| 28: str := "',', ';' or ':=' expected"
|
|
| 29: str := "module not found"
|
|
| 30: str := "multiply defined identifier"
|
|
| 31: str := "recursive import"
|
|
| 32: str := "'=' expected"
|
|
| 33: str := "')' expected"
|
|
| 34: str := "syntax error in expression"
|
|
| 35: str := "'}' expected"
|
|
| 36: str := "incompatible operand"
|
|
| 37: str := "incompatible operands"
|
|
| 38: str := "'RETURN' expected"
|
|
| 39: str := "integer overflow"
|
|
| 40: str := "floating point overflow"
|
|
| 41: str := "not enough floating point registers; simplify expression"
|
|
| 42: str := "out of range 0..255"
|
|
| 43: str := "expression is not an integer"
|
|
| 44: str := "out of range 0..MAXSET"
|
|
| 45: str := "division by zero"
|
|
| 46: str := "integer division by zero"
|
|
| 47: str := "'OF' or ',' expected"
|
|
| 48: str := "undeclared identifier"
|
|
| 49: str := "type expected"
|
|
| 50: str := "recursive type definition"
|
|
| 51: str := "illegal value of constant"
|
|
| 52: str := "not a record type"
|
|
| 53: str := "':' expected"
|
|
| 54: str := "need to import SYSTEM"
|
|
| 55: str := "pointer type not defined"
|
|
| 56: str := "out of range 0..MAXSET"
|
|
| 57: str := "'TO' expected"
|
|
| 58: str := "not a record type"
|
|
| 59: str := "this expression cannot be a procedure"
|
|
| 60: str := "identifier does not match procedure name"
|
|
| 61: str := "illegally marked identifier"
|
|
| 62: str := "expression should be constant"
|
|
| 63: str := "'stdcall', 'ccall', 'ccall16', 'windows' or 'linux' expected"
|
|
| 64: str := "'(' expected"
|
|
| 65: str := "',' expected"
|
|
| 66: str := "incompatible parameter"
|
|
| 67: str := "'OF' expected"
|
|
| 68: str := "type expected"
|
|
| 69: str := "result type of procedure is not a basic type"
|
|
| 70: str := "import not supported"
|
|
| 71: str := "']' expected"
|
|
| 72: str := "expression is not BOOLEAN"
|
|
| 73: str := "not a record"
|
|
| 74: str := "undefined record field"
|
|
| 75: str := "not an array"
|
|
| 76: str := "expression is not an integer"
|
|
| 77: str := "not a pointer"
|
|
| 78: str := "type guard not allowed"
|
|
| 79: str := "not a type"
|
|
| 80: str := "not a record type"
|
|
| 81: str := "not a pointer type"
|
|
| 82: str := "type guard not allowed"
|
|
| 83: str := "index out of range"
|
|
| 84: str := "dimension too large"
|
|
| 85: str := "procedure must have level 0"
|
|
| 86: str := "not a procedure"
|
|
| 87: str := "incompatible expression (RETURN)"
|
|
| 88: str := "'THEN' expected"
|
|
| 89: str := "'DO' expected"
|
|
| 90: str := "'UNTIL' expected"
|
|
| 91: str := "incompatible assignment"
|
|
| 92: str := "procedure call of a function"
|
|
| 93: str := "not a variable"
|
|
| 94: str := "read only variable"
|
|
| 95: str := "invalid type of expression (CASE)"
|
|
| 96: str := "':=' expected"
|
|
| 97: str := "not INTEGER variable"
|
|
| 98: str := "illegal value of constant (0)"
|
|
| 99: str := "incompatible label"
|
|
|100: str := "multiply defined label"
|
|
|101: str := "too large parameter of WCHR"
|
|
|102: str := "label expected"
|
|
|103: str := "illegal value of constant"
|
|
|104: str := "type too large"
|
|
|105: str := "access to intermediate variables not allowed"
|
|
|106: str := "qualified identifier expected"
|
|
|107: str := "too large parameter of CHR"
|
|
|108: str := "a variable or a procedure expected"
|
|
|109: str := "expression should be constant"
|
|
|110: str := "'noalign' expected"
|
|
|111: str := "record [noalign] cannot have a base type"
|
|
|112: str := "record [noalign] cannot be a base type"
|
|
|113: str := "result type of procedure should not be REAL"
|
|
|114: str := "identifiers 'lib_init' and 'version' are reserved"
|
|
|115: str := "recursive constant definition"
|
|
|116: str := "procedure too deep nested"
|
|
|117: str := "'stdcall64', 'win64', 'systemv', 'windows' or 'linux' expected"
|
|
|118: str := "this flag for Windows only"
|
|
|119: str := "this flag for Linux only"
|
|
|120: str := "too many formal parameters"
|
|
END;
|
|
C.StringLn(str);
|
|
C.String(" file: "); C.StringLn(fname);
|
|
UTILS.Exit(1)
|
|
END errormsg;
|
|
|
|
|
|
PROCEDURE error1* (s1: ARRAY OF CHAR);
|
|
BEGIN
|
|
C.Ln;
|
|
C.StringLn(s1);
|
|
UTILS.Exit(1)
|
|
END error1;
|
|
|
|
|
|
PROCEDURE error3* (s1, s2, s3: ARRAY OF CHAR);
|
|
BEGIN
|
|
C.Ln;
|
|
C.String(s1); C.String(s2); C.StringLn(s3);
|
|
UTILS.Exit(1)
|
|
END error3;
|
|
|
|
|
|
PROCEDURE error5* (s1, s2, s3, s4, s5: ARRAY OF CHAR);
|
|
BEGIN
|
|
C.Ln;
|
|
C.String(s1); C.String(s2); C.String(s3); C.String(s4); C.StringLn(s5);
|
|
UTILS.Exit(1)
|
|
END error5;
|
|
|
|
|
|
END ERRORS. |