Class: Rley::Syntax::VerbatimSymbol

Inherits:
Terminal show all
Defined in:
lib/rley/syntax/verbatim_symbol.rb

Overview

A verbatim word is terminal symbol that represents one unique word in the language defined the grammar.

Instance Attribute Summary collapse

Attributes inherited from GrmSymbol

#generative, #name

Instance Method Summary collapse

Methods inherited from Terminal

#nullable?, #terminal?

Methods inherited from GrmSymbol

#generative?, #terminal?

Constructor Details

#initialize(aText) ⇒ VerbatimSymbol

Returns a new instance of VerbatimSymbol.



13
14
15
16
# File 'lib/rley/syntax/verbatim_symbol.rb', line 13

def initialize(aText)
  super(aText) # Do we need to separate the text from the name?
  @text = aText.dup
end

Instance Attribute Details

#textObject (readonly)

The exact text representation of the word.



11
12
13
# File 'lib/rley/syntax/verbatim_symbol.rb', line 11

def text
  @text
end

Instance Method Details

#to_sString

The String representation of the verbatim symbol

Returns:

  • (String)


20
21
22
# File 'lib/rley/syntax/verbatim_symbol.rb', line 20

def to_s()
  return "'#{text}'"
end