@@ -1420,7 +1420,6 @@ namespace attributes {
14201420
14211421 // Establish the text to parse for the signature
14221422 std::string signature = parseSignature (lineNumber);
1423- std::cerr << " -------------------------------- SourceFileAttributesParser::parseFunction 10" << std::endl << signature << std::endl;
14241423 if (signature.empty ()) {
14251424 rcppExportNoFunctionFoundWarning (lineNumber); // #nocov
14261425 return Function (); // #nocov
@@ -1430,7 +1429,6 @@ namespace attributes {
14301429 // (bail with an empty result if we can't find them)
14311430 std::string::size_type endParenLoc = signature.find_last_of (' )' );
14321431 std::string::size_type beginParenLoc = signature.find_first_of (' (' );
1433- std::cerr << " -------------------------------- SourceFileAttributesParser::parseFunction 20" << std::endl << beginParenLoc << std::endl << endParenLoc << std::endl;
14341432 if (endParenLoc == std::string::npos ||
14351433 beginParenLoc == std::string::npos ||
14361434 endParenLoc < beginParenLoc) {
@@ -1484,7 +1482,6 @@ namespace attributes {
14841482 endParenLoc-beginParenLoc-1 );
14851483 std::vector<std::string> args = parseArguments (argsText);
14861484 for (auto arg: args)
1487- std::cerr << " -------------------------------- SourceFileAttributesParser::parseFunction 30" << std::endl << arg << std::endl;
14881485 for (std::vector<std::string>::const_iterator it =
14891486 args.begin (); it != args.end (); ++it) {
14901487
@@ -1592,14 +1589,13 @@ namespace attributes {
15921589 std::vector<std::string> SourceFileAttributesParser::parseArguments (
15931590 const std::string& argText) {
15941591
1595- std::cerr << " -------------------------------- SourceFileAttributesParser::SourceFileAttributesParser::parseArguments 1" << std::endl << argText << std::endl;
15961592 int templateCount = 0 ;
15971593 int parenCount = 0 ;
15981594 bool endOfArg = false ;
15991595 std::string currentArg;
16001596 std::vector<std::string> args;
16011597 char quote = 0 ;
1602- char prevChar = 0 ;
1598+ bool escaped = false ;
16031599 typedef std::string::const_iterator it_t ;
16041600 for (it_t it = argText.begin (); it != argText.end (); ++it) {
16051601
@@ -1611,10 +1607,15 @@ namespace attributes {
16111607 // Ignore quoted strings and character values in single quotes
16121608 if ( ! quote && (ch == ' "' || ch == ' \' ' ))
16131609 quote = ch;
1614- else if (quote && ch == quote && prevChar != ' \\ ' )
1610+ else if (quote && ch == quote && ! escaped )
16151611 quote = 0 ;
16161612
1617- std::cerr << " -------------------------------- SourceFileAttributesParser::SourceFileAttributesParser::parseArguments 10" << std::endl << " '" << prevChar << " ' '" << ch << " ' #" << quote << " #" << std::endl;
1613+ // Escaped character inside quotes
1614+ if (escaped)
1615+ escaped = false ;
1616+ else if (quote && ch == ' \\ ' )
1617+ escaped = true ;
1618+
16181619 // Detect end of argument declaration
16191620 if ( ! quote &&
16201621 (ch == ' ,' ) &&
@@ -1625,7 +1626,6 @@ namespace attributes {
16251626 endOfArg = true ;
16261627 }
16271628
1628- std::cerr << " -------------------------------- SourceFileAttributesParser::SourceFileAttributesParser::parseArguments 20" << std::endl << endOfArg << std::endl;
16291629 if ( ! endOfArg) {
16301630
16311631 // Append current character if not a space at start
@@ -1650,10 +1650,6 @@ namespace attributes {
16501650 }
16511651 }
16521652 }
1653- std::cerr << " -------------------------------- SourceFileAttributesParser::SourceFileAttributesParser::parseArguments 30" << std::endl << templateCount << " " << parenCount << std::endl;
1654- std::cerr << " -------------------------------- SourceFileAttributesParser::SourceFileAttributesParser::parseArguments 40" << std::endl << currentArg << std::endl;
1655-
1656- prevChar = ch;
16571653 }
16581654
16591655 if (!currentArg.empty ())
0 commit comments