Parse SET item: property = value | variable = value | variable:label
(tokens: &[Token])
| 4117 | |
| 4118 | /// Parse SET item: property = value | variable = value | variable:label |
| 4119 | fn set_item(tokens: &[Token]) -> IResult<&[Token], SetItem> { |
| 4120 | alt(( |
| 4121 | // Property assignment: object.property = value |
| 4122 | map( |
| 4123 | tuple(( |
| 4124 | property_access_token, |
| 4125 | expect_token(Token::Equal), |
| 4126 | expression, |
| 4127 | )), |
| 4128 | |(property, _, value)| SetItem::Property { property, value }, |
| 4129 | ), |
| 4130 | // Label assignment: variable:label or variable IS label |
| 4131 | map( |
| 4132 | tuple(( |
| 4133 | identifier, |
| 4134 | alt((expect_token(Token::Colon), expect_token(Token::Is))), |
| 4135 | label_expression, |
| 4136 | )), |
| 4137 | |(variable, _, labels)| SetItem::Label { variable, labels }, |
| 4138 | ), |
| 4139 | // Variable assignment: variable = value |
| 4140 | map( |
| 4141 | tuple((identifier, expect_token(Token::Equal), expression)), |
| 4142 | |(variable, _, value)| SetItem::Variable { variable, value }, |
| 4143 | ), |
| 4144 | ))(tokens) |
| 4145 | } |
| 4146 | |
| 4147 | /// Parse REMOVE statement: REMOVE remove_item [, remove_item]* |
| 4148 | fn remove_statement(tokens: &[Token]) -> IResult<&[Token], RemoveStatement> { |
nothing calls this directly
no test coverage detected