MCPcopy Create free account
hub / github.com/amber-lang/amber / skip_function_body

Function skip_function_body

src/modules/function/declaration_utils.rs:10–29  ·  view source on GitHub ↗
(meta: &mut ParserMetadata)

Source from the content-addressed store, hash-verified

8use heraclitus_compiler::prelude::*;
9
10pub fn skip_function_body(meta: &mut ParserMetadata) -> (usize, usize, bool) {
11 let index_begin = meta.get_index();
12 let mut is_failable = false;
13 let mut scope = 1;
14 while let Some(tok) = meta.get_current_token() {
15 match tok.word.as_str() {
16 "{" => scope += 1,
17 "}" => scope -= 1,
18 "fail" => is_failable = true,
19 "?" => is_failable = true,
20 _ => {}
21 }
22 if scope == 0 {
23 break;
24 }
25 meta.increment_index();
26 }
27 let index_end = meta.get_index();
28 (index_begin, index_end, is_failable)
29}
30
31pub fn is_functions_comment_doc(meta: &mut ParserMetadata) -> bool {
32 let index = meta.get_index();

Callers

nothing calls this directly

Calls 1

get_indexMethod · 0.80

Tested by

no test coverage detected