Class: Ibex::Frontend::Token

Inherits:
Struct
  • Object
show all
Defined in:
lib/ibex/frontend/source_cursor.rb,
lib/ibex/frontend/source_cursor.rb,
sig/ibex/frontend/source_cursor.rbs,
sig/ibex/frontend/source_cursor.rbs

Overview

A grammar token and its source coordinate.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#locationObject

Returns the value of attribute location

Returns:

  • (Object)

    the current value of location



26
27
28
# File 'lib/ibex/frontend/source_cursor.rb', line 26

def location
  @location
end

#spanObject

Returns the value of attribute span

Returns:

  • (Object)

    the current value of span



26
27
28
# File 'lib/ibex/frontend/source_cursor.rb', line 26

def span
  @span
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



26
27
28
# File 'lib/ibex/frontend/source_cursor.rb', line 26

def type
  @type
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



26
27
28
# File 'lib/ibex/frontend/source_cursor.rb', line 26

def value
  @value
end

Class Method Details

.new(type:, value:, location:, span:) ⇒ instance .new(arg0) ⇒ instance

Overloads:

  • .new(type:, value:, location:, span:) ⇒ instance

    Parameters:

    Returns:

    • (instance)
  • .new(arg0) ⇒ instance

    Parameters:

    Returns:

    • (instance)


35
36
# File 'sig/ibex/frontend/source_cursor.rbs', line 35

def self.new: (?type: Symbol, ?value: token_value, ?location: Location, ?span: SourceSpan?) -> instance
| ({ ?type: Symbol, ?value: token_value, ?location: Location, ?span: SourceSpan? }) -> instance

Instance Method Details

#to_hHash[Symbol, untyped]

RBS:

  • () -> Hash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])


36
37
38
# File 'lib/ibex/frontend/source_cursor.rb', line 36

def to_h
  { type: type, value: value, location: location.to_h }
end