diff options
author | 2021-10-11 01:42:22 +0200 | |
---|---|---|
committer | 2021-10-31 19:26:10 +0100 | |
commit | e1d6802843960e911f19c7e9c4a4b626ae854b90 (patch) | |
tree | e62d4d3fa0bc4f3ce1582eb2edb35b2d0d030994 /language/src | |
parent | fix(web): a11y issue reported by Lighthouse (diff) | |
download | refinery-e1d6802843960e911f19c7e9c4a4b626ae854b90.tar.gz refinery-e1d6802843960e911f19c7e9c4a4b626ae854b90.tar.zst refinery-e1d6802843960e911f19c7e9c4a4b626ae854b90.zip |
feat(web): simplify contextual parsing
* More relaxted parsing in the browser for stable variable/node
identifier classification.
* String support in the browser.
* contains, refers, and opposite keywords are no longer contextual,
which simplifies parsing in the browser.
Diffstat (limited to 'language/src')
-rw-r--r-- | language/src/main/java/tools/refinery/language/GenerateProblem.mwe2 | 34 | ||||
-rw-r--r-- | language/src/main/java/tools/refinery/language/Problem.xtext | 4 |
2 files changed, 26 insertions, 12 deletions
diff --git a/language/src/main/java/tools/refinery/language/GenerateProblem.mwe2 b/language/src/main/java/tools/refinery/language/GenerateProblem.mwe2 index 79eb79a7..58620d6a 100644 --- a/language/src/main/java/tools/refinery/language/GenerateProblem.mwe2 +++ b/language/src/main/java/tools/refinery/language/GenerateProblem.mwe2 | |||
@@ -3,35 +3,39 @@ module tools.refinery.language.GenerateProblem | |||
3 | import org.eclipse.xtext.xtext.generator.* | 3 | import org.eclipse.xtext.xtext.generator.* |
4 | import org.eclipse.xtext.xtext.generator.model.project.* | 4 | import org.eclipse.xtext.xtext.generator.model.project.* |
5 | 5 | ||
6 | var rootPath = ".." | 6 | var rootPath = '..' |
7 | 7 | ||
8 | Workflow { | 8 | Workflow { |
9 | component = XtextGenerator { | 9 | component = XtextGenerator { |
10 | configuration = { | 10 | configuration = { |
11 | project = StandardProjectConfig { | 11 | project = StandardProjectConfig { |
12 | baseName = "language" | 12 | baseName = 'language' |
13 | rootPath = rootPath | 13 | rootPath = rootPath |
14 | runtimeTest = { | 14 | runtimeTest = { |
15 | enabled = true | 15 | enabled = true |
16 | srcGen = 'src/testFixtures/xtext-gen' | 16 | srcGen = 'src/testFixtures/xtext-gen' |
17 | } | 17 | } |
18 | genericIde = { | 18 | genericIde = { |
19 | name = "language-ide" | 19 | name = 'language-ide' |
20 | } | ||
21 | web = { | ||
22 | enabled = true | ||
23 | name = 'language-web' | ||
20 | } | 24 | } |
21 | mavenLayout = true | 25 | mavenLayout = true |
22 | } | 26 | } |
23 | code = { | 27 | code = { |
24 | encoding = "UTF-8" | 28 | encoding = 'UTF-8' |
25 | lineDelimiter = "\n" | 29 | lineDelimiter = '\n' |
26 | fileHeader = "/*\n * generated by Xtext \${version}\n */" | 30 | fileHeader = '/*\n * generated by Xtext \${version}\n */' |
27 | preferXtendStubs = false | 31 | preferXtendStubs = false |
28 | } | 32 | } |
29 | } | 33 | } |
30 | 34 | ||
31 | language = StandardLanguage { | 35 | language = StandardLanguage { |
32 | name = "tools.refinery.language.Problem" | 36 | name = 'tools.refinery.language.Problem' |
33 | fileExtensions = "problem" | 37 | fileExtensions = 'problem' |
34 | referencedResource = "platform:/resource/refinery-language-model/model/problem.genmodel" | 38 | referencedResource = 'platform:/resource/refinery-language-model/model/problem.genmodel' |
35 | serializer = { | 39 | serializer = { |
36 | generateStub = false | 40 | generateStub = false |
37 | } | 41 | } |
@@ -44,7 +48,17 @@ Workflow { | |||
44 | junitSupport = { | 48 | junitSupport = { |
45 | generateStub = false | 49 | generateStub = false |
46 | skipXbaseTestingPackage = true | 50 | skipXbaseTestingPackage = true |
47 | junitVersion = "5" | 51 | junitVersion = '5' |
52 | } | ||
53 | webSupport = { | ||
54 | // We only generate the {@code AbstractProblemWebModule}, | ||
55 | // because we write our own integration code for CodeMirror 6. | ||
56 | framework = 'codemirror' | ||
57 | generateHtmlExample = false | ||
58 | generateJettyLauncher = false | ||
59 | generateJsHighlighting = false | ||
60 | generateServlet = false | ||
61 | generateWebXml = false | ||
48 | } | 62 | } |
49 | } | 63 | } |
50 | } | 64 | } |
diff --git a/language/src/main/java/tools/refinery/language/Problem.xtext b/language/src/main/java/tools/refinery/language/Problem.xtext index c4c890e3..6f6a8588 100644 --- a/language/src/main/java/tools/refinery/language/Problem.xtext +++ b/language/src/main/java/tools/refinery/language/Problem.xtext | |||
@@ -26,7 +26,7 @@ EnumLiteral returns Node: | |||
26 | name=Identifier; | 26 | name=Identifier; |
27 | 27 | ||
28 | ReferenceDeclaration: | 28 | ReferenceDeclaration: |
29 | (-> (containment?="contains" | "refers"))? | 29 | (containment?="contains" | "refers")? |
30 | referenceType=[Relation|QualifiedName] | 30 | referenceType=[Relation|QualifiedName] |
31 | ("[" multiplicity=Multiplicity "]")? | 31 | ("[" multiplicity=Multiplicity "]")? |
32 | name=Identifier | 32 | name=Identifier |
@@ -184,7 +184,7 @@ QualifiedName hidden(): | |||
184 | 184 | ||
185 | Identifier: | 185 | Identifier: |
186 | ID | "true" | "false" | "unknown" | "error" | "class" | "abstract" | "extends" | "enum" | "pred" | "scope" | | 186 | ID | "true" | "false" | "unknown" | "error" | "class" | "abstract" | "extends" | "enum" | "pred" | "scope" | |
187 | "unique" | "default" | "problem" | "contains" | "refers" | "new" | "delete"; | 187 | "unique" | "default" | "problem" | "new" | "delete"; |
188 | 188 | ||
189 | Integer returns ecore::EInt hidden(): | 189 | Integer returns ecore::EInt hidden(): |
190 | "-"? INT; | 190 | "-"? INT; |