-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode-editor.js
More file actions
29 lines (25 loc) · 817 Bytes
/
code-editor.js
File metadata and controls
29 lines (25 loc) · 817 Bytes
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
function tokensToRegex(tokens) {
return new RegExp("(?:" + tokens.join("|") + ")");
}
allKeywords = [ "object", "property", "alias", "relationType", "hasProperty", "hasAlias"];
CodeMirror.defineSimpleMode("axioma", {
start: [
{regex: tokensToRegex(allKeywords), token: "keyword"},
{regex: /#.*/, token: "comment"}
],
meta: {
dontIndentStates: ["comment"],
lineComment: "#"
}
});
// Register an array of completion words for this mode
CodeMirror.registerHelper("hintWords", "axioma",
allKeywords);
var editor = CodeMirror.fromTextArea(document.getElementById('modelDefinitionInput'), {
lineNumbers: true,
styleActiveLine: true,
matchBrackets: true,
autoCloseTags: true,
mode: "axioma",
extraKeys: {"'`'": "autocomplete"}
});