src/parser/generated/regexp-tree.js
function Char(value, kind, loc) {
  let symbol;
  let codePoint;

  switch (kind) {
    case 'decimal': {
      codePoint = Number(value.slice(1));
      symbol = String.fromCodePoint(codePoint);
      break;
    }
    case 'oct': {
      codePoint = parseInt(value.slice(1), 8);
      symbol = String.fromCodePoint(codePoint);
      break;
    }
    case 'hex':
    case 'unicode': {
      if (value.lastIndexOf('\\u') > 0) {
        let [lead, trail] = value.split('\\u').slice(1);
        lead = parseInt(lead, 16);
        trail = parseInt(trail, 16);
        codePoint = (lead - 0xd800) * 0x400 + (trail - 0xdc00) + 0x10000;

        symbol = String.fromCodePoint(codePoint);
      } else {
        const hex = value.slice(2).replace('{', '');
        codePoint = parseInt(hex, 16);
        if (codePoint > 0x10ffff) {
          throw new SyntaxError(`Bad character escape sequence: ${value}`);
        }

        symbol = String.fromCodePoint(codePoint);
      }
      break;
    }
    case 'meta': {
      switch (value) {
        case '\\t':
          symbol = '\t';
          codePoint = symbol.codePointAt(0);
          break;
        case '\\n':
          symbol = '\n';
          codePoint = symbol.codePointAt(0);
          break;
        case '\\r':
          symbol = '\r';
          codePoint = symbol.codePointAt(0);
          break;
        case '\\v':
          symbol = '\v';
          codePoint = symbol.codePointAt(0);
          break;
        case '\\f':
          symbol = '\f';
          codePoint = symbol.codePointAt(0);
          break;
        case '\\b':
          symbol = '\b';
          codePoint = symbol.codePointAt(0);
        case '\\0':
          symbol = '\0';
          codePoint = 0;
        case '.':
          symbol = '.';
          codePoint = NaN;
          break;
        default:
          codePoint = NaN;
      }
      break;
    }
    case 'simple': {
      symbol = value;
      codePoint = symbol.codePointAt(0);
      break;
    }
  }

  return Node({
    type: 'Char',
    value,
    kind,
    symbol,
    codePoint,
  }, loc);
}
function Char(value, kind, loc) {
  let symbol;
  let codePoint;

  switch (kind) {
    case 'decimal': {
      codePoint = Number(value.slice(1));
      symbol = String.fromCodePoint(codePoint);
      break;
    }
    case 'oct': {
      codePoint = parseInt(value.slice(1), 8);
      symbol = String.fromCodePoint(codePoint);
      break;
    }
    case 'hex':
    case 'unicode': {
      if (value.lastIndexOf('\\u') > 0) {
        let [lead, trail] = value.split('\\u').slice(1);
        lead = parseInt(lead, 16);
        trail = parseInt(trail, 16);
        codePoint = (lead - 0xd800) * 0x400 + (trail - 0xdc00) + 0x10000;

        symbol = String.fromCodePoint(codePoint);
      } else {
        const hex = value.slice(2).replace('{', '');
        codePoint = parseInt(hex, 16);
        if (codePoint > 0x10ffff) {
          throw new SyntaxError(`Bad character escape sequence: ${value}`);
        }

        symbol = String.fromCodePoint(codePoint);
      }
      break;
    }
    case 'meta': {
      switch (value) {
        case '\\t':
          symbol = '\t';
          codePoint = symbol.codePointAt(0);
          break;
        case '\\n':
          symbol = '\n';
          codePoint = symbol.codePointAt(0);
          break;
        case '\\r':
          symbol = '\r';
          codePoint = symbol.codePointAt(0);
          break;
        case '\\v':
          symbol = '\v';
          codePoint = symbol.codePointAt(0);
          break;
        case '\\f':
          symbol = '\f';
          codePoint = symbol.codePointAt(0);
          break;
        case '\\b':
          symbol = '\b';
          codePoint = symbol.codePointAt(0);
        case '\\0':
          symbol = '\0';
          codePoint = 0;
        case '.':
          symbol = '.';
          codePoint = NaN;
          break;
        default:
          codePoint = NaN;
      }
      break;
    }
    case 'simple': {
      symbol = value;
      codePoint = symbol.codePointAt(0);
      break;
    }
  }

  return Node({
    type: 'Char',
    value,
    kind,
    symbol,
    codePoint,
  }, loc);
}
Creates a character node.