-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample
135 lines (111 loc) · 4.06 KB
/
example
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
Identifiers: {
$\u0032; \u0024\u0032; this.new.target;
}
Numerals: {
0, -0, 1, -1, +1.1, 0.1, 0.1e3
0b01, 0x0123456789abcdef
NaN, Infinity, -Infinity
// 1_1 // [ ] Proposal Numeric Separators
}
RegExp: {
/[^[\]]/g;
/{(.)}{{1,}|{}}/g;
/(?:[^'\\\n]+?(?=\\.|')|\\.)*?(?:'|$)/g;
/(?:[^\\`$]+?(?=\\.|`|\${)|\\.)*?(?:`|$|\$(?={))/g;
}
Strings: {
'@@' // [x] Not a ‹fault›
'\
a\a' // [x] ‹quote›•‹comment›
"\
\\n\\b"/**/ // [x] ‹quote›•‹comment›•‹comment›
}
Templates: {
`(
,|;|\.\.\.|\.|:|\?${
// We're including non-conflicting RegExp atoms here
'[:=!]?'
}
|\+\+|--|=>
|\+=|-=|\*\*=|\*=
|&&|&=|&|\|\||\|=|\||%=|%|\^=|\^|~=|~
|<<=|<<|<=|<|>>>=|>>>|>>=|>>|>=|>
|!==|!=|!|===|==|=
|\+|-|\*\*|\*
${(({}) => ({[`${'{}'}`]:`${'}"{'}`})['{}'])((text, entity, match, state) => {
match.format = 'punctuator';
TokenMatcher.capture(
state.context.goal === ECMAScriptGoal
? (text === '*' && state.lastAtom && state.lastAtom.text === 'function' && 'keyword') ||
ECMAScriptGoal.punctuation[text] ||
'operator'
: state.context.goal.punctuators && state.context.goal.punctuators[text] === true
? (match.punctuator =
(state.context.goal.punctuation && state.context.goal.punctuation[text]) || 'punctuation')
: (text.length === 1 || ((state.nextOffset = match.index + 1), (text = match[0] = text[0])),
state.context.goal.type || 'sequence'),
match,
);
})}
)`
}
Solidus: {
// [x] ExpressionStart never divide
( ([ /([(regexp)])/g / [] ] ) );
( [] /( [ /([(regexp)])/g / [] ] ) );
( ([]) /( [ /([(regexp)])/g / [] ] ) );
( [] /* */ /( [ /([(regexp)])/g / [] ] ) );
( []/( [/*/*//*/*//([(regexp)])/g / [] ] ) );
// [x] Literals always divide (never ASI)
( [] /([(divisor)])/g / [] );
( ([]) /([(divisor)])/g / [] );
( []/*/*//**//*/*//([(divisor)])/g / [] );
a = b // [x] Identifiers always divide (never ASI)
/(divisor)/g.exec(c).map(d);
// [x] Declaration (ASI) then ExpressionStart
function ƒ () {} /(regexp)/g.exec(c).map(d);
async () => {} // [x] Curly+LineBreak is ASI
/(regexp)/g.exec(c).map(d);
async () => {} /* [x] and with Multiline Comment */
/(regexp)/g.exec(c).map(d);
async () => ({}) // [x] Parenthsized Expression (no ASI)
/(divisor)/g.exec(c).map(d);
async () // [x] Function calls always in Expression
/(divisor)/g.exec(c).map(d);
async () /(divisor)/g.exec(c).map(d);
async () => // [x] Arrow Function Body is Expression
/(regexp)/g.exec(c).map(d);
// [ ] ObjectLiteral is "a literal"
const x = {} /(divisor)/g.exec(c).map(d);
// [ ] Function/ClassExpression is "an expression"
const y = function ƒ () {}
/(divisor)/g.exec(c).map(d);
// Keyword always regexp (regardless of ASI)
return await/*/\*//(regexp)/g.exec(c).map(d);
(function () {
// Recursively operative Keywords
void void
typeof typeof
delete this
(async function () {
// Recursively operative Keywords
await await
('')
});
(function* () {
// Recursively operative Keywords
yield yield
('')
});
return new class {}
return
return
return async function () {}
// [ ] Non-Keywords
async
async ('')
});
// Matt Austin's
Function("arg=`", "/*body`){});({x: this/**/");
(function(arg=`/*``*/){/*body`){});({x: this/**/})
}