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

Function parse_file

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

Parse a file: File = ( ( | | ))

(context: &mut Context)

Source from the content-addressed store, hash-verified

3112// File =
3113// (<Attributes> (<AddressBlock> | <Module> | <Script>))*
3114fn parse_file(context: &mut Context) -> Result<Vec<Definition>, Diagnostic> {
3115 let mut defs = vec![];
3116 while context.tokens.peek() != Tok::EOF {
3117 let attributes = parse_attributes(context)?;
3118 defs.push(match context.tokens.peek() {
3119 Tok::Spec | Tok::Module => Definition::Module(parse_module(attributes, context)?),
3120 Tok::Script => Definition::Script(parse_script(attributes, context)?),
3121 _ => Definition::Address(parse_address_block(attributes, context)?),
3122 })
3123 }
3124 Ok(defs)
3125}
3126
3127/// Parse the `input` string as a file of Move source code and return the
3128/// result as either a pair of FileDefinition and doc comments or some Diagnostics. The `file` name

Callers 1

parse_file_stringFunction · 0.70

Calls 9

parse_attributesFunction · 0.85
AddressEnum · 0.85
parse_address_blockFunction · 0.85
parse_moduleFunction · 0.70
ScriptClass · 0.70
parse_scriptFunction · 0.70
ModuleClass · 0.50
peekMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected