class Clangc::SourceRange

Identifies a half-open character range in the source code.

Use #start and #end to retrieve the starting and end locations from a source range, respectively.

Public Instance Methods

Clangc::SourceRange#end → clangc::SourceLocation click to toggle source

Retrieve a source location representing the last character within a source range.

VALUE
c_SourceRange_get_end(VALUE self)
{
    SourceRange_t *sr;
    SourceLocation_t *sl;
    VALUE a_source_location;
    Data_Get_Struct(self, SourceRange_t, sr);

    R_GET_CLASS_DATA("Clangc", SourceLocation, a_source_location, sl);
    sl->data = clang_getRangeEnd(sr->data);
    sl->parent = self;
    return a_source_location;
}
clangc::SourceRange#is_equal click to toggle source

Determine whether two ranges are equivalent. Returns true if the ranges are the same, false if they differ.

VALUE
c_SourceRange_is_equal(VALUE self, VALUE source_range)
{
    SourceRange_t *sr1;
    SourceRange_t *sr2;
    Data_Get_Struct(self, SourceRange_t, sr1);
    CHECK_ARG_TYPE(source_range, SourceRange);
    Data_Get_Struct(source_range, SourceRange_t, sr2);
    return NOT_0_2_RVAL(clang_equalRanges(sr1->data, sr2->data));
}
Clangc::SourceRange#is_null → true or false click to toggle source

Returns true is the underlying CXSourceRange is NULL or false otherwise

VALUE
c_SourceRange_is_null(VALUE self)
{
    SourceRange_t *s;
    Data_Get_Struct(self, SourceRange_t, s);
    return NOT_0_2_RVAL(clang_Range_isNull(s->data));
}
Clangc::SourceRange#start → clangc::SourceLocation click to toggle source

Retrieve a source location representing the first character within a source range.

VALUE
c_SourceRange_get_start(VALUE self)
{
    SourceRange_t *sr;
    SourceLocation_t *sl;
    VALUE a_source_location;
    Data_Get_Struct(self, SourceRange_t, sr);

    R_GET_CLASS_DATA("Clangc", SourceLocation, a_source_location, sl);
    sl->data = clang_getRangeStart(sr->data);
    sl->parent = self;
    return a_source_location;
}