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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1f54d0984df3ed72f1e75e93088d4df2287d00baad296c0002da2c558fca79e
4
- data.tar.gz: 6190f65650f8680d9e72093913667d336a7998fbefd3c4d1ae2409004d86d38c
3
+ metadata.gz: 3e03684f43c00dc08a44a65d67d2e768f722bb676ffadd84ad39e464c538f831
4
+ data.tar.gz: 7aa534fd733a6ec1d0315a4a534ff2a7027a28dcec2f3ca4da272bdfcca09d9d
5
5
  SHA512:
6
- metadata.gz: 4e87c966f8ad0b0200135e70c6f07f7b73d898fa9081b50fce3f06c05eda799cdfa8d02d189ecea5fe080040aa878e543a55e8ab369600945e4c1594eae7807a
7
- data.tar.gz: edb16b91ac8501388e3aecb72b96a99b3ff09f7b9d23d09a65b0e4668b94df35f7e1818eb8943519849711042bb8f5dfd413d98fc4cab4496124ef57b6f26203
6
+ metadata.gz: 2df6ccff1729ed6ac747a42f210389eb0cee162189bf707e9ebb6eaf7b2c36ee58464ee33e2dc4b5e0e940253707a7a124786d710dfc98441dedcbfeba1ed7e4
7
+ data.tar.gz: bbfb6363c513dde5d0c505ffa0c06231c045708cbe6357036a466a5fffff8cd31eb33540282d2263dba2dda8e25b7412fd68346f8f427b7b1fde44dcf49ca46d
@@ -1,5 +1,5 @@
1
1
  class Livetext
2
- VERSION = "0.8.93"
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
@@ -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
- # puts "==========="
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)
@@ -59,7 +59,7 @@ module Livetext::UserAPI
59
59
 
60
60
  def _raw_body(tag = "__EOF__")
61
61
  lines = []
62
- @save_location = @sources.last
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
- @save_location = @sources.last
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.93
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-02 00:00:00.000000000 Z
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