Skip to content

Commit 49e35a1

Browse files
Puml parser class diagram grammar extension (#175)
1 parent 399d8ad commit 49e35a1

17 files changed

Lines changed: 2560 additions & 149 deletions

File tree

plantuml/parser/integration_test/class_diagram/class_diagram_positive/class_diagram_positive.puml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ skinparam shadowing false
2020
left to right direction
2121
top to bottom direction
2222

23-
package core <<domain>> {
23+
namespace core <<domain>> {
2424

2525
struct Point <<value_object>> {
2626
x: f32

plantuml/parser/integration_test/class_diagram/class_diagram_positive/output.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,10 @@
236236
"source_line": null
237237
},
238238
{
239-
"id": "core::geometry.Circle",
239+
"id": "core.geometry.Circle",
240240
"name": "Circle",
241241
"alias": null,
242-
"parent_id": "core::geometry",
242+
"parent_id": "core.geometry",
243243
"entity_type": "Class",
244244
"stereotypes": [],
245245
"attributes": [
@@ -284,10 +284,10 @@
284284
"source_line": null
285285
},
286286
{
287-
"id": "core::geometry.Rectangle",
287+
"id": "core.geometry.Rectangle",
288288
"name": "Rectangle",
289289
"alias": null,
290-
"parent_id": "core::geometry",
290+
"parent_id": "core.geometry",
291291
"entity_type": "Class",
292292
"stereotypes": [],
293293
"attributes": [
@@ -332,10 +332,10 @@
332332
"source_line": null
333333
},
334334
{
335-
"id": "core::geometry::advanced.RoundedRectangle",
335+
"id": "core.geometry.advanced.RoundedRectangle",
336336
"name": "RoundedRectangle",
337337
"alias": null,
338-
"parent_id": "core::geometry::advanced",
338+
"parent_id": "core.geometry.advanced",
339339
"entity_type": "Class",
340340
"stereotypes": [],
341341
"attributes": [
@@ -475,16 +475,16 @@
475475
"id": "core",
476476
"name": "core",
477477
"parent_id": null,
478-
"container_type": "Package"
478+
"container_type": "Namespace"
479479
},
480480
{
481-
"id": "core::geometry",
481+
"id": "core.geometry",
482482
"name": "core::geometry",
483483
"parent_id": null,
484484
"container_type": "Package"
485485
},
486486
{
487-
"id": "core::geometry::advanced",
487+
"id": "core.geometry.advanced",
488488
"name": "core::geometry::advanced",
489489
"parent_id": null,
490490
"container_type": "Package"
@@ -504,7 +504,7 @@
504504
],
505505
"relationships": [
506506
{
507-
"source": "core::geometry.Circle",
507+
"source": "core.geometry.Circle",
508508
"target": "core.Shape",
509509
"relation_type": "Inheritance",
510510
"label": "inherit",
@@ -515,7 +515,7 @@
515515
"target_role": null
516516
},
517517
{
518-
"source": "core::geometry.Rectangle",
518+
"source": "core.geometry.Rectangle",
519519
"target": "core.Shape",
520520
"relation_type": "Inheritance",
521521
"label": null,
@@ -526,8 +526,8 @@
526526
"target_role": null
527527
},
528528
{
529-
"source": "core::geometry::advanced.RoundedRectangle",
530-
"target": "core::geometry.Rectangle",
529+
"source": "core.geometry.advanced.RoundedRectangle",
530+
"target": "core.geometry.Rectangle",
531531
"relation_type": "Inheritance",
532532
"label": null,
533533
"stereotype": "extend",
@@ -560,7 +560,7 @@
560560
},
561561
{
562562
"source": "core.Color",
563-
"target": "core::geometry.Circle",
563+
"target": "core.geometry.Circle",
564564
"relation_type": "Aggregation",
565565
"label": null,
566566
"stereotype": null,
@@ -570,7 +570,7 @@
570570
"target_role": null
571571
},
572572
{
573-
"source": "core::geometry.Rectangle",
573+
"source": "core.geometry.Rectangle",
574574
"target": "core.Color",
575575
"relation_type": "Association",
576576
"label": null,
@@ -603,8 +603,8 @@
603603
"target_role": null
604604
},
605605
{
606-
"source": "core::geometry.Circle",
607-
"target": "core::geometry.Rectangle",
606+
"source": "core.geometry.Circle",
607+
"target": "core.geometry.Rectangle",
608608
"relation_type": "Association",
609609
"label": null,
610610
"stereotype": "bidirectional",
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
' *******************************************************************************
2+
' Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
'
4+
' See the NOTICE file(s) distributed with this work for additional
5+
' information regarding copyright ownership.
6+
'
7+
' This program and the accompanying materials are made available under the
8+
' terms of the Apache License Version 2.0 which is available at
9+
' https://www.apache.org/licenses/LICENSE-2.0
10+
'
11+
' SPDX-License-Identifier: Apache-2.0
12+
' *******************************************************************************
13+
@startuml class_diagram_unsupported_syntax
14+
15+
title Unsupported Class Diagram Syntax Coverage
16+
17+
' Priority group 1: file-level constructs
18+
set namespaceSeparator ::
19+
20+
together {
21+
class GroupedA
22+
class GroupedB
23+
}
24+
25+
legend top left
26+
|= Color |= Meaning |
27+
| <#Lavender> | Internal |
28+
end legend
29+
30+
note top of GroupedA : top-level note coverage
31+
32+
package sample::newline #Lavender
33+
{
34+
' Priority group 2: declaration headers
35+
object "FactoryFunctor" as FactoryFunctor {
36+
+ operator()()
37+
}
38+
39+
interface IActivateTask [[cd_activate_task.puml]] {
40+
+ Execute(amp::stop_token) : ResultBlank
41+
}
42+
43+
interface BaseInterface
44+
45+
interface ChildInterface extends BaseInterface {
46+
}
47+
48+
interface ServiceContract
49+
50+
interface CheckProgrammingDependenciesFlag {
51+
+ GetCPDFlag() : CheckProgrammingDependenciesFlagState
52+
}
53+
54+
enum CheckProgrammingDependenciesFlagState
55+
56+
enum ErrorInfo {
57+
kUnspecified
58+
}
59+
60+
struct StartResponsePayload {
61+
+ ErrorInfo
62+
}
63+
64+
class GenericClass<T> {
65+
}
66+
67+
class DiagnosticJobCollectionBuilder {
68+
+ With<DiagnosticJobType>(::ara::core::InstanceSpecifier, DiagnosticJobConstructorArgumentTypes...)
69+
}
70+
71+
class SoftwareEntityTable {
72+
+ SetFingerprint(year : uint8, month : uint8, day : uint8, len_and_tester_id : uint8, reserved : array<uint8, 9>)
73+
}
74+
75+
class ServiceImpl implements ServiceContract {
76+
' Priority group 3: member-level syntax
77+
{abstract} + Run() : ResultBlank
78+
{static} + Finalize()
79+
+ Submit(callable) : auto <<const>>
80+
+ Build()
81+
--
82+
- config_ : Config
83+
84+
' Priority group 4: C++ member names and method templates
85+
+ ~ServiceImpl()
86+
+ operator()(amp::stop_token) : ResultBlank
87+
+ Submit<CallableType, ArgumentTypes...>(callable, arguments)
88+
+ Submit(CallableType&&, ArgumentTypes&&)<T> : auto
89+
90+
' Priority group 5: C++ type expressions
91+
+ GetActiveSWEs() : SoftwareEntityTable&
92+
+ TakeOwnership() : Artifact&&
93+
+ operator->() : Result<Artifact>*
94+
+ run_application(argv : []test::StringLiteral) : std::int32_t
95+
+ non_fatal_errors : {test::result::Error}
96+
+ Visit(visitor : amp::callback<void(Flashing&)>)
97+
+ VisitUnnamed(amp::callback<void(FlashingMinion&)>)
98+
99+
' Priority group 6: multiline signatures
100+
+ CreateJobs(const amp::stop_token&,\n InfrastructureContext, Context)
101+
+ ChangeHandler(amp::pmr::unique_ptr<ExecutorFactory>,\
102+
\n std::shared_ptr<mw::diag::IConversations>)
103+
}
104+
105+
note right of ServiceImpl : inline note coverage
106+
107+
class "<<template>>\nTest<T>" as TestTemplate <<service>> #Khaki {
108+
+ Bind()
109+
}
110+
}
111+
112+
class TestMethod #Lavender{
113+
+ Test(\n callable,\n on_success,\n timeout,\n stop_token,\n minion_id,\n retries)
114+
- std::mutex
115+
}
116+
117+
object "runTest" as runTestType {
118+
+ run<Param1, Args...>(
119+
argc : std::int32_t,
120+
argv : []std::uint8_t,
121+
args : Args&&...) : std::int32_t
122+
}
123+
124+
class AllowModeChangeService {
125+
using AllowOpModeChangeOutput = std::uint8_t
126+
}
127+
128+
ServiceImpl ..|> ServiceContract
129+
ChildInterface -up-|> BaseInterface
130+
StartResponsePayload +- ErrorInfo
131+
StartResponsePayload o- ErrorInfo
132+
CheckProgrammingDependenciesFlag -> CheckProgrammingDependenciesFlagState : uses
133+
FactoryFunctor --> ServiceImpl : creates
134+
135+
@enduml

0 commit comments

Comments
 (0)