Skip to content

Commit aa0441b

Browse files
Antonin Delpeuchnarpfel
authored andcommitted
feat: Implement parsing gen fn (tree-sitter#3)
Porting of the unreviewed PR tree-sitter#272 ---- Generator functions were implemented in rust-lang/rust#118457, tracking issue rust-lang/rust#117078. Co-authored-by: Paul Gey <[email protected]> Reviewed-on: https://codeberg.org/grammar-orchard/tree-sitter-rust-orchard/pulls/3
1 parent 3691201 commit aa0441b

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

grammar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ module.exports = grammar({
461461
'default',
462462
'const',
463463
'unsafe',
464+
'gen',
464465
$.extern_modifier,
465466
)),
466467

test/corpus/async.txt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,27 @@ gen move {}
161161
(expression_statement
162162
(gen_block
163163
(block))))
164+
165+
================================================================================
166+
gen fn
167+
================================================================================
168+
169+
gen fn f() -> u8 {
170+
yield 42;
171+
yield;
172+
}
173+
174+
--------------------------------------------------------------------------------
175+
176+
(source_file
177+
(function_item
178+
(function_modifiers)
179+
(identifier)
180+
(parameters)
181+
(primitive_type)
182+
(block
183+
(expression_statement
184+
(yield_expression
185+
(integer_literal)))
186+
(expression_statement
187+
(yield_expression)))))

0 commit comments

Comments
 (0)