MCPcopy Create free account
hub / github.com/Glyphack/enderpy / parse_fstring_middle

Method parse_fstring_middle

parser/src/parser/parser.rs:3411–3427  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

3409 }
3410
3411 fn parse_fstring_middle(&mut self) -> Result<Expression, ParsingError> {
3412 let node = self.start_node();
3413 match self.cur_kind() {
3414 Kind::FStringMiddle => {
3415 let val = self.cur_token().as_str(self.source);
3416 self.bump(Kind::FStringMiddle);
3417 Ok(Expression::Constant(Box::new(Constant {
3418 node: self.finish_node(node),
3419 value: ConstantValue::Str(QuoteType::from(val)),
3420 })))
3421 }
3422 Kind::LeftBracket => self.parse_fstring_replacement_field(),
3423 _ => {
3424 panic!("kind is {}", self.cur_token().kind);
3425 }
3426 }
3427 }
3428
3429 pub fn to_row_col(&self, start: u32, end: u32) -> (u32, u32, u32, u32) {
3430 get_row_col_position(start, end, &self.lexer.line_starts)

Callers 2

parse_fstringMethod · 0.80

Calls 8

ConstantClass · 0.85
start_nodeMethod · 0.80
cur_kindMethod · 0.80
as_strMethod · 0.80
cur_tokenMethod · 0.80
bumpMethod · 0.80
finish_nodeMethod · 0.80

Tested by

no test coverage detected