How to properly use 'as' with state declaration?

0 votes
asked Sep 15 in Question / help by dragondive (440 points)

The `as` keyword in case of state declaration works in apparently inconsistent ways. 

state X --> OK
state X as Y --> KO [syntax error]
state "X" as Y --> OK
state X as "Y" --> OK? [renders state Y]

I'm not sure if this is a bug or a feature ‍‍:shrug: and in any case, it doesn't look like a major problem. But it would be good to document the "expected" behaviour.

Version information: [on PlantUML online server]


1 Answer

+1 vote
answered Sep 15 by The-Lu (36,240 points)
selected Sep 17 by dragondive
Best answer

Hello D.,

I does not remember where alias is defined: 
But the main rule is between `alias` and `long name or label`:

  • `alias` is always without quote (alias1, alias2, ...) before or after the `as` keyword
  • and `long name or label` is always with double-quotes, even if there are not space on... ("label", "long label", "label with newline\n...", etc) before or after the `as` keyword

Then here is a simple example:

Then, if you want you can improve the State doc. here:

And FYI I just had this simple example on the doc.; awaiting the check of the PlantUML team.

If that can help,

commented Sep 17 by dragondive (440 points)
Thanks, @Th. The rule that the "long name" should be in quotes always (even if it has no spaces) is helpful. I'm doing some "fun stuff" using the preprocessor, the "long name" is passed to the procedure, so it is useful for me to know the exact output the preprocessor should generate. With this rule, I fixed my problem and I will post the outcome of my "fun stuff" soon.
commented Sep 17 by dragondive (440 points)
Also, I had not realized that the documents are user-editable (banner blindness). I will remember this, and submit a change if I come across some improvement.
commented Sep 17 by The-Lu (36,240 points)

Hello D.,

You are welcome;
and awaiting your 'fun stuff'.


commented Nov 6 by dragondive (440 points)

The "fun stuff" is available on my github. I made some examples using the preprocessor, for example, generating fibonacci recursion tree, collatz sequence, etc. plantuml_demo/src/preprocessor at main · dragondive/plantuml_demo (

commented Nov 6 by The-Lu (36,240 points)

Hello D.,


Thanks a lot for sharing the link of your works.
I will watch.