Class: Rley::Lexical::Literal
- Defined in:
- lib/rley/lexical/literal.rb
Overview
A literal (value) is a token that represents a data value in the parsed language. For instance, in Ruby data values such as strings, numbers, regular expression,... can appear directly in the source code. These are examples of literal values. One responsibility of a tokenizer/lexer is to convert the text representation into a corresponding value in a convenient format for the interpreter/compiler.
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
The value expressed in one of the target datatype.
Attributes inherited from Token
Instance Method Summary collapse
-
#initialize(aValue, theLexeme, aTerminal, aPosition = nil) ⇒ Literal
constructor
Constructor.
Constructor Details
#initialize(aValue, theLexeme, aTerminal, aPosition = nil) ⇒ Literal
Constructor.
22 23 24 25 |
# File 'lib/rley/lexical/literal.rb', line 22 def initialize(aValue, theLexeme, aTerminal, aPosition = nil) super(theLexeme, aTerminal, aPosition) @value = aValue end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns The value expressed in one of the target datatype.
15 16 17 |
# File 'lib/rley/lexical/literal.rb', line 15 def value @value end |