1 19 20 package org.netbeans.lib.lexer.token; 21 22 import org.netbeans.api.lexer.TokenId; 23 import org.netbeans.lib.lexer.CharPreprocessorError; 24 import org.netbeans.lib.lexer.PreprocessedTextStorage; 25 26 37 38 public class PreprocessedTextToken<T extends TokenId> extends DefaultToken<T> { 39 40 private PreprocessedTextStorage prepTextStorage; 42 private CharPreprocessorError prepError; 44 public PreprocessedTextToken(T id, int length) { 45 super(id, length); 46 } 47 48 public void initPrep(PreprocessedTextStorage prepTextStorage, CharPreprocessorError prepError) { 49 this.prepTextStorage = prepTextStorage; 50 this.prepError = prepError; 51 } 52 53 @Override 54 public synchronized CharSequence preprocessedText() { 55 return prepTextStorage; 56 } 57 58 @Override 59 public synchronized boolean isPreprocessedText() { 60 return (prepTextStorage != null); 61 } 62 63 @Override 64 public String preprocessError() { 65 return (prepError != null) ? prepError.message() : null; 66 } 67 68 @Override 69 public int preprocessErrorIndex() { 70 return (prepError != null) ? prepError.index() : -1; 71 } 72 73 @Override 74 protected String dumpInfoTokenType() { 75 return "PreT"; } 77 78 } 79 80 | Popular Tags |