MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / visitDouble

Method visitDouble

parser/parser.cc:1345–1359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1343}
1344
1345std::any ParserVisitor::visitDouble(CelParser::DoubleContext* ctx) {
1346 std::string value;
1347 if (ctx->sign) {
1348 value = ctx->sign->getText();
1349 }
1350 value += ctx->tok->getText();
1351 double double_value;
1352 if (absl::SimpleAtod(value, &double_value)) {
1353 return ExprToAny(factory_.NewDoubleConst(
1354 factory_.NextId(SourceRangeFromParserRuleContext(ctx)), double_value));
1355 } else {
1356 return ExprToAny(factory_.ReportError(SourceRangeFromParserRuleContext(ctx),
1357 "invalid double literal"));
1358 }
1359}
1360
1361std::any ParserVisitor::visitString(CelParser::StringContext* ctx) {
1362 auto status_or_value = cel::internal::ParseStringLiteral(ctx->tok->getText());

Callers

nothing calls this directly

Calls 6

ExprToAnyFunction · 0.85
getTextMethod · 0.80
NewDoubleConstMethod · 0.45
NextIdMethod · 0.45
ReportErrorMethod · 0.45

Tested by

no test coverage detected