Class: FFI::Clang::Token
- Inherits:
-
Object
- Object
- FFI::Clang::Token
- Defined in:
- lib/ffi/clang/token.rb
Overview
Represents a single token in the source code.
Instance Method Summary collapse
-
#extent ⇒ Object
Get the extent (source range) of this token.
-
#initialize(token, translation_unit) ⇒ Token
constructor
Initialize a token.
-
#kind ⇒ Object
Get the kind of this token.
-
#location ⇒ Object
Get the location of this token.
-
#spelling ⇒ Object
Get the spelling (text) of this token.
Constructor Details
#initialize(token, translation_unit) ⇒ Token
Initialize a token.
76 77 78 79 |
# File 'lib/ffi/clang/token.rb', line 76 def initialize(token, translation_unit) @token = token @translation_unit = translation_unit end |
Instance Method Details
#extent ⇒ Object
Get the extent (source range) of this token.
101 102 103 |
# File 'lib/ffi/clang/token.rb', line 101 def extent SourceRange.new Lib.get_token_extent(@translation_unit, @token) end |
#kind ⇒ Object
Get the kind of this token.
83 84 85 |
# File 'lib/ffi/clang/token.rb', line 83 def kind Lib.get_token_kind(@token) end |
#location ⇒ Object
Get the location of this token.
95 96 97 |
# File 'lib/ffi/clang/token.rb', line 95 def location ExpansionLocation.new Lib.get_token_location(@translation_unit, @token) end |
#spelling ⇒ Object
Get the spelling (text) of this token.
89 90 91 |
# File 'lib/ffi/clang/token.rb', line 89 def spelling Lib.extract_string Lib.get_token_spelliing(@translation_unit, @token) end |