lib-ruby-parser (C++ bindings)
4.0.1+ruby-3.1.1
C++ bindings for lib-ruby-parser library
|
Represents a plain non-interpolated string literal (e.g. "foo"
)
More...
#include <nodes.hpp>
Public Attributes | |
Bytes | value |
MaybeLoc | begin_l |
MaybeLoc | end_l |
Loc | expression_l |
Represents a plain non-interpolated string literal (e.g. "foo"
)
MaybeLoc lib_ruby_parser::Str::begin_l |
Location of the string begin
None
if string literal is a part of the words array (like w[foo bar baz]
)
MaybeLoc lib_ruby_parser::Str::end_l |
Location of the string begin
None
if string literal is a part of the words array (like w[foo bar baz]
)
Loc lib_ruby_parser::Str::expression_l |
Location of the full expression
Bytes lib_ruby_parser::Str::value |
Value of the string literal
Note that it's a StringValue
, not a String
. The reason is that you can get UTF-8 incompatible strings from a valid UTF-8 source using escape sequences like "\xFF"
These "\", "x", "F", "F" chars are valid separately, but together they construct a char with code = 255 that is invalid for UTF-8.
You can use to_string_lossy
or to_string
methods to get a raw string value.