1 19 20 package org.netbeans.lib.lexer.inc; 21 22 import java.util.Set ; 23 import org.netbeans.api.lexer.InputAttributes; 24 import org.netbeans.api.lexer.LanguagePath; 25 import org.netbeans.api.lexer.TokenId; 26 import org.netbeans.lib.lexer.EmbeddingContainer; 27 import org.netbeans.lib.lexer.TokenHierarchyOperation; 28 import org.netbeans.lib.lexer.TokenList; 29 import org.netbeans.lib.lexer.token.AbstractToken; 30 31 55 56 public final class FilterSnapshotTokenList<T extends TokenId> implements TokenList<T> { 57 58 59 private TokenList<T> tokenList; 60 61 65 private int tokenOffsetDiff; 66 67 public FilterSnapshotTokenList(TokenList<T> tokenList, int tokenOffsetDiff) { 68 this.tokenList = tokenList; 69 this.tokenOffsetDiff = tokenOffsetDiff; 70 } 71 72 public TokenList delegate() { 73 return tokenList; 74 } 75 76 public int tokenOffsetDiff() { 77 return tokenOffsetDiff; 78 } 79 80 public Object tokenOrEmbeddingContainer(int index) { 81 return tokenList.tokenOrEmbeddingContainer(index); 82 } 83 84 public AbstractToken<T> replaceFlyToken(int index, AbstractToken<T> flyToken, int offset) { 85 return tokenList.replaceFlyToken(index, flyToken, offset); 86 } 87 88 public int tokenOffset(int index) { 89 return tokenOffsetDiff + tokenList.tokenOffset(index); 90 } 91 92 public int modCount() { 93 return -1; 94 } 95 96 public int tokenCount() { 97 return tokenList.tokenCount(); 98 } 99 100 public int tokenCountCurrent() { 101 return tokenList.tokenCountCurrent(); 102 } 103 104 public LanguagePath languagePath() { 105 return tokenList.languagePath(); 106 } 107 108 public int childTokenOffset(int rawOffset) { 109 throw new IllegalStateException ("Unexpected call."); 110 } 111 112 public char childTokenCharAt(int rawOffset, int index) { 113 throw new IllegalStateException ("Unexpected call."); 114 } 115 116 public void wrapToken(int index, EmbeddingContainer<T> embeddingContainer) { 117 tokenList.wrapToken(index, embeddingContainer); 118 } 119 120 public TokenList<? extends TokenId> root() { 121 return tokenList.root(); 122 } 123 124 public TokenHierarchyOperation<?,? extends TokenId> tokenHierarchyOperation() { 125 return tokenList.tokenHierarchyOperation(); 126 } 127 128 public InputAttributes inputAttributes() { 129 return tokenList.inputAttributes(); 130 } 131 132 public int lookahead(int index) { 133 return tokenList.lookahead(index); 135 } 136 137 public Object state(int index) { 138 return tokenList.state(index); 139 } 140 141 public boolean isContinuous() { 142 return tokenList.isContinuous(); 143 } 144 145 public Set <T> skipTokenIds() { 146 return tokenList.skipTokenIds(); 147 } 148 149 } | Popular Tags |