Error

data class Error(var id: String, var line: Int, var charPosition: Int, var msg: String) : CompilationError

Defines the lexical and syntax errors in the source program

Example:

11: int main(){
12: ^1234.5;
13: return 0;
14: }
Error: main.c:12:5: expected expression before ‘^’ token

Instance of Error class:
Error(
"Lexical Error",
12,
5,
"expected expression before ‘^’ token"
)

Constructors

Link copied to clipboard
constructor(id: String, line: Int, charPosition: Int, msg: String)

Properties

Link copied to clipboard

is the character position where the error is located

Link copied to clipboard
var id: String

can be either "Syntax Error" or "Lexical Error"

Link copied to clipboard
var line: Int

is the line where the error is located

Link copied to clipboard
var msg: String

is the error message written by the parser