1 11 12 package org.eclipse.jface.text.rules; 13 14 15 import org.eclipse.core.runtime.Assert; 16 17 18 25 public class WhitespaceRule implements IRule { 26 27 28 protected IWhitespaceDetector fDetector; 29 30 37 public WhitespaceRule(IWhitespaceDetector detector) { 38 Assert.isNotNull(detector); 39 fDetector= detector; 40 } 41 42 45 public IToken evaluate(ICharacterScanner scanner) { 46 int c= scanner.read(); 47 if (fDetector.isWhitespace((char) c)) { 48 do { 49 c= scanner.read(); 50 } while (fDetector.isWhitespace((char) c)); 51 scanner.unread(); 52 return Token.WHITESPACE; 53 } 54 55 scanner.unread(); 56 return Token.UNDEFINED; 57 } 58 } 59 | Popular Tags |