Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Enhance error detection at parsing time #4210

@pekkaklarck

Description

@pekkaklarck

Robot's parser detects many errors already at the parsing time, but there are also many syntax errors that are only detected at the execution time. A problem with detecting errors only at the execution time is that they aren't reported to tools like editor plugins that use Robot's parser. We should thus move error detection to parser as much as possible. This includes at least these cases:

  • Empty test and keyword.
  • END, ELSE, ELSE IF, EXCEPT or FINALLY when there is no matching parent element like IF or TRY.
  • RETURN used in test. Fixed already in RF 5.0.
  • BREAK/CONTINUE outside loops. Fixed already in RF 5.0.
  • RETURN/BREAK/CONTINUE in FINALLY. Fixed already in RF 5.0.

We also have a similar problem that some of the error situations detected by the parser are not detected as early as they could be. For example, having IF with more than one condition is detected by the parser when the parsing model is validated, but the underlying tokens do not get ERROR type. This is a problem if only using tokens (i.e. when using get_tokens, not get_model) and also when using the model it would be more convenient if invalid tokens could be easily detected. This problem occurs at least in these cases:

  • IF, ELSE IF and WHILE with more than one condition.
  • ELSE, END, BREAK, CONTINUE, TRY and FINALLY with values.
  • AS with invalid variable or with more than one variable.

Because these latter errors are detected by the parser, only a bit late, I don't consider this limitation as bad as the problem with the earlier errors.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions