Class: Loxxy::FrontEnd::Literal

Inherits:
Rley::Lexical::Token
  • Object
show all
Defined in:
lib/loxxy/front_end/literal.rb

Overview

The superclass for all tokens that have a data value.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(aValue, aLexeme, aTerminal, aPosition) ⇒ Literal

Constructor.

Parameters:

  • aValue (Datatype::BuiltinDatatype)

    the Lox data value

  • aLexeme (String)

    the lexeme (= piece of text from input)

  • aTerminal (Rley::Syntax::Terminal, String)

    The terminal symbol corresponding to the lexeme.

  • aPosition (Rley::Lexical::Position)

    The position of lexeme in input text.



19
20
21
22
# File 'lib/loxxy/front_end/literal.rb', line 19

def initialize(aValue, aLexeme, aTerminal, aPosition)
  super(aLexeme, aTerminal, aPosition)
  @value = aValue
end

Instance Attribute Details

#valueDatatype (readonly)

Returns The value expressed in one of the Lox datatype.

Returns:

  • (Datatype)

    The value expressed in one of the Lox datatype.



10
11
12
# File 'lib/loxxy/front_end/literal.rb', line 10

def value
  @value
end