From aa1940052bb5f93e310ebf89b304c3b004503ffe Mon Sep 17 00:00:00 2001 From: axelcl Date: Tue, 9 Nov 2004 21:45:12 +0000 Subject: [PATCH] no indentation of HTML and phpdocs --- .../phpdt/internal/formatter/CodeFormatter.java | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java index 27e8037..b272fbd 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/formatter/CodeFormatter.java @@ -372,6 +372,11 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } if (token == Scanner.TokenNameEOF) break; + if (token == Scanner.TokenNameHEREDOC || token == Scanner.TokenNameINLINE_HTML) { + // no indentation for heredocs and HTML ! + outputCurrentTokenWithoutIndent(Scanner.TokenNameHEREDOC); + continue; + } /* * ## MODIFYING the indentation level before generating new lines and indentation in the output string */ @@ -1420,7 +1425,7 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { // |= (15.25.2) return "|="; //$NON-NLS-1$ case TokenNameDOT_EQUAL: - // .= + // .= return ".="; //$NON-NLS-1$ case TokenNameDOT: // . @@ -1444,6 +1449,11 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { } } + private void outputCurrentTokenWithoutIndent(int token) { + newLine(0); + formattedSource.append(scanner.source, scanner.startPosition, scanner.currentPosition - scanner.startPosition); + } + /** * Appends token to the formatted output.
* If it contains \n, append a LINE_SEPARATOR and indent after it. @@ -1908,7 +1918,7 @@ public class CodeFormatter implements ITerminalSymbols, ICodeFormatter { //return (currentToken == TokenNameCOMMA || currentToken == // TokenNameSEMICOLON); return currentToken != TokenNameif && currentToken != TokenNameLPAREN && currentToken != TokenNameNOT - && currentToken != TokenNamewhile && currentToken != TokenNamefor && currentToken != TokenNameforeach + && currentToken != TokenNamewhile && currentToken != TokenNamefor && currentToken != TokenNameforeach && currentToken != TokenNameswitch; } -- 1.7.1