Lines 2060-2085
Link Here
|
2060 |
|
2060 |
|
2061 |
this.localScanner.resetTo(this.scribe.scanner.currentPosition, this.scribe.scannerEndPosition - 1); |
2061 |
this.localScanner.resetTo(this.scribe.scanner.currentPosition, this.scribe.scannerEndPosition - 1); |
2062 |
int dimensions = 0; |
2062 |
int dimensions = 0; |
|
|
2063 |
int balance = 0; |
2063 |
try { |
2064 |
try { |
2064 |
int token; |
2065 |
int token; |
2065 |
while ((token = this.localScanner.getNextToken()) != TerminalTokens.TokenNameEOF) { |
2066 |
loop: while ((token = this.localScanner.getNextToken()) != TerminalTokens.TokenNameEOF) { |
2066 |
switch(token) { |
2067 |
switch(token) { |
2067 |
case TerminalTokens.TokenNameRBRACKET: |
2068 |
case TerminalTokens.TokenNameRBRACKET: |
2068 |
dimensions++; |
2069 |
dimensions++; |
|
|
2070 |
balance--; |
2069 |
break; |
2071 |
break; |
2070 |
case TerminalTokens.TokenNameCOMMENT_BLOCK : |
2072 |
case TerminalTokens.TokenNameCOMMENT_BLOCK : |
2071 |
case TerminalTokens.TokenNameCOMMENT_JAVADOC : |
2073 |
case TerminalTokens.TokenNameCOMMENT_JAVADOC : |
2072 |
case TerminalTokens.TokenNameCOMMENT_LINE : |
2074 |
case TerminalTokens.TokenNameCOMMENT_LINE : |
|
|
2075 |
break; |
2073 |
case TerminalTokens.TokenNameLBRACKET : |
2076 |
case TerminalTokens.TokenNameLBRACKET : |
|
|
2077 |
balance++; |
2074 |
break; |
2078 |
break; |
2075 |
default: |
2079 |
default: |
2076 |
return dimensions; |
2080 |
break loop; |
2077 |
} |
2081 |
} |
2078 |
} |
2082 |
} |
2079 |
} catch(InvalidInputException e) { |
2083 |
} catch(InvalidInputException e) { |
2080 |
// ignore |
2084 |
// ignore |
2081 |
} |
2085 |
} |
2082 |
return dimensions; |
2086 |
if (balance == 0) { |
|
|
2087 |
return dimensions; |
2088 |
} |
2089 |
return 0; |
2083 |
} |
2090 |
} |
2084 |
|
2091 |
|
2085 |
private boolean hasComments() { |
2092 |
private boolean hasComments() { |
Lines 2400-2420
Link Here
|
2400 |
this.scribe.space(); |
2407 |
this.scribe.space(); |
2401 |
arrayAllocationExpression.type.traverse(this, scope); |
2408 |
arrayAllocationExpression.type.traverse(this, scope); |
2402 |
|
2409 |
|
2403 |
final Expression[] dimensions = arrayAllocationExpression.dimensions; |
2410 |
if (isNextToken(TerminalTokens.TokenNameLBRACKET)) { |
2404 |
int dimensionsLength = dimensions.length; |
2411 |
final Expression[] dimensions = arrayAllocationExpression.dimensions; |
2405 |
for (int i = 0; i < dimensionsLength; i++) { |
2412 |
int dimensionsLength = dimensions.length; |
2406 |
if (this.preferences.insert_space_before_opening_bracket_in_array_allocation_expression) { |
2413 |
for (int i = 0; i < dimensionsLength; i++) { |
2407 |
this.scribe.space(); |
2414 |
if (this.preferences.insert_space_before_opening_bracket_in_array_allocation_expression) { |
2408 |
} |
|
|
2409 |
this.scribe.printNextToken(TerminalTokens.TokenNameLBRACKET, false); |
2410 |
if (dimensions[i] != null) { |
2411 |
if (this.preferences.insert_space_after_opening_bracket_in_array_allocation_expression) { |
2412 |
this.scribe.space(); |
2415 |
this.scribe.space(); |
2413 |
} |
2416 |
} |
2414 |
dimensions[i].traverse(this, scope); |
2417 |
this.scribe.printNextToken(TerminalTokens.TokenNameLBRACKET, false); |
2415 |
this.scribe.printNextToken(TerminalTokens.TokenNameRBRACKET, this.preferences.insert_space_before_closing_bracket_in_array_allocation_expression); |
2418 |
if (dimensions[i] != null) { |
2416 |
} else { |
2419 |
if (this.preferences.insert_space_after_opening_bracket_in_array_allocation_expression) { |
2417 |
this.scribe.printNextToken(TerminalTokens.TokenNameRBRACKET, this.preferences.insert_space_between_empty_brackets_in_array_allocation_expression); |
2420 |
this.scribe.space(); |
|
|
2421 |
} |
2422 |
dimensions[i].traverse(this, scope); |
2423 |
this.scribe.printNextToken(TerminalTokens.TokenNameRBRACKET, this.preferences.insert_space_before_closing_bracket_in_array_allocation_expression); |
2424 |
} else { |
2425 |
this.scribe.printNextToken(TerminalTokens.TokenNameRBRACKET, this.preferences.insert_space_between_empty_brackets_in_array_allocation_expression); |
2426 |
} |
2418 |
} |
2427 |
} |
2419 |
} |
2428 |
} |
2420 |
final ArrayInitializer initializer = arrayAllocationExpression.initializer; |
2429 |
final ArrayInitializer initializer = arrayAllocationExpression.initializer; |