diff options
author | John Hodge <tpg@mutabah.net> | 2016-10-28 17:18:00 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-10-28 17:18:00 +0800 |
commit | ae297391200c96a43c811afd37a3260af3b2fc51 (patch) | |
tree | 3b78946d950e5d1cf73ff9435b098d5c4be78295 /src/expand/format_args.cpp | |
parent | 609b469f75d77edf7e03dcdccc8caac28bef4e6f (diff) | |
download | mrust-ae297391200c96a43c811afd37a3260af3b2fc51.tar.gz |
Expand format_args! - Handle trailing commas
Diffstat (limited to 'src/expand/format_args.cpp')
-rw-r--r-- | src/expand/format_args.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
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; |