@ohos-ports/hermes-parser 0.37.0-beta.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 (90) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -0
  3. package/dist/HermesAST.js.flow +57 -0
  4. package/dist/HermesASTAdapter.js +192 -0
  5. package/dist/HermesASTAdapter.js.flow +189 -0
  6. package/dist/HermesParser.js +108 -0
  7. package/dist/HermesParser.js.flow +163 -0
  8. package/dist/HermesParserDecodeUTF8String.js +68 -0
  9. package/dist/HermesParserDecodeUTF8String.js.flow +65 -0
  10. package/dist/HermesParserDeserializer.js +242 -0
  11. package/dist/HermesParserDeserializer.js.flow +260 -0
  12. package/dist/HermesParserNodeDeserializers.js +2594 -0
  13. package/dist/HermesParserNodeDeserializers.js.flow +16 -0
  14. package/dist/HermesParserWASM.js +6 -0
  15. package/dist/HermesParserWASM.js.flow +97 -0
  16. package/dist/HermesToESTreeAdapter.js +441 -0
  17. package/dist/HermesToESTreeAdapter.js.flow +423 -0
  18. package/dist/ParserOptions.js +20 -0
  19. package/dist/ParserOptions.js.flow +44 -0
  20. package/dist/babel/TransformESTreeToBabel.js +1197 -0
  21. package/dist/babel/TransformESTreeToBabel.js.flow +1349 -0
  22. package/dist/estree/StripFlowTypes.js +175 -0
  23. package/dist/estree/StripFlowTypes.js.flow +158 -0
  24. package/dist/estree/StripFlowTypesForBabel.js +215 -0
  25. package/dist/estree/StripFlowTypesForBabel.js.flow +216 -0
  26. package/dist/estree/TransformComponentSyntax.js +792 -0
  27. package/dist/estree/TransformComponentSyntax.js.flow +864 -0
  28. package/dist/estree/TransformEnumSyntax.js +106 -0
  29. package/dist/estree/TransformEnumSyntax.js.flow +125 -0
  30. package/dist/estree/TransformMatchSyntax.js +1083 -0
  31. package/dist/estree/TransformMatchSyntax.js.flow +991 -0
  32. package/dist/estree/TransformRecordSyntax.js +296 -0
  33. package/dist/estree/TransformRecordSyntax.js.flow +310 -0
  34. package/dist/generated/ESTreeVisitorKeys.js +233 -0
  35. package/dist/generated/ESTreeVisitorKeys.js.flow +15 -0
  36. package/dist/generated/ParserVisitorKeys.js +842 -0
  37. package/dist/generated/ParserVisitorKeys.js.flow +17 -0
  38. package/dist/getModuleDocblock.js +112 -0
  39. package/dist/getModuleDocblock.js.flow +118 -0
  40. package/dist/index.js +170 -0
  41. package/dist/index.js.flow +131 -0
  42. package/dist/src/HermesASTAdapter.js +192 -0
  43. package/dist/src/HermesParser.js +108 -0
  44. package/dist/src/HermesParserDecodeUTF8String.js +68 -0
  45. package/dist/src/HermesParserDeserializer.js +242 -0
  46. package/dist/src/HermesParserNodeDeserializers.js +2594 -0
  47. package/dist/src/HermesToESTreeAdapter.js +441 -0
  48. package/dist/src/ParserOptions.js +20 -0
  49. package/dist/src/babel/TransformESTreeToBabel.js +1197 -0
  50. package/dist/src/estree/StripFlowTypes.js +175 -0
  51. package/dist/src/estree/StripFlowTypesForBabel.js +215 -0
  52. package/dist/src/estree/TransformComponentSyntax.js +792 -0
  53. package/dist/src/estree/TransformEnumSyntax.js +106 -0
  54. package/dist/src/estree/TransformMatchSyntax.js +1083 -0
  55. package/dist/src/estree/TransformRecordSyntax.js +296 -0
  56. package/dist/src/generated/ESTreeVisitorKeys.js +233 -0
  57. package/dist/src/generated/ParserVisitorKeys.js +842 -0
  58. package/dist/src/getModuleDocblock.js +112 -0
  59. package/dist/src/index.js +170 -0
  60. package/dist/src/transform/SimpleTransform.js +145 -0
  61. package/dist/src/transform/astArrayMutationHelpers.js +62 -0
  62. package/dist/src/transform/astNodeMutationHelpers.js +201 -0
  63. package/dist/src/traverse/SimpleTraverser.js +139 -0
  64. package/dist/src/traverse/getVisitorKeys.js +39 -0
  65. package/dist/src/utils/Builders.js +190 -0
  66. package/dist/src/utils/GenID.js +46 -0
  67. package/dist/src/utils/createSyntaxError.js +25 -0
  68. package/dist/src/utils/isReservedWord.js +62 -0
  69. package/dist/src/utils/mutateESTreeASTForPrettier.js +127 -0
  70. package/dist/transform/SimpleTransform.js +145 -0
  71. package/dist/transform/SimpleTransform.js.flow +168 -0
  72. package/dist/transform/astArrayMutationHelpers.js +62 -0
  73. package/dist/transform/astArrayMutationHelpers.js.flow +71 -0
  74. package/dist/transform/astNodeMutationHelpers.js +201 -0
  75. package/dist/transform/astNodeMutationHelpers.js.flow +252 -0
  76. package/dist/traverse/SimpleTraverser.js +139 -0
  77. package/dist/traverse/SimpleTraverser.js.flow +133 -0
  78. package/dist/traverse/getVisitorKeys.js +39 -0
  79. package/dist/traverse/getVisitorKeys.js.flow +38 -0
  80. package/dist/utils/Builders.js +190 -0
  81. package/dist/utils/Builders.js.flow +218 -0
  82. package/dist/utils/GenID.js +46 -0
  83. package/dist/utils/GenID.js.flow +39 -0
  84. package/dist/utils/createSyntaxError.js +25 -0
  85. package/dist/utils/createSyntaxError.js.flow +24 -0
  86. package/dist/utils/isReservedWord.js +62 -0
  87. package/dist/utils/isReservedWord.js.flow +57 -0
  88. package/dist/utils/mutateESTreeASTForPrettier.js +127 -0
  89. package/dist/utils/mutateESTreeASTForPrettier.js.flow +130 -0
  90. package/package.json +30 -0
@@ -0,0 +1,190 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * strict
8
+ * @format
9
+ */
10
+ 'use strict'; // Rely on the mapper to fix up parent relationships.
11
+
12
+ Object.defineProperty(exports, "__esModule", {
13
+ value: true
14
+ });
15
+ exports.EMPTY_PARENT = void 0;
16
+ exports.callExpression = callExpression;
17
+ exports.conjunction = conjunction;
18
+ exports.createDefaultPosition = createDefaultPosition;
19
+ exports.disjunction = disjunction;
20
+ exports.etc = etc;
21
+ exports.ident = ident;
22
+ exports.iife = iife;
23
+ exports.nullLiteral = nullLiteral;
24
+ exports.numberLiteral = numberLiteral;
25
+ exports.stringLiteral = stringLiteral;
26
+ exports.throwStatement = throwStatement;
27
+ exports.typeofExpression = typeofExpression;
28
+ exports.variableDeclaration = variableDeclaration;
29
+ const EMPTY_PARENT = null;
30
+ exports.EMPTY_PARENT = EMPTY_PARENT;
31
+
32
+ function createDefaultPosition() {
33
+ return {
34
+ line: 1,
35
+ column: 0
36
+ };
37
+ }
38
+
39
+ function etc({
40
+ loc,
41
+ range,
42
+ parent
43
+ } = {}) {
44
+ return {
45
+ loc: {
46
+ start: (loc == null ? void 0 : loc.start) != null ? loc.start : createDefaultPosition(),
47
+ end: (loc == null ? void 0 : loc.end) != null ? loc.end : createDefaultPosition()
48
+ },
49
+ range: range != null ? range : [0, 0],
50
+ parent: parent != null ? parent : EMPTY_PARENT
51
+ };
52
+ }
53
+
54
+ function ident(name, info) {
55
+ return {
56
+ type: 'Identifier',
57
+ name,
58
+ optional: false,
59
+ typeAnnotation: null,
60
+ ...etc(info)
61
+ };
62
+ }
63
+
64
+ function stringLiteral(value, info) {
65
+ return {
66
+ type: 'Literal',
67
+ value,
68
+ raw: `"${value}"`,
69
+ literalType: 'string',
70
+ ...etc(info)
71
+ };
72
+ }
73
+
74
+ function numberLiteral(value, info) {
75
+ return {
76
+ type: 'Literal',
77
+ value,
78
+ raw: String(value),
79
+ literalType: 'numeric',
80
+ ...etc(info)
81
+ };
82
+ }
83
+
84
+ function nullLiteral(info) {
85
+ return {
86
+ type: 'Literal',
87
+ value: null,
88
+ raw: 'null',
89
+ literalType: 'null',
90
+ ...etc(info)
91
+ };
92
+ }
93
+
94
+ function conjunction(tests) {
95
+ if (tests.length === 0) {
96
+ throw new Error('Must have at least one test.');
97
+ }
98
+
99
+ return tests.reduce((acc, test) => ({
100
+ type: 'LogicalExpression',
101
+ left: acc,
102
+ right: test,
103
+ operator: '&&',
104
+ ...etc()
105
+ }));
106
+ }
107
+
108
+ function disjunction(tests) {
109
+ if (tests.length === 0) {
110
+ throw new Error('Must have at least one test.');
111
+ }
112
+
113
+ return tests.reduce((acc, test) => ({
114
+ type: 'LogicalExpression',
115
+ left: acc,
116
+ right: test,
117
+ operator: '||',
118
+ ...etc()
119
+ }));
120
+ }
121
+
122
+ function variableDeclaration(kind, id, init, info) {
123
+ return {
124
+ type: 'VariableDeclaration',
125
+ kind,
126
+ declarations: [{
127
+ type: 'VariableDeclarator',
128
+ init,
129
+ id,
130
+ ...etc(),
131
+ parent: EMPTY_PARENT
132
+ }],
133
+ ...etc(info)
134
+ };
135
+ }
136
+
137
+ function callExpression(callee, args, info) {
138
+ return {
139
+ type: 'CallExpression',
140
+ callee,
141
+ arguments: args,
142
+ typeArguments: null,
143
+ optional: false,
144
+ ...etc(info)
145
+ };
146
+ }
147
+
148
+ function throwStatement(arg, info) {
149
+ return {
150
+ type: 'ThrowStatement',
151
+ argument: callExpression(ident('Error'), [arg]),
152
+ ...etc(info)
153
+ };
154
+ }
155
+
156
+ function iife(statements, params = [], args = []) {
157
+ const callee = {
158
+ type: 'ArrowFunctionExpression',
159
+ params,
160
+ expression: false,
161
+ async: false,
162
+ predicate: null,
163
+ returnType: null,
164
+ typeParameters: null,
165
+ id: null,
166
+ body: {
167
+ type: 'BlockStatement',
168
+ body: statements,
169
+ ...etc()
170
+ },
171
+ ...etc()
172
+ };
173
+ return callExpression(callee, args);
174
+ }
175
+
176
+ function typeofExpression(arg, kind) {
177
+ return {
178
+ type: 'BinaryExpression',
179
+ left: {
180
+ type: 'UnaryExpression',
181
+ operator: 'typeof',
182
+ argument: arg,
183
+ prefix: true,
184
+ ...etc()
185
+ },
186
+ right: stringLiteral(kind),
187
+ operator: '===',
188
+ ...etc()
189
+ };
190
+ }
@@ -0,0 +1,218 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ * @format
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ import type {
14
+ ArrowFunctionExpression,
15
+ BinaryExpression,
16
+ BindingName,
17
+ CallExpression,
18
+ ESNode,
19
+ Expression,
20
+ Identifier,
21
+ LogicalExpression,
22
+ NullLiteral,
23
+ NumericLiteral,
24
+ Position,
25
+ Range,
26
+ SourceLocation,
27
+ SpreadElement,
28
+ Statement,
29
+ StringLiteral,
30
+ Super,
31
+ ThrowStatement,
32
+ VariableDeclaration,
33
+ } from 'hermes-estree';
34
+
35
+ // Rely on the mapper to fix up parent relationships.
36
+ export const EMPTY_PARENT: $FlowFixMe = null;
37
+
38
+ export function createDefaultPosition(): Position {
39
+ return {
40
+ line: 1,
41
+ column: 0,
42
+ };
43
+ }
44
+
45
+ export type Etc = {
46
+ parent?: ESNode,
47
+ loc?: SourceLocation,
48
+ range?: Range,
49
+ };
50
+
51
+ export function etc({loc, range, parent}: Etc = {}): {
52
+ parent: ESNode,
53
+ loc: SourceLocation,
54
+ range: Range,
55
+ } {
56
+ return {
57
+ loc: {
58
+ start: loc?.start != null ? loc.start : createDefaultPosition(),
59
+ end: loc?.end != null ? loc.end : createDefaultPosition(),
60
+ },
61
+ range: range ?? [0, 0],
62
+ parent: parent ?? EMPTY_PARENT,
63
+ };
64
+ }
65
+
66
+ export function ident(name: string, info?: Etc): Identifier {
67
+ return {
68
+ type: 'Identifier',
69
+ name,
70
+ optional: false,
71
+ typeAnnotation: null,
72
+ ...etc(info),
73
+ };
74
+ }
75
+
76
+ export function stringLiteral(value: string, info?: Etc): StringLiteral {
77
+ return {
78
+ type: 'Literal',
79
+ value,
80
+ raw: `"${value}"`,
81
+ literalType: 'string',
82
+ ...etc(info),
83
+ };
84
+ }
85
+
86
+ export function numberLiteral(value: number, info?: Etc): NumericLiteral {
87
+ return {
88
+ type: 'Literal',
89
+ value,
90
+ raw: String(value),
91
+ literalType: 'numeric',
92
+ ...etc(info),
93
+ };
94
+ }
95
+
96
+ export function nullLiteral(info?: Etc): NullLiteral {
97
+ return {
98
+ type: 'Literal',
99
+ value: null,
100
+ raw: 'null',
101
+ literalType: 'null',
102
+ ...etc(info),
103
+ };
104
+ }
105
+
106
+ export function conjunction(tests: ReadonlyArray<Expression>): Expression {
107
+ if (tests.length === 0) {
108
+ throw new Error('Must have at least one test.');
109
+ }
110
+ return tests.reduce((acc, test): LogicalExpression => ({
111
+ type: 'LogicalExpression',
112
+ left: acc,
113
+ right: test,
114
+ operator: '&&',
115
+ ...etc(),
116
+ }));
117
+ }
118
+
119
+ export function disjunction(tests: ReadonlyArray<Expression>): Expression {
120
+ if (tests.length === 0) {
121
+ throw new Error('Must have at least one test.');
122
+ }
123
+ return tests.reduce((acc, test): LogicalExpression => ({
124
+ type: 'LogicalExpression',
125
+ left: acc,
126
+ right: test,
127
+ operator: '||',
128
+ ...etc(),
129
+ }));
130
+ }
131
+
132
+ export function variableDeclaration(
133
+ kind: VariableDeclaration['kind'],
134
+ id: BindingName,
135
+ init: Expression,
136
+ info?: Etc,
137
+ ): VariableDeclaration {
138
+ return {
139
+ type: 'VariableDeclaration',
140
+ kind,
141
+ declarations: [
142
+ {
143
+ type: 'VariableDeclarator',
144
+ init,
145
+ id,
146
+ ...etc(),
147
+ parent: EMPTY_PARENT,
148
+ },
149
+ ],
150
+ ...etc(info),
151
+ };
152
+ }
153
+
154
+ export function callExpression(
155
+ callee: Expression | Super,
156
+ args: ReadonlyArray<Expression | SpreadElement>,
157
+ info?: Etc,
158
+ ): CallExpression {
159
+ return {
160
+ type: 'CallExpression',
161
+ callee,
162
+ arguments: args,
163
+ typeArguments: null,
164
+ optional: false,
165
+ ...etc(info),
166
+ };
167
+ }
168
+
169
+ export function throwStatement(arg: Expression, info?: Etc): ThrowStatement {
170
+ return {
171
+ type: 'ThrowStatement',
172
+ argument: callExpression(ident('Error'), [arg]),
173
+ ...etc(info),
174
+ };
175
+ }
176
+
177
+ export function iife(
178
+ statements: ReadonlyArray<Statement>,
179
+ params: ReadonlyArray<BindingName> = [],
180
+ args: ReadonlyArray<Expression> = [],
181
+ ): CallExpression {
182
+ const callee: ArrowFunctionExpression = {
183
+ type: 'ArrowFunctionExpression',
184
+ params,
185
+ expression: false,
186
+ async: false,
187
+ predicate: null,
188
+ returnType: null,
189
+ typeParameters: null,
190
+ id: null,
191
+ body: {
192
+ type: 'BlockStatement',
193
+ body: statements,
194
+ ...etc(),
195
+ },
196
+ ...etc(),
197
+ };
198
+ return callExpression(callee, args);
199
+ }
200
+
201
+ export function typeofExpression(
202
+ arg: Expression,
203
+ kind: string,
204
+ ): BinaryExpression {
205
+ return {
206
+ type: 'BinaryExpression',
207
+ left: {
208
+ type: 'UnaryExpression',
209
+ operator: 'typeof',
210
+ argument: arg,
211
+ prefix: true,
212
+ ...etc(),
213
+ },
214
+ right: stringLiteral(kind),
215
+ operator: '===',
216
+ ...etc(),
217
+ };
218
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * strict
8
+ * @format
9
+ */
10
+ 'use strict';
11
+
12
+ Object.defineProperty(exports, "__esModule", {
13
+ value: true
14
+ });
15
+ exports.default = void 0;
16
+ const genPrefix = '$$gen$';
17
+
18
+ class GenID {
19
+ constructor(uniqueTransformPrefix) {
20
+ this.genN = 0;
21
+ this.used = new Set();
22
+ this.prefix = void 0;
23
+ this.prefix = `${genPrefix}${uniqueTransformPrefix}`;
24
+ }
25
+
26
+ id() {
27
+ let name;
28
+
29
+ do {
30
+ name = `${this.prefix}${this.genN}`;
31
+ this.genN++;
32
+ } while (this.used.has(name));
33
+
34
+ this.used.add(name);
35
+ return name;
36
+ }
37
+
38
+ addUsage(name) {
39
+ if (name.startsWith(this.prefix)) {
40
+ this.used.add(name);
41
+ }
42
+ }
43
+
44
+ }
45
+
46
+ exports.default = GenID;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ * @format
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ const genPrefix = '$$gen$';
14
+
15
+ export default class GenID {
16
+ genN: number = 0;
17
+ readonly used: Set<string> = new Set();
18
+ readonly prefix: string;
19
+
20
+ constructor(uniqueTransformPrefix: string) {
21
+ this.prefix = `${genPrefix}${uniqueTransformPrefix}`;
22
+ }
23
+
24
+ id(): string {
25
+ let name;
26
+ do {
27
+ name = `${this.prefix}${this.genN}`;
28
+ this.genN++;
29
+ } while (this.used.has(name));
30
+ this.used.add(name);
31
+ return name;
32
+ }
33
+
34
+ addUsage(name: string): void {
35
+ if (name.startsWith(this.prefix)) {
36
+ this.used.add(name);
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * strict
8
+ * @format
9
+ */
10
+ 'use strict';
11
+
12
+ Object.defineProperty(exports, "__esModule", {
13
+ value: true
14
+ });
15
+ exports.createSyntaxError = createSyntaxError;
16
+
17
+ function createSyntaxError(node, err) {
18
+ const syntaxError = new SyntaxError(err); // $FlowExpectedError[prop-missing]
19
+
20
+ syntaxError.loc = {
21
+ line: node.loc.start.line,
22
+ column: node.loc.start.column
23
+ };
24
+ return syntaxError;
25
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ * @format
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ import type {ESNode} from 'hermes-estree';
14
+
15
+ export function createSyntaxError(node: ESNode, err: string): SyntaxError {
16
+ const syntaxError = new SyntaxError(err);
17
+ // $FlowExpectedError[prop-missing]
18
+ syntaxError.loc = {
19
+ line: node.loc.start.line,
20
+ column: node.loc.start.column,
21
+ };
22
+
23
+ return syntaxError;
24
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * strict
8
+ * @format
9
+ */
10
+ 'use strict';
11
+
12
+ Object.defineProperty(exports, "__esModule", {
13
+ value: true
14
+ });
15
+ exports.default = isReservedWord;
16
+
17
+ function isReservedWord(name) {
18
+ switch (name) {
19
+ case 'await':
20
+ case 'break':
21
+ case 'case':
22
+ case 'catch':
23
+ case 'class':
24
+ case 'const':
25
+ case 'continue':
26
+ case 'debugger':
27
+ case 'default':
28
+ case 'delete':
29
+ case 'do':
30
+ case 'else':
31
+ case 'enum':
32
+ case 'export':
33
+ case 'extends':
34
+ case 'false':
35
+ case 'finally':
36
+ case 'for':
37
+ case 'function':
38
+ case 'if':
39
+ case 'import':
40
+ case 'in':
41
+ case 'instanceof':
42
+ case 'new':
43
+ case 'null':
44
+ case 'return':
45
+ case 'super':
46
+ case 'switch':
47
+ case 'this':
48
+ case 'throw':
49
+ case 'true':
50
+ case 'try':
51
+ case 'typeof':
52
+ case 'var':
53
+ case 'void':
54
+ case 'while':
55
+ case 'with':
56
+ case 'yield':
57
+ return true;
58
+
59
+ default:
60
+ return false;
61
+ }
62
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ * @format
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ export default function isReservedWord(name: string): boolean {
14
+ switch (name) {
15
+ case 'await':
16
+ case 'break':
17
+ case 'case':
18
+ case 'catch':
19
+ case 'class':
20
+ case 'const':
21
+ case 'continue':
22
+ case 'debugger':
23
+ case 'default':
24
+ case 'delete':
25
+ case 'do':
26
+ case 'else':
27
+ case 'enum':
28
+ case 'export':
29
+ case 'extends':
30
+ case 'false':
31
+ case 'finally':
32
+ case 'for':
33
+ case 'function':
34
+ case 'if':
35
+ case 'import':
36
+ case 'in':
37
+ case 'instanceof':
38
+ case 'new':
39
+ case 'null':
40
+ case 'return':
41
+ case 'super':
42
+ case 'switch':
43
+ case 'this':
44
+ case 'throw':
45
+ case 'true':
46
+ case 'try':
47
+ case 'typeof':
48
+ case 'var':
49
+ case 'void':
50
+ case 'while':
51
+ case 'with':
52
+ case 'yield':
53
+ return true;
54
+ default:
55
+ return false;
56
+ }
57
+ }