diff options
author | Kristóf Marussy <kristof@marussy.com> | 2021-06-27 23:21:42 +0200 |
---|---|---|
committer | Kristóf Marussy <kristof@marussy.com> | 2021-06-27 23:30:25 +0200 |
commit | 7febe0b4781c5bb0fab34895ad642040ae143a8b (patch) | |
tree | 5bc49f9195b18a938382f2527ee4ab273527a07a /language-web | |
parent | Electric semicolons (diff) | |
download | refinery-7febe0b4781c5bb0fab34895ad642040ae143a8b.tar.gz refinery-7febe0b4781c5bb0fab34895ad642040ae143a8b.tar.zst refinery-7febe0b4781c5bb0fab34895ad642040ae143a8b.zip |
Add data constant support
Diffstat (limited to 'language-web')
-rw-r--r-- | language-web/src/main/webapp/index.html | 9 | ||||
-rw-r--r-- | language-web/src/main/webapp/xtext-resources/generated/mode-problem.js | 8 |
2 files changed, 12 insertions, 5 deletions
diff --git a/language-web/src/main/webapp/index.html b/language-web/src/main/webapp/index.html index 97c4dbab..3e068f68 100644 --- a/language-web/src/main/webapp/index.html +++ b/language-web/src/main/webapp/index.html | |||
@@ -22,8 +22,9 @@ | |||
22 | 22 | ||
23 | class Person { | 23 | class Person { |
24 | Person[] children opposite parent | 24 | Person[] children opposite parent |
25 | Person parent opposite children | 25 | Person[0..1] parent opposite children |
26 | TaxStatus[1] taxStatus | 26 | int age |
27 | TaxStatus taxStatus | ||
27 | } | 28 | } |
28 | 29 | ||
29 | enum TaxStatus { | 30 | enum TaxStatus { |
@@ -41,6 +42,10 @@ members('family', ciri). | |||
41 | children(anne, ciri). | 42 | children(anne, ciri). |
42 | ?children(bob, ciri). | 43 | ?children(bob, ciri). |
43 | taxStatus(anne, adult). | 44 | taxStatus(anne, adult). |
45 | age(anne, 35). | ||
46 | bobAge: 27. | ||
47 | age(bob, bobAge). | ||
48 | !age(ciri, bobAge). | ||
44 | 49 | ||
45 | scope Family = 1, Person += 5..10. | 50 | scope Family = 1, Person += 5..10. |
46 | </pre></div> | 51 | </pre></div> |
diff --git a/language-web/src/main/webapp/xtext-resources/generated/mode-problem.js b/language-web/src/main/webapp/xtext-resources/generated/mode-problem.js index 92adcff1..ba39dd13 100644 --- a/language-web/src/main/webapp/xtext-resources/generated/mode-problem.js +++ b/language-web/src/main/webapp/xtext-resources/generated/mode-problem.js | |||
@@ -1,5 +1,6 @@ | |||
1 | define(["codemirror", "codemirror/addon/mode/simple"], function(CodeMirror, SimpleMode) { | 1 | define(["codemirror", "codemirror/addon/mode/simple"], function(CodeMirror, SimpleMode) { |
2 | var keywords = "abstract|class|contains|enum|error|extends|false|opposite|pred|problem|refers|scope|true|unknown"; | 2 | var keywords = "abstract|class|contains|enum|error|extends|false|opposite|pred|problem|refers|scope|true|unknown"; |
3 | var extraKeywords = "!|\\(|\\)|\\*|\\+|,|-|\\.|:|;|=|\\?|\\[|\\]|\\{|\\}"; | ||
3 | CodeMirror.defineSimpleMode("xtext/problem", { | 4 | CodeMirror.defineSimpleMode("xtext/problem", { |
4 | start: [ | 5 | start: [ |
5 | {token: "comment", regex: "\\/\\*", next : "comment"}, | 6 | {token: "comment", regex: "\\/\\*", next : "comment"}, |
@@ -10,9 +11,10 @@ define(["codemirror", "codemirror/addon/mode/simple"], function(CodeMirror, Simp | |||
10 | {token: "comment", regex: "%.*$"}, | 11 | {token: "comment", regex: "%.*$"}, |
11 | {token: "comment", regex: "\\/\\/.*$"}, | 12 | {token: "comment", regex: "\\/\\/.*$"}, |
12 | {token: "lparen", indent: true, regex: "[[({]"}, | 13 | {token: "lparen", indent: true, regex: "[[({]"}, |
13 | {token: "rparen", dedent: true, dedentIfLineStart: true, regex: "[\\])}]"}, | 14 | {token: "rparen", dedent: true, regex: "[\\])}]"}, |
14 | {indent: true, push: "predicateBody", regex: ":-"}, | 15 | {indent: true, push: "predicateBody", regex: ":-"}, |
15 | {token: "keyword", regex: "\\b(?:" + keywords + ")\\b"} | 16 | {token: "keyword", regex: "\\b(?:" + keywords + ")\\b"}, |
17 | {token: "keyword", regex: "(?:^|\\s)(?:" + extraKeywords + ")(?=[\\s.:;,!?+\\-*/&|<>()[\\]{}]|$)"} | ||
16 | ], | 18 | ], |
17 | comment: [ | 19 | comment: [ |
18 | {token: "comment", regex: ".*?\\*\\/", next : "start"}, | 20 | {token: "comment", regex: ".*?\\*\\/", next : "start"}, |
@@ -32,7 +34,7 @@ define(["codemirror", "codemirror/addon/mode/simple"], function(CodeMirror, Simp | |||
32 | {token: "comment", regex: "%.*$"}, | 34 | {token: "comment", regex: "%.*$"}, |
33 | {token: "comment", regex: "\\/\\/.*$"}, | 35 | {token: "comment", regex: "\\/\\/.*$"}, |
34 | {token: "lparen", indent: true, regex: "[[({]"}, | 36 | {token: "lparen", indent: true, regex: "[[({]"}, |
35 | {token: "rparen", dedent: true, dedentIfLineStart: true, regex: "[\\])}]"}, | 37 | {token: "rparen", dedent: true, regex: "[\\])}]"}, |
36 | {dedent: true, dedentIfLineStart: false, pop: true, regex: "\\.\\s*$"}, | 38 | {dedent: true, dedentIfLineStart: false, pop: true, regex: "\\.\\s*$"}, |
37 | {indent: true, dedent: true, regex: "[;]"}, | 39 | {indent: true, dedent: true, regex: "[;]"}, |
38 | {token: "keyword", regex: "\\b(?:" + keywords + ")\\b"} | 40 | {token: "keyword", regex: "\\b(?:" + keywords + ")\\b"} |