MCPcopy Create free account
hub / github.com/diem/move / parse_attributes

Function parse_attributes

language/move-compiler/src/parser/syntax.rs:582–603  ·  view source on GitHub ↗

Parse attributes. Used to annotate a variety of AST nodes Attributes = ("#" "[" Comma "]")

(context: &mut Context)

Source from the content-addressed store, hash-verified

580// Parse attributes. Used to annotate a variety of AST nodes
581// Attributes = ("#" "[" Comma<Attribute> "]")*
582fn 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

Callers 4

parse_address_blockFunction · 0.85
parse_moduleFunction · 0.85
parse_scriptFunction · 0.85
parse_fileFunction · 0.85

Calls 8

parse_comma_listFunction · 0.70
spannedFunction · 0.70
peekMethod · 0.45
start_locMethod · 0.45
advanceMethod · 0.45
previous_end_locMethod · 0.45
pushMethod · 0.45
file_hashMethod · 0.45

Tested by

no test coverage detected