Parse a file: File = ( ( | | ))
(context: &mut Context)
| 3112 | // File = |
| 3113 | // (<Attributes> (<AddressBlock> | <Module> | <Script>))* |
| 3114 | fn 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 |
no test coverage detected