rapydscript-ng 0.7.23 → 0.8.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 (114) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +72 -26
  3. package/bin/package.json +1 -0
  4. package/bin/rapydscript +65 -62
  5. package/editor-plugins/nvim/rapydscript/README.md +184 -0
  6. package/editor-plugins/nvim/rapydscript/bin/rapydscript.so +0 -0
  7. package/editor-plugins/nvim/rapydscript/ftdetect/rapydscript.lua +10 -0
  8. package/editor-plugins/nvim/rapydscript/lua/rapydscript/health.lua +88 -0
  9. package/editor-plugins/nvim/rapydscript/lua/rapydscript/init.lua +279 -0
  10. package/local-agent.md +28 -0
  11. package/package.json +4 -5
  12. package/release/baselib-plain-pretty.js +448 -326
  13. package/release/baselib-plain-ugly.js +3 -3
  14. package/release/compiler.js +2528 -1672
  15. package/release/signatures.json +17 -17
  16. package/src/ast.pyj +73 -25
  17. package/src/baselib-builtins.pyj +2 -2
  18. package/src/baselib-containers.pyj +153 -151
  19. package/src/baselib-internal.pyj +3 -3
  20. package/src/baselib-str.pyj +5 -5
  21. package/src/lib/aes.pyj +1 -1
  22. package/src/lib/encodings.pyj +1 -1
  23. package/src/lib/pythonize.pyj +1 -1
  24. package/src/lib/re.pyj +2 -2
  25. package/src/lib/traceback.pyj +165 -28
  26. package/src/lib/uuid.pyj +1 -1
  27. package/src/output/codegen.pyj +10 -3
  28. package/src/output/functions.pyj +31 -40
  29. package/src/output/literals.pyj +11 -14
  30. package/src/output/loops.pyj +25 -87
  31. package/src/output/modules.pyj +5 -47
  32. package/src/output/statements.pyj +1 -1
  33. package/src/output/stream.pyj +58 -31
  34. package/src/parse.pyj +777 -427
  35. package/src/tokenizer.pyj +16 -4
  36. package/src/utils.pyj +1 -1
  37. package/test/_treeshake_mod.pyj +30 -0
  38. package/test/_treeshake_side_effect.pyj +9 -0
  39. package/test/ast_serialization.pyj +392 -0
  40. package/test/async.pyj +95 -0
  41. package/test/baselib.pyj +1 -2
  42. package/test/embedded_compiler.pyj +57 -0
  43. package/test/fmt.pyj +201 -0
  44. package/test/generic.pyj +7 -3
  45. package/test/imports.pyj +8 -6
  46. package/test/internationalization.pyj +38 -37
  47. package/test/lint.pyj +120 -115
  48. package/test/lsp.pyj +222 -0
  49. package/test/repl.pyj +70 -65
  50. package/test/sourcemaps.pyj +315 -0
  51. package/test/starargs.pyj +46 -39
  52. package/test/traceback.pyj +263 -0
  53. package/test/treeshaking.pyj +181 -0
  54. package/test/web_repl_export.pyj +88 -0
  55. package/tools/ast_serialize.mjs +557 -0
  56. package/tools/cli.mjs +510 -0
  57. package/tools/compile.mjs +201 -0
  58. package/tools/compiler.mjs +127 -0
  59. package/tools/{completer.js → completer.mjs} +6 -6
  60. package/tools/{embedded_compiler.js → embedded_compiler.mjs} +17 -13
  61. package/tools/export.js +109 -56
  62. package/tools/fmt.mjs +735 -0
  63. package/tools/{gettext.js → gettext.mjs} +46 -53
  64. package/tools/{ini.js → ini.mjs} +9 -10
  65. package/tools/{lint.js → lint.mjs} +107 -56
  66. package/tools/lsp.mjs +914 -0
  67. package/tools/lsp_protocol.mjs +259 -0
  68. package/tools/lsp_symbols.mjs +418 -0
  69. package/tools/{msgfmt.js → msgfmt.mjs} +18 -18
  70. package/tools/{repl.js → repl.mjs} +52 -41
  71. package/tools/{self.js → self.mjs} +56 -46
  72. package/tools/sourcemap.mjs +123 -0
  73. package/tools/test.mjs +152 -0
  74. package/tools/treeshake.mjs +400 -0
  75. package/tools/{utils.js → utils.mjs} +26 -23
  76. package/tools/{web_repl.js → web_repl.mjs} +15 -13
  77. package/tools/web_repl_export.mjs +93 -0
  78. package/tree-sitter/README.md +101 -0
  79. package/tree-sitter/grammar.js +992 -0
  80. package/tree-sitter/package.json +43 -0
  81. package/tree-sitter/queries/rapydscript/highlights.scm +232 -0
  82. package/tree-sitter/queries/rapydscript/indents.scm +64 -0
  83. package/tree-sitter/queries/rapydscript/injections.scm +14 -0
  84. package/tree-sitter/queries/rapydscript/locals.scm +108 -0
  85. package/tree-sitter/src/grammar.json +4976 -0
  86. package/tree-sitter/src/node-types.json +2901 -0
  87. package/tree-sitter/src/parser.c +196465 -0
  88. package/tree-sitter/src/scanner.c +294 -0
  89. package/tree-sitter/src/tree_sitter/alloc.h +54 -0
  90. package/tree-sitter/src/tree_sitter/array.h +330 -0
  91. package/tree-sitter/src/tree_sitter/parser.h +286 -0
  92. package/tree-sitter/test/corpus/chaining.txt +99 -0
  93. package/tree-sitter/test/corpus/classes.txt +147 -0
  94. package/tree-sitter/test/corpus/comprehensions.txt +155 -0
  95. package/tree-sitter/test/corpus/containers.txt +242 -0
  96. package/tree-sitter/test/corpus/control_flow.txt +361 -0
  97. package/tree-sitter/test/corpus/decorators.txt +64 -0
  98. package/tree-sitter/test/corpus/existential.txt +102 -0
  99. package/tree-sitter/test/corpus/functions.txt +293 -0
  100. package/tree-sitter/test/corpus/imports.txt +117 -0
  101. package/tree-sitter/test/corpus/literals.txt +135 -0
  102. package/tree-sitter/test/corpus/operators.txt +296 -0
  103. package/tree-sitter/test/corpus/statements.txt +189 -0
  104. package/tree-sitter/test/corpus/strings.txt +90 -0
  105. package/tree-sitter/test/corpus/subscripts.txt +227 -0
  106. package/tree-sitter/tree-sitter.json +36 -0
  107. package/web-repl/env.js +35 -23
  108. package/web-repl/main.js +8 -8
  109. package/bin/export +0 -75
  110. package/bin/web-repl-export +0 -102
  111. package/tools/cli.js +0 -523
  112. package/tools/compile.js +0 -184
  113. package/tools/compiler.js +0 -84
  114. package/tools/test.js +0 -110
@@ -0,0 +1,286 @@
1
+ #ifndef TREE_SITTER_PARSER_H_
2
+ #define TREE_SITTER_PARSER_H_
3
+
4
+ #ifdef __cplusplus
5
+ extern "C" {
6
+ #endif
7
+
8
+ #include <stdbool.h>
9
+ #include <stdint.h>
10
+ #include <stdlib.h>
11
+
12
+ #define ts_builtin_sym_error ((TSSymbol)-1)
13
+ #define ts_builtin_sym_end 0
14
+ #define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
15
+
16
+ #ifndef TREE_SITTER_API_H_
17
+ typedef uint16_t TSStateId;
18
+ typedef uint16_t TSSymbol;
19
+ typedef uint16_t TSFieldId;
20
+ typedef struct TSLanguage TSLanguage;
21
+ typedef struct TSLanguageMetadata {
22
+ uint8_t major_version;
23
+ uint8_t minor_version;
24
+ uint8_t patch_version;
25
+ } TSLanguageMetadata;
26
+ #endif
27
+
28
+ typedef struct {
29
+ TSFieldId field_id;
30
+ uint8_t child_index;
31
+ bool inherited;
32
+ } TSFieldMapEntry;
33
+
34
+ // Used to index the field and supertype maps.
35
+ typedef struct {
36
+ uint16_t index;
37
+ uint16_t length;
38
+ } TSMapSlice;
39
+
40
+ typedef struct {
41
+ bool visible;
42
+ bool named;
43
+ bool supertype;
44
+ } TSSymbolMetadata;
45
+
46
+ typedef struct TSLexer TSLexer;
47
+
48
+ struct TSLexer {
49
+ int32_t lookahead;
50
+ TSSymbol result_symbol;
51
+ void (*advance)(TSLexer *, bool);
52
+ void (*mark_end)(TSLexer *);
53
+ uint32_t (*get_column)(TSLexer *);
54
+ bool (*is_at_included_range_start)(const TSLexer *);
55
+ bool (*eof)(const TSLexer *);
56
+ void (*log)(const TSLexer *, const char *, ...);
57
+ };
58
+
59
+ typedef enum {
60
+ TSParseActionTypeShift,
61
+ TSParseActionTypeReduce,
62
+ TSParseActionTypeAccept,
63
+ TSParseActionTypeRecover,
64
+ } TSParseActionType;
65
+
66
+ typedef union {
67
+ struct {
68
+ uint8_t type;
69
+ TSStateId state;
70
+ bool extra;
71
+ bool repetition;
72
+ } shift;
73
+ struct {
74
+ uint8_t type;
75
+ uint8_t child_count;
76
+ TSSymbol symbol;
77
+ int16_t dynamic_precedence;
78
+ uint16_t production_id;
79
+ } reduce;
80
+ uint8_t type;
81
+ } TSParseAction;
82
+
83
+ typedef struct {
84
+ uint16_t lex_state;
85
+ uint16_t external_lex_state;
86
+ } TSLexMode;
87
+
88
+ typedef struct {
89
+ uint16_t lex_state;
90
+ uint16_t external_lex_state;
91
+ uint16_t reserved_word_set_id;
92
+ } TSLexerMode;
93
+
94
+ typedef union {
95
+ TSParseAction action;
96
+ struct {
97
+ uint8_t count;
98
+ bool reusable;
99
+ } entry;
100
+ } TSParseActionEntry;
101
+
102
+ typedef struct {
103
+ int32_t start;
104
+ int32_t end;
105
+ } TSCharacterRange;
106
+
107
+ struct TSLanguage {
108
+ uint32_t abi_version;
109
+ uint32_t symbol_count;
110
+ uint32_t alias_count;
111
+ uint32_t token_count;
112
+ uint32_t external_token_count;
113
+ uint32_t state_count;
114
+ uint32_t large_state_count;
115
+ uint32_t production_id_count;
116
+ uint32_t field_count;
117
+ uint16_t max_alias_sequence_length;
118
+ const uint16_t *parse_table;
119
+ const uint16_t *small_parse_table;
120
+ const uint32_t *small_parse_table_map;
121
+ const TSParseActionEntry *parse_actions;
122
+ const char * const *symbol_names;
123
+ const char * const *field_names;
124
+ const TSMapSlice *field_map_slices;
125
+ const TSFieldMapEntry *field_map_entries;
126
+ const TSSymbolMetadata *symbol_metadata;
127
+ const TSSymbol *public_symbol_map;
128
+ const uint16_t *alias_map;
129
+ const TSSymbol *alias_sequences;
130
+ const TSLexerMode *lex_modes;
131
+ bool (*lex_fn)(TSLexer *, TSStateId);
132
+ bool (*keyword_lex_fn)(TSLexer *, TSStateId);
133
+ TSSymbol keyword_capture_token;
134
+ struct {
135
+ const bool *states;
136
+ const TSSymbol *symbol_map;
137
+ void *(*create)(void);
138
+ void (*destroy)(void *);
139
+ bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist);
140
+ unsigned (*serialize)(void *, char *);
141
+ void (*deserialize)(void *, const char *, unsigned);
142
+ } external_scanner;
143
+ const TSStateId *primary_state_ids;
144
+ const char *name;
145
+ const TSSymbol *reserved_words;
146
+ uint16_t max_reserved_word_set_size;
147
+ uint32_t supertype_count;
148
+ const TSSymbol *supertype_symbols;
149
+ const TSMapSlice *supertype_map_slices;
150
+ const TSSymbol *supertype_map_entries;
151
+ TSLanguageMetadata metadata;
152
+ };
153
+
154
+ static inline bool set_contains(const TSCharacterRange *ranges, uint32_t len, int32_t lookahead) {
155
+ uint32_t index = 0;
156
+ uint32_t size = len - index;
157
+ while (size > 1) {
158
+ uint32_t half_size = size / 2;
159
+ uint32_t mid_index = index + half_size;
160
+ const TSCharacterRange *range = &ranges[mid_index];
161
+ if (lookahead >= range->start && lookahead <= range->end) {
162
+ return true;
163
+ } else if (lookahead > range->end) {
164
+ index = mid_index;
165
+ }
166
+ size -= half_size;
167
+ }
168
+ const TSCharacterRange *range = &ranges[index];
169
+ return (lookahead >= range->start && lookahead <= range->end);
170
+ }
171
+
172
+ /*
173
+ * Lexer Macros
174
+ */
175
+
176
+ #ifdef _MSC_VER
177
+ #define UNUSED __pragma(warning(suppress : 4101))
178
+ #else
179
+ #define UNUSED __attribute__((unused))
180
+ #endif
181
+
182
+ #define START_LEXER() \
183
+ bool result = false; \
184
+ bool skip = false; \
185
+ UNUSED \
186
+ bool eof = false; \
187
+ int32_t lookahead; \
188
+ goto start; \
189
+ next_state: \
190
+ lexer->advance(lexer, skip); \
191
+ start: \
192
+ skip = false; \
193
+ lookahead = lexer->lookahead;
194
+
195
+ #define ADVANCE(state_value) \
196
+ { \
197
+ state = state_value; \
198
+ goto next_state; \
199
+ }
200
+
201
+ #define ADVANCE_MAP(...) \
202
+ { \
203
+ static const uint16_t map[] = { __VA_ARGS__ }; \
204
+ for (uint32_t i = 0; i < sizeof(map) / sizeof(map[0]); i += 2) { \
205
+ if (map[i] == lookahead) { \
206
+ state = map[i + 1]; \
207
+ goto next_state; \
208
+ } \
209
+ } \
210
+ }
211
+
212
+ #define SKIP(state_value) \
213
+ { \
214
+ skip = true; \
215
+ state = state_value; \
216
+ goto next_state; \
217
+ }
218
+
219
+ #define ACCEPT_TOKEN(symbol_value) \
220
+ result = true; \
221
+ lexer->result_symbol = symbol_value; \
222
+ lexer->mark_end(lexer);
223
+
224
+ #define END_STATE() return result;
225
+
226
+ /*
227
+ * Parse Table Macros
228
+ */
229
+
230
+ #define SMALL_STATE(id) ((id) - LARGE_STATE_COUNT)
231
+
232
+ #define STATE(id) id
233
+
234
+ #define ACTIONS(id) id
235
+
236
+ #define SHIFT(state_value) \
237
+ {{ \
238
+ .shift = { \
239
+ .type = TSParseActionTypeShift, \
240
+ .state = (state_value) \
241
+ } \
242
+ }}
243
+
244
+ #define SHIFT_REPEAT(state_value) \
245
+ {{ \
246
+ .shift = { \
247
+ .type = TSParseActionTypeShift, \
248
+ .state = (state_value), \
249
+ .repetition = true \
250
+ } \
251
+ }}
252
+
253
+ #define SHIFT_EXTRA() \
254
+ {{ \
255
+ .shift = { \
256
+ .type = TSParseActionTypeShift, \
257
+ .extra = true \
258
+ } \
259
+ }}
260
+
261
+ #define REDUCE(symbol_name, children, precedence, prod_id) \
262
+ {{ \
263
+ .reduce = { \
264
+ .type = TSParseActionTypeReduce, \
265
+ .symbol = symbol_name, \
266
+ .child_count = children, \
267
+ .dynamic_precedence = precedence, \
268
+ .production_id = prod_id \
269
+ }, \
270
+ }}
271
+
272
+ #define RECOVER() \
273
+ {{ \
274
+ .type = TSParseActionTypeRecover \
275
+ }}
276
+
277
+ #define ACCEPT_INPUT() \
278
+ {{ \
279
+ .type = TSParseActionTypeAccept \
280
+ }}
281
+
282
+ #ifdef __cplusplus
283
+ }
284
+ #endif
285
+
286
+ #endif // TREE_SITTER_PARSER_H_
@@ -0,0 +1,99 @@
1
+ ==================
2
+ leading dot method chaining
3
+ ==================
4
+
5
+ $(element)
6
+ .css('color', 'red')
7
+ .show()
8
+
9
+ ---
10
+
11
+ (module
12
+ (call
13
+ function: (attribute
14
+ object: (call
15
+ function: (attribute
16
+ object: (call
17
+ function: (identifier)
18
+ arguments: (argument_list
19
+ (identifier)))
20
+ attribute: (identifier))
21
+ arguments: (argument_list
22
+ (string)
23
+ (string)))
24
+ attribute: (identifier))
25
+ arguments: (argument_list)))
26
+
27
+ ==================
28
+ backslash continuation chaining
29
+ ==================
30
+
31
+ x = obj\
32
+ .css("a", "b")\
33
+ .show()
34
+
35
+ ---
36
+
37
+ (module
38
+ (assignment
39
+ left: (pattern
40
+ (identifier))
41
+ right: (call
42
+ function: (attribute
43
+ object: (call
44
+ function: (attribute
45
+ object: (identifier)
46
+ attribute: (identifier))
47
+ arguments: (argument_list
48
+ (string)
49
+ (string)))
50
+ attribute: (identifier))
51
+ arguments: (argument_list))))
52
+
53
+ ==================
54
+ self executing function
55
+ ==================
56
+
57
+ (def(args):
58
+ log(args)
59
+ )(x)
60
+
61
+ ---
62
+
63
+ (module
64
+ (call
65
+ function: (parenthesized_expression
66
+ (anonymous_function
67
+ parameters: (parameters
68
+ (identifier))
69
+ body: (block
70
+ (call
71
+ function: (identifier)
72
+ arguments: (argument_list
73
+ (identifier))))))
74
+ arguments: (argument_list
75
+ (identifier))))
76
+
77
+ ==================
78
+ self executing with call
79
+ ==================
80
+
81
+ def():
82
+ setup()
83
+ .call(this)
84
+
85
+ ---
86
+
87
+ (module
88
+ (call
89
+ function: (attribute
90
+ object: (anonymous_function
91
+ parameters: (parameters)
92
+ body: (block
93
+ (call
94
+ function: (identifier)
95
+ arguments: (argument_list))))
96
+ attribute: (identifier))
97
+ arguments: (argument_list
98
+ (this))))
99
+
@@ -0,0 +1,147 @@
1
+ ==================
2
+ simple class
3
+ ==================
4
+
5
+ class ColorfulTextField:
6
+ def __init__(self):
7
+ self.widget = field
8
+
9
+ ---
10
+
11
+ (module
12
+ (class_definition
13
+ name: (identifier)
14
+ body: (block
15
+ (function_definition
16
+ name: (identifier)
17
+ parameters: (parameters
18
+ (identifier))
19
+ body: (block
20
+ (assignment
21
+ left: (pattern
22
+ (attribute
23
+ object: (identifier)
24
+ attribute: (identifier)))
25
+ right: (identifier)))))))
26
+
27
+ ==================
28
+ class with inheritance
29
+ ==================
30
+
31
+ class Child(Parent):
32
+ def __init__(self):
33
+ Parent.__init__(self)
34
+
35
+ ---
36
+
37
+ (module
38
+ (class_definition
39
+ name: (identifier)
40
+ superclasses: (argument_list
41
+ (identifier))
42
+ body: (block
43
+ (function_definition
44
+ name: (identifier)
45
+ parameters: (parameters
46
+ (identifier))
47
+ body: (block
48
+ (call
49
+ function: (attribute
50
+ object: (identifier)
51
+ attribute: (identifier))
52
+ arguments: (argument_list
53
+ (identifier))))))))
54
+
55
+ ==================
56
+ class multiple inheritance
57
+ ==================
58
+
59
+ class C(A, B):
60
+ pass
61
+
62
+ ---
63
+
64
+ (module
65
+ (class_definition
66
+ name: (identifier)
67
+ superclasses: (argument_list
68
+ (identifier)
69
+ (identifier))
70
+ body: (block
71
+ (pass_statement))))
72
+
73
+ ==================
74
+ static method
75
+ ==================
76
+
77
+ class Test:
78
+ @staticmethod
79
+ def staticMethod(a):
80
+ return a + 1
81
+
82
+ ---
83
+
84
+ (module
85
+ (class_definition
86
+ name: (identifier)
87
+ body: (block
88
+ (decorated_definition
89
+ (decorator
90
+ (identifier))
91
+ definition: (function_definition
92
+ name: (identifier)
93
+ parameters: (parameters
94
+ (identifier))
95
+ body: (block
96
+ (return_statement
97
+ (binary_operator
98
+ left: (identifier)
99
+ right: (number)))))))))
100
+
101
+ ==================
102
+ external class decorator
103
+ ==================
104
+
105
+ @external
106
+ class Alpha:
107
+ pass
108
+
109
+ ---
110
+
111
+ (module
112
+ (decorated_definition
113
+ (decorator
114
+ (identifier))
115
+ definition: (class_definition
116
+ name: (identifier)
117
+ body: (block
118
+ (pass_statement)))))
119
+
120
+ ==================
121
+ class with scoped flag
122
+ ==================
123
+
124
+ class AutoBound:
125
+ from __python__ import bound_methods
126
+
127
+ def val(self):
128
+ return self.a
129
+
130
+ ---
131
+
132
+ (module
133
+ (class_definition
134
+ name: (identifier)
135
+ body: (block
136
+ (scoped_flag_statement
137
+ flag: (identifier))
138
+ (function_definition
139
+ name: (identifier)
140
+ parameters: (parameters
141
+ (identifier))
142
+ body: (block
143
+ (return_statement
144
+ (attribute
145
+ object: (identifier)
146
+ attribute: (identifier))))))))
147
+
@@ -0,0 +1,155 @@
1
+ ==================
2
+ list comprehension
3
+ ==================
4
+
5
+ a = [i*i for i in range(20)]
6
+
7
+ ---
8
+
9
+ (module
10
+ (assignment
11
+ left: (pattern
12
+ (identifier))
13
+ right: (list_comprehension
14
+ body: (binary_operator
15
+ left: (identifier)
16
+ right: (identifier))
17
+ (for_in_clause
18
+ left: (pattern
19
+ (identifier))
20
+ right: (call
21
+ function: (identifier)
22
+ arguments: (argument_list
23
+ (number)))))))
24
+
25
+ ==================
26
+ list comprehension with condition
27
+ ==================
28
+
29
+ a = [i*i for i in range(1,20) if i*i%3 == 0]
30
+
31
+ ---
32
+
33
+ (module
34
+ (assignment
35
+ left: (pattern
36
+ (identifier))
37
+ right: (list_comprehension
38
+ body: (binary_operator
39
+ left: (identifier)
40
+ right: (identifier))
41
+ (for_in_clause
42
+ left: (pattern
43
+ (identifier))
44
+ right: (call
45
+ function: (identifier)
46
+ arguments: (argument_list
47
+ (number)
48
+ (number))))
49
+ (if_clause
50
+ (comparison_operator
51
+ (binary_operator
52
+ left: (binary_operator
53
+ left: (identifier)
54
+ right: (identifier))
55
+ right: (number))
56
+ (number))))))
57
+
58
+ ==================
59
+ set comprehension
60
+ ==================
61
+
62
+ a = {i*i for i in range(1,20)}
63
+
64
+ ---
65
+
66
+ (module
67
+ (assignment
68
+ left: (pattern
69
+ (identifier))
70
+ right: (set_comprehension
71
+ body: (binary_operator
72
+ left: (identifier)
73
+ right: (identifier))
74
+ (for_in_clause
75
+ left: (pattern
76
+ (identifier))
77
+ right: (call
78
+ function: (identifier)
79
+ arguments: (argument_list
80
+ (number)
81
+ (number)))))))
82
+
83
+ ==================
84
+ dict comprehension
85
+ ==================
86
+
87
+ a = {x: x+1 for x in range(20) if x > 2}
88
+
89
+ ---
90
+
91
+ (module
92
+ (assignment
93
+ left: (pattern
94
+ (identifier))
95
+ right: (dictionary_comprehension
96
+ body: (pair
97
+ key: (identifier)
98
+ value: (binary_operator
99
+ left: (identifier)
100
+ right: (number)))
101
+ (for_in_clause
102
+ left: (pattern
103
+ (identifier))
104
+ right: (call
105
+ function: (identifier)
106
+ arguments: (argument_list
107
+ (number))))
108
+ (if_clause
109
+ (comparison_operator
110
+ (identifier)
111
+ (number))))))
112
+
113
+ ==================
114
+ generator expression
115
+ ==================
116
+
117
+ a = (x for x in items)
118
+
119
+ ---
120
+
121
+ (module
122
+ (assignment
123
+ left: (pattern
124
+ (identifier))
125
+ right: (generator_expression
126
+ body: (identifier)
127
+ (for_in_clause
128
+ left: (pattern
129
+ (identifier))
130
+ right: (identifier)))))
131
+
132
+ ==================
133
+ comprehension with tuple target
134
+ ==================
135
+
136
+ a = [(x, y) for x, y in pairs]
137
+
138
+ ---
139
+
140
+ (module
141
+ (assignment
142
+ left: (pattern
143
+ (identifier))
144
+ right: (list_comprehension
145
+ body: (tuple
146
+ (identifier)
147
+ (identifier))
148
+ (for_in_clause
149
+ left: (pattern_list
150
+ (pattern
151
+ (identifier))
152
+ (pattern
153
+ (identifier)))
154
+ right: (identifier)))))
155
+