Class: SyntaxTree::TStringEnd
Overview
TStringEnd represents the end of a string literal.
"string"
In the example above, TStringEnd represents the second set of quotes. Strings can also use single quotes. They can also be declared using the %q and %Q syntax, as in:
%q{string}
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
- String
-
the end of the string.
Attributes inherited from Node
Instance Method Summary collapse
- #===(other) ⇒ Object
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #copy(value: nil, location: nil) ⇒ Object
- #deconstruct_keys(_keys) ⇒ Object
-
#initialize(value:, location:) ⇒ TStringEnd
constructor
A new instance of TStringEnd.
Methods inherited from Node
#construct_keys, #end_char, #format, #pretty_print, #start_char, #to_json, #to_mermaid
Constructor Details
#initialize(value:, location:) ⇒ TStringEnd
Returns a new instance of TStringEnd.
11025 11026 11027 11028 |
# File 'lib/syntax_tree/node.rb', line 11025 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#value ⇒ Object (readonly)
- String
-
the end of the string
11023 11024 11025 |
# File 'lib/syntax_tree/node.rb', line 11023 def value @value end |
Instance Method Details
#===(other) ⇒ Object
11051 11052 11053 |
# File 'lib/syntax_tree/node.rb', line 11051 def ===(other) other.is_a?(TStringEnd) && value === other.value end |
#accept(visitor) ⇒ Object
11030 11031 11032 |
# File 'lib/syntax_tree/node.rb', line 11030 def accept(visitor) visitor.visit_tstring_end(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
11034 11035 11036 |
# File 'lib/syntax_tree/node.rb', line 11034 def child_nodes [] end |
#copy(value: nil, location: nil) ⇒ Object
11038 11039 11040 11041 11042 11043 |
# File 'lib/syntax_tree/node.rb', line 11038 def copy(value: nil, location: nil) TStringEnd.new( value: value || self.value, location: location || self.location ) end |
#deconstruct_keys(_keys) ⇒ Object
11047 11048 11049 |
# File 'lib/syntax_tree/node.rb', line 11047 def deconstruct_keys(_keys) { value: value, location: location } end |