MCPcopy Create free account
hub / github.com/dprint/jsonc-parser / scan

Method scan

src/parse_to_ast.rs:114–135  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

112
113impl<'a> Context<'a> {
114 pub fn scan(&mut self) -> Result<Option<Token<'a>>, ParseError> {
115 let previous_end = self.last_token_end;
116 let token = self.scan_handling_comments()?;
117 self.last_token_end = self.scanner.token_end();
118
119 // store the comment for the previous token end, and current token start
120 if let Some(comments) = self.comments.as_mut()
121 && let Some(current_comments) = self.current_comments.take()
122 {
123 let current_comments = Rc::new(current_comments);
124 comments.insert(previous_end, current_comments.clone());
125 comments.insert(self.scanner.token_start(), current_comments);
126 }
127
128 if let Some(token) = &token
129 && self.tokens.is_some()
130 {
131 self.capture_token(token.clone());
132 }
133
134 Ok(token)
135 }
136
137 pub fn token(&self) -> Option<Token<'a>> {
138 self.scanner.token()

Callers 5

parse_to_astFunction · 0.45
parse_objectFunction · 0.45
parse_object_propertyFunction · 0.45
parse_arrayFunction · 0.45

Calls 6

token_endMethod · 0.80
insertMethod · 0.80
token_startMethod · 0.80
capture_tokenMethod · 0.80
takeMethod · 0.45

Tested by

no test coverage detected