| 1268 | } |
| 1269 | |
| 1270 | std::vector<MapExprEntry> ParserVisitor::visitEntries( |
| 1271 | CelParser::MapInitializerListContext* ctx) { |
| 1272 | std::vector<MapExprEntry> res; |
| 1273 | if (!ctx || ctx->keys.empty()) { |
| 1274 | return res; |
| 1275 | } |
| 1276 | |
| 1277 | res.reserve(ctx->cols.size()); |
| 1278 | for (size_t i = 0; i < ctx->cols.size(); ++i) { |
| 1279 | auto id = factory_.NextId(SourceRangeFromToken(ctx->cols[i])); |
| 1280 | if (!enable_optional_syntax_ && ctx->keys[i]->opt) { |
| 1281 | factory_.ReportError(SourceRangeFromParserRuleContext(ctx), |
| 1282 | "unsupported syntax '?'"); |
| 1283 | res.push_back(factory_.NewMapEntry(0, factory_.NewUnspecified(0), |
| 1284 | factory_.NewUnspecified(0), false)); |
| 1285 | continue; |
| 1286 | } |
| 1287 | auto key = ExprFromAny(visit(ctx->keys[i]->e)); |
| 1288 | auto value = ExprFromAny(visit(ctx->values[i])); |
| 1289 | res.push_back(factory_.NewMapEntry(id, std::move(key), std::move(value), |
| 1290 | ctx->keys[i]->opt != nullptr)); |
| 1291 | } |
| 1292 | return res; |
| 1293 | } |
| 1294 | |
| 1295 | std::any ParserVisitor::visitInt(CelParser::IntContext* ctx) { |
| 1296 | std::string value; |
nothing calls this directly
no test coverage detected