Skip to content

Commit 5c73bc6

Browse files
committed
Fix #1525
1 parent 26bdd60 commit 5c73bc6

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

web/js/codeworld-mode.js

+21-17
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,33 @@ CodeMirror.defineMode('codeworld', (config, modeConfig) => {
2626
'\\\\HT|\\\\LF|\\\\VT|\\\\FF|\\\\CR|\\\\SO|\\\\SI|\\\\DLE|\\\\DC1|\\\\DC2|' +
2727
'\\\\DC3|\\\\DC4|\\\\NAK|\\\\SYN|\\\\ETB|\\\\CAN|\\\\EM|\\\\SUB|\\\\ESC|' +
2828
'\\\\FS|\\\\GS|\\\\RS|\\\\US|\\\\SP|\\\\DEL';
29-
const RE_WHITESPACE = /[ \v\t\f]+/;
30-
const RE_STARTMETA = /{-#/;
31-
const RE_STARTCOMMENT = /{-/;
32-
const RE_DASHES = /--+(?=$|[^:!#$%&*+./<=>?@\\^|~-]+)/;
33-
const RE_QUAL = /[A-Z][A-Za-z_0-9']*\.(?=[A-Za-z_:!#$%&*+./<=>?@\\^|~]|-[^-])/;
34-
const RE_VARID = /[a-z_][A-Za-z_0-9']*/;
35-
const RE_CONID = /[A-Z][A-Za-z_0-9']*/;
36-
const RE_VARSYM = /[!#$%&*+./<=>?@\\^|~-][:!#$%&*+./<=>?@\\^|~-]*/;
37-
const RE_CONSYM = /:[:!#$%&*+./<=>?@\\^|~-]*/;
38-
const RE_NUMBER = /[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?|0[oO][0-7]+|0[xX][0-9a-fA-F]+/;
29+
const RE_WHITESPACE = /[ \v\t\f]+/u;
30+
const RE_STARTMETA = /\{-#/u;
31+
const RE_STARTCOMMENT = /\{-/u;
32+
const RE_DASHES = /--+(?=$|[^:!#$%&*+./<=>?@\\^|~-]+)/u;
33+
const RE_QUAL =
34+
/\p{Lu}(\p{L}|[_0-9'])*\.(?=\p{L}|[_:!#$%&*+./<=>?@\\^|~]|-[^-])/u;
35+
const RE_VARID = /(\p{Ll}|_)(\p{L}|[_0-9'])*/u;
36+
const RE_CONID = /\p{Lu}(\p{L}|[_0-9'])*/u;
37+
const RE_VARSYM = /[!#$%&*+./<=>?@\\^|~-][:!#$%&*+./<=>?@\\^|~-]*/u;
38+
const RE_CONSYM = /:[:!#$%&*+./<=>?@\\^|~-]*/u;
39+
const RE_NUMBER =
40+
/[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?|0[oO][0-7]+|0[xX][0-9a-fA-F]+/u;
3941
const RE_CHAR = new RegExp(
4042
`'(?:[^\\\\']|\\\\[abfnrtv\\\\"']|\\\\^[A-Z@[\\\\\\]^_]|${MULTICHAR_ESCAPE_REGEX})'`
4143
);
4244
const RE_STRING = new RegExp(
4345
`"(?:[^\\\\"]|\\\\[abfnrtv\\\\"'&]|\\\\^[A-Z@[\\\\\\]^_]|${MULTICHAR_ESCAPE_REGEX})*"`
4446
);
45-
const RE_OPENBRACKET = /[([{]/;
46-
const RE_CLOSEBRACKET = /[)\]}]/;
47-
const RE_INCOMMENT = /(?:[^{-]|-(?=$|[^}])|\{(?=$|[^-]))*/;
48-
const RE_ENDCOMMENT = /-}/;
49-
const RE_ELECTRIC_START = /^\s*(?:[:!#$%&*+./<=>?@^|~,)\]}-]+|where\b|in\b|of\b|then\b|else\b|deriving\b)/;
50-
const RE_ELECTRIC_INPUT = /^\s*(?:[:!#$%&*+./<=>?@^|~,)\]}-]+|where|in|of|then|else|deriving).?$/;
51-
const RE_NEGATIVE_NUM = /^\s*[-]($|[^!#$%&*+./<=>?@\\^|~-])/;
47+
const RE_OPENBRACKET = /[([{]/u;
48+
const RE_CLOSEBRACKET = /[)\]}]/u;
49+
const RE_INCOMMENT = /(?:[^{-]|-(?=$|[^}])|\{(?=$|[^-]))*/u;
50+
const RE_ENDCOMMENT = /-\}/u;
51+
const RE_ELECTRIC_START =
52+
/^\s*(?:[:!#$%&*+./<=>?@^|~,)\]}-]+|where\b|in\b|of\b|then\b|else\b|deriving\b)/u;
53+
const RE_ELECTRIC_INPUT =
54+
/^\s*(?:[:!#$%&*+./<=>?@^|~,)\]}-]+|where|in|of|then|else|deriving).?$/u;
55+
const RE_NEGATIVE_NUM = /^\s*[-]($|[^!#$%&*+./<=>?@\\^|~-])/u;
5256

5357
// The state has the following properties:
5458
//

0 commit comments

Comments
 (0)