rtext 0.11.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb4a1d69fdbd2a206533e794037b5ef402fe0211
4
- data.tar.gz: 605e53ea50a4af9adc9fa9dfef056d9f33700066
3
+ metadata.gz: 5faa974d72aeb5691970df505d698e80f0ea9a56
4
+ data.tar.gz: f9a3321097146cd6695457bb806c609fee79f308
5
5
  SHA512:
6
- metadata.gz: 8dcfad15c3d4de23ec459bb2ed7cb78791135a451f3968f43050cc588d23691139f5e5569cd7b9e9ee5eb96f5a676d1ae31143d5d62597fba448441c0e25d4a1
7
- data.tar.gz: 3ae19eeb2b28ad8bd1e1f1f2399b60b45bf6f6c73305ae0ef426b672d774cf98bcc73417902c6cb3d1dc6d8cfe08c37f4a78acea0356466c4cf0e06f10ef3be2
6
+ metadata.gz: 294b78983c8de3f0d5dea3df20b4259d2356a2fce258444d05cf0b8a83eab825abd8b0f05a257791b16040f3d7bd23b252d44c9122a2d734d94593052461b201
7
+ data.tar.gz: 10f507771eb3efe33214bbed1bf9e11c3030b0b8ee0b650c98fe037edaefa64a2bcbc82a3e11c6f2e2879f73128090d1a1256b47d4cd8b0584bd14fe81e52d2c
data/CHANGELOG CHANGED
@@ -122,3 +122,8 @@
122
122
  =0.11.0
123
123
 
124
124
  * Add support for Ruby up to 3.2
125
+
126
+ =0.11.1
127
+
128
+ * Fix column indixes to consistently start at 1
129
+ * Fix algorithm of context creation if inside comment/annotation
data/Project.yaml CHANGED
@@ -1,5 +1,5 @@
1
1
  name: rtext
2
- version: 0.11.0
2
+ version: 0.11.1
3
3
  git: https://github.com/mthiede/rtext.git
4
4
  summary: Ruby Textual Modelling
5
5
  email: martin dot thiede at gmx de
@@ -10,6 +10,9 @@ dependencies:
10
10
  http://rubygems.org:
11
11
  - {name: rgen, version: ['>= 0.10.0', '< 0.11']}
12
12
  - {name: filelock, version: ['>= 1.1.1', '< 1.2']}
13
+ - {name: rake, version: ['>= 13.0.0', '< 14.0'], development: true}
14
+ - {name: minitest, version: ['>= 5.20.0', '< 6.0'], development: true}
15
+ - {name: minitest-fail-fast, version: ['>= 0.1.0', '< 0.2'], development: true}
13
16
  rdoc_options: [--main, README.rdoc, -x, test]
14
17
  extra_rdoc_files: [README.rdoc, CHANGELOG, MIT-LICENSE, RText_Users_Guide, RText_Protocol]
15
18
  encrypt_sources: false
@@ -117,14 +117,15 @@ module ContextBuilder
117
117
  if context_lines.empty?
118
118
  context_lines << ""
119
119
  end
120
- position_in_line ||= context_lines.last.size
120
+ position_in_line ||= context_lines.last.size + 1
121
121
  # cut off last line right of cursor
122
- if position_in_line < 1
122
+ # raise "position_in_line starts at index 1!" if position_in_line == 0
123
+ if position_in_line <= 1
123
124
  tail = context_lines.pop
124
125
  context_lines << ""
125
126
  else
126
- tail = context_lines.last[position_in_line..-1]
127
- context_lines << context_lines.pop[0..position_in_line-1]
127
+ tail = context_lines.last[position_in_line-1..-1]
128
+ context_lines << context_lines.pop[0..position_in_line-2]
128
129
  end
129
130
  before_brace = !tail.nil? && !tail.match(/^\s*\{/).nil?
130
131
  before_bracket = !tail.nil? && !tail.match(/^\s*\[/).nil?
@@ -8,6 +8,7 @@ class Context
8
8
  # returns the extracted lines and the new position in the last line
9
9
  def extract(lines, pos)
10
10
  lines = filter_lines(lines)
11
+ return nil if lines.nil?
11
12
  lines, new_pos = join_lines(lines, pos)
12
13
  non_ignored_lines = 0
13
14
  array_nesting = 0
@@ -49,10 +50,16 @@ def extract(lines, pos)
49
50
  end
50
51
 
51
52
  def filter_lines(lines)
52
- lines.reject { |l|
53
- ls = l.strip
54
- ls[0..0] == "@" || ls[0..0] == "#"
55
- }
53
+ ret = []
54
+ lines.each_with_index do |line, i|
55
+ ls = line.strip
56
+ if ls.start_with?("@") || ls.start_with?("#")
57
+ return nil if i+1 == lines.length
58
+ else
59
+ ret << line
60
+ end
61
+ end
62
+ ret
56
63
  end
57
64
 
58
65
  # when joining two lines, all whitespace is preserved in order to simplify the algorithm
@@ -19,7 +19,7 @@ def detect(lines, column)
19
19
  # context model since the context builder removes it as "just being completed"
20
20
  lines.last.concat(" ")
21
21
  current_line = lines.last
22
- context = ContextBuilder.build_context(@lang, lines, lines.last.size)
22
+ context = ContextBuilder.build_context(@lang, lines, lines.last.size + 1)
23
23
  tokens = tokenize(lines.last, @lang.reference_regexp)
24
24
  token = tokens.find{|t| t.scol && t.scol <= column && t.ecol && t.ecol >= column}
25
25
  if context && context.element && token &&
@@ -29,7 +29,7 @@ def detect(lines, column)
29
29
  else
30
30
  line_prefix = ""
31
31
  end
32
- context2 = ContextBuilder.build_context(@lang, lines, line_prefix.size)
32
+ context2 = ContextBuilder.build_context(@lang, lines, line_prefix.size + 1)
33
33
  # for command prefixes nested below a lable, the context element and feature are
34
34
  # the parent element and feature, this is not what's expected here
35
35
  if line_prefix =~ /^\s*\w*$/
data/lib/rtext/service.rb CHANGED
@@ -188,7 +188,7 @@ class Service
188
188
 
189
189
  def content_complete(sock, request, response)
190
190
  # column numbers start at 1
191
- linepos = request["column"]-1
191
+ linepos = request["column"]
192
192
  lines = request["context"]
193
193
  version = request["version"].to_i
194
194
  lang = @service_provider.language
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Thiede
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-21 00:00:00.000000000 Z
11
+ date: 2023-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rgen
@@ -50,6 +50,66 @@ dependencies:
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
52
  version: '1.2'
53
+ - !ruby/object:Gem::Dependency
54
+ name: rake
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 13.0.0
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '14.0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 13.0.0
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: '14.0'
73
+ - !ruby/object:Gem::Dependency
74
+ name: minitest
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: 5.20.0
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: '6.0'
83
+ type: :development
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 5.20.0
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: '6.0'
93
+ - !ruby/object:Gem::Dependency
94
+ name: minitest-fail-fast
95
+ requirement: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: 0.1.0
100
+ - - "<"
101
+ - !ruby/object:Gem::Version
102
+ version: '0.2'
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: 0.1.0
110
+ - - "<"
111
+ - !ruby/object:Gem::Version
112
+ version: '0.2'
53
113
  description: RText can be used to derive textual languages from an RGen metamodel
54
114
  with very little effort.
55
115
  email: