Parse property access: object.property
(tokens: &[Token])
| 2284 | |
| 2285 | /// Parse property access: object.property |
| 2286 | fn property_access(tokens: &[Token]) -> IResult<&[Token], PropertyAccess> { |
| 2287 | map( |
| 2288 | tuple(( |
| 2289 | identifier, |
| 2290 | expect_token(Token::Dot), |
| 2291 | identifier, |
| 2292 | many0(tuple((expect_token(Token::Dot), identifier))), |
| 2293 | )), |
| 2294 | |(object, _, first_property, additional_properties)| { |
| 2295 | // Build the full property path: object.property1.property2... |
| 2296 | let mut property_path = first_property; |
| 2297 | for (_, prop) in additional_properties { |
| 2298 | property_path = format!("{}.{}", property_path, prop); |
| 2299 | } |
| 2300 | PropertyAccess { |
| 2301 | object, |
| 2302 | property: property_path, |
| 2303 | location: Location::default(), |
| 2304 | } |
| 2305 | }, |
| 2306 | )(tokens) |
| 2307 | } |
| 2308 | |
| 2309 | /// Parse property access that starts with a PropertyAccess token: PropertyAccess.Dot.Identifier... |
| 2310 | fn property_access_continued(tokens: &[Token]) -> IResult<&[Token], PropertyAccess> { |
nothing calls this directly
no test coverage detected