Parse attributes. Used to annotate a variety of AST nodes Attributes = ("#" "[" Comma "]")
(context: &mut Context)
| 580 | // Parse attributes. Used to annotate a variety of AST nodes |
| 581 | // Attributes = ("#" "[" Comma<Attribute> "]")* |
| 582 | fn parse_attributes(context: &mut Context) -> Result<Vec<Attributes>, Diagnostic> { |
| 583 | let mut attributes_vec = vec![]; |
| 584 | while let Tok::NumSign = context.tokens.peek() { |
| 585 | let start_loc = context.tokens.start_loc(); |
| 586 | context.tokens.advance()?; |
| 587 | let attributes_ = parse_comma_list( |
| 588 | context, |
| 589 | Tok::LBracket, |
| 590 | Tok::RBracket, |
| 591 | parse_attribute, |
| 592 | "attribute", |
| 593 | )?; |
| 594 | let end_loc = context.tokens.previous_end_loc(); |
| 595 | attributes_vec.push(spanned( |
| 596 | context.tokens.file_hash(), |
| 597 | start_loc, |
| 598 | end_loc, |
| 599 | attributes_, |
| 600 | )) |
| 601 | } |
| 602 | Ok(attributes_vec) |
| 603 | } |
| 604 | |
| 605 | //************************************************************************************************** |
| 606 | // Fields and Bindings |
no test coverage detected