rtext 0.10.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +10 -1
- data/Project.yaml +5 -2
- data/lib/rtext/context_builder.rb +5 -4
- data/lib/rtext/frontend/connector.rb +6 -1
- data/lib/rtext/frontend/context.rb +11 -4
- data/lib/rtext/instantiator.rb +6 -6
- data/lib/rtext/link_detector.rb +2 -2
- data/lib/rtext/service.rb +1 -1
- metadata +66 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5faa974d72aeb5691970df505d698e80f0ea9a56
|
4
|
+
data.tar.gz: f9a3321097146cd6695457bb806c609fee79f308
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 294b78983c8de3f0d5dea3df20b4259d2356a2fce258444d05cf0b8a83eab825abd8b0f05a257791b16040f3d7bd23b252d44c9122a2d734d94593052461b201
|
7
|
+
data.tar.gz: 10f507771eb3efe33214bbed1bf9e11c3030b0b8ee0b650c98fe037edaefa64a2bcbc82a3e11c6f2e2879f73128090d1a1256b47d4cd8b0584bd14fe81e52d2c
|
data/CHANGELOG
CHANGED
@@ -117,4 +117,13 @@
|
|
117
117
|
|
118
118
|
=0.10.0
|
119
119
|
|
120
|
-
* Switch to Ruby 2.7
|
120
|
+
* Switch to Ruby 2.7
|
121
|
+
|
122
|
+
=0.11.0
|
123
|
+
|
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.
|
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
|
@@ -8,8 +8,11 @@ description: RText can be used to derive textual languages from an RGen metamode
|
|
8
8
|
authors: [Martin Thiede]
|
9
9
|
dependencies:
|
10
10
|
http://rubygems.org:
|
11
|
-
- {name: rgen, version: ['>= 0.
|
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
|
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-
|
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?
|
@@ -120,7 +120,12 @@ def ensure_process_cleanup(process_id, out_file, timeout)
|
|
120
120
|
ensure
|
121
121
|
unless process_id.nil?
|
122
122
|
begin
|
123
|
-
|
123
|
+
begin
|
124
|
+
Process.kill('QUIT', process_id)
|
125
|
+
rescue ArgumentError
|
126
|
+
# SIGQUIT not supported in Ruby 2.7 on Windows
|
127
|
+
Process.kill('KILL', process_id)
|
128
|
+
end
|
124
129
|
rescue Errno::ESRCH => _
|
125
130
|
end
|
126
131
|
end
|
@@ -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
|
-
|
53
|
-
|
54
|
-
ls
|
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
|
data/lib/rtext/instantiator.rb
CHANGED
@@ -112,18 +112,18 @@ class Instantiator
|
|
112
112
|
element = clazz.new
|
113
113
|
@env << element if @env
|
114
114
|
@root_elements << element if is_root
|
115
|
-
|
115
|
+
unlabeled_args = @lang.unlabled_arguments(clazz.ecore).name
|
116
116
|
di_index = 0
|
117
117
|
defined_args = {}
|
118
118
|
arg_list.each do |a|
|
119
119
|
if is_labeled(a)
|
120
120
|
set_argument(element, a[0].value, a[1], defined_args, command.line)
|
121
121
|
else
|
122
|
-
if di_index <
|
123
|
-
set_argument(element,
|
122
|
+
if di_index < unlabeled_args.size
|
123
|
+
set_argument(element, unlabeled_args[di_index], a, defined_args, command.line)
|
124
124
|
di_index += 1
|
125
125
|
elsif a != nil
|
126
|
-
problem("Unexpected
|
126
|
+
problem("Unexpected unlabeled argument, #{unlabeled_args.size} unlabeled arguments expected", command.line)
|
127
127
|
end
|
128
128
|
end
|
129
129
|
end
|
@@ -249,9 +249,9 @@ class Instantiator
|
|
249
249
|
begin
|
250
250
|
v_value = v.value
|
251
251
|
feature_instance_class = feature.eType.instanceClass
|
252
|
-
if feature_instance_class == String && (v_value.is_a?(Float) || v_value.is_a?(
|
252
|
+
if feature_instance_class == String && (v_value.is_a?(Float) || v_value.is_a?(Integer))
|
253
253
|
element.setOrAddGeneric(feature.name, v_value.to_s)
|
254
|
-
elsif feature_instance_class == Float && v_value.is_a?(
|
254
|
+
elsif feature_instance_class == Float && v_value.is_a?(Integer)
|
255
255
|
element.setOrAddGeneric(feature.name, v_value.to_f)
|
256
256
|
else
|
257
257
|
element.setOrAddGeneric(feature.name, v_value)
|
data/lib/rtext/link_detector.rb
CHANGED
@@ -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"]
|
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.
|
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:
|
11
|
+
date: 2023-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rgen
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.10.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '0.
|
22
|
+
version: '0.11'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.10.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '0.
|
32
|
+
version: '0.11'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: filelock
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -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:
|