antares 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/antares/structure.rb +9 -4
- data/lib/antares/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bc8ef85951928394e098f70eb7f193529561862db09ec04ea9911da83d7cb532
|
|
4
|
+
data.tar.gz: 6c7cfe7089d8b8f02152f95607d54c64c5272698e4715f894b7b0c725c3a289b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 85f58196e7c5c78f3589a8fdeb5082e44ba50ad81f2f795412c5dd0f8b5c139d181a686b9418f2c77dff7118d05aabf5c62108afd0dec986a101ae19f7acc036
|
|
7
|
+
data.tar.gz: bd7f8e25aaee6226972f9e0407e228b02610f17ae8a0c77ccf5805d281bce03acfb9d8b5fca02f0115af4494779444b4a479e4270b68ec4fd7c36539cb725913
|
data/CHANGELOG.md
CHANGED
data/lib/antares/structure.rb
CHANGED
|
@@ -104,7 +104,7 @@ module Antares
|
|
|
104
104
|
kind: :block, label: bracket.kind)
|
|
105
105
|
end
|
|
106
106
|
ranges << Region.new(start_line: line, end_line: line, start_column: 0,
|
|
107
|
-
end_column: @line_data.fetch(line).text
|
|
107
|
+
end_column: line_content(@line_data.fetch(line).text).length,
|
|
108
108
|
kind: :line, label: @line_data.fetch(line).label)
|
|
109
109
|
ranges.concat(context_at(line).reverse)
|
|
110
110
|
ranges.uniq { |region| [region.start_line, region.start_column, region.end_line, region.end_column] }
|
|
@@ -356,8 +356,9 @@ module Antares
|
|
|
356
356
|
unless value.strip.empty?
|
|
357
357
|
token_kind = @token_kinds[type] ||= classify_token(type.qualname)
|
|
358
358
|
kind = token_kind == :comment ? :comment : (token_kind == :string ? :string : :token)
|
|
359
|
-
|
|
360
|
-
|
|
359
|
+
content = line_content(value)
|
|
360
|
+
span_finish = column + content.length
|
|
361
|
+
span = [column, span_finish, kind, content] if span_finish > column
|
|
361
362
|
end
|
|
362
363
|
column = finish
|
|
363
364
|
span
|
|
@@ -389,10 +390,14 @@ module Antares
|
|
|
389
390
|
raise ArgumentError, "column must be a nonnegative integer" unless column.is_a?(Integer) && column >= 0
|
|
390
391
|
refresh(brackets: brackets, folds: folds)
|
|
391
392
|
text = @line_data.fetch(line).text
|
|
392
|
-
last = text
|
|
393
|
+
last = line_content(text).length
|
|
393
394
|
raise RangeError, "column outside line" if column > last
|
|
394
395
|
end
|
|
395
396
|
|
|
397
|
+
def line_content(text)
|
|
398
|
+
text.end_with?("\r\n") ? text.delete_suffix("\r\n") : text.delete_suffix("\n")
|
|
399
|
+
end
|
|
400
|
+
|
|
396
401
|
def validate_line(line)
|
|
397
402
|
raise RangeError, "line outside document" unless line.is_a?(Integer) && line >= 0 && line < line_count
|
|
398
403
|
end
|
data/lib/antares/version.rb
CHANGED