Lines 333-353
Link Here
|
333 |
} |
333 |
} |
334 |
ProbingScanner.setSource((char[]) null); |
334 |
ProbingScanner.setSource((char[]) null); |
335 |
|
335 |
|
|
|
336 |
// probe for expression |
336 |
Expression expression = this.codeSnippetParsingUtil.parseExpression(source.toCharArray(), getDefaultCompilerOptions(), true); |
337 |
Expression expression = this.codeSnippetParsingUtil.parseExpression(source.toCharArray(), getDefaultCompilerOptions(), true); |
337 |
if (expression != null) { |
338 |
if (expression != null) { |
338 |
return internalFormatExpression(source, indentationLevel, lineSeparator, expression, offset, length); |
339 |
return internalFormatExpression(source, indentationLevel, lineSeparator, expression, offset, length); |
339 |
} |
340 |
} |
340 |
|
341 |
|
341 |
ASTNode[] bodyDeclarations = this.codeSnippetParsingUtil.parseClassBodyDeclarations(source.toCharArray(), getDefaultCompilerOptions(), true); |
342 |
// probe for statements |
342 |
if (bodyDeclarations != null) { |
|
|
343 |
return internalFormatClassBodyDeclarations(source, indentationLevel, lineSeparator, bodyDeclarations, offset, length); |
344 |
} |
345 |
|
346 |
ConstructorDeclaration constructorDeclaration = this.codeSnippetParsingUtil.parseStatements(source.toCharArray(), getDefaultCompilerOptions(), true); |
343 |
ConstructorDeclaration constructorDeclaration = this.codeSnippetParsingUtil.parseStatements(source.toCharArray(), getDefaultCompilerOptions(), true); |
347 |
if (constructorDeclaration.statements != null) { |
344 |
if (constructorDeclaration.statements != null) { |
348 |
return internalFormatStatements(source, indentationLevel, lineSeparator, constructorDeclaration, offset, length); |
345 |
return internalFormatStatements(source, indentationLevel, lineSeparator, constructorDeclaration, offset, length); |
349 |
} |
346 |
} |
350 |
|
347 |
|
|
|
348 |
// probe for body declarations (fields, methods, constructors) |
349 |
ASTNode[] bodyDeclarations = this.codeSnippetParsingUtil.parseClassBodyDeclarations(source.toCharArray(), getDefaultCompilerOptions(), true); |
350 |
if (bodyDeclarations != null) { |
351 |
return internalFormatClassBodyDeclarations(source, indentationLevel, lineSeparator, bodyDeclarations, offset, length); |
352 |
} |
353 |
|
354 |
// this has to be a compilation unit |
351 |
return formatCompilationUnit(source, indentationLevel, lineSeparator, offset, length); |
355 |
return formatCompilationUnit(source, indentationLevel, lineSeparator, offset, length); |
352 |
} |
356 |
} |
353 |
} |
357 |
} |