import java.util.Locale;
import java.util.Map;
+import javax.swing.text.html.Option;
+
import net.sourceforge.phpdt.core.ICodeFormatter;
import net.sourceforge.phpdt.core.compiler.CharOperation;
import net.sourceforge.phpdt.core.compiler.ITerminalSymbols;
&& previousToken != TokenNameRBRACE
&& previousToken != TokenNamesuper) {
// && previousToken != TokenNamethis) {
- space();
+ if (!options.compactArrays) {
+ space();
+ }
}
// If in a for/if/while statement, increase the parenthesis
// count
if (previousCompilableToken == TokenNamearray) {
arrayDeclarationCount++;
arrayDeclarationParenthesis[arrayDeclarationCount] = openParenthesis[openParenthesisCount - 1];
- indentationLevel++;
- pendingNewLines = 1;
+ if (!options.compactArrays) {
+ indentationLevel++;
+ pendingNewLines = 1;
+ }
}
// S }
break;
if (arrayDeclarationCount > 0) {
if (arrayDeclarationParenthesis[arrayDeclarationCount] == openParenthesis[openParenthesisCount - 1]) {
if (previousCompilableToken != TokenNameLPAREN) {
- newLine(1);
+ if (!options.compactArrays) {
+ newLine(1);
+ }
} else if (previousToken == TokenNameCOMMENT_LINE
|| previousToken == TokenNameCOMMENT_BLOCK
|| previousToken == TokenNameCOMMENT_PHPDOC) {
// prevent to combine comment line and statement line (#1475484)
- newLine(1);
+ if (!options.compactArrays) {
+ newLine(1);
+ }
+ }
+ if (!options.compactArrays) {
+ indentationLevel--;
+
}
- indentationLevel--;
currentLineIndentationLevel = indentationLevel;
pendingNewLines = 0;
arrayDeclarationCount--;
if (arrayDeclarationCount > 0) {
if (arrayDeclarationParenthesis[arrayDeclarationCount] == openParenthesis[openParenthesisCount - 1]) {
// there is no left parenthesis to close in current array declaration (#1475484)
- pendingNewLines = 1;
+ if (!options.compactArrays) {
+ pendingNewLines = 1;
+ }
}
}
break;
case TokenNameDOT:
- space();
+ if (!options.compactStringConcatenation) {
+ space();
+ }
pendingSpace = false;
break;
case TokenNameSEMICOLON:
case TokenNameDOLLAR:
case Scanner.TokenNameCOMMENT_LINE:
return false;
+ case TokenNameDOT:
+ return !options.compactStringConcatenation;
default:
return true;
}