In addition to synax analysis (lex), there is also a semantic analysis of code. And in the case of errors of semantics, it is required to understand exactly where the error occurred. Like:
function a(int $b) {}
a(null);
// Error: Integer required in XXX file on line 2 and offset 3, but null given.
// a(null);
// ^
The only way to get this information is the TreeNode instance:
class TreeNode {
+public function getOffset(): int;
}
I tried to implement this in the form of Pull Request, but the source code is pretty confusing =\
In addition to synax analysis (lex), there is also a semantic analysis of code. And in the case of errors of semantics, it is required to understand exactly where the error occurred. Like:
The only way to get this information is the TreeNode instance:
I tried to implement this in the form of Pull Request, but the source code is pretty confusing =\