Class: Rlex::Token

Inherits:
Struct
  • Object
show all
Defined in:
lib/rlex/token.rb

Overview

Simple class to represent tokens matched from the input.

Author:

Instance Attribute Summary collapse

Instance Attribute Details

#colInteger (readonly)

Column position of the matched text

Returns:

  • (Integer)

    the current value of col



12
13
14
# File 'lib/rlex/token.rb', line 12

def col
  @col
end

#lineInteger (readonly)

Line number of the matched text

Returns:

  • (Integer)

    the current value of line



12
13
14
# File 'lib/rlex/token.rb', line 12

def line
  @line
end

#typeSymbol (readonly)

Type of the token, such as the name of the rule used to match it

Returns:

  • (Symbol)

    the current value of type



12
13
14
# File 'lib/rlex/token.rb', line 12

def type
  @type
end

#valueString (readonly)

Text matched from the input

Returns:

  • (String)

    the current value of value



12
13
14
# File 'lib/rlex/token.rb', line 12

def value
  @value
end