added delay to parser
This commit is contained in:
parent
0bfe68b429
commit
f369fc6e43
Binary file not shown.
@ -267,6 +267,20 @@
|
||||
@enduml
|
||||
```
|
||||
),
|
||||
(
|
||||
[Delay],
|
||||
```
|
||||
@startuml
|
||||
|
||||
Alice -> Bob: Authentication Request
|
||||
...
|
||||
Bob --> Alice: Authentication Response
|
||||
...5 minutes later...
|
||||
Bob --> Alice: Good Bye !
|
||||
|
||||
@enduml
|
||||
```
|
||||
),
|
||||
(
|
||||
[Space],
|
||||
```
|
||||
|
@ -1,6 +1,6 @@
|
||||
#import "diagram.typ": diagram, _par, _evt, _gap
|
||||
#import "participant.typ": SHAPES
|
||||
#import "separator.typ": _sep
|
||||
#import "separator.typ": _sep, _delay
|
||||
#import "sequence.typ": _seq, _ret
|
||||
#import "group.typ": _grp, _alt
|
||||
#import "note.typ": _note, SIDES
|
||||
@ -384,6 +384,19 @@
|
||||
return _gap(size: size)
|
||||
}
|
||||
|
||||
#let is-delay-stmt(line) = {
|
||||
return line.starts-with("...")
|
||||
}
|
||||
|
||||
#let parse-delay-stmt(line) = {
|
||||
if line == "..." {
|
||||
return _delay()
|
||||
}
|
||||
let m = line.match(regex("\.\.\.\s*(.*?)\s*\.\.\."))
|
||||
let name = m.captures.first()
|
||||
return _delay(name: name)
|
||||
}
|
||||
|
||||
#let is-sep-stmt(line) = {
|
||||
return line.starts-with("==") and line.ends-with("==")
|
||||
}
|
||||
@ -961,6 +974,8 @@
|
||||
elmts += parse-par-stmt(line)
|
||||
} else if is-gap-stmt(line) {
|
||||
elmts += parse-gap-stmt(line)
|
||||
} else if is-delay-stmt(line) {
|
||||
elmts += parse-delay-stmt(line)
|
||||
} else if is-sep-stmt(line) {
|
||||
elmts += parse-sep-stmt(line)
|
||||
} else if is-evt-stmt(line) {
|
||||
|
Loading…
Reference in New Issue
Block a user