plantuml / plantuml

Generate diagrams from textual description
https://plantuml.com
Other
9.73k stars 881 forks source link

Multiline actions in new activity diagram containing a curly brace } at the end of line cause an error #1685

Open DaumAlexande opened 3 months ago

DaumAlexande commented 3 months ago

Describe the bug Actions spanning multiple lines in an activity diagram incorrectly detect an end at some special characters (especially a single closing curly brace } not followed by any other character), resulting in an error.

To Reproduce

Create an activity diagram containing an action where a line ends with a } symbol. An example running on the plantuml online service can be found here: https://www.plantuml.com/plantuml/uml/SoWkIImgAStDuG8pkBYiSZBpKXNACqioQhbSYuhoYueLCbABKgsvk5BpKhWSW0HGCG00

The bug can also be reproduced by running plantuml locally with the same form of diagram.

@startuml
start

:line with }c
Errors here;

end
@enduml

Expected behavior A valid activity diagram is produced, that contains one action with a literal } character inside. Only : and ; should delimit an action.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context I could narrow down the issue by debugging on the current master branch. The behavior is caused by the Regex returned by CommandActivityLong3::getPatternEnd2(), which is used to determine when a long action is ended.

This regex matches the following strings at end of line (written as examples, the raw regex can be found in the source code in CommandActivity3.java):

I'm not familiar enough with the plantuml activity syntax to know why all these endings are required, but to me it seems like a multiline action should only end on a semicolon.