Пример #1
0
 public int[] checkTokenAt(int index) {
   if (index == text.length()) index--;
   StringTokenizer textScanner = new StringTokenizer(text);
   String token = textScanner.getTokenAt(index);
   int[] results = new int[3];
   results[0] = dict.checkFor(token.toUpperCase()) ? 1 : 0;
   results[1] = textScanner.getIndex() - token.length();
   results[2] = token.length();
   return results;
 }
Пример #2
0
 public Vector<int[]> highlightSyntax() {
   Vector<int[]> points = new Vector<int[]>();
   StringTokenizer textScanner = new StringTokenizer(text);
   String temp = "";
   while (textScanner.hasNext()) {
     String current = textScanner.next();
     if (dict.checkFor(current.toUpperCase())) {
       temp += current;
       int[] p = new int[3];
       p[0] = 1;
       p[1] = textScanner.getIndex() - current.length();
       p[2] = current.length();
       points.add(p);
     }
   }
   return points;
 }