summaryrefslogtreecommitdiff
path: root/lib/prism/parse_result.rb
diff options
context:
space:
mode:
authorKevin Newton <[email protected]>2024-05-02 11:12:43 -0400
committergit <[email protected]>2024-05-02 15:27:18 +0000
commit7c0cf71049e82f165ab847e50a358d3659c547bb ()
tree0d6c9f9a07e24603b27d5b51a92c8534853566c7 /lib/prism/parse_result.rb
parent398453c3c0a1e516fda342a9dbdb27f7ed981de2 (diff)
[ruby/prism] Node#script_lines and supporting infra
https://.com/ruby/prism/commit/cb4a8ab772
-rw-r--r--lib/prism/parse_result.rb10
1 files changed, 10 insertions, 0 deletions
@@ -27,6 +27,11 @@ module Prism
source.encoding
end
# Perform a byteslice on the source code using the given byte offset and
# byte length.
def slice(byte_offset, length)
@@ -177,6 +182,11 @@ module Prism
"#<Prism::Location @start_offset=#{@start_offset} @length=#{@length} start_line=#{start_line}>"
end
# The source code that this location represents.
def slice
source.slice(start_offset, length)