Beispiel #1
0
 private void escapeChar() {
   nextChar();
   switch (c) {
     case 34: // '"'
     case 39: // '\''
     case 92: // '\\'
     case 98: // 'b'
     case 102: // 'f'
     case 110: // 'n'
     case 114: // 'r'
     case 116: // 't'
       lastLiteral = c;
       nextChar();
       return;
   }
   int i = Character.digit((char) c, 8);
   if (i >= 0) {
     lastLiteral = 0;
     int j = i >= 4 ? 2 : 3;
     do {
       lastLiteral = (lastLiteral << 3) + i;
       nextChar();
       i = Character.digit((char) c, 8);
     } while (i >= 0 && --j > 0);
     return;
   } else {
     report(new Failure(getPos(), "Syntax error in escape sequence"));
     return;
   }
 }
Beispiel #2
0
 private int number() {
   int i = col;
   int j = 0;
   int k = Character.digit((char) c, 10);
   do {
     j = 10 * j + k;
     nextChar();
     k = Character.digit((char) c, 10);
   } while (k >= 0);
   lexemeText = line.substring(i, col);
   lastLiteral = j;
   return token = 6;
 }