Minor parsing failure of Eclipse plugin (caused by white-spaces)

0 votes
asked Nov 7, 2014 in Bug by gmc-devel (120 points)

We are using the (current) PlantUML eclipse plugin (with Eclipse C++ Luna SR1)
and there are two (but related) issues. IMHO these are problems of parsing the source-content between
the keywords @startuml and @enduml.

A) Following (minimal) sample shows an 'Syntax Error?'

     * @startuml
     * state Start #LightGreen
     * state Stop #LightGreen
     * Start --> Stop
     * @enduml

This issue is caused by the 3rd (Ie. empty) line after @startuml, because (our) eclipse removes trailing white-spaces.

B) After deleting this empy line, the resulting graphic is shown;
but if this comment-block has leading tabs and spaces (before the *-character)
in different lines, the plugin still shows an parser-error!


Based on my expiriences, the PlantUML eclipse plugin uses follwing parser-algorithm:

1) detect the column X of the @-character of the keyword @startuml

2) Up to the @enduml-keyword, the leading X-1 characters of each lines afterwards are removed;
  the remaining line contains the PlantUML-syntax ...

I think, the problem in 2) is:
A syntax-error occurs, if a line (afterwards) has less than X characters;
Additionally this removing of leading characters does not take TAB/Spaces into account.

A solution would be (before dropping leading characters):
Expand TAB's to n Spaces; maybe n can be determined from eclipse or use 4
If a line has less than X characters: just skip it.

It's (currently) simple to prevent these issues, if developers are briefed about the pitfalls.
But a bug-fix (or feature enhancement) will prevent these "simple" parser-issues on white-spaces ...

Best regards from Salzburg,

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

[Antispam2 Feature: please please wait 1 or 2 minutes (this message will disappear) before pressing the button otherwise it will fail](--------)
To avoid this verification in future, please log in or register.