Esempio n. 1
0
 public static int makestring(String a, Token b) {
   char[] temp = new char[a.length()];
   temp = a.toCharArray();
   int i = 1;
   if (temp[0] == '\'') {
     while (Character.isLetter(temp[i])
         || Character.isDigit(temp[i])
         || isoperator(temp[i])
         || ispunc(temp[i])
         || Character.isWhitespace(temp[i])) {
       i++;
       if (temp[i - 1] == '\'') {
         setToken(b, i - 2, a.substring(1, i - 1), LexToInt.string);
         return i;
       }
       if (i == a.length()) {
         break;
       }
     }
     if (temp[i - 1] == '\'') {
       setToken(b, i - 2, a.substring(1, i - 1), LexToInt.string);
       return i;
     }
   }
   return -1;
 }
Esempio n. 2
0
 public static int makespace(String a, Token b) {
   char[] temp = new char[a.length()];
   temp = a.toCharArray();
   int i = 0;
   if (a.isEmpty()) {
     setToken(b, a.length(), "\n", LexToInt.delete);
     return a.length();
   }
   if (Character.isWhitespace(temp[i])) {
     while (Character.isWhitespace(temp[i])) {
       i++;
       if (i == a.length()) {
         break;
       }
     }
     setToken(b, i, a.substring(0, i), LexToInt.delete);
     return i;
   }
   return -1;
 }