Open rhdunn opened 8 years ago
Unfortunately with the very context-sensitive nature of the language and with the fact that in Main Module you can have any expression at the end of the file, it's nearly impossible to get this done right. If you could please prepare some examples with the expected behaviour it would be much easier to at least check if this is achievable.
The immediate case is related to issue #198:
declare function a($x, $y) {
if ($x < (2*$y)) then
$y
else
$x
};
declare function b($x) {
()
};
Here, the code in the $x
and $y
part of the if will not be validated, and function b
will not be exposed to the user when referring to it in another module.
If the intellij-xquery parser encounters an error, the code that follows the error point is not parsed correctly. This has the following effects:
It would be helpful for the parser to recover as close as possible to the next valid start/recover point. I understand that this will be complex.
At the basic level, this should be able to recover to the start of the next statement such as
if
,for
,let
, anddeclare function
statements.