From c5cf4de4a0606a888b5d9e0350e880fd2cc7e9cb Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 27 May 2014 15:50:59 -0400 Subject: [PATCH] Parser - Multiple -- terminators are considered to be a single terminator followed by words that are not terminators. There can be only one! --- src/Parser.cpp | 3 ++- test/bug.495.t | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Parser.cpp b/src/Parser.cpp index 80262b6e0..50fc0daac 100644 --- a/src/Parser.cpp +++ b/src/Parser.cpp @@ -263,7 +263,8 @@ void Parser::findTerminator () std::vector ::iterator i; for (i = _tree->_branches.begin (); i != _tree->_branches.end (); ++i) { - if ((*i)->attribute ("raw") == "--") + if (!found && + (*i)->attribute ("raw") == "--") { (*i)->unTag ("?"); (*i)->tag ("TERMINATOR"); diff --git a/test/bug.495.t b/test/bug.495.t index 28d73b294..eef05148c 100755 --- a/test/bug.495.t +++ b/test/bug.495.t @@ -45,7 +45,7 @@ if (open my $fh, '>', 'bug.rc') # Bug #495 - double hyphen mishandled for annotations. qx{../src/task rc:bug.rc add foo 2>&1}; -qx{../src/task rc:bug.rc 1 annotate "This -- is -- a -- test" 2>&1}; +qx{../src/task rc:bug.rc 1 annotate This -- is -- a -- test 2>&1}; my $output = qx{../src/task rc:bug.rc long 2>&1}; like ($output, qr/This is -- a -- test/, 'Double hyphens preserved, except the first ones.');