-
Notifications
You must be signed in to change notification settings - Fork 0
/
Untitled-1.js
85 lines (60 loc) · 1.99 KB
/
Untitled-1.js
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* We've started Quokka for you automatically on this file.
*
* To open a new Quokka file:
* - Press `Ctrl K, J` to create a new JavaScript File
* - Press `Ctrl K, T` to create a new TypeScript File
* - Press `Ctrl K, L` to open an interactive sample from:
* https://github.com/wallabyjs/interactive-examples
*
* To start/restart Quokka on an existing file:
* - Press `Ctrl K, Q`
*/
// See the output of console.log right next to your code
const quokka = { isAwesome: false };
console.log(quokka);
// See the value of a variable simply by typing its name
quokka;
// Use sequence expression to compare objects
const wallaby = { "is Quokka's BigBrother": true };
(quokka, wallaby)
// Gutter indicators show what code was executed (code coverage)
// Orange indicators means only part of the line was executed
// because JavaScript stops processing after first false value
console.log('partialCoverage', false && true);
// Green indicators means that Quokka executed all statements
// on a line of code
if (false) {
// White indicators means that a line of code was never
// executed by Quokka
console.log('noCoverage', true);
}
// Red indicators show where an error occurred. The error message
// is also shown beside the error
// throw new Error('Something went wrong');
// There's a lot more Quokka can do! Visit our docs to learn more:
// - https://quokkajs.com/docs/
const moo = require('moo')
let lexer = moo.compile({
WS: /[ \t]+/,
comment: /\/\/.*?$/,
number: /0|[1-9][0-9]*/,
string: /"(?:\\["\\]|[^\n"\\])*"/,
letter: /[a-zA-Z]*"/,
// lparen: '(',
// rparen: ')',
keyword: ['while', 'if', 'else', 'moo', 'cows'],
NL: { match: /\n/, lineBreaks: true },
})
// k
lexer.reset('aaa333\n')
console.log(lexer.next())
console.log(lexer.next())
console.log(lexer.next())
console.log(lexer.next())
console.log(lexer.next())
console.log(lexer.next())
console.log(lexer.next())
console.log(lexer.next())
console.log(lexer.next())
console.log(lexer.next())
screen;