(toks, start_idx, tables_with_alias, schema, default_tables=None)
| 268 | |
| 269 | |
| 270 | def parse_value(toks, start_idx, tables_with_alias, schema, default_tables=None): |
| 271 | idx = start_idx |
| 272 | len_ = len(toks) |
| 273 | |
| 274 | isBlock = False |
| 275 | if toks[idx] == '(': |
| 276 | isBlock = True |
| 277 | idx += 1 |
| 278 | |
| 279 | if toks[idx] == 'select': |
| 280 | idx, val = parse_sql(toks, idx, tables_with_alias, schema) |
| 281 | elif "\"" in toks[idx]: # token is a string value |
| 282 | val = toks[idx] |
| 283 | idx += 1 |
| 284 | else: |
| 285 | try: |
| 286 | val = float(toks[idx]) |
| 287 | idx += 1 |
| 288 | except: |
| 289 | end_idx = idx |
| 290 | while end_idx < len_ and toks[end_idx] != ',' and toks[end_idx] != ')'\ |
| 291 | and toks[end_idx] != 'and' and toks[end_idx] not in CLAUSE_KEYWORDS and toks[end_idx] not in JOIN_KEYWORDS: |
| 292 | end_idx += 1 |
| 293 | |
| 294 | idx, val = parse_col_unit(toks[start_idx: end_idx], 0, tables_with_alias, schema, default_tables) |
| 295 | idx = end_idx |
| 296 | |
| 297 | if isBlock: |
| 298 | assert toks[idx] == ')' |
| 299 | idx += 1 |
| 300 | |
| 301 | return idx, val |
| 302 | |
| 303 | |
| 304 | def parse_condition(toks, start_idx, tables_with_alias, schema, default_tables=None): |
no test coverage detected