motoko 2.0.6 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/contrib/monaco.js +65 -52
  2. package/package.json +1 -1
package/contrib/monaco.js CHANGED
@@ -1,44 +1,44 @@
1
- 'use strict'
1
+ 'use strict';
2
2
 
3
3
  /// Monaco editor configuration
4
4
  exports.configure = (monaco) => {
5
- monaco.languages.register({ id: "motoko" });
6
- monaco.languages.setLanguageConfiguration("motoko", {
5
+ monaco.languages.register({ id: 'motoko' });
6
+ monaco.languages.setLanguageConfiguration('motoko', {
7
7
  comments: {
8
- lineComment: "//",
9
- blockComment: ["/*", "*/"],
8
+ lineComment: '//',
9
+ blockComment: ['/*', '*/'],
10
10
  },
11
11
  brackets: [
12
- ["{", "}"],
13
- ["[", "]"],
14
- ["(", ")"],
12
+ ['{', '}'],
13
+ ['[', ']'],
14
+ ['(', ')'],
15
15
  ],
16
16
  autoClosingPairs: [
17
- { open: "{", close: "}" },
18
- { open: "[", close: "]" },
19
- { open: "(", close: ")" },
17
+ { open: '{', close: '}' },
18
+ { open: '[', close: ']' },
19
+ { open: '(', close: ')' },
20
20
  { open: '"', close: '"' },
21
- { open: "<", close: ">" },
21
+ { open: '<', close: '>' },
22
22
  ],
23
23
  });
24
- monaco.languages.setMonarchTokensProvider("motoko", {
25
- defaultToken: "",
26
- tokenPostfix: ".mo",
24
+ monaco.languages.setMonarchTokensProvider('motoko', {
25
+ defaultToken: '',
26
+ tokenPostfix: '.mo',
27
27
  // prettier-ignore
28
28
  keywords: [
29
29
  'actor', 'and', 'async', 'assert', 'await', 'break', 'case', 'catch', 'class',
30
- 'continue', 'debug', 'debug_show', 'do', 'else', 'false', 'for', 'from_candid', 'func', 'if', 'ignore', 'in', 'import',
31
- 'label', 'let', 'loop', 'module', 'not', 'null', 'object', 'or', 'return',
32
- 'switch', 'throw', 'to_candid', 'true', 'try', 'type', 'var', 'while', 'with',
30
+ 'continue', 'debug', 'debug_show', 'do', 'else', 'false', 'flexible', 'for', 'from_candid', 'func', 'if', 'ignore', 'in',
31
+ 'import', 'label', 'let', 'loop', 'module', 'not', 'null', 'object', 'or', 'private', 'public', 'query', 'return', 'shared',
32
+ 'stable', 'switch', 'system', 'throw', 'to_candid', 'true', 'try', 'type', 'var', 'while', 'with',
33
33
  ],
34
34
  accessmodifiers: [
35
- "public",
36
- "private",
37
- "flexible",
38
- "query",
39
- "shared",
40
- "stable",
41
- "system",
35
+ 'public',
36
+ 'private',
37
+ 'flexible',
38
+ 'query',
39
+ 'shared',
40
+ 'stable',
41
+ 'system',
42
42
  ],
43
43
  // prettier-ignore
44
44
  typeKeywords: [
@@ -62,55 +62,68 @@ exports.configure = (monaco) => {
62
62
  /[a-zA-Z_$][\w$]*/,
63
63
  {
64
64
  cases: {
65
- "@typeKeywords": "keyword.type",
66
- "@keywords": "keyword",
67
- "@default": "identifier",
65
+ '@typeKeywords': 'keyword.type',
66
+ '@keywords': 'keyword',
67
+ '@default': 'identifier',
68
68
  },
69
69
  },
70
70
  ],
71
71
  // whitespace
72
- { include: "@whitespace" },
72
+ { include: '@whitespace' },
73
73
 
74
74
  // delimiters and operators
75
- [/[{}()[\]]/, "@brackets"],
76
- [/[<>](?!@symbols)/, "@brackets"],
77
- [/@symbols/, { cases: { "@operators": "operator", "@default": "" } }],
75
+ [/[{}()[\]]/, '@brackets'],
76
+ [/[<>](?!@symbols)/, '@brackets'],
77
+ [
78
+ /@symbols/,
79
+ { cases: { '@operators': 'operator', '@default': '' } },
80
+ ],
78
81
  // numbers
79
- [/\d*\.\d+([eE][-+]?\d+)?/, "number.float"],
80
- [/0[xX][0-9a-fA-F_]+/, "number.hex"],
81
- [/[0-9_]+/, "number"],
82
+ [/\d*\.\d+([eE][-+]?\d+)?/, 'number.float'],
83
+ [/0[xX][0-9a-fA-F_]+/, 'number.hex'],
84
+ [/[0-9_]+/, 'number'],
82
85
 
83
86
  // delimiter: after number because of .\d floats
84
- [/[;,.]/, "delimiter"],
87
+ [/[;,.]/, 'delimiter'],
85
88
 
86
89
  // strings
87
- [/"([^"\\]|\\.)*$/, "string.invalid"], // non-teminated string
88
- [/"/, { token: "string.quote", bracket: "@open", next: "@string" }],
90
+ [/"([^"\\]|\\.)*$/, 'string.invalid'], // non-teminated string
91
+ [
92
+ /"/,
93
+ {
94
+ token: 'string.quote',
95
+ bracket: '@open',
96
+ next: '@string',
97
+ },
98
+ ],
89
99
 
90
100
  // characters
91
- [/'[^\\']'/, "string"],
92
- [/(')(@escapes)(')/, ["string", "string.escape", "string"]],
93
- [/'/, "string.invalid"],
101
+ [/'[^\\']'/, 'string'],
102
+ [/(')(@escapes)(')/, ['string', 'string.escape', 'string']],
103
+ [/'/, 'string.invalid'],
94
104
  ],
95
105
 
96
106
  comment: [
97
- [/[^/*]+/, "comment"],
98
- [/\/\*/, "comment", "@push"], // nested comment
99
- ["\\*/", "comment", "@pop"],
100
- [/[/*]/, "comment"],
107
+ [/[^/*]+/, 'comment'],
108
+ [/\/\*/, 'comment', '@push'], // nested comment
109
+ ['\\*/', 'comment', '@pop'],
110
+ [/[/*]/, 'comment'],
101
111
  ],
102
112
 
103
113
  string: [
104
- [/[^\\"]+/, "string"],
105
- [/@escapes/, "string.escape"],
106
- [/\\./, "string.escape.invalid"],
107
- [/"/, { token: "string.quote", bracket: "@close", next: "@pop" }],
114
+ [/[^\\"]+/, 'string'],
115
+ [/@escapes/, 'string.escape'],
116
+ [/\\./, 'string.escape.invalid'],
117
+ [
118
+ /"/,
119
+ { token: 'string.quote', bracket: '@close', next: '@pop' },
120
+ ],
108
121
  ],
109
122
 
110
123
  whitespace: [
111
- [/[ \t\r\n]+/, "white"],
112
- [/\/\*/, "comment", "@comment"],
113
- [/\/\/.*$/, "comment"],
124
+ [/[ \t\r\n]+/, 'white'],
125
+ [/\/\*/, 'comment', '@comment'],
126
+ [/\/\/.*$/, 'comment'],
114
127
  ],
115
128
  },
116
129
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motoko",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "Compile Motoko smart contracts in Node.js and the browser.",
5
5
  "author": "Ryan Vandersmith (https://github.com/rvanasa)",
6
6
  "license": "Apache-2.0",