diff options
author | Christian Kamm <christian.d.kamm@nokia.com> | 2010-09-24 15:40:45 +0200 |
---|---|---|
committer | Christian Kamm <christian.d.kamm@nokia.com> | 2010-09-24 15:41:13 +0200 |
commit | dc58172b781226c181a1c0771fca59d17145754c (patch) | |
tree | 565f5eb8f4ab43c42888d11914ac6f83235bc955 /src/plugins/cpptools/cppcodeformatter.cpp | |
parent | 449426baea983633c53c621bea47bf6a4a671d18 (diff) | |
download | qt-creator-dc58172b781226c181a1c0771fca59d17145754c.tar.gz |
C++ indenter: Add some small error recovery.
Diffstat (limited to 'src/plugins/cpptools/cppcodeformatter.cpp')
-rw-r--r-- | src/plugins/cpptools/cppcodeformatter.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp index 30f589e602..a81a57f339 100644 --- a/src/plugins/cpptools/cppcodeformatter.cpp +++ b/src/plugins/cpptools/cppcodeformatter.cpp @@ -178,6 +178,7 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block) if (tryExpression()) break; switch (kind) { + case T_RBRACE: leave(true); continue; case T_SEMICOLON: leave(); continue; case T_LBRACE: case T_COLON: @@ -193,6 +194,8 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block) if (tryExpression()) break; switch (kind) { + case T_SEMICOLON: leave(true); break; + case T_RBRACE: leave(true); continue; case T_RPAREN: leave(); break; } break; @@ -256,6 +259,7 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block) case if_statement: switch (kind) { case T_LPAREN: enter(condition_open); break; + default: leave(true); continue; } break; case maybe_else: @@ -286,6 +290,7 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block) case return_statement: switch (kind) { + case T_RBRACE: leave(true); continue; case T_SEMICOLON: leave(true); break; } break; @@ -296,11 +301,13 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block) switch (kind) { case T_LBRACE: turnInto(substatement_open); break; case T_SEMICOLON: leave(true); break; + case T_RBRACE: leave(true); continue; } break; case for_statement: switch (kind) { case T_LPAREN: enter(for_statement_paren_open); break; + default: leave(true); continue; } break; case for_statement_paren_open: |