From 0e1b141df9b55703474be179af938b33be86f048 Mon Sep 17 00:00:00 2001 From: HÃ¥vard Pettersen Date: Thu, 14 Nov 2019 11:47:19 +0000 Subject: use comma tracker one more place --- eval/src/vespa/eval/eval/function.cpp | 5 ++--- eval/src/vespa/eval/eval/string_stuff.h | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'eval/src') diff --git a/eval/src/vespa/eval/eval/function.cpp b/eval/src/vespa/eval/eval/function.cpp index 75d63ea7415..44bb61abe17 100644 --- a/eval/src/vespa/eval/eval/function.cpp +++ b/eval/src/vespa/eval/eval/function.cpp @@ -479,10 +479,9 @@ std::vector get_ident_list(ParseContext &ctx, bool wrapped) { ctx.skip_spaces(); ctx.eat('('); } + CommaTracker ident_list(wrapped); while (!ctx.find_list_end()) { - if (!list.empty() || !wrapped) { - ctx.eat(','); - } + ident_list.maybe_eat_comma(ctx); list.push_back(get_ident(ctx, false)); } if (wrapped) { diff --git a/eval/src/vespa/eval/eval/string_stuff.h b/eval/src/vespa/eval/eval/string_stuff.h index 3cbc7c9d35b..820196fe959 100644 --- a/eval/src/vespa/eval/eval/string_stuff.h +++ b/eval/src/vespa/eval/eval/string_stuff.h @@ -15,6 +15,7 @@ namespace vespalib::eval { struct CommaTracker { bool first; CommaTracker() : first(true) {} + CommaTracker(bool first_in) : first(first_in) {} bool maybe_add_comma(vespalib::string &dst) { if (first) { first = false; -- cgit v1.2.3