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

Skip to content

feature - PlantUML support StateSmith ignore #494

@adamfk

Description

@adamfk

From discussion here: #492 (comment)

Rather than try to keep up with all the various features in PlantUML, we should allow users to instruct StateSmith to ignore everything between special comments.

⚠️ Note! You should be careful with this feature. It is rather powerful. You could abuse it to hide states and transitions from StateSmith (which I wouldn't recommend) 🙃. Best to just hide unsupported styling from StateSmith.

Option A (chosen):

Easiest to parse with confidence. A bit noisy, but also very clear.

' <StateSmith:ignore>
mainframe Some Title
!theme spacelab
' </StateSmith:ignore>

@startuml MySm
[*] -> a
a -> b
@enduml

Possible Antlr4 lexer rule:

SS_IGNORE_COMMENT:
    (START_OF_INPUT | LINE_ENDER)
    HWS*   // optional horizontal whitespace
    SINGLE_QUOTE
    HWS*   // optional horizontal whitespace
    '<StateSmith:ignore>'
    .*?
    '</StateSmith:ignore>'
    -> skip
    ;

Option B (not chosen):

This is less noisy looking, but parsing with confidence is kinda annoying as ANTLR4 can't do lexer lookaheads.

' StateSmith:ignore-begin
mainframe Some Title
!theme spacelab
' StateSmith:ignore-end

@startuml MySm
[*] -> a
a -> b
@enduml

Decision

Go with Option A for now. It is easy to do the "right" thing. We can add support for B if we find A annoying after some use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions