mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
64bd893b0b
commit
fcaa09aaf8
11 changed files with 41 additions and 48 deletions
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
|
@ -21,7 +21,6 @@ import org.eclipse.core.resources.IFile;
|
|||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract class for representing the content of a file.
|
||||
* It serves as the input to the preprocessor.
|
||||
|
@ -30,7 +29,6 @@ import org.eclipse.core.runtime.IPath;
|
|||
* @since 5.2
|
||||
*/
|
||||
public abstract class FileContent {
|
||||
|
||||
/**
|
||||
* Returns the location of this file content as it will appear in {@link IASTFileLocation#getFileName()}
|
||||
*/
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Niefer (IBM Corporation) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Niefer (IBM Corporation) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
|
@ -21,8 +21,9 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
|
|||
import org.eclipse.cdt.internal.core.dom.parser.ASTQueries;
|
||||
|
||||
public class CPPBlockScope extends CPPNamespaceScope implements ICPPBlockScope {
|
||||
public CPPBlockScope( IASTNode physicalNode ){
|
||||
super( physicalNode );
|
||||
|
||||
public CPPBlockScope(IASTNode physicalNode) {
|
||||
super(physicalNode);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -318,7 +318,6 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace
|
|||
fInlineNamespaceDefinitions.add(nsDef);
|
||||
}
|
||||
|
||||
|
||||
public static ICPPNamespaceScope[] computeEnclosingNamespaceSet(ICPPInternalNamespaceScope nsScope) {
|
||||
if (nsScope.isInlineNamepace()) {
|
||||
try {
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Andrew Niefer (IBM Corporation) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
* Andrew Niefer (IBM Corporation) - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
|
@ -42,9 +42,6 @@ public class CPPTemplateScope extends CPPScope implements ICPPTemplateScope {
|
|||
return (ICPPASTTemplateDeclaration) getPhysicalNode();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPScope#getScopeName()
|
||||
*/
|
||||
@Override
|
||||
public IName getScopeName() {
|
||||
ICPPASTTemplateDeclaration template = (ICPPASTTemplateDeclaration) getPhysicalNode();
|
||||
|
|
|
@ -6,9 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.IName;
|
||||
|
|
|
@ -92,7 +92,8 @@ public interface IWritableIndex extends IIndex {
|
|||
|
||||
/**
|
||||
* Makes an uncommitted file that was created earlier by calling
|
||||
* {@link #addUncommittedFile(int, IIndexFileLocation, ISignificantMacros)} method visible in the index.
|
||||
* {@link #addUncommittedFile(int, IIndexFileLocation, ISignificantMacros)} method visible
|
||||
* in the index.
|
||||
*
|
||||
* @return The file that was updated.
|
||||
* @throws CoreException
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser.scanner;
|
||||
|
||||
|
@ -16,7 +16,6 @@ package org.eclipse.cdt.internal.core.parser.scanner;
|
|||
* @since 5.2
|
||||
*/
|
||||
public abstract class AbstractCharArray {
|
||||
|
||||
/**
|
||||
* Returns the length of this array or -1 if it is yet, unknown. This method may be called
|
||||
* before the array has been traversed.
|
||||
|
@ -25,8 +24,8 @@ public abstract class AbstractCharArray {
|
|||
|
||||
/**
|
||||
* Returns the length of the array. This method is called only after the lexer has worked its
|
||||
* way through the array. Therefore for subclasses it is efficient enough to read through to the
|
||||
* end of the array and provide the length.
|
||||
* way through the array. Therefore for subclasses it is efficient enough to read through to
|
||||
* the end of the array and provide the length.
|
||||
*/
|
||||
public abstract int getLength();
|
||||
|
||||
|
@ -37,8 +36,8 @@ public abstract class AbstractCharArray {
|
|||
public abstract boolean isValidOffset(int offset);
|
||||
|
||||
/**
|
||||
* Computes 64-bit hash value of the character array. This method doesn't cause any I/O if called
|
||||
* after the array has been traversed.
|
||||
* Computes 64-bit hash value of the character array. This method doesn't cause any I/O if
|
||||
* called after the array has been traversed.
|
||||
* @return The hash value of the contents of the array.
|
||||
*/
|
||||
public abstract long getContentsHash();
|
||||
|
|
|
@ -164,18 +164,20 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
|
|||
};
|
||||
|
||||
private static class IncludeResolution {
|
||||
String fLocation;
|
||||
boolean fHeuristic;
|
||||
final String fLocation;
|
||||
final boolean fHeuristic;
|
||||
|
||||
IncludeResolution(String location, boolean heusistic) {
|
||||
fLocation = location;
|
||||
fHeuristic = heusistic;
|
||||
}
|
||||
}
|
||||
|
||||
final private IIncludeFileTester<IncludeResolution> createPathTester= new IIncludeFileTester<IncludeResolution>() {
|
||||
@Override
|
||||
public IncludeResolution checkFile(String path, boolean isHeuristicMatch, IncludeSearchPathElement onPath) {
|
||||
if (fFileContentProvider.getInclusionExists(path)) {
|
||||
IncludeResolution res= new IncludeResolution();
|
||||
res.fHeuristic= isHeuristicMatch;
|
||||
res.fLocation= path;
|
||||
return res;
|
||||
return new IncludeResolution(path, isHeuristicMatch);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser.scanner;
|
||||
|
||||
|
@ -15,7 +15,6 @@ package org.eclipse.cdt.internal.core.parser.scanner;
|
|||
* Wrapper around char[] to implement {@link AbstractCharArray}.
|
||||
*/
|
||||
public final class CharArray extends AbstractCharArray {
|
||||
|
||||
private final char[] fArray;
|
||||
private long hash64;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Markus Schorn - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser.scanner;
|
||||
|
||||
|
@ -25,14 +25,13 @@ import java.nio.charset.CodingErrorAction;
|
|||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
|
||||
/**
|
||||
* Implementation of char array for a file referencing content via
|
||||
* soft references.
|
||||
* Implementation of char array for a file referencing content via soft references.
|
||||
*/
|
||||
public class FileCharArray extends LazyCharArray {
|
||||
private static final String UTF8_CHARSET_NAME = "UTF-8"; //$NON-NLS-1$
|
||||
|
||||
public static AbstractCharArray create(String fileName, String charSet, InputStream in) throws IOException {
|
||||
// no support for non-local files
|
||||
// No support for non-local files.
|
||||
if (!(in instanceof FileInputStream)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -84,10 +83,9 @@ public class FileCharArray extends LazyCharArray {
|
|||
private String fFileName;
|
||||
private String fCharSet;
|
||||
private FileChannel fChannel;
|
||||
private long fNextFileOffset= 0;
|
||||
private int fNextCharOffset= 0;
|
||||
private boolean fReachedEOF= false;
|
||||
|
||||
private long fNextFileOffset;
|
||||
private int fNextCharOffset;
|
||||
private boolean fReachedEOF;
|
||||
|
||||
private FileCharArray(String fileName, String charSet) {
|
||||
fFileName= fileName;
|
||||
|
@ -192,7 +190,8 @@ public class FileCharArray extends LazyCharArray {
|
|||
|
||||
private void decode(FileChannel channel, long fileOffset, long fileEndOffset, CharBuffer dest) throws IOException {
|
||||
final Charset charset = Charset.forName(fCharSet);
|
||||
final CharsetDecoder decoder = charset.newDecoder().onMalformedInput(CodingErrorAction.REPLACE)
|
||||
final CharsetDecoder decoder = charset.newDecoder()
|
||||
.onMalformedInput(CodingErrorAction.REPLACE)
|
||||
.onUnmappableCharacter(CodingErrorAction.REPLACE);
|
||||
|
||||
final ByteBuffer in = ByteBuffer.allocate((int) (fileEndOffset - fileOffset));
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
* Markus Schorn - initial API and implementation
|
||||
* Sergey Prigogin (Google)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.parser.scanner;
|
||||
|
||||
|
@ -16,8 +16,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Implementation of char array for a file referencing content via
|
||||
* soft references.
|
||||
* Implementation of char array for a file referencing content via soft references.
|
||||
* Because of bug 320157 we need to deal with chunks of different length.
|
||||
*/
|
||||
public abstract class LazyCharArray extends AbstractCharArray {
|
||||
|
@ -95,14 +94,14 @@ public abstract class LazyCharArray extends AbstractCharArray {
|
|||
@Override
|
||||
public final void arraycopy(int offset, char[] destination, int destinationPos, int length) {
|
||||
final Chunk chunk= getChunkForOffset(offset);
|
||||
final int offsetInChunk= offset-chunk.fCharOffset;
|
||||
final int offsetInChunk= offset - chunk.fCharOffset;
|
||||
final char[] data= getChunkData(chunk);
|
||||
final int maxLenInChunk = data.length - offsetInChunk;
|
||||
if (length <= maxLenInChunk) {
|
||||
System.arraycopy(data, offsetInChunk, destination, destinationPos, length);
|
||||
} else {
|
||||
System.arraycopy(data, offsetInChunk, destination, destinationPos, maxLenInChunk);
|
||||
arraycopy(offset+maxLenInChunk, destination, destinationPos+maxLenInChunk, length-maxLenInChunk);
|
||||
arraycopy(offset + maxLenInChunk, destination, destinationPos + maxLenInChunk, length - maxLenInChunk);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue