예제 #1
0
void ASTContext::InitBuiltinTypes() {
  // [R404]
  VoidTy = QualType(new (*this, TypeAlignment) VoidType(), 0);

  auto Opts = getLangOpts();
  auto ByteKind = Type::Int1;
  auto IntKind = Opts.DefaultInt8? Type::Int8 : Type::Int4;
  auto RealKind = Opts.DefaultReal8? Type::Real8 : Type::Real4;
  auto DblKind = Type::Real8;
  if(Opts.DefaultReal8 && !Opts.DefaultDouble8)
    DblKind = Type::Real16;

  IntegerTy = QualType(getBuiltinType(BuiltinType::Integer, IntKind), 0);

  RealTy = QualType(getBuiltinType(BuiltinType::Real, RealKind), 0);
  DoublePrecisionTy = QualType(getBuiltinType(BuiltinType::Real, DblKind,
                                              false, true), 0);

  ComplexTy = QualType(getBuiltinType(BuiltinType::Complex, RealKind), 0);
  DoubleComplexTy = QualType(getBuiltinType(BuiltinType::Complex, DblKind,
                                            false, true), 0);

  LogicalTy = QualType(getBuiltinType(BuiltinType::Logical, IntKind), 0);
  ByteTy = QualType(getBuiltinType(BuiltinType::Logical, ByteKind,
                                   false, false, true), 0);

  CharacterTy = QualType(getCharacterType(1), 0);
  NoLengthCharacterTy = QualType(getCharacterType(0), 0);
}
예제 #2
0
CodeDocument::Position CodeDocument::findWordBreakBefore (const Position& position) const noexcept
{
    auto p = position;
    const int maxDistance = 256;
    int i = 0;
    bool stoppedAtLineStart = false;

    while (i < maxDistance)
    {
        auto c = p.movedBy (-1).getCharacter();

        if (c == '\r' || c == '\n')
        {
            stoppedAtLineStart = true;

            if (i > 0)
                break;
        }

        if (! CharacterFunctions::isWhitespace (c))
            break;

        p.moveBy (-1);
        ++i;
    }

    if (i < maxDistance && ! stoppedAtLineStart)
    {
        auto type = getCharacterType (p.movedBy (-1).getCharacter());

        while (i < maxDistance && type == getCharacterType (p.movedBy (-1).getCharacter()))
        {
            p.moveBy (-1);
            ++i;
        }
    }

    return p;
}
예제 #3
0
CodeDocument::Position CodeDocument::findWordBreakAfter (const Position& position) const noexcept
{
    auto p = position;
    const int maxDistance = 256;
    int i = 0;

    while (i < maxDistance
            && CharacterFunctions::isWhitespace (p.getCharacter())
            && (i == 0 || (p.getCharacter() != '\n'
                            && p.getCharacter() != '\r')))
    {
        ++i;
        p.moveBy (1);
    }

    if (i == 0)
    {
        auto type = getCharacterType (p.getCharacter());

        while (i < maxDistance && type == getCharacterType (p.getCharacter()))
        {
            ++i;
            p.moveBy (1);
        }

        while (i < maxDistance
                && CharacterFunctions::isWhitespace (p.getCharacter())
                && (i == 0 || (p.getCharacter() != '\n'
                                && p.getCharacter() != '\r')))
        {
            ++i;
            p.moveBy (1);
        }
    }

    return p;
}