Skip to content

Commit

Permalink
Implment OSS-213 (#712)
Browse files Browse the repository at this point in the history
The parser changers are trivial. Most of damage
was to test cases and test input.

Co-authored-by: reidspencer <[email protected]>
  • Loading branch information
reid-spencer and reidspencer authored Jan 29, 2025
1 parent 4bd7867 commit b42d42d
Show file tree
Hide file tree
Showing 36 changed files with 895 additions and 829 deletions.
3 changes: 1 addition & 2 deletions commands/input/adaptors.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ domain Adaptors is {
context One is {
command TwoIsDone is { ??? }
adaptor FromTwo from context Two is {
option css("background: blue")
handler Adaptation is {
on event Adaptors.Two.DidIt from context Two {
"convert Two.DidIt to One.TwoIsDone"
tell command Adaptors.One.TwoIsDone to context One
}
}
}
} with { option css("background: blue") }
}
context Two is {
event DidIt is { ??? }
Expand Down
3 changes: 2 additions & 1 deletion commands/input/everything.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ domain Everything is {
command ACommand is { ??? }

entity Something is {
option aggregate option transient

type somethingDate is Date

Expand All @@ -76,6 +75,8 @@ domain Everything is {
returns {b: Boolean}
???
}
} with {
option aggregate option transient
}

entity SomeOtherThing is {
Expand Down
23 changes: 11 additions & 12 deletions commands/input/hugo/context-relationships.riddl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
domain foo {
context A {
option css("fill:white,stroke:#333,stroke-width:3px,color:blue") option faicon("fa-house")
type AEvents is one of { A.AEvent1, C.CEvent }
sink Sink { inlet aInlet is A.AEvents }
command ACommand { ??? }
Expand All @@ -17,17 +16,12 @@ domain foo {
}
}
}
} with {
option css("fill:white,stroke:#333,stroke-width:3px,color:blue")
option faicon("fa-house")
}
// case m: Type => Some(foreignContext -> s"Uses ${m.identify} from")
// case e: Entity => Some(foreignContext -> s"References ${e.identify} in")
// case f: Field => Some(foreignContext -> s"Sets ${f.identify} in")
// case i: Inlet => Some(foreignContext -> s"Sends to ${i.identify} in")
// case o: Outlet => Some(foreignContext -> s"Takes from ${o.identify} in")
// case p: Processor[?, ?] => Some(foreignContext -> s"Tells to ${p.identify} in")

context B {
option css("fill:white,stroke:#333,stroke-width:3px,color:green")
option faicon("fa-house")
command BCommand { ??? }
flow Flow is {
inlet bInlet is A.AEvents
Expand All @@ -42,10 +36,11 @@ domain foo {
}
}
}
} with {
option css("fill:white,stroke:#333,stroke-width:3px,color:green")
option faicon("fa-house")
}
context C {
option css("fill:white,stroke:#333,stroke-width:3px,color:purple")
option faicon("fa-house")
command CCommand is { ??? }
event CEvent is { ??? }
entity CEntity {
Expand All @@ -57,13 +52,17 @@ domain foo {
}
}
}
} with {
option css("fill:white,stroke:#333,stroke-width:3px,color:purple")
option faicon("fa-house")
}
}

domain bar {
context D {
adaptor Dadaptor from context A is { ??? }
} with {
option css("fill:white,stroke:#333,stroke-width:3px,color:red")
option faicon("fa-house")
adaptor Dadaptor from context A is { ??? }
}
}
24 changes: 13 additions & 11 deletions commands/input/match-error.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ domain PersonalBanking is {

domain PersonalBankingApp is {
context Test is {
option is technology("react.js")
result Title is { value: String }
command Name is { value: String }
group HomePage is {
output AccountDetailsPage presents result Title with {
described as "Show a blank page with a title"
}
input Two acquires command Name with {
described as "Show a blank page with a title, collect a Name"
}
result Title is { value: String }
command Name is { value: String }
group HomePage is {
output AccountDetailsPage presents result Title with {
described as "Show a blank page with a title"
}
} with { described as "A very simple app for testing" }
input Two acquires command Name with {
described as "Show a blank page with a title, collect a Name"
}
}
} with {
option is technology("react.js")
described as "A very simple app for testing"
}
} with { briefly "The user interface for the Personal Banking Application" }
}
14 changes: 9 additions & 5 deletions commands/input/rbbq.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ domain ReactiveBBQ is {
address: type Kitchen.IP4Address
} // Should we support IP4Address?
entity OrderViewer is {
option is kind("device")
record fields is { field: type Kitchen.OrderViewType }
state OrderState of OrderViewer.fields
handler input is { ??? }

} with {
option is kind("device")
briefly "This is an OrderViewer"
explained as {
|The OrderViewer is the device in the kitchen, probably a touch screen,
Expand Down Expand Up @@ -93,26 +93,28 @@ domain ReactiveBBQ is {

context Order is {
entity Order is {
option is aggregate
record fields is {
orderId is ReactiveBBQ.OrderId,
customerId is ReactiveBBQ.CustomerId
}
state OrderState of Order.fields
handler foo is {}
} with {
option is aggregate
}
}

context Payment is {
entity Payment is {
option is aggregate
record fields is {
orderId is ReactiveBBQ.OrderId,
amount is Number,
cardToken is String
}
state PaymentState of Payment.fields
handler foo is { ??? }
} with {
option is aggregate
}
}

Expand All @@ -124,10 +126,11 @@ domain ReactiveBBQ is {
}
type MenuItemRef is reference to entity Menu.MenuItem
entity MenuEntity is {
option is aggregate
record fields is { items: many Menu.MenuItemRef }
state typical of MenuEntity.fields
handler foo is { ??? }
} with {
option is aggregate
}
}

Expand All @@ -146,10 +149,11 @@ domain ReactiveBBQ is {
} with { explained as "This is a retail store Location" }

entity Reservation is {
option aggregate
record fields is { value: ReservationValue }
state reservation of Reservation.fields
handler ofInputs is {}
} with {
option aggregate
}
} // end of context
} with {
Expand Down
2 changes: 1 addition & 1 deletion commands/input/regressions/match-error.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ domain PersonalBanking is {

domain PersonalBankingApp is {
context Test is {
option is technology("react.js")
result Title is { value: String }
command Name is { value: String }
group HomePage is {
Expand All @@ -24,6 +23,7 @@ domain PersonalBanking is {
}
}
} with {
option is technology("react.js")
briefly "The user interface for the Personal Banking Application"
described as "A very simple app for testing"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class AdaptorWriterTest extends WriterTest {
|| _Briefly_ | No brief description. |
|| _Authors_ | |
|| _Definition Path_ | Root.Adaptors.One.FromTwo |
|| _View Source Link_ | [commands/input/adaptors.riddl(77->372)]() |
|| _View Source Link_ | [commands/input/adaptors.riddl(77->375)]() |
|| _Used By_ | None |
|| _Uses_ | None |
|
Expand All @@ -69,7 +69,7 @@ class AdaptorWriterTest extends WriterTest {
|| :---: | :--- |
|| _Briefly_ | No brief description. |
|| _Definition Path_ | FromTwo.Root.Adaptors.One.Adaptation |
|| _View Source Link_ | [commands/input/adaptors.riddl(158->368)]() |
|| _View Source Link_ | [commands/input/adaptors.riddl(121->331)]() |
|| _Used By_ | None |
|| _Uses_ | None |
|
Expand Down
16 changes: 11 additions & 5 deletions language/input/dokn.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ domain dokn is {
}

entity Company is {
option event-sourced option available

type AddCompany is command {
mailingAddress: Address,
Expand All @@ -56,6 +55,9 @@ domain dokn is {
send event CompanyAdded to outlet CompanyEvents_out
}
}
} with {
option event-sourced
option available
}
}

Expand All @@ -66,7 +68,6 @@ domain dokn is {
}

entity Driver is {
option event-sourced option available

type AddDriverToCompany is command { name: String, mobile: MobileNumber, companyId: CompanyId }
type DriverAddedToCompany is event { name: String, mobile: MobileNumber, companyId: CompanyId }
Expand Down Expand Up @@ -97,12 +98,13 @@ domain dokn is {
send event DriverRemovedFromCompany to inlet Driver_out
}
}
} with {
option event-sourced option available
}
}

context Note is {
entity Note is {
option event-sourced option available
record fields is {
noteId: NoteId,
locationId: type LocationId,
Expand All @@ -114,25 +116,27 @@ domain dokn is {
}
state NoteBase of Note.fields
handler NoteBaseHandler is { ??? }
} with {
option event-sourced option available
}
}

context Media is {
entity Media is {
option consistent
record fields is {
mediaId: MediaId,
path: String,
companyId: CompanyId
}
state MediaBase of Media.fields
handler MediaBaseHandler is { ??? }
} with {
option consistent
}
}

context Location is {
entity Location is {
option event-sourced option available

type AddDeliveryLocation is command {
geohash: Location, label: String
Expand Down Expand Up @@ -189,6 +193,8 @@ domain dokn is {
send result Location.LocationNotes to outlet Driver_out
}
}
} with {
option event-sourced option available
}
}
} with {
Expand Down
5 changes: 3 additions & 2 deletions language/input/everything_full.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ context full is {
}

entity Something is {
option aggregate
option transient
function misc is {
requires { n: Nothing }
returns { b: Boolean }
???
} with {
option aggregate
option transient
}
type somethingDate is Date

Expand Down
16 changes: 10 additions & 6 deletions language/input/rbbq.riddl
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ domain ReactiveBBQ is {
address: type IP4Address
}
entity OrderViewer is {
option is kind("device")
record AField is { field: type OrderViewType }
state OrderState of OrderViewer.AField
handler Input is { ??? }
} with {
option is kind("device")
explained as {
|# brief
|This is an OrderViewer
Expand Down Expand Up @@ -97,26 +97,28 @@ domain ReactiveBBQ is {

context Order is {
entity Order is {
option is aggregate
record Fields is {
orderId is OrderId,
customerId is CustomerId
}
state OrderState of Order.Fields
handler foo is {}
} with {
option is aggregate
}
}

context Payment is {
entity Payment is {
option is aggregate
record Fields is {
orderId is OrderId,
amount is Number,
cardToken is String
}
state PaymentState of Payment.Fields
handler foo is { ??? }
} with {
option is aggregate
}
}

Expand All @@ -128,10 +130,11 @@ domain ReactiveBBQ is {
}
type MenuItemRef is reference to entity MenuItem
entity Menu is {
option is aggregate
record Fields is { items: many MenuItemRef }
state typical of Menu.Fields
handler foo is { ??? }
} with {
option is aggregate
}
}

Expand All @@ -150,11 +153,12 @@ domain ReactiveBBQ is {
} with { explained as "This is a retail store Location" }

entity Reservation is {
option aggregate
record Fields is { value: ReservationValue }
state reservation of Reservation.Fields
handler ofInputs is {}
}
} with {
option aggregate
}
}
} with {
explained as {
Expand Down
Loading

0 comments on commit b42d42d

Please sign in to comment.