@oat-sa/tao-core-ui 1.67.0 → 1.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/ckeditor/ckConfigurator.js +10 -1
  2. package/dist/maths/calculator/basicCalculator.js +4 -4
  3. package/dist/maths/calculator/calculatorComponent.js +22 -25
  4. package/dist/maths/calculator/core/board.js +12329 -720
  5. package/dist/maths/calculator/core/labels.js +7924 -138
  6. package/dist/maths/calculator/core/plugin.js +4 -5
  7. package/dist/maths/calculator/css/calculator.css +18 -5
  8. package/dist/maths/calculator/css/calculator.css.map +1 -1
  9. package/dist/maths/calculator/defaultCalculator.js +10 -6
  10. package/dist/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +23 -25
  11. package/dist/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +7979 -194
  12. package/dist/maths/calculator/scientificCalculator.js +7 -12
  13. package/package.json +5 -7
  14. package/src/ckeditor/ckConfigurator.js +11 -4
  15. package/src/maths/calculator/basicCalculator.js +1 -4
  16. package/src/maths/calculator/calculatorComponent.js +49 -60
  17. package/src/maths/calculator/core/board.js +372 -493
  18. package/src/maths/calculator/core/labels.js +46 -48
  19. package/src/maths/calculator/core/plugin.js +3 -5
  20. package/src/maths/calculator/core/tpl/terms.tpl +7 -1
  21. package/src/maths/calculator/css/calculator.css +18 -5
  22. package/src/maths/calculator/css/calculator.css.map +1 -1
  23. package/src/maths/calculator/defaultCalculator.js +7 -9
  24. package/src/maths/calculator/plugins/keyboard/templateKeyboard/defaultTemplate.tpl +3 -3
  25. package/src/maths/calculator/plugins/keyboard/templateKeyboard/templateKeyboard.js +17 -20
  26. package/src/maths/calculator/plugins/screen/simpleScreen/simpleScreen.js +102 -108
  27. package/src/maths/calculator/scientificCalculator.js +2 -10
  28. package/src/maths/calculator/scss/calculator.scss +14 -1
  29. package/src/maths/calculator/tpl/basicKeyboard.tpl +3 -3
  30. package/src/maths/calculator/tpl/scientificKeyboard.tpl +4 -4
  31. package/dist/maths/calculator/core/areaBroker.js +0 -43
  32. package/dist/maths/calculator/core/expression.js +0 -463
  33. package/dist/maths/calculator/core/terms.js +0 -456
  34. package/dist/maths/calculator/core/tokenizer.js +0 -229
  35. package/dist/maths/calculator/core/tokens.js +0 -167
  36. package/dist/maths/calculator/plugins/core/degrad.js +0 -71
  37. package/dist/maths/calculator/plugins/core/history.js +0 -149
  38. package/dist/maths/calculator/plugins/core/remind.js +0 -76
  39. package/dist/maths/calculator/plugins/core/stepNavigation.js +0 -148
  40. package/dist/maths/calculator/plugins/modifiers/pow10.js +0 -136
  41. package/dist/maths/calculator/plugins/modifiers/sign.js +0 -314
  42. package/dist/maths/calculator/pluginsLoader.js +0 -47
  43. package/src/maths/calculator/core/areaBroker.js +0 -38
  44. package/src/maths/calculator/core/expression.js +0 -430
  45. package/src/maths/calculator/core/terms.js +0 -459
  46. package/src/maths/calculator/core/tokenizer.js +0 -245
  47. package/src/maths/calculator/core/tokens.js +0 -178
  48. package/src/maths/calculator/plugins/core/degrad.js +0 -90
  49. package/src/maths/calculator/plugins/core/history.js +0 -166
  50. package/src/maths/calculator/plugins/core/remind.js +0 -96
  51. package/src/maths/calculator/plugins/core/stepNavigation.js +0 -175
  52. package/src/maths/calculator/plugins/modifiers/pow10.js +0 -143
  53. package/src/maths/calculator/plugins/modifiers/sign.js +0 -339
  54. package/src/maths/calculator/pluginsLoader.js +0 -46
@@ -1,459 +0,0 @@
1
- /**
2
- * This program is free software; you can redistribute it and/or
3
- * modify it under the terms of the GNU General Public License
4
- * as published by the Free Software Foundation; under version 2
5
- * of the License (non-upgradable).
6
- *
7
- * This program is distributed in the hope that it will be useful,
8
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
- * GNU General Public License for more details.
11
- *
12
- * You should have received a copy of the GNU General Public License
13
- * along with this program; if not, write to the Free Software
14
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15
- *
16
- * Copyright (c) 2018-2019 Open Assessment Technologies SA ;
17
- */
18
- /**
19
- * @author Jean-Sébastien Conan <jean-sebastien@taotesting.com>
20
- */
21
- import __ from 'i18n';
22
- import labels from 'ui/maths/calculator/core/labels';
23
-
24
- /**
25
- * @typedef {Object} term - Represents a tokenizable term
26
- * @property {String} label - The displayable text
27
- * @property {String} value - The related text that should be found in the expression
28
- * @property {String} type - The type of token
29
- * @property {String} description - A description of what represent the term
30
- * @property {String|null} exponent - Some terms introduce exponent notation, and this property tells on which side
31
- */
32
-
33
- /**
34
- * Defines the terms that can be tokenized from an expression
35
- * @type {term[]}
36
- */
37
- export default {
38
- // Digits definition
39
- NUM0: {
40
- label: labels.NUM0,
41
- value: '0',
42
- type: 'digit',
43
- description: __('Digit 0'),
44
- exponent: null
45
- },
46
- NUM1: {
47
- label: labels.NUM1,
48
- value: '1',
49
- type: 'digit',
50
- description: __('Digit 1'),
51
- exponent: null
52
- },
53
- NUM2: {
54
- label: labels.NUM2,
55
- value: '2',
56
- type: 'digit',
57
- description: __('Digit 2'),
58
- exponent: null
59
- },
60
- NUM3: {
61
- label: labels.NUM3,
62
- value: '3',
63
- type: 'digit',
64
- description: __('Digit 3'),
65
- exponent: null
66
- },
67
- NUM4: {
68
- label: labels.NUM4,
69
- value: '4',
70
- type: 'digit',
71
- description: __('Digit 4'),
72
- exponent: null
73
- },
74
- NUM5: {
75
- label: labels.NUM5,
76
- value: '5',
77
- type: 'digit',
78
- description: __('Digit 5'),
79
- exponent: null
80
- },
81
- NUM6: {
82
- label: labels.NUM6,
83
- value: '6',
84
- type: 'digit',
85
- description: __('Digit 6'),
86
- exponent: null
87
- },
88
- NUM7: {
89
- label: labels.NUM7,
90
- value: '7',
91
- type: 'digit',
92
- description: __('Digit 7'),
93
- exponent: null
94
- },
95
- NUM8: {
96
- label: labels.NUM8,
97
- value: '8',
98
- type: 'digit',
99
- description: __('Digit 8'),
100
- exponent: null
101
- },
102
- NUM9: {
103
- label: labels.NUM9,
104
- value: '9',
105
- type: 'digit',
106
- description: __('Digit 9'),
107
- exponent: null
108
- },
109
- DOT: {
110
- label: labels.DOT,
111
- value: '.',
112
- type: 'digit',
113
- description: __('Dot'),
114
- exponent: null
115
- },
116
- EXP10: {
117
- label: labels.EXP10,
118
- value: 'e',
119
- type: 'digit',
120
- description: __('Power of 10'),
121
- exponent: 'right'
122
- },
123
-
124
- // Aggregators
125
- LPAR: {
126
- label: labels.LPAR,
127
- value: '(',
128
- type: 'aggregator',
129
- description: __('Left parenthesis'),
130
- exponent: null
131
- },
132
- RPAR: {
133
- label: labels.RPAR,
134
- value: ')',
135
- type: 'aggregator',
136
- description: __('Right parenthesis'),
137
- exponent: null
138
- },
139
-
140
- // Separator
141
- COMMA: {
142
- label: labels.COMMA,
143
- value: ',',
144
- type: 'separator',
145
- description: __('Arguments separator'),
146
- exponent: null
147
- },
148
- ELLIPSIS: {
149
- label: labels.ELLIPSIS,
150
- value: '~',
151
- type: 'separator',
152
- description: __('Value ellipsis'),
153
- exponent: null
154
- },
155
-
156
- // Operators
157
- SUB: {
158
- label: labels.SUB,
159
- value: '-',
160
- type: 'operator',
161
- description: __('Binary operator -'),
162
- exponent: null
163
- },
164
- NEG: {
165
- label: labels.NEG,
166
- value: labels.NEG,
167
- type: 'operator',
168
- description: __('Unary operator -'),
169
- exponent: null
170
- },
171
- ADD: {
172
- label: labels.ADD,
173
- value: '+',
174
- type: 'operator',
175
- description: __('Binary operator +'),
176
- exponent: null
177
- },
178
- POS: {
179
- label: labels.POS,
180
- value: labels.POS,
181
- type: 'operator',
182
- description: __('Unary operator +'),
183
- exponent: null
184
- },
185
- MUL: {
186
- label: labels.MUL,
187
- value: '*',
188
- type: 'operator',
189
- description: __('Binary operator *'),
190
- exponent: null
191
- },
192
- DIV: {
193
- label: labels.DIV,
194
- value: '/',
195
- type: 'operator',
196
- description: __('Binary operator /'),
197
- exponent: null
198
- },
199
- MOD: {
200
- label: labels.MOD,
201
- value: '%',
202
- type: 'operator',
203
- description: __('Binary operator modulo'),
204
- exponent: null
205
- },
206
- POW: {
207
- label: labels.POW,
208
- value: '^',
209
- type: 'operator',
210
- description: __('Power of'),
211
- exponent: 'right'
212
- },
213
- FAC: {
214
- label: labels.FAC,
215
- value: '!',
216
- type: 'operator',
217
- description: __('Factorial'),
218
- exponent: null
219
- },
220
- ASSIGN: {
221
- label: labels.ASSIGN,
222
- value: '=',
223
- type: 'operator',
224
- description: __('Assign'),
225
- exponent: null
226
- },
227
-
228
- // Variables
229
- ANS: {
230
- label: labels.ANS,
231
- value: 'ans',
232
- type: 'variable',
233
- description: __('Last result'),
234
- exponent: null
235
- },
236
-
237
- // Constants
238
- PI: {
239
- label: labels.PI,
240
- value: 'PI',
241
- type: 'constant',
242
- description: __('Value of PI'),
243
- exponent: null
244
- },
245
- E: {
246
- label: labels.E,
247
- value: 'E',
248
- type: 'constant',
249
- description: __('Value of E'),
250
- exponent: null
251
- },
252
-
253
- // Errors
254
- NAN: {
255
- label: labels.NAN,
256
- value: 'NaN',
257
- type: 'error',
258
- description: __('Error in value'),
259
- exponent: null
260
- },
261
- INFINITY: {
262
- label: labels.INFINITY,
263
- value: 'Infinity',
264
- type: 'error',
265
- description: __('Error in result'),
266
- exponent: null
267
- },
268
- ERROR: {
269
- label: labels.ERROR,
270
- value: '#',
271
- type: 'error',
272
- description: __('Error in syntax'),
273
- exponent: null
274
- },
275
-
276
- // Functions
277
- EXP: {
278
- label: labels.EXP,
279
- value: 'exp',
280
- type: 'function',
281
- description: __('Exponent'),
282
- exponent: 'right'
283
- },
284
- SQRT: {
285
- label: labels.SQRT,
286
- value: 'sqrt',
287
- type: 'function',
288
- description: __('Square root'),
289
- exponent: null
290
- },
291
- CBRT: {
292
- label: labels.CBRT,
293
- value: 'cbrt',
294
- type: 'function',
295
- description: __('Cube root'),
296
- exponent: null
297
- },
298
- NTHRT: {
299
- label: labels.SQRT,
300
- value: 'nthrt',
301
- type: 'function',
302
- description: __('Nth root'),
303
- exponent: 'left'
304
- },
305
- FLOOR: {
306
- label: labels.FLOOR,
307
- value: 'floor',
308
- type: 'function',
309
- description: __('Round to lower whole number'),
310
- exponent: null
311
- },
312
- CEIL: {
313
- label: labels.CEIL,
314
- value: 'ceil',
315
- type: 'function',
316
- description: __('Round to upper whole number'),
317
- exponent: null
318
- },
319
- ROUND: {
320
- label: labels.ROUND,
321
- value: 'round',
322
- type: 'function',
323
- description: __('Round to closest whole number'),
324
- exponent: null
325
- },
326
- TRUNC: {
327
- label: labels.TRUNC,
328
- value: 'trunc',
329
- type: 'function',
330
- description: __('Whole number part'),
331
- exponent: null
332
- },
333
- SIN: {
334
- label: labels.SIN,
335
- value: 'sin',
336
- type: 'function',
337
- description: __('Sine'),
338
- exponent: null
339
- },
340
- COS: {
341
- label: labels.COS,
342
- value: 'cos',
343
- type: 'function',
344
- description: __('Cosine'),
345
- exponent: null
346
- },
347
- TAN: {
348
- label: labels.TAN,
349
- value: 'tan',
350
- type: 'function',
351
- description: __('Tangent'),
352
- exponent: null
353
- },
354
- ASIN: {
355
- label: labels.ASIN,
356
- value: 'asin',
357
- type: 'function',
358
- description: __('Arc sine'),
359
- exponent: null
360
- },
361
- ACOS: {
362
- label: labels.ACOS,
363
- value: 'acos',
364
- type: 'function',
365
- description: __('Arc cosine'),
366
- exponent: null
367
- },
368
- ATAN: {
369
- label: labels.ATAN,
370
- value: 'atan',
371
- type: 'function',
372
- description: __('Arc tangent'),
373
- exponent: null
374
- },
375
- SINH: {
376
- label: labels.SINH,
377
- value: 'sinh',
378
- type: 'function',
379
- description: __('Hyperbolic sine'),
380
- exponent: null
381
- },
382
- COSH: {
383
- label: labels.COSH,
384
- value: 'cosh',
385
- type: 'function',
386
- description: __('Hyperbolic cosine'),
387
- exponent: null
388
- },
389
- TANH: {
390
- label: labels.TANH,
391
- value: 'tanh',
392
- type: 'function',
393
- description: __('Hyperbolic tangent'),
394
- exponent: null
395
- },
396
- ASINH: {
397
- label: labels.ASINH,
398
- value: 'asinh',
399
- type: 'function',
400
- description: __('Hyperbolic arc sine'),
401
- exponent: null
402
- },
403
- ACOSH: {
404
- label: labels.ACOSH,
405
- value: 'acosh',
406
- type: 'function',
407
- description: __('Hyperbolic arc cosine'),
408
- exponent: null
409
- },
410
- ATANH: {
411
- label: labels.ATANH,
412
- value: 'atanh',
413
- type: 'function',
414
- description: __('Hyperbolic arc tangent'),
415
- exponent: null
416
- },
417
- LN: {
418
- label: labels.LN,
419
- value: 'ln',
420
- type: 'function',
421
- description: __('Natural logarithm'),
422
- exponent: null
423
- },
424
- LOG: {
425
- label: labels.LN,
426
- value: 'log',
427
- type: 'function',
428
- description: __('Natural logarithm'),
429
- exponent: null
430
- },
431
- LG: {
432
- label: labels.LOG,
433
- value: 'lg',
434
- type: 'function',
435
- description: __('Base-10 logarithm'),
436
- exponent: null
437
- },
438
- LOG10: {
439
- label: labels.LOG,
440
- value: 'log10',
441
- type: 'function',
442
- description: __('Base-10 logarithm'),
443
- exponent: null
444
- },
445
- ABS: {
446
- label: labels.ABS,
447
- value: 'abs',
448
- type: 'function',
449
- description: __('Absolute value'),
450
- exponent: null
451
- },
452
- RAND: {
453
- label: labels.RAND,
454
- value: 'random',
455
- type: 'function',
456
- description: __('Random value'),
457
- exponent: null
458
- }
459
- };
@@ -1,245 +0,0 @@
1
- /**
2
- * This program is free software; you can redistribute it and/or
3
- * modify it under the terms of the GNU General Public License
4
- * as published by the Free Software Foundation; under version 2
5
- * of the License (non-upgradable).
6
- *
7
- * This program is distributed in the hope that it will be useful,
8
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
- * GNU General Public License for more details.
11
- *
12
- * You should have received a copy of the GNU General Public License
13
- * along with this program; if not, write to the Free Software
14
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15
- *
16
- * Copyright (c) 2018-2019 Open Assessment Technologies SA ;
17
- */
18
-
19
- /**
20
- * Tokenize a mathematical expression based on the list of known terms.
21
- * @author Jean-Sébastien Conan <jean-sebastien@taotesting.com>
22
- */
23
- import _ from 'lodash';
24
- import registeredTerms from 'ui/maths/calculator/core/terms';
25
- import tokensHelper from 'ui/maths/calculator/core/tokens';
26
- import moo from 'lib/moo/moo';
27
-
28
- /**
29
- * List of ignored tokens
30
- * @type {Object}
31
- */
32
- var ignoredTokens = {
33
- SPACE: {
34
- match: /\s+/,
35
- lineBreaks: true
36
- }
37
- };
38
-
39
- /**
40
- * Match keywords
41
- * @type {RegExp}
42
- */
43
- var reKeyword = /[a-zA-Z_]\w*/;
44
-
45
- /**
46
- * Match numbers
47
- * @type {RegExp}
48
- */
49
- var reNumber = /[-+]?\d*\.?\d+(?:[eE][-+]?\d+)?/;
50
-
51
- /**
52
- * Match keywords prefixed with @
53
- * @type {RegExp}
54
- */
55
- var rePrefixedKeyword = new RegExp('@' + reKeyword.source);
56
-
57
- /**
58
- * Match keywords only
59
- * @type {RegExp}
60
- */
61
- var reKeywordOnly = new RegExp('^' + reKeyword.source + '$');
62
-
63
- /**
64
- * List of keywords (functions from the list of registered terms).
65
- * @type {Object}
66
- */
67
- var keywords = _.pick(registeredTerms, filterKeyword);
68
-
69
- /**
70
- * List of symbols (operators and operands from the list of registered terms).
71
- * @type {Object}
72
- */
73
- var symbols = _.omit(registeredTerms, filterKeyword);
74
-
75
- /**
76
- * List of digits and related symbols
77
- * @type {Object}
78
- */
79
- var digits = _.pick(registeredTerms, filterDigit);
80
-
81
- /**
82
- * Filter function that checks if the provided term is a keyword.
83
- * Keywords are all terms that have alphanumeric non digit value from the list of terms.
84
- * @param term
85
- * @returns {boolean}
86
- */
87
- function filterKeyword(term) {
88
- return term.value.match(reKeywordOnly);
89
- }
90
-
91
- /**
92
- * Filter function that checks if the provided term is a digit or a related symbol.
93
- * @param term
94
- * @returns {boolean}
95
- */
96
- function filterDigit(term) {
97
- return tokensHelper.isDigit(term.type) || term.value === '-' || term.value === '+';
98
- }
99
-
100
- /**
101
- * @typedef {Object} token
102
- * @property {String} type - The identifier of the token
103
- * @property {String} value - The actual value of the token
104
- * @property {String} text - The raw value that produced the token
105
- * @property {Number} offset - The original offset in the source
106
- * @property {Number} lineBreaks - How many line breaks are contained in the raw value
107
- * @property {Number} line - The line number of the token (starting from 1)
108
- * @property {Number} col - The column number of the token (starting from 1)
109
- */
110
-
111
- /**
112
- * Generates an expression tokenizer.
113
- *
114
- * @example
115
- *
116
- * var expression = '(.1 + .2) * 10^8';
117
- * var tokenizer = calculatorTokenizerFactory();
118
- * var terms = tokenizer(expression);
119
- *
120
- * // terms now contains an array of terms:
121
- * // [{type: "LPAR", value: "(", text: "(", offset: 0, lineBreaks: 0, line: 1, col: 1},
122
- * // {type: "DOT", value: ".", text: ".", offset: 1, lineBreaks: 0, line: 1, col: 2},
123
- * // {type: "NUM1", value: "1", text: "1", offset: 2, lineBreaks: 0, line: 1, col: 3},
124
- * // {type: "ADD", value: "+", text: "+", offset: 4, lineBreaks: 0, line: 1, col: 5},
125
- * // {type: "DOT", value: ".", text: ".", offset: 6, lineBreaks: 0, line: 1, col: 7},
126
- * // {type: "NUM2", value: "2", text: "2", offset: 7, lineBreaks: 0, line: 1, col: 8},
127
- * // {type: "RPAR", value: ")", text: ")", offset: 8, lineBreaks: 0, line: 1, col: 9},
128
- * // {type: "MUL", value: "*", text: "*", offset: 10, lineBreaks: 0, line: 1, col: 11},
129
- * // {type: "NUM1", value: "1", text: "1", offset: 12, lineBreaks: 0, line: 1, col: 13},
130
- * // {type: "NUM0", value: "0", text: "0", offset: 13, lineBreaks: 0, line: 1, col: 14},
131
- * // {type: "POW", value: "^", text: "^", offset: 14, lineBreaks: 0, line: 1, col: 15},
132
- * // {type: "NUM8", value: "8", text: "8", offset: 15, lineBreaks: 0, line: 1, col: 16}]
133
- *
134
- * @param {Object} [config]
135
- * @param {Object} [config.keywords] - List of additional keywords: key being the name, value being the pattern (should be on the domain /[a-zA-Z]+/)
136
- * @param {Object} [config.symbols] - List of additional symbols: key being the name, value being the pattern
137
- * @returns {calculatorTokenizer}
138
- */
139
- function calculatorTokenizerFactory(config) {
140
- var keywordsTransform, lexer, digitLexer, digitContext;
141
-
142
- /**
143
- * Extracts a token from the current position in the expression
144
- * @returns {token}
145
- */
146
- var next = function next() {
147
- var term;
148
-
149
- if (digitContext) {
150
- term = digitLexer.next();
151
- if (term) {
152
- term.offset += digitContext.offset;
153
- }
154
- }
155
-
156
- if (!term) {
157
- digitContext = null;
158
-
159
- do {
160
- term = lexer.next();
161
- } while (term && ignoredTokens[term.type]);
162
-
163
- // rely on a specific lexer to tokenize numbers
164
- // this is required to properly identify numbers like 42e15 without colliding with regular identifiers
165
- if (term && term.type === 'number') {
166
- digitContext = term;
167
- digitLexer.reset(term.value);
168
- term = next();
169
- }
170
- }
171
-
172
- return term;
173
- };
174
-
175
- /**
176
- * @typedef {Object} calculatorTokenizer
177
- */
178
- var tokenizer = {
179
- /**
180
- * Gets an iterator that will returns tokens from the provided expression
181
- * @param {String} expression
182
- * @returns {function(): token}
183
- */
184
- iterator: function iterator(expression) {
185
- lexer.reset(tokensHelper.stringValue(expression));
186
- return next;
187
- },
188
-
189
- /**
190
- * Tokenizes the expression
191
- * @param {String} expression
192
- * @returns {token[]}
193
- */
194
- tokenize: function tokenize(expression) {
195
- var iterator = tokenizer.iterator(expression);
196
- var terms = [];
197
- var term;
198
-
199
- do {
200
- term = iterator();
201
- if (term) {
202
- terms.push(term);
203
- }
204
- } while (term);
205
-
206
- return terms;
207
- }
208
- };
209
-
210
- config = config || {};
211
- config.keywords = _.defaults(_.mapValues(keywords, 'value'), config.keywords);
212
- config.symbols = _.defaults(_.mapValues(symbols, 'value'), config.symbols);
213
- keywordsTransform = moo.keywords(config.keywords);
214
-
215
- // Lexer used to tokenize the expression
216
- lexer = moo.compile(
217
- _.defaults(
218
- {},
219
- ignoredTokens,
220
- {
221
- number: reNumber,
222
- prefixed: {
223
- match: rePrefixedKeyword,
224
- type: function(token) {
225
- // simply rely on the keywords transform to identify the prefixed keyword
226
- return keywordsTransform(token.substring(1));
227
- }
228
- },
229
- term: {
230
- match: reKeyword,
231
- type: keywordsTransform
232
- },
233
- syntaxError: moo.error
234
- },
235
- config.symbols
236
- )
237
- );
238
-
239
- // Lexer used to tokenize numbers
240
- digitLexer = moo.compile(_.mapValues(digits, 'value'));
241
-
242
- return tokenizer;
243
- }
244
-
245
- export default calculatorTokenizerFactory;