Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/prism/util/pm_newline_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ typedef struct {
/** The line number. */
int32_t line;

/** The column number. */
/** The column in bytes. */
uint32_t column;
} pm_line_column_t;

Expand Down
20 changes: 10 additions & 10 deletions lib/prism/parse_result.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def line_end(byte_offset)
offsets[find_line(byte_offset) + 1] || source.bytesize
end

# Return the column number for the given byte offset.
# Return the column in bytes for the given byte offset.
def column(byte_offset)
byte_offset - line_start(byte_offset)
end
Expand All @@ -113,7 +113,7 @@ def character_offset(byte_offset)
(source.byteslice(0, byte_offset) or raise).length
end

# Return the column number in characters for the given byte offset.
# Return the column in characters for the given byte offset.
def character_column(byte_offset)
character_offset(byte_offset) - character_offset(line_start(byte_offset))
end
Expand Down Expand Up @@ -146,7 +146,7 @@ def code_units_cache(encoding)
CodeUnitsCache.new(source, encoding)
end

# Returns the column number in code units for the given encoding for the
# Returns the column in code units for the given encoding for the
# given byte offset.
def code_units_column(byte_offset, encoding)
code_units_offset(byte_offset, encoding) - code_units_offset(line_start(byte_offset), encoding)
Expand Down Expand Up @@ -253,7 +253,7 @@ def character_offset(byte_offset)
byte_offset
end

# Return the column number in characters for the given byte offset.
# Return the column in characters for the given byte offset.
def character_column(byte_offset)
byte_offset - line_start(byte_offset)
end
Expand Down Expand Up @@ -428,19 +428,19 @@ def end_line
source.line(end_offset)
end

# The column number in bytes where this location starts from the start of
# The column in bytes where this location starts from the start of
# the line.
def start_column
source.column(start_offset)
end

# The column number in characters where this location ends from the start of
# The column in characters where this location ends from the start of
# the line.
def start_character_column
source.character_column(start_offset)
end

# The column number in code units of the given encoding where this location
# The column in code units of the given encoding where this location
# starts from the start of the line.
def start_code_units_column(encoding = Encoding::UTF_16LE)
source.code_units_column(start_offset, encoding)
Expand All @@ -452,19 +452,19 @@ def cached_start_code_units_column(cache)
cache[start_offset] - cache[source.line_start(start_offset)]
end

# The column number in bytes where this location ends from the start of the
# The column in bytes where this location ends from the start of the
# line.
def end_column
source.column(end_offset)
end

# The column number in characters where this location ends from the start of
# The column in characters where this location ends from the start of
# the line.
def end_character_column
source.character_column(end_offset)
end

# The column number in code units of the given encoding where this location
# The column in code units of the given encoding where this location
# ends from the start of the line.
def end_code_units_column(encoding = Encoding::UTF_16LE)
source.code_units_column(end_offset, encoding)
Expand Down
2 changes: 1 addition & 1 deletion lib/prism/translation/ripper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def self.lex_state_name(state)
# The current line number of the parser.
attr_reader :lineno

# The current column number of the parser.
# The current column in bytes of the parser.
attr_reader :column

# Create a new Translation::Ripper object with the given source.
Expand Down
2 changes: 1 addition & 1 deletion templates/lib/prism/dot_visitor.rb.erb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ module Prism
"Node_#{node.object_id}"
end

# Inspect a location to display the start and end line and column numbers.
# Inspect a location to display the start and end line and columns in bytes.
def location_inspect(location)
"(#{location.start_line},#{location.start_column})-(#{location.end_line},#{location.end_column})"
end
Expand Down