Sha256: c568e9f721ae320515ec355ece331fb0dd243beb6e8b5b77655330bde077ba14
Contents?: true
Size: 1.11 KB
Versions: 8
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true require_relative 'token' module Dendroid module Lexical # 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 as text. # 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. class Literal < Token # @return [Object] The value expressed in one of the target datatype. attr_reader :value # Constructor. # @param original [String] the piece of text from input # @param pos [Dendroid::Lexical::TokenPosition] line, column position of token # @param symbol [Dendroid::Syntax::Terminal, String] # @param aValue [Object] value of the token in internal representation def initialize(original, pos, symbol, aValue) super(original, pos, symbol) @value = aValue end end # class end # module end # module
Version data entries
8 entries across 8 versions & 1 rubygems