mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
notnull
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package org.intellij.lang.regexp;
|
||||
|
||||
import com.intellij.lexer.FlexAdapter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
@@ -29,7 +30,7 @@ public class RegExpLexer extends FlexAdapter {
|
||||
myCapabilities = capabilities;
|
||||
}
|
||||
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
getFlex().commentMode = (initialState & COMMENT_MODE) != 0 || myCapabilities.contains(RegExpCapability.COMMENT_MODE);
|
||||
super.start(buffer, startOffset, endOffset, initialState & ~COMMENT_MODE);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class JavaSyntaxHighlighterFactory extends SyntaxHighlighterFactory imple
|
||||
*/
|
||||
@Nullable
|
||||
@Override
|
||||
public SyntaxHighlighter create(FileType fileType, @Nullable Project project, @Nullable VirtualFile file) {
|
||||
public SyntaxHighlighter create(@NotNull FileType fileType, @Nullable Project project, @Nullable VirtualFile file) {
|
||||
if (project != null && file != null) {
|
||||
PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
|
||||
if (psiFile instanceof ClsFileImpl) {
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.psi.xml.XmlElementType;
|
||||
import com.intellij.psi.xml.XmlTokenType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
@@ -35,7 +36,7 @@ public class JavaIndexPatternBuilder implements IndexPatternBuilder {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Lexer getIndexingLexer(final PsiFile file) {
|
||||
public Lexer getIndexingLexer(@NotNull final PsiFile file) {
|
||||
if (file instanceof PsiJavaFile && !(file instanceof JspFile)) {
|
||||
return JavaParserDefinition.createLexer(((PsiJavaFile)file).getLanguageLevel());
|
||||
}
|
||||
@@ -44,7 +45,7 @@ public class JavaIndexPatternBuilder implements IndexPatternBuilder {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public TokenSet getCommentTokenSet(final PsiFile file) {
|
||||
public TokenSet getCommentTokenSet(@NotNull final PsiFile file) {
|
||||
if (file instanceof PsiJavaFile && !(file instanceof ServerPageFile)) {
|
||||
return TokenSet.orSet(StdTokenSets.COMMENT_BIT_SET, XML_COMMENT_BIT_SET, JavaDocTokenType.ALL_JAVADOC_TOKENS, XML_DATA_CHARS);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,13 +32,14 @@ import com.intellij.psi.jsp.JspFile;
|
||||
import com.intellij.psi.jsp.JspTokenType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public class JspIndexPatternBuilder implements IndexPatternBuilder {
|
||||
@Override
|
||||
public Lexer getIndexingLexer(final PsiFile file) {
|
||||
public Lexer getIndexingLexer(@NotNull final PsiFile file) {
|
||||
if (JspPsiUtil.isInJspFile(file)) {
|
||||
EditorHighlighter highlighter = null;
|
||||
|
||||
@@ -67,7 +68,7 @@ public class JspIndexPatternBuilder implements IndexPatternBuilder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public TokenSet getCommentTokenSet(final PsiFile file) {
|
||||
public TokenSet getCommentTokenSet(@NotNull final PsiFile file) {
|
||||
final JspFile jspFile = JspPsiUtil.getJspFile(file);
|
||||
TokenSet commentTokens = TokenSet.orSet(JavaIndexPatternBuilder.XML_COMMENT_BIT_SET, StdTokenSets.COMMENT_BIT_SET);
|
||||
final ParserDefinition parserDefinition =
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.editor.highlighter.EditorHighlighter;
|
||||
import com.intellij.openapi.editor.highlighter.HighlighterIterator;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.util.text.CharSequenceSubSequence;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Sergey Evdokimov
|
||||
@@ -38,7 +39,7 @@ public class LexerEditorHighlighterLexer extends LexerBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int state) {
|
||||
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int state) {
|
||||
if (myAlreadyInitializedHighlighter) {
|
||||
this.buffer = buffer;
|
||||
start = startOffset;
|
||||
@@ -75,6 +76,7 @@ public class LexerEditorHighlighterLexer extends LexerBase {
|
||||
iterator.advance();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CharSequence getBufferSequence() {
|
||||
return buffer;
|
||||
|
||||
@@ -54,7 +54,7 @@ public class JavaDocLexer extends MergingLexerAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public final void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
myBuffer = buffer;
|
||||
myBufferIndex = startOffset;
|
||||
myBufferEndOffset = endOffset;
|
||||
@@ -68,6 +68,7 @@ public class JavaDocLexer extends MergingLexerAdapter {
|
||||
return myState;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CharSequence getBufferSequence() {
|
||||
return myBuffer;
|
||||
|
||||
@@ -175,7 +175,7 @@ public class JavaLexer extends LexerBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public final void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
myBuffer = buffer;
|
||||
myBufferArray = CharArrayUtil.fromSequenceWithoutCopying(buffer);
|
||||
myBufferIndex = startOffset;
|
||||
@@ -417,6 +417,7 @@ public class JavaLexer extends LexerBase {
|
||||
return pos;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CharSequence getBufferSequence() {
|
||||
return myBuffer;
|
||||
|
||||
@@ -27,6 +27,7 @@ package org.jetbrains.lang.manifest.parser;
|
||||
import com.intellij.lexer.LexerBase;
|
||||
import com.intellij.psi.TokenType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.lang.manifest.psi.ManifestTokenType;
|
||||
|
||||
@@ -63,7 +64,7 @@ public class ManifestLexer extends LexerBase {
|
||||
private IElementType myTokenType;
|
||||
|
||||
@Override
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
this.myBuffer = buffer;
|
||||
this.myEndOffset = endOffset;
|
||||
myCurrentState = State.values()[initialState];
|
||||
@@ -104,6 +105,7 @@ public class ManifestLexer extends LexerBase {
|
||||
return myEndOffset;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CharSequence getBufferSequence() {
|
||||
return myBuffer;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@
|
||||
package com.intellij.lexer;
|
||||
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class DelegateLexer extends LexerBase {
|
||||
@@ -34,7 +35,7 @@ public class DelegateLexer extends LexerBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
myDelegate.start(buffer, startOffset, endOffset, initialState);
|
||||
}
|
||||
|
||||
@@ -64,6 +65,7 @@ public class DelegateLexer extends LexerBase {
|
||||
myDelegate.advance();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public final CharSequence getBufferSequence() {
|
||||
return myDelegate.getBufferSequence();
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.lexer;
|
||||
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -45,7 +46,7 @@ public class DocCommentLexer extends MergingLexerAdapter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public final void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
myBuffer = buffer;
|
||||
myBufferIndex = startOffset;
|
||||
myBufferEndOffset = endOffset;
|
||||
@@ -59,6 +60,7 @@ public class DocCommentLexer extends MergingLexerAdapter {
|
||||
return myState;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CharSequence getBufferSequence() {
|
||||
return myBuffer;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.lexer;
|
||||
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -39,7 +40,7 @@ public class FlexAdapter extends LexerBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(final CharSequence buffer, int startOffset, int endOffset, final int initialState) {
|
||||
public void start(@NotNull final CharSequence buffer, int startOffset, int endOffset, final int initialState) {
|
||||
myText = buffer;
|
||||
myEnd = endOffset;
|
||||
myFlex.reset(myText, startOffset, endOffset, initialState);
|
||||
@@ -76,6 +77,7 @@ public class FlexAdapter extends LexerBase {
|
||||
myTokenType = null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CharSequence getBufferSequence() {
|
||||
return myText;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package com.intellij.lexer;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
@@ -75,7 +76,7 @@ public class LayeredLexer extends DelegateLexer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
LOG.assertTrue(initialState != IN_LAYER_STATE, "Restoring to layer is not supported.");
|
||||
myState = initialState;
|
||||
myCurrentLayerLexer = null;
|
||||
@@ -157,13 +158,14 @@ public class LayeredLexer extends DelegateLexer {
|
||||
myState = isLayerActive() ? IN_LAYER_STATE : super.getState();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public LexerPosition getCurrentPosition() {
|
||||
return new LexerPositionImpl(getTokenStart(), getState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restore(LexerPosition position) {
|
||||
public void restore(@NotNull LexerPosition position) {
|
||||
start(getBufferSequence(), position.getOffset(), getBufferEnd(), position.getState());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.lexer;
|
||||
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
@@ -35,20 +36,22 @@ public abstract class Lexer {
|
||||
* @param initialState the initial state of the lexer.
|
||||
* @since IDEA 7
|
||||
*/
|
||||
public abstract void start(CharSequence buffer, int startOffset, int endOffset, int initialState);
|
||||
public abstract void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState);
|
||||
|
||||
public final void start(CharSequence buf, int start, int end) {
|
||||
public final void start(@NotNull CharSequence buf, int start, int end) {
|
||||
start(buf, start, end, 0);
|
||||
}
|
||||
|
||||
public final void start(CharSequence buf) {
|
||||
public final void start(@NotNull CharSequence buf) {
|
||||
start(buf, 0, buf.length(), 0);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public CharSequence getTokenSequence() {
|
||||
return getBufferSequence().subSequence(getTokenStart(), getTokenEnd());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getTokenText() {
|
||||
return getTokenSequence().toString();
|
||||
}
|
||||
@@ -93,6 +96,7 @@ public abstract class Lexer {
|
||||
*
|
||||
* @return the lexer position and state.
|
||||
*/
|
||||
@NotNull
|
||||
public abstract LexerPosition getCurrentPosition();
|
||||
|
||||
/**
|
||||
@@ -100,7 +104,7 @@ public abstract class Lexer {
|
||||
*
|
||||
* @param position the state and position to restore to.
|
||||
*/
|
||||
public abstract void restore(LexerPosition position);
|
||||
public abstract void restore(@NotNull LexerPosition position);
|
||||
|
||||
/**
|
||||
* Returns the buffer sequence over which the lexer is running. This method should return the
|
||||
@@ -108,6 +112,7 @@ public abstract class Lexer {
|
||||
* @return the lexer buffer.
|
||||
* @since IDEA 7
|
||||
*/
|
||||
@NotNull
|
||||
public abstract CharSequence getBufferSequence();
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package com.intellij.lexer;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class LexerBase extends Lexer {
|
||||
@NotNull
|
||||
@Override
|
||||
public LexerPosition getCurrentPosition() {
|
||||
final int offset = getTokenStart();
|
||||
@@ -24,7 +27,7 @@ public abstract class LexerBase extends Lexer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restore(LexerPosition position) {
|
||||
public void restore(@NotNull LexerPosition position) {
|
||||
start(getBufferSequence(), position.getOffset(), getBufferEnd(), position.getState());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2010 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.lexer;
|
||||
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class MergingLexerAdapterBase extends DelegateLexer {
|
||||
private IElementType myTokenType;
|
||||
@@ -29,7 +30,7 @@ public class MergingLexerAdapterBase extends DelegateLexer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(final CharSequence buffer, final int startOffset, final int endOffset, final int initialState) {
|
||||
public void start(@NotNull final CharSequence buffer, final int startOffset, final int endOffset, final int initialState) {
|
||||
super.start(buffer, startOffset, endOffset, initialState);
|
||||
myTokenType = null;
|
||||
}
|
||||
@@ -81,7 +82,7 @@ public class MergingLexerAdapterBase extends DelegateLexer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restore(LexerPosition position) {
|
||||
public void restore(@NotNull LexerPosition position) {
|
||||
MyLexerPosition pos = (MyLexerPosition)position;
|
||||
|
||||
getDelegate().restore(pos.getOriginalPosition());
|
||||
@@ -90,6 +91,7 @@ public class MergingLexerAdapterBase extends DelegateLexer {
|
||||
myState = pos.getOldState();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public LexerPosition getCurrentPosition() {
|
||||
return new MyLexerPosition(myTokenStart, myTokenType, getDelegate().getCurrentPosition(), myState);
|
||||
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,6 +22,7 @@ import com.intellij.lexer.LexerBase;
|
||||
import com.intellij.psi.CustomHighlighterTokenType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -40,7 +41,7 @@ public class AbstractCustomLexer extends LexerBase {
|
||||
myTokenParsers = tokenParsers.toArray(new TokenParser[tokenParsers.size()]);
|
||||
}
|
||||
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
myBuffer = buffer;
|
||||
myStartOffset = startOffset;
|
||||
myEndOffset = endOffset;
|
||||
@@ -95,6 +96,7 @@ public class AbstractCustomLexer extends LexerBase {
|
||||
myCurrentToken.updateData(myPosition, myPosition + 1, CustomHighlighterTokenType.CHARACTER);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public CharSequence getBufferSequence() {
|
||||
return myBuffer;
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,7 @@ import com.intellij.psi.search.IndexPattern;
|
||||
import com.intellij.psi.search.UsageSearchContext;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import gnu.trove.TIntArrayList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
@@ -148,7 +149,7 @@ public abstract class BaseFilterLexer extends DelegateLexer implements IdTableBu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
super.start(buffer, startOffset, endOffset, initialState);
|
||||
myCachedBufferSequence = getBufferSequence();
|
||||
myCachedArraySequence = CharArrayUtil.fromSequenceWithoutCopying(myCachedBufferSequence);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.lexer;
|
||||
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class CompositeLexer extends LexerBase {
|
||||
private final Lexer myLexer1;
|
||||
@@ -30,12 +31,13 @@ public abstract class CompositeLexer extends LexerBase {
|
||||
protected abstract IElementType getCompositeTokenType(IElementType type1, IElementType type2);
|
||||
|
||||
@Override
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
myLexer1.start(buffer, startOffset, endOffset, (initialState >> 16) & 0xFFFF);
|
||||
myLexer2.start(buffer, startOffset, endOffset, initialState & 0xFFFF);
|
||||
myCurOffset = startOffset;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CharSequence getBufferSequence() {
|
||||
return myLexer1.getBufferSequence();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,6 +17,7 @@ package com.intellij.lexer;
|
||||
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class FilterLexer extends DelegateLexer {
|
||||
private final Filter myFilter;
|
||||
@@ -55,7 +56,7 @@ public class FilterLexer extends DelegateLexer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
super.start(buffer, startOffset, endOffset, initialState);
|
||||
myPrevTokenEnd = -1;
|
||||
locateToken();
|
||||
@@ -73,13 +74,14 @@ public class FilterLexer extends DelegateLexer {
|
||||
return myPrevTokenEnd;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public LexerPosition getCurrentPosition() {
|
||||
return getDelegate().getCurrentPosition(); //To change body of overridden methods use File | Settings | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restore(LexerPosition position) {
|
||||
public void restore(@NotNull LexerPosition position) {
|
||||
getDelegate().restore(position);
|
||||
myPrevTokenEnd = -1;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@
|
||||
package com.intellij.lexer;
|
||||
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class StoppableLexerAdapter extends DelegateLexer {
|
||||
|
||||
@@ -61,13 +62,14 @@ public class StoppableLexerAdapter extends DelegateLexer {
|
||||
return myStopped ? null : super.getTokenType();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public LexerPosition getCurrentPosition() {
|
||||
return getDelegate().getCurrentPosition();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restore(LexerPosition position) {
|
||||
public void restore(@NotNull LexerPosition position) {
|
||||
getDelegate().restore(position);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.StringEscapesTokenTypes;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
@@ -74,7 +75,7 @@ public class StringLiteralLexer extends LexerBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
myBuffer = buffer;
|
||||
myStart = startOffset;
|
||||
if (myQuoteChar == NO_QUOTE_CHAR) {
|
||||
@@ -249,6 +250,7 @@ public class StringLiteralLexer extends LexerBase {
|
||||
myEnd = locateToken(myStart);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CharSequence getBufferSequence() {
|
||||
return myBuffer;
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,7 @@ import com.intellij.openapi.fileTypes.impl.CustomSyntaxTableFileType;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ide.highlighter.custom.CustomFileHighlighter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
@@ -32,7 +33,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class CustomFileTypeHighlighterProvider implements SyntaxHighlighterProvider {
|
||||
@Override
|
||||
@Nullable
|
||||
public SyntaxHighlighter create(final FileType fileType, @Nullable final Project project, @Nullable final VirtualFile file) {
|
||||
public SyntaxHighlighter create(@NotNull final FileType fileType, @Nullable final Project project, @Nullable final VirtualFile file) {
|
||||
if (fileType instanceof AbstractFileType) {
|
||||
return new CustomFileHighlighter(((CustomSyntaxTableFileType) fileType).getSyntaxTable());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,7 @@ package com.intellij.lexer;
|
||||
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class PrefixSuffixStripperLexer extends LexerBase {
|
||||
private CharSequence myBuffer;
|
||||
@@ -49,7 +50,7 @@ public class PrefixSuffixStripperLexer extends LexerBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
myBuffer = buffer;
|
||||
myBufferArray = CharArrayUtil.fromSequenceWithoutCopying(buffer);
|
||||
myTokenStart = startOffset;
|
||||
@@ -87,6 +88,7 @@ public class PrefixSuffixStripperLexer extends LexerBase {
|
||||
return myBufferEnd;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CharSequence getBufferSequence() {
|
||||
return myBuffer;
|
||||
|
||||
+6
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,6 +22,7 @@ package com.intellij.psi.templateLanguages;
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.lexer.LexerPosition;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class TemplateBlackAndWhiteLexer extends Lexer {
|
||||
@@ -39,11 +40,12 @@ public class TemplateBlackAndWhiteLexer extends Lexer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(final CharSequence buffer, final int startOffset, final int endOffset, final int initialState) {
|
||||
public void start(@NotNull final CharSequence buffer, final int startOffset, final int endOffset, final int initialState) {
|
||||
myBaseLexer.start(buffer, startOffset, endOffset, initialState);
|
||||
setupTemplateToken();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CharSequence getBufferSequence() {
|
||||
return myBaseLexer.getBufferSequence();
|
||||
@@ -139,13 +141,14 @@ public class TemplateBlackAndWhiteLexer extends Lexer {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public LexerPosition getCurrentPosition() {
|
||||
return new Position(myTemplateLexer.getCurrentPosition(), myBaseLexer.getCurrentPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restore(LexerPosition position) {
|
||||
public void restore(@NotNull LexerPosition position) {
|
||||
final Position p = (Position)position;
|
||||
myBaseLexer.restore(p.getBasePosition());
|
||||
final LexerPosition templatePos = p.getTemplatePosition();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package com.intellij.lexer;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.util.containers.ImmutableUserMap;
|
||||
import com.intellij.util.containers.Queue;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author peter
|
||||
@@ -73,6 +74,7 @@ public abstract class LookAheadLexer extends LexerBase{
|
||||
assert !myTypeCache.isEmpty();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public CharSequence getBufferSequence() {
|
||||
return myBaseLexer.getBufferSequence();
|
||||
}
|
||||
@@ -109,11 +111,12 @@ public abstract class LookAheadLexer extends LexerBase{
|
||||
return myTokenStart;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public LookAheadLexerPosition getCurrentPosition() {
|
||||
return new LookAheadLexerPosition(this, ImmutableUserMap.EMPTY);
|
||||
}
|
||||
|
||||
public final void restore(final LexerPosition _position) {
|
||||
public final void restore(@NotNull final LexerPosition _position) {
|
||||
restore((LookAheadLexerPosition) _position);
|
||||
}
|
||||
|
||||
@@ -129,7 +132,7 @@ public abstract class LookAheadLexer extends LexerBase{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
myBaseLexer.start(buffer, startOffset, endOffset, initialState & 0xFFFF);
|
||||
myTokenStart = startOffset;
|
||||
myTypeCache.clear();
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,6 +17,7 @@ package com.intellij.openapi.fileTypes;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
@@ -24,7 +25,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class LanguageFileTypeHighlighterProvider implements SyntaxHighlighterProvider {
|
||||
@Nullable
|
||||
public SyntaxHighlighter create(final FileType fileType, @Nullable final Project project, @Nullable final VirtualFile file) {
|
||||
public SyntaxHighlighter create(@NotNull final FileType fileType, @Nullable final Project project, @Nullable final VirtualFile file) {
|
||||
if (fileType instanceof LanguageFileType) {
|
||||
return SyntaxHighlighterFactory.getSyntaxHighlighter(((LanguageFileType)fileType).getLanguage(), project, file);
|
||||
}
|
||||
|
||||
+13
-6
@@ -35,14 +35,16 @@ import org.jetbrains.annotations.Nullable;
|
||||
public class EditorHighlighterFactoryImpl extends EditorHighlighterFactory {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.editor.highlighter.EditorHighlighterFactoryImpl");
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public EditorHighlighter createEditorHighlighter(SyntaxHighlighter highlighter, final EditorColorsScheme colors) {
|
||||
public EditorHighlighter createEditorHighlighter(SyntaxHighlighter highlighter, @NotNull final EditorColorsScheme colors) {
|
||||
if (highlighter == null) highlighter = new PlainSyntaxHighlighter();
|
||||
return new LexerEditorHighlighter(highlighter, colors);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public EditorHighlighter createEditorHighlighter(final FileType fileType, final EditorColorsScheme settings, final Project project) {
|
||||
public EditorHighlighter createEditorHighlighter(@NotNull final FileType fileType, @NotNull final EditorColorsScheme settings, final Project project) {
|
||||
if (fileType instanceof LanguageFileType) {
|
||||
return FileTypeEditorHighlighterProviders.INSTANCE.forFileType(fileType).getEditorHighlighter(project, fileType, null, settings);
|
||||
}
|
||||
@@ -51,11 +53,13 @@ public class EditorHighlighterFactoryImpl extends EditorHighlighterFactory {
|
||||
return createEditorHighlighter(highlighter, settings);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public EditorHighlighter createEditorHighlighter(final Project project, final FileType fileType) {
|
||||
public EditorHighlighter createEditorHighlighter(final Project project, @NotNull final FileType fileType) {
|
||||
return createEditorHighlighter(fileType, EditorColorsManager.getInstance().getGlobalScheme(), project);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public EditorHighlighter createEditorHighlighter(@NotNull VirtualFile vFile, @NotNull EditorColorsScheme settings, @Nullable Project project) {
|
||||
FileType fileType = vFile.getFileType();
|
||||
@@ -105,18 +109,21 @@ public class EditorHighlighterFactoryImpl extends EditorHighlighterFactory {
|
||||
return fileType;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public EditorHighlighter createEditorHighlighter(final Project project, final VirtualFile file) {
|
||||
public EditorHighlighter createEditorHighlighter(final Project project, @NotNull final VirtualFile file) {
|
||||
return createEditorHighlighter(file, EditorColorsManager.getInstance().getGlobalScheme(), project);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public EditorHighlighter createEditorHighlighter(final Project project, final String fileName) {
|
||||
public EditorHighlighter createEditorHighlighter(final Project project, @NotNull final String fileName) {
|
||||
return createEditorHighlighter(EditorColorsManager.getInstance().getGlobalScheme(), fileName, project);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public EditorHighlighter createEditorHighlighter(final EditorColorsScheme settings, final String fileName, @Nullable final Project project) {
|
||||
public EditorHighlighter createEditorHighlighter(@NotNull final EditorColorsScheme settings, @NotNull final String fileName, @Nullable final Project project) {
|
||||
return createEditorHighlighter(new LightVirtualFile(fileName), settings, project);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,9 +33,6 @@ import com.intellij.util.diff.DiffTree;
|
||||
import com.intellij.util.diff.DiffTreeChangeBuilder;
|
||||
import com.intellij.util.diff.FlyweightCapableTreeStructure;
|
||||
import com.intellij.util.diff.ShallowNodeComparator;
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -674,7 +671,7 @@ public class PsiBuilderQuickTest extends LightPlatformTestCase {
|
||||
private int myBufferEnd = 1;
|
||||
|
||||
@Override
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
myBuffer = buffer.subSequence(startOffset, endOffset);
|
||||
myIndex = 0;
|
||||
myBufferEnd = myBuffer.length();
|
||||
@@ -710,6 +707,7 @@ public class PsiBuilderQuickTest extends LightPlatformTestCase {
|
||||
if (myIndex < myBufferEnd) myIndex++;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CharSequence getBufferSequence() {
|
||||
return myBuffer;
|
||||
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.StringEscapesTokenTypes;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
|
||||
|
||||
@@ -41,7 +42,7 @@ public class GroovySlashyStringLexer extends LexerBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
if (buffer.length()<endOffset) {
|
||||
LogMessageEx.error(LOG, "buffer Length: " + buffer.length() + ", endOffset: " + endOffset, buffer.toString());
|
||||
}
|
||||
@@ -107,6 +108,7 @@ public class GroovySlashyStringLexer extends LexerBase {
|
||||
myTokenType = locateToken();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CharSequence getBufferSequence() {
|
||||
return myBuffer;
|
||||
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,6 +24,7 @@ import com.intellij.psi.TokenType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -87,7 +88,7 @@ public class GroovyDocLexer extends MergingLexerAdapter implements GroovyDocToke
|
||||
myFlexLexer = lexer;
|
||||
}
|
||||
|
||||
public final void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public final void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
myBuffer = buffer;
|
||||
myBufferIndex = startOffset;
|
||||
myBufferEndOffset = endOffset;
|
||||
@@ -100,6 +101,7 @@ public class GroovyDocLexer extends MergingLexerAdapter implements GroovyDocToke
|
||||
return myState;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public CharSequence getBufferSequence() {
|
||||
return myBuffer;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.impl.search.IndexPatternBuilder;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.lang.lexer.GroovyLexer;
|
||||
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
|
||||
import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
|
||||
@@ -30,14 +31,14 @@ import org.jetbrains.plugins.groovy.lang.psi.GroovyFile;
|
||||
* Date: 16.07.2008
|
||||
*/
|
||||
public class GroovyIndexPatternBuilder implements IndexPatternBuilder {
|
||||
public Lexer getIndexingLexer(PsiFile file) {
|
||||
public Lexer getIndexingLexer(@NotNull PsiFile file) {
|
||||
if (file instanceof GroovyFile) {
|
||||
return new GroovyLexer();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public TokenSet getCommentTokenSet(PsiFile file) {
|
||||
public TokenSet getCommentTokenSet(@NotNull PsiFile file) {
|
||||
return TokenSets.ALL_COMMENT_TOKENS;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.fileTypes.SyntaxHighlighter;
|
||||
import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.xml.XmlTokenType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class HtmlHighlightingLexer extends BaseHtmlLexer {
|
||||
@@ -96,7 +97,7 @@ public class HtmlHighlightingLexer extends BaseHtmlLexer {
|
||||
registerHandler(XmlTokenType.XML_COMMENT_CHARACTERS,value);
|
||||
}
|
||||
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
super.start(buffer, startOffset, endOffset, initialState);
|
||||
|
||||
if ((initialState & EMBEDDED_LEXER_ON)!=0) {
|
||||
|
||||
+3
-1
@@ -25,6 +25,7 @@ import com.intellij.util.text.CharArrayCharSequence;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import gnu.trove.TIntIntHashMap;
|
||||
import org.intellij.plugins.relaxNG.compact.RncTokenTypes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.kohsuke.rngom.parse.compact.*;
|
||||
|
||||
@@ -130,6 +131,7 @@ public class CompactSyntaxLexerAdapter extends LexerBase {
|
||||
return CharArrayUtil.fromSequence(myBuffer);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CharSequence getBufferSequence() {
|
||||
return myBuffer;
|
||||
@@ -173,7 +175,7 @@ public class CompactSyntaxLexerAdapter extends LexerBase {
|
||||
}
|
||||
|
||||
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
myBuffer = buffer;
|
||||
|
||||
final Reader reader = new CharSequenceReader(buffer, startOffset, endOffset);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,6 +26,7 @@ import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.psi.xml.XmlTokenType;
|
||||
import com.intellij.util.text.CharArrayUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -239,7 +240,7 @@ abstract class BaseHtmlLexer extends DelegateLexer {
|
||||
tokenHandlers.put(elementType,value);
|
||||
}
|
||||
|
||||
public void start(final CharSequence buffer, final int startOffset, final int endOffset, final int initialState) {
|
||||
public void start(@NotNull final CharSequence buffer, final int startOffset, final int endOffset, final int initialState) {
|
||||
initState(initialState);
|
||||
super.start(buffer, startOffset, endOffset, initialState & BASE_STATE_MASK);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.psi.TokenType;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.xml.XmlTokenType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Maxim.Mossienko
|
||||
@@ -51,7 +52,7 @@ public class HtmlLexer extends BaseHtmlLexer {
|
||||
private int myTokenEnd;
|
||||
|
||||
@Override
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
myTokenType = null;
|
||||
super.start(buffer, startOffset, endOffset, initialState);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,8 @@
|
||||
/* It's an automatically generated code. Do not modify it. */
|
||||
package com.intellij.lexer;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class _XmlLexer extends FlexAdapter {
|
||||
private int myState = __XmlLexer.YYINITIAL;
|
||||
|
||||
@@ -43,7 +45,7 @@ public class _XmlLexer extends FlexAdapter {
|
||||
packState();
|
||||
}
|
||||
|
||||
public void start(final CharSequence buffer, final int startOffset, final int endOffset, final int initialState) {
|
||||
public void start(@NotNull final CharSequence buffer, final int startOffset, final int endOffset, final int initialState) {
|
||||
super.start(buffer, startOffset, endOffset, initialState);
|
||||
handleState(initialState);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,6 +34,7 @@ import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.tree.TokenSet;
|
||||
import com.intellij.psi.xml.XmlElementType;
|
||||
import com.intellij.psi.xml.XmlEntityDecl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Mike
|
||||
@@ -65,7 +66,7 @@ public class DtdParsing extends XmlParsing implements XmlElementType {
|
||||
new DtdLexer(false) {
|
||||
final int myInitialState = getLexerInitialState(type, contextType);
|
||||
@Override
|
||||
public void start(CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) {
|
||||
super.start(buffer, startOffset, endOffset, myInitialState);
|
||||
}
|
||||
}, chars
|
||||
|
||||
Reference in New Issue
Block a user