aboutsummaryrefslogtreecommitdiffstats
path: root/language-web/src/main/js/index.jsx
blob: 48c0baeb675dfb867b49a6ca165fd509667dd6fa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React from 'react';
import { render } from 'react-dom';

import XtextCodeMirror from "./components/XtextCodeMirror";

import '../css/index.scss';

const initialValue = `class Family {
  contains Person[] members
}

class Person {
  Person[] children opposite parent
  Person[0..1] parent opposite children
  int age
  TaxStatus taxStatus
}

enum TaxStatus {
  child, student, adult, retired
}

% A child cannot have any dependents.
error invalidTaxStatus(Person p) :-
  taxStatus(p, child), children(p, _q).

Family('family').
members('family', anne).
members('family', bob).
members('family', ciri).
children(anne, ciri).
?children(bob, ciri).
taxStatus(anne, adult).
age(anne, 35).
bobAge: 27.
age(bob, bobAge).
!age(ciri, bobAge).

scope Family = 1, Person += 5..10.
`;
const app = <XtextCodeMirror initialValue={initialValue}/>;

render(app, document.getElementById('app'));