ruanpienaar / mscgen

Automatically exported from code.google.com/p/mscgen
GNU General Public License v2.0
0 stars 0 forks source link

mscgen cannot handle Bx-A (but A-xB works) #53

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This may be intended behaviour, though I noticed that if you reverse the -x arc 
in test 16, mscgen will no longer parse it. You need to explicitly add a space 
in between the first entity and the arc.
  The reason for this is because the x is now considered a part of the entity name.

I am merely mentioning this because the mscgen is otherwise very forgiving with 
directions and lack of spaces. Particularly most of the tests do not have 
spaces between the (non-box) arcs and the entities.

Note that the error is the user will see is practically useless in debugging 
this ("unexpected characters at line X" or so). So if this is intended 
behaviour I would recommend that a better error message is emitted to assist 
the user.

Original issue reported on code.google.com by NThykier@gmail.com on 19 Sep 2010 at 3:14

GoogleCodeExporter commented 9 years ago
Yup - I noticed this when adding that arc type.

Using a space is one workaround, putting double quotes around the entity name 
is the other e.g. "A"x-"B".  It doesn't look easy to fix up the scanner as it 
doesn't know the grammar context at that point so any string handling would 
take effect for each and every string in the input.

So I've opted to improve the error message output as you suggest.  Now it 
detects if "x-" appears on the line where the parse failed and adds a note to 
the output as well as displaying the faulty input line:

Error detected at line 22: syntax error, unexpected characters.
>  ax-b [label="data2"];

Note: This input line contains 'x-' which has special meaning as a 
      'lost message' arc, but may not have been recognised as such if it
      is preceeded by other letters or numbers.  Please use double-quoted
      strings for tokens before 'x-', or insert a preceeding whitespace if
      this is what you intend.

Original comment by Michael....@gmail.com on 4 Oct 2010 at 8:55

GoogleCodeExporter commented 9 years ago
Fixed at r145      

Original comment by Michael....@gmail.com on 4 Oct 2010 at 8:58