(chars: &[char], pos: &mut usize)
| 129 | } |
| 130 | |
| 131 | fn parse_double_quoted_string(chars: &[char], pos: &mut usize) -> Result<String, SqlError> { |
| 132 | if *pos >= chars.len() || chars[*pos] != '"' { |
| 133 | return Err(SqlError::Parse { |
| 134 | detail: format!( |
| 135 | "expected double quote at position {}, found {:?}", |
| 136 | pos, |
| 137 | chars.get(*pos) |
| 138 | ), |
| 139 | }); |
| 140 | } |
| 141 | *pos += 1; |
| 142 | let mut s = String::new(); |
| 143 | loop { |
| 144 | if *pos >= chars.len() { |
| 145 | return Err(SqlError::Parse { |
| 146 | detail: "unterminated double-quoted string literal".to_string(), |
| 147 | }); |
| 148 | } |
| 149 | match chars[*pos] { |
| 150 | '"' => { |
| 151 | *pos += 1; |
| 152 | if *pos < chars.len() && chars[*pos] == '"' { |
| 153 | s.push('"'); |
| 154 | *pos += 1; |
| 155 | } else { |
| 156 | break; |
| 157 | } |
| 158 | } |
| 159 | c => { |
| 160 | s.push(c); |
| 161 | *pos += 1; |
| 162 | } |
| 163 | } |
| 164 | } |
| 165 | Ok(s) |
| 166 | } |
| 167 | |
| 168 | fn parse_number(chars: &[char], pos: &mut usize) -> Result<Value, SqlError> { |
| 169 | let start = *pos; |
no test coverage detected