Validate literals
(literal: &Literal, errors: &mut Vec<ValidationError>)
| 2018 | |
| 2019 | /// Validate literals |
| 2020 | fn validate_literal(literal: &Literal, errors: &mut Vec<ValidationError>) { |
| 2021 | match literal { |
| 2022 | Literal::String(s) => { |
| 2023 | if s.is_empty() { |
| 2024 | errors.push(ValidationError { |
| 2025 | message: "String literal cannot be empty".to_string(), |
| 2026 | location: None, |
| 2027 | error_type: ValidationErrorType::Syntax, |
| 2028 | }); |
| 2029 | } |
| 2030 | } |
| 2031 | Literal::Vector(v) => { |
| 2032 | if v.is_empty() { |
| 2033 | errors.push(ValidationError { |
| 2034 | message: "Vector literal cannot be empty".to_string(), |
| 2035 | location: None, |
| 2036 | error_type: ValidationErrorType::Syntax, |
| 2037 | }); |
| 2038 | } |
| 2039 | } |
| 2040 | Literal::DateTime(dt) => { |
| 2041 | validate_datetime_format(dt, errors); |
| 2042 | } |
| 2043 | Literal::Duration(dur) => { |
| 2044 | validate_duration_format(dur, errors); |
| 2045 | } |
| 2046 | Literal::TimeWindow(tw) => { |
| 2047 | validate_timewindow_format(tw, errors); |
| 2048 | } |
| 2049 | _ => {} // Other literals are fine |
| 2050 | } |
| 2051 | } |
| 2052 | |
| 2053 | /// Validate datetime format |
| 2054 | fn validate_datetime_format(dt: &str, errors: &mut Vec<ValidationError>) { |
no test coverage detected