1 19 20 package org.netbeans.lib.lexer.batch; 21 22 import java.util.Set ; 23 import org.netbeans.api.lexer.LanguagePath; 24 import org.netbeans.lib.lexer.EmbeddingContainer; 25 import org.netbeans.lib.lexer.TokenList; 26 import org.netbeans.api.lexer.InputAttributes; 27 import org.netbeans.api.lexer.TokenId; 28 import org.netbeans.lib.lexer.TokenHierarchyOperation; 29 import org.netbeans.lib.lexer.token.AbstractToken; 30 31 45 46 public final class SkimTokenList<T extends TokenId> implements TokenList<T> { 47 48 private CopyTextTokenList<T> tokenList; 49 50 private int startOffset; 51 52 private char[] text; 53 54 55 public SkimTokenList(CopyTextTokenList<T> tokenList, int startOffset, char[] text) { 56 this.tokenList = tokenList; 57 this.startOffset = startOffset; 58 this.text = text; 59 } 60 61 public CopyTextTokenList<T> getTokenList() { 62 return tokenList; 63 } 64 65 public int getStartOffset() { 66 return startOffset; 67 } 68 69 char[] getText() { 70 return text; 71 } 72 73 void setText(char[] text) { 74 this.text = text; 75 } 76 77 public int childTokenOffset(int rawOffset) { 78 int offsetShift = (rawOffset >> 16); 79 return startOffset + (rawOffset & 0xFFFF) + offsetShift; 80 } 81 82 public char childTokenCharAt(int rawOffset, int index) { 83 return text[((rawOffset + index) & 0xFFFF)]; 84 } 85 86 public int modCount() { 87 return 0; 88 } 89 90 public Object tokenOrEmbeddingContainer(int index) { 91 return tokenList.tokenOrEmbeddingContainer(index); 92 } 93 94 public AbstractToken<T> replaceFlyToken( 95 int index, AbstractToken<T> flyToken, int offset) { 96 return tokenList.replaceFlyToken(index, flyToken, offset); 97 } 98 99 100 public int lookahead(int index) { 101 return tokenList.lookahead(index); 102 } 103 104 public Object state(int index) { 105 return tokenList.state(index); 106 } 107 108 public int tokenOffset(int index) { 109 return tokenList.tokenOffset(index); 110 } 111 112 public int tokenCount() { 113 return tokenList.tokenCount(); 114 } 115 116 public int tokenCountCurrent() { 117 return tokenList.tokenCountCurrent(); 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 LanguagePath languagePath() { 129 return tokenList.languagePath(); 130 } 131 132 public void wrapToken(int index, EmbeddingContainer embeddingContainer) { 133 tokenList.wrapToken(index, embeddingContainer); 134 } 135 136 public InputAttributes inputAttributes() { 137 return tokenList.inputAttributes(); 138 } 139 140 public boolean isContinuous() { 141 return tokenList.isContinuous(); 142 } 143 144 public Set <T> skipTokenIds() { 145 return tokenList.skipTokenIds(); 146 } 147 148 } 149 | Popular Tags |