Class: RemLint::Token

Inherits:
Struct
  • Object
show all
Defined in:
lib/remlint/expr_lexer.rb

Overview

One lexeme of a command's body, with where it sat.

offset is a character offset into the logical line's text, which LogicalLine#position_at turns into a file line and column. Tokens carry the offset rather than a line number because a continued command's tokens are spread over several lines and only the offset survives the join.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#offsetObject

Returns the value of attribute offset

Returns:

  • (Object)

    the current value of offset



12
13
14
# File 'lib/remlint/expr_lexer.rb', line 12

def offset
  @offset
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



12
13
14
# File 'lib/remlint/expr_lexer.rb', line 12

def type
  @type
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



12
13
14
# File 'lib/remlint/expr_lexer.rb', line 12

def value
  @value
end

Instance Method Details

#end_offsetObject



22
23
24
# File 'lib/remlint/expr_lexer.rb', line 22

def end_offset
  offset + length
end

#lengthObject



18
19
20
# File 'lib/remlint/expr_lexer.rb', line 18

def length
  value.length
end