From ae297391200c96a43c811afd37a3260af3b2fc51 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 28 Oct 2016 17:18:00 +0800 Subject: Expand format_args! - Handle trailing commas --- src/expand/format_args.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/expand/format_args.cpp b/src/expand/format_args.cpp index 5d9940bc..9696a586 100644 --- a/src/expand/format_args.cpp +++ b/src/expand/format_args.cpp @@ -408,6 +408,11 @@ class CFormatArgsExpander: // - Parse the arguments while( GET_TOK(tok, lex) == TOK_COMMA ) { + if( lex.lookahead(0) == TOK_EOF ) { + GET_TOK(tok, lex); + break; + } + // - Named parameters if( lex.lookahead(0) == TOK_IDENT && lex.lookahead(1) == TOK_EQUAL ) { @@ -431,6 +436,7 @@ class CFormatArgsExpander: free_args.push_back( mv$(expr_tt) ); } } + CHECK_TOK(tok, TOK_EOF); // - Parse the format string ::std::vector< FmtFrag> fragments; -- cgit v1.2.3