livetext 0.8.93 → 0.8.94
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/lib/livetext.rb +5 -2
- data/lib/standard.rb +80 -5
- data/lib/userapi.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e03684f43c00dc08a44a65d67d2e768f722bb676ffadd84ad39e464c538f831
|
4
|
+
data.tar.gz: 7aa534fd733a6ec1d0315a4a534ff2a7027a28dcec2f3ca4da272bdfcca09d9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2df6ccff1729ed6ac747a42f210389eb0cee162189bf707e9ebb6eaf7b2c36ee58464ee33e2dc4b5e0e940253707a7a124786d710dfc98441dedcbfeba1ed7e4
|
7
|
+
data.tar.gz: bbfb6363c513dde5d0c505ffa0c06231c045708cbe6357036a466a5fffff8cd31eb33540282d2263dba2dda8e25b7412fd68346f8f427b7b1fde44dcf49ca46d
|
data/lib/livetext.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class Livetext
|
2
|
-
VERSION = "0.8.
|
2
|
+
VERSION = "0.8.94"
|
3
3
|
Path = File.expand_path(File.join(File.dirname(__FILE__)))
|
4
4
|
end
|
5
5
|
|
@@ -195,11 +195,14 @@ return @body
|
|
195
195
|
|
196
196
|
def handle_dotcmd(line, indent = 0)
|
197
197
|
indent = @indentation.last # top of stack
|
198
|
-
name = _get_name(line)
|
198
|
+
name = _get_name(line).to_sym
|
199
199
|
result = nil
|
200
200
|
if @main.respond_to?(name)
|
201
201
|
result = @main.send(name)
|
202
202
|
else
|
203
|
+
TTY.puts "version = #{Livetext::VERSION}"
|
204
|
+
TTY.puts "#{(@main.methods - Object.methods).sort.inspect}"
|
205
|
+
TTY.puts name.inspect
|
203
206
|
@main._error! "Name '#{name}' is unknown"
|
204
207
|
return
|
205
208
|
end
|
data/lib/standard.rb
CHANGED
@@ -162,7 +162,7 @@ EOS
|
|
162
162
|
# FIXME *Must* allow for vars/functions
|
163
163
|
assigns.each do |a|
|
164
164
|
var, val = a.split("=")
|
165
|
-
STDERR.puts "-- var=val #{[var, val].inspect}"
|
165
|
+
# STDERR.puts "-- var=val #{[var, val].inspect}"
|
166
166
|
var.strip!
|
167
167
|
val.strip!
|
168
168
|
val = val[1..-2] if val[0] == ?" && val[-1] == ?"
|
@@ -173,6 +173,83 @@ STDERR.puts "-- var=val #{[var, val].inspect}"
|
|
173
173
|
_optional_blank_line
|
174
174
|
end
|
175
175
|
|
176
|
+
def _assign_get_var(c, e)
|
177
|
+
name = c
|
178
|
+
loop do
|
179
|
+
c = e.peek
|
180
|
+
case c
|
181
|
+
when /[a-zA-Z_\.0-9]/
|
182
|
+
name << e.next
|
183
|
+
next
|
184
|
+
when / =/
|
185
|
+
return name
|
186
|
+
else
|
187
|
+
raise "Error: did not expect #{c.inspect} in variable name"
|
188
|
+
end
|
189
|
+
end
|
190
|
+
raise "Error: loop ended parsing variable name"
|
191
|
+
end
|
192
|
+
|
193
|
+
def _assign_skip_equal(e)
|
194
|
+
loop { break if e.peek != " "; e.next }
|
195
|
+
if e.peek == "="
|
196
|
+
e.next # skip spaces too
|
197
|
+
loop { break if e.peek != " "; e.next }
|
198
|
+
else
|
199
|
+
raise "Error: expect equal sign"
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
def _quoted_value(quote, e)
|
204
|
+
value = ""
|
205
|
+
loop do
|
206
|
+
c = e.next
|
207
|
+
break if c == quote
|
208
|
+
value << c
|
209
|
+
end
|
210
|
+
value
|
211
|
+
end
|
212
|
+
|
213
|
+
def _unquoted_value(e)
|
214
|
+
value = ""
|
215
|
+
loop do
|
216
|
+
c = e.next
|
217
|
+
break if c == " " || c == ","
|
218
|
+
value << c
|
219
|
+
end
|
220
|
+
value
|
221
|
+
end
|
222
|
+
|
223
|
+
def _assign_get_value
|
224
|
+
c = e.peek
|
225
|
+
value = ""
|
226
|
+
case c
|
227
|
+
when ?", ?'
|
228
|
+
value = _quoted_value(c, e)
|
229
|
+
else
|
230
|
+
value = _unquoted_value(e)
|
231
|
+
end
|
232
|
+
c = e.peek
|
233
|
+
value
|
234
|
+
end
|
235
|
+
|
236
|
+
def set_NEW
|
237
|
+
line = _data.dup # dup needed?
|
238
|
+
e = line.each_char # enum
|
239
|
+
loop do
|
240
|
+
c = e.next
|
241
|
+
case c
|
242
|
+
when /a-z/i
|
243
|
+
_assign_get_var(c, e)
|
244
|
+
_assign_skip_equal
|
245
|
+
when " "
|
246
|
+
next
|
247
|
+
else
|
248
|
+
raise "set: Huh? line = #{line}"
|
249
|
+
end
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
176
253
|
def variables
|
177
254
|
_body.each do |line|
|
178
255
|
next if line.strip.empty?
|
@@ -231,7 +308,7 @@ STDERR.puts "-- var=val #{[var, val].inspect}"
|
|
231
308
|
# like include, but search upward as needed
|
232
309
|
file = @_args.first
|
233
310
|
file = _seek(file)
|
234
|
-
STDERR.puts "---- _seek found: #{file.inspect}"
|
311
|
+
# STDERR.puts "---- _seek found: #{file.inspect}"
|
235
312
|
_error!(file, "No such include file '#{file}'") unless file
|
236
313
|
@parent.process_file(file)
|
237
314
|
_optional_blank_line
|
@@ -303,9 +380,7 @@ STDERR.puts "---- _seek found: #{file.inspect}"
|
|
303
380
|
meths = grab_file(file)
|
304
381
|
modname = name.gsub("/","_").capitalize
|
305
382
|
string = "module ::#{modname}; #{meths}\nend"
|
306
|
-
|
307
|
-
# string.each_line.with_index {|line, i| puts "#{'%3d' % (i+1)} : #{line}" }
|
308
|
-
# puts "==========="
|
383
|
+
|
309
384
|
eval(string)
|
310
385
|
newmod = Object.const_get("::" + modname)
|
311
386
|
self.extend(newmod)
|
data/lib/userapi.rb
CHANGED
@@ -59,7 +59,7 @@ module Livetext::UserAPI
|
|
59
59
|
|
60
60
|
def _raw_body(tag = "__EOF__")
|
61
61
|
lines = []
|
62
|
-
|
62
|
+
# @save_location = @sources.last
|
63
63
|
loop do
|
64
64
|
@line = nextline
|
65
65
|
break if @line.nil?
|
@@ -77,7 +77,7 @@ module Livetext::UserAPI
|
|
77
77
|
|
78
78
|
def _body(raw=false)
|
79
79
|
lines = []
|
80
|
-
|
80
|
+
# @save_location = @sources.last
|
81
81
|
end_found = false
|
82
82
|
loop do
|
83
83
|
@line = nextline
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: livetext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.94
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hal Fulton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A smart text processor extensible in Ruby
|
14
14
|
email: rubyhacker@gmail.com
|