1 package freemarker.eclipse.test.util; 2 3 import org.eclipse.jface.text.rules.ICharacterScanner; 4 5 14 public class MockCharacterScanner implements ICharacterScanner { 15 16 private int pos = 0; 17 private String text = ""; 18 19 public MockCharacterScanner(String text) { 20 this.text = text; 21 } 22 23 public int getColumn() { 24 throw new UnsupportedOperationException (); 25 } 26 27 public char[][] getLegalLineDelimiters() { 28 return new char[][] { "\n".toCharArray()}; 29 } 30 31 public int read() { 32 return text.charAt(pos++); 33 } 34 35 public void unread() { 36 pos--; 37 } 38 39 public int getPos() { 40 return pos; 41 } 42 } | Popular Tags |