class SyntaxTree::CHAR
can use control characters with this as well, as in ?C-a.
In the example above, the CHAR node represents the string literal “a”. You
?a
CHAR irepresents a single codepoint in the script encoding.
def ===(other)
def ===(other) other.is_a?(CHAR) && value === other.value end
def accept(visitor)
def accept(visitor) visitor.visit_CHAR(self) end
def child_nodes
def child_nodes [] end
def copy(value: nil, location: nil)
def copy(value: nil, location: nil) node = CHAR.new( value: value || self.value, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node end
def deconstruct_keys(_keys)
def deconstruct_keys(_keys) { value: value, location: location, comments: comments } end
def format(q)
def format(q) if value.length != 2 q.text(value) else q.text(q.quote) q.text(value[1] == "\"" ? "\\\"" : value[1]) q.text(q.quote) end end
def initialize(value:, location:)
def initialize(value:, location:) @value = value @location = location @comments = [] end