aboutsummaryrefslogtreecommitdiffstats
path: root/language-web/src/main/js/index.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'language-web/src/main/js/index.tsx')
-rw-r--r--language-web/src/main/js/index.tsx30
1 files changed, 20 insertions, 10 deletions
diff --git a/language-web/src/main/js/index.tsx b/language-web/src/main/js/index.tsx
index 80c70f23..dfecde37 100644
--- a/language-web/src/main/js/index.tsx
+++ b/language-web/src/main/js/index.tsx
@@ -9,23 +9,34 @@ import { ThemeProvider } from './theme/ThemeProvider';
9import '../css/index.scss'; 9import '../css/index.scss';
10 10
11const initialValue = `class Family { 11const initialValue = `class Family {
12 contains Person[] members 12 contains Person[] members
13} 13}
14 14
15class Person { 15class Person {
16 Person[] children opposite parent 16 Person[] children opposite parent
17 Person[0..1] parent opposite children 17 Person[0..1] parent opposite children
18 int age 18 int age
19 TaxStatus taxStatus 19 TaxStatus taxStatus
20} 20}
21 21
22enum TaxStatus { 22enum TaxStatus {
23 child, student, adult, retired 23 child, student, adult, retired
24} 24}
25 25
26% A child cannot have any dependents. 26% A child cannot have any dependents.
27error invalidTaxStatus(Person p) <-> 27pred invalidTaxStatus(Person p) <->
28 taxStatus(p, child), children(p, _q). 28 taxStatus(p, child),
29 children(p, _q)
30 ; taxStatus(p, retired),
31 parent(p, q),
32 !taxStatus(q, retired).
33
34direct rule createChild(p):
35 children(p, newPerson) = unknown,
36 equals(newPerson, newPerson) = unknown
37 ~> new q,
38 children(p, q) = true,
39 taxStatus(q, child) = true.
29 40
30unique family. 41unique family.
31Family(family). 42Family(family).
@@ -44,8 +55,7 @@ age(bob, bobAge).
44scope Family = 1, Person += 5..10. 55scope Family = 1, Person += 5..10.
45`; 56`;
46 57
47const rootStore = new RootStore(); 58const rootStore = new RootStore(initialValue);
48rootStore.editorStore.updateValue(initialValue);
49 59
50const app = ( 60const app = (
51 <RootStoreProvider rootStore={rootStore}> 61 <RootStoreProvider rootStore={rootStore}>