Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script parser: No error reported for unknown labels #140

Open
mattulbrich opened this issue Jun 19, 2019 · 4 comments
Open

Script parser: No error reported for unknown labels #140

mattulbrich opened this issue Jun 19, 2019 · 4 comments

Comments

@mattulbrich
Copy link
Owner

mattulbrich commented Jun 19, 2019

If a label is unknown, then the script silently ignores the code and does not do anything.

Load the main example, first PVC and use script

cases {
	case match "this_case_does_not_exist!": {
		thisCommandDoesNotExist ;
	}
}

No error is reported. Also not for the non-existing command.

While this could be named a feature, I'd rather say it is a bug.

Refers to 39a8d27.

@sgrebing
Copy link
Collaborator

This is correct behaviour according to our definition of the language. the interpreter interprets the string literal as string expression and tries to find it in the label data of a goal. If no goal with such an expression exists, the case is dismissed.

@mattulbrich
Copy link
Owner Author

OK. This definition is theoretically sound and reasonable.

However, from a user experience point of view, this has undesired consequences: A typo in a case condition remains totally undetected.

I would suggest that either the interpreter issues a warning or the code highlighting takes according actions such that such a situation of dead proof code can easily be interpreted.

@sgrebing
Copy link
Collaborator

Yeah, I was thinking about building a special type of exception that can be rendered as a warning in the script code. This would however mean a major rebuild of the cases handling in the interpreter to be able to capture and bookkeep which cases have been matched. This issue is then closely related to our enhancement about non-used cases.

@mattulbrich
Copy link
Owner Author

While you are at it:

It would be very valuable to continue executing the script on other branches if one branch fails.
Hence having a list of exceptions would be better. That list could contain warnings (probably recognisable by the class of exception) and errors. Alternatively, there could be two lists for warnings and errors.

(After vstte)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants