Skip to content

Commit

Permalink
update snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Jun 2, 2022
1 parent 9f8558a commit 52fbfc7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion __tests__/__snapshots__/gaiman.spec.js.snap
Expand Up @@ -493,7 +493,7 @@ exports[`values should parse arrays 1`] = `
"async function main() {
try {
let $_x = new GaimanArray(1, 2, 3, 4);
let $_x = new GaimanArray(1, 2, 3, 4);
$_x = new GaimanArray(1, 2, 3, 4);
for (let $_word of new GaimanArray(\`lorem\`, \`ipsum\`, \`dolor\`)) {
if (gaiman.should_break_loop(1)) {
break;
Expand Down
3 changes: 3 additions & 0 deletions docs/index.html
Expand Up @@ -236,7 +236,10 @@
<script src="https://cdn.jsdelivr.net/npm/peggy"></script>
<script src="https://cdn.jsdelivr.net/combine/npm/codemirror@5.x.x/mode/javascript/javascript.js,npm/codemirror@5.x.x/mode/pegjs/pegjs.js,npm/codemirror@5.x.x/mode/css/css.js"></script>
<script src="https://cdn.jsdelivr.net/combine/npm/codemirror@5.65.0/mode/xml/xml.js,npm/codemirror@5.65.0/mode/htmlmixed/htmlmixed.js,npm/codemirror@5/addon/mode/simple.js"></script>
<!--
<script src="https://cdn.jsdelivr.net/gh/jcubic/gaiman@master/src/codemirror.js"></script>
-->
<script src="../src/codemirror.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery.splitter"></script>
<script src="https://cdn.jsdelivr.net/gh/jcubic/static/js/idb-keyval.js"></script>
<script src="https://cdn.jsdelivr.net/gh/jcubic/gaiman/umd.min.js"></script>
Expand Down
15 changes: 6 additions & 9 deletions src/codemirror.js
Expand Up @@ -27,8 +27,8 @@
"type", "ask*", "echo*", "input*", "update", "clear", "mask"
], keywords = wordObj(keywordList);

var indentWords = wordObj(["def", "do", "then", "lambda"]);
var dedentWords = wordObj(["end"]);
var indentWords = wordObj(["def", "do", "then", "lambda", "else"]);
var dedentWords = wordObj(["end", "else"]);
var opening = {"[": "]", "{": "}", "(": ")"};
var closing = {"]": "[", "}": "{", ")": "("};

Expand Down Expand Up @@ -193,25 +193,22 @@
style = state.lastTok == "." ? "property"
: keywords.propertyIsEnumerable(stream.current()) ? "keyword"
: /^[A-Z]/.test(word) ? "tag"
: (state.lastTok == "def" || state.lastTok == "class" || state.varList) ? "def"
: (state.lastTok == "def" || state.varList) ? "def"
: "variable";
if (style == "keyword") {
thisTok = word;
if (indentWords.propertyIsEnumerable(word)) kwtype = "indent";
else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent";
else if ((word == "if" || word == "unless") && stream.column() == stream.indentation())
kwtype = "indent";
else if (word == "do" && state.context.indented < state.indented)
kwtype = "indent";
}
}
if (curPunc || (style && style != "comment")) state.lastTok = thisTok;
if (curPunc == "|") state.varList = !state.varList;

if (kwtype == "indent" || /[\(\[\{]/.test(curPunc))
state.context = {prev: state.context, type: curPunc || style, indented: state.indented};
else if ((kwtype == "dedent" || /[\)\]\}]/.test(curPunc)) && state.context.prev)
else if ((kwtype == "dedent" || /[\)\]\}]/.test(curPunc)) && state.context.prev) {
state.context = state.context.prev;
}

if (stream.eol())
state.continuedLine = (curPunc == "\\" || style == "operator");
Expand All @@ -228,7 +225,7 @@
(state.continuedLine ? config.indentUnit : 0);
},

electricInput: /^\s*(?:end|do|then|lambda|else|\})$/,
electricInput: /^\s*(?:end|do|then|lambda|\})$/,
lineComment: "#",
fold: "indent"
};
Expand Down

0 comments on commit 52fbfc7

Please sign in to comment.