From 6562bdc1b4f3b70d4aec7a5759300dc56e007267 Mon Sep 17 00:00:00 2001 From: ydah <13041216+ydah@users.noreply.github.com> Date: Mon, 25 Dec 2023 16:24:38 +0900 Subject: [PATCH] carrets->carets https://github.com/codespell-project/codespell/pull/3263 --- lib/lrama/lexer/location.rb | 8 ++++---- sig/lrama/lexer/location.rbs | 4 ++-- spec/lrama/lexer/location_spec.rb | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/lrama/lexer/location.rb b/lib/lrama/lexer/location.rb index 7cf66282..aefce3e1 100644 --- a/lib/lrama/lexer/location.rb +++ b/lib/lrama/lexer/location.rb @@ -57,14 +57,14 @@ def to_s def generate_error_message(error_message) <<~ERROR.chomp #{path}:#{first_line}:#{first_column}: #{error_message} - #{line_with_carrets} + #{line_with_carets} ERROR end - def line_with_carrets + def line_with_carets <<~TEXT #{text} - #{carrets} + #{carets} TEXT end @@ -78,7 +78,7 @@ def blanks (text[0...first_column] or raise "#{first_column} is invalid").gsub(/[^\t]/, ' ') end - def carrets + def carets blanks + '^' * (last_column - first_column) end diff --git a/sig/lrama/lexer/location.rbs b/sig/lrama/lexer/location.rbs index 82d14b66..cb5dfcfd 100644 --- a/sig/lrama/lexer/location.rbs +++ b/sig/lrama/lexer/location.rbs @@ -12,13 +12,13 @@ module Lrama def ==: (Location other) -> bool def partial_location: (Integer, Integer) -> Location def generate_error_message: (String) -> String - def line_with_carrets: () -> String + def line_with_carets: () -> String private def path: () -> String def blanks: () -> String - def carrets: () -> String + def carets: () -> String def text: () -> String def _text: () -> Array[String] end diff --git a/spec/lrama/lexer/location_spec.rb b/spec/lrama/lexer/location_spec.rb index 2c932c2e..149f8602 100644 --- a/spec/lrama/lexer/location_spec.rb +++ b/spec/lrama/lexer/location_spec.rb @@ -32,8 +32,8 @@ end end - describe "#line_with_carrets" do - it "returns line text with carrets" do + describe "#line_with_carets" do + it "returns line text with carets" do path = fixture_path("lexer/location.y") grammar_file = Lrama::Lexer::GrammarFile.new(path, File.read(path)) location = Lrama::Lexer::Location.new(grammar_file: grammar_file, first_line: 33, first_column: 12, last_line: 33, last_column: 15) @@ -42,7 +42,7 @@ ^^^ TEXT - expect(location.line_with_carrets).to eq expected + expect(location.line_with_carets).to eq expected end end end