From 90a7f26e868132bbd013aadf405c03e212396bcb Mon Sep 17 00:00:00 2001 From: hillj Date: Tue, 22 Jul 2008 14:13:37 +0000 Subject: Tue Jul 22 07:50:38 UTC 2008 James H. Hill --- CIAO/CCF/CCF/CodeGenerationKit/IndentationCxx.hpp | 64 +++++++++++++---------- CIAO/ChangeLog | 9 ++++ 2 files changed, 46 insertions(+), 27 deletions(-) (limited to 'CIAO') diff --git a/CIAO/CCF/CCF/CodeGenerationKit/IndentationCxx.hpp b/CIAO/CCF/CCF/CodeGenerationKit/IndentationCxx.hpp index 6c4c05db38c..d521fe4eca7 100644 --- a/CIAO/CCF/CCF/CodeGenerationKit/IndentationCxx.hpp +++ b/CIAO/CCF/CCF/CodeGenerationKit/IndentationCxx.hpp @@ -83,39 +83,48 @@ namespace Indentation } case '{': { - ensure_new_line (); - output_indentation (); - result = write (c); - ensure_new_line (); - - indentation_.push (indentation_.top () + spaces_); + if (!(construct_ == CXX_COMMENT || construct_ == STRING_LITERAL)) + { + ensure_new_line (); + output_indentation (); + result = write (c); + ensure_new_line (); + indentation_.push (indentation_.top () + spaces_); + } + else + defaulting = true; break; } case '}': { - if (indentation_.size () > 1) - indentation_.pop (); - - // Reduce multiple newlines to one. - while (hold_.size () > 1) + if (!(construct_ == CXX_COMMENT || construct_ == STRING_LITERAL)) { - typename Hold::reverse_iterator i = hold_.rbegin (); - if (*i == '\n' && *(i + 1) == '\n') hold_.pop_back (); - else break; - } + if (indentation_.size () > 1) + indentation_.pop (); - ensure_new_line (); - output_indentation (); + // Reduce multiple newlines to one. + while (hold_.size () > 1) + { + typename Hold::reverse_iterator i = hold_.rbegin (); + if (*i == '\n' && *(i + 1) == '\n') hold_.pop_back (); + else break; + } - hold_.push_back (c); + ensure_new_line (); + output_indentation (); + + hold_.push_back (c); - // Add double newline after '}'. - // - hold_.push_back ('\n'); - hold_.push_back ('\n'); - position_ = 0; + // Add double newline after '}'. + // + hold_.push_back ('\n'); + hold_.push_back ('\n'); + position_ = 0; + } + else + defaulting = true; break; } @@ -184,12 +193,13 @@ namespace Indentation } case '\"': { - if (construct_ != CXX_COMMENT && - (hold_.empty () || hold_.back () != '\\')) + if (construct_ != CXX_COMMENT && (hold_.empty () || hold_.back () != '\\')) { // not escape sequence - if (construct_ == STRING_LITERAL) construct_ = OTHER; - else construct_ = STRING_LITERAL; + if (construct_ == STRING_LITERAL) + construct_ = OTHER; + else + construct_ = STRING_LITERAL; } defaulting = true; diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index 1835701aab3..a2898f7d2d4 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,12 @@ +Tue Jul 22 07:50:38 UTC 2008 James H. Hill + + * CCF/CCF/CodeGenerationKit/IndentationCxx.hpp: + + Bug fix where using a curly brace, i.e., '{' or '}', inside a + string or comment caused the code generator to treat it as a + regular curly brace. This meant the code generator inserted a + newline when it was not supposed to. + Fri Jul 04 10:43:00 UTC 2008 Simon Massey * tools/IDL3_to_IDL2/IDL3_to_IDL2.mpc: -- cgit v1.2.1