Esempio n. 1
0
  private void fetchTokenInCCFor_x() {
    if (!left()) {
      return;
    }
    final int last = p;

    if (peekIs('{') && syntax.opEscXBraceHex8()) {
      inc();
      final int num = scanUnsignedHexadecimalNumber(8);
      if (num < 0) {
        throw new ValueException(ERR_TOO_BIG_WIDE_CHAR_VALUE);
      }
      if (left()) {
        final int c2 = peek();
        if (EncodingHelper.isXDigit(c2)) {
          throw new ValueException(ERR_TOO_LONG_WIDE_CHAR_VALUE);
        }
      }

      if (p > last + 1 && left() && peekIs('}')) {
        inc();
        token.type = TokenType.CODE_POINT;
        token.setCode(num);
      } else {
        /* can't read nothing or invalid format */
        p = last;
      }
    } else if (syntax.opEscXHex2()) {
      int num = scanUnsignedHexadecimalNumber(2);
      if (num < 0) {
        throw new ValueException(ERR_TOO_BIG_NUMBER);
      }
      if (p == last) {
          /* can't read nothing. */
        num = 0; /* but, it's not error */
      }
      token.type = TokenType.RAW_BYTE;
      token.setC(num);
    }
  }