hhu-stups / prob-issues

ProB issues (for probcli, ProB Tcl/Tk, ProB2, ProB2UI)
6 stars 0 forks source link

Parsing error in the internal representation of machines with subsidiary operations #321

Closed cobizobi closed 9 months ago

cobizobi commented 1 year ago

When exporting the internal representation of a machine with subsidiary operations, these are created as `Import.set_visualizations` = SELECT [...], which leads to the following parsing error when I want to load the machine:

Error: A quoted identifier cannot contain a dot. Please quote only the identifiers before and after the dot, but not the dot itself, e. g.: `Import`.`set_visualizations`
leuschel commented 1 year ago

The pretty printing of identifiers with dots has been changed in prob_prolog (8e901e4ad82b50a065ec3b9f9732a0b0311baf12), but this probably does not yet solve this issue, as probably there are still parsing errors when trying to load the internal representation.

iTitus commented 10 months ago

The error messages was first introduced in this commit: https://github.com/hhu-stups/probparsers/commit/e2220a3a299e83b6b556c2b32b6e9fa36d299932 by @dgelessus

Is this still a problem - does the check still need to exist? Or do we need to escape all dots in identifiers?

dgelessus commented 9 months ago

Yes, the check in the parser needs to stay, as far as I can tell. The underlying problem is that a dotted identifier is joined into a single atom in the Prolog AST. For example, the Prolog AST node identifier('Import.set_visualizations') represents the identifier set_visualizations from the machine Import (written in B syntax as Import.set_visualizations or `Import`.`set_visualizations`). There is no possible Prolog AST representation for an identifier literally named Import.set_visualizations, so the parser rejects the syntax `Import.set_visualizations`.

If this check would be removed, then the syntax `Import.set_visualizations` would be accepted, but ProB would incorrectly interpret it the same way as `Import`.`set_visualizations`.

I don't have the machine where the original issue occurred, so I can't check if it's resolved now. I think the current solution in prob_prolog is correct though. In this case, I think Import.set_visualizations is supposed to be a qualified identifier from the machine Import and not a single identifier containing a dot, so the interpretation `Import`.`set_visualizations` is correct.