livetext 0.8.11 → 0.8.12

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
  SHA1:
3
- metadata.gz: 7eb62fbb6a80a7c5f209a38632b6017bde607bcc
4
- data.tar.gz: 6d598d34f8909fd4be5d33a483b4e9e84871a020
3
+ metadata.gz: 2b30201fdbfb90ab4042db07a2e2e13b8de01b4e
4
+ data.tar.gz: a7c1883fcd37443c7c2071cb3ca0f6ad96032d81
5
5
  SHA512:
6
- metadata.gz: 3cf0a897527ee72bc908efa172fc8f46f53b45f765a75360db7c98dd19ac4d4d2111ba63f1ecb3bf7b01c4c2629f064f103323164bc5ea8f21c8af1ab4dfad86
7
- data.tar.gz: 2337e79b8c029ba8d2a1b4cf6da4dae0600a5e6c19dce6d77f29756eb92cb19ca5320a2fc490529a9556874f2c10ba946270f97763f254bfc37960866bbfe4c2
6
+ metadata.gz: 9900907abf9f428f946177f7f5a74d396d6d507e00df40595c4edf9165c7ee0b03de1364321f95f4d324ab87265d600a60e5410adc68529b759248c757ae9997
7
+ data.tar.gz: 7fcaba27222d017d48304d77c1ee8f78fd38e11573f5f77be0d1e52d18a62c5db774e423e0d02dedd7792176e1fb9fbc4e6239ef0f2b6c1b5bcc953a51f421f0
data/lib/formatline.rb CHANGED
@@ -46,7 +46,8 @@ class FormatLine
46
46
 
47
47
  def funcall(name, param)
48
48
  fobj = ::Livetext::Functions.new
49
- fobj.param = param
49
+ ::Livetext::Functions.param = param
50
+ # STDERR.puts "Calling '#{name}' with '#{param}'"
50
51
  fobj.send(name)
51
52
  end
52
53
 
@@ -56,6 +57,7 @@ class FormatLine
56
57
  end
57
58
 
58
59
  def fcall
60
+ # puts "Calling funcall: #@name(#@param)"
59
61
  @buffer << funcall(@fname, @param)
60
62
  @fname, @param = "", ""
61
63
  end
data/lib/functions.rb CHANGED
@@ -3,11 +3,13 @@ require 'standard' # FIXME
3
3
  class Livetext::Functions # Functions will go here... user-def AND pre-def??
4
4
  Formats = ::Livetext::Standard::SimpleFormats
5
5
 
6
- def initialize
7
- @param = nil
6
+ @param = nil
7
+
8
+ def self.param
9
+ @param
8
10
  end
9
11
 
10
- def param=(str)
12
+ def self.param=(str)
11
13
  @param = str
12
14
  end
13
15
 
@@ -20,9 +22,10 @@ class Livetext::Functions # Functions will go here... user-def AND pre-def??
20
22
  end
21
23
 
22
24
  def simple_format(*args)
23
- @param ||= "NO PARAMETER"
25
+ param = self.class.param
26
+ param ||= "NO PARAMETER"
24
27
  pairs = Formats.values_at(*args)
25
- str = @param.dup
28
+ str = param.dup
26
29
  pairs.reverse.each do |pair|
27
30
  str = "#{pair.first}#{str}#{pair.last}"
28
31
  end
data/lib/livetext.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class Livetext
2
- VERSION = "0.8.11"
2
+ VERSION = "0.8.12"
3
3
  end
4
4
 
5
5
  require 'fileutils'
data/lib/standard.rb CHANGED
@@ -42,7 +42,7 @@ module Livetext::Standard
42
42
  funcname = @_args[0]
43
43
  _error! "Illegal name '#{funcname}'" if _disallowed?(funcname)
44
44
  func_def = <<-EOS
45
- def #{funcname}
45
+ def #{funcname}(*args)
46
46
  #{_body_text(true)}
47
47
  end
48
48
  EOS
data/lib/userapi.rb CHANGED
@@ -38,6 +38,7 @@ module Livetext::UserAPI
38
38
  end
39
39
 
40
40
  def _end?(str, sigil=".")
41
+ return false if str.nil?
41
42
  cmd = sigil + "end"
42
43
  return false if str.index(cmd) != 0
43
44
  return false unless _trailing?(str[5])
@@ -65,6 +66,7 @@ module Livetext::UserAPI
65
66
  @save_location = @sources.last
66
67
  loop do
67
68
  @line = nextline
69
+ raise if @line.nil?
68
70
  break if _end?(@line, sigil)
69
71
  next if _comment?(@line, sigil) # FIXME?
70
72
  @line = _formatting(@line) unless raw
@@ -77,7 +79,7 @@ module Livetext::UserAPI
77
79
  lines
78
80
  end
79
81
  rescue => err
80
- p err, err.backtrace
82
+ # FIXME
81
83
  _error!("Expecting .end, found end of file")
82
84
  end
83
85
 
@@ -1,3 +1,4 @@
1
+ .backtrace
1
2
  Blah
2
3
  blah
3
4
 
@@ -6,23 +6,6 @@ here...
6
6
  "Eureka!"
7
7
  .end
8
8
 
9
- .func sign
10
- str = @_data
11
- out = ""
12
- wide = str.length + 2
13
- out << " "*4 + "+"
14
- wide.times { out << "-" }
15
- out << "\n" + " "*4
16
- out << "| #{str} |\n"
17
- out << " "*4 + "+"
18
- wide.times { out << "-" }
19
- out << "\n\n "
20
- STDERR.puts out
21
- out
22
- .end
23
-
24
9
  I am calling $$myfunc here...
25
10
  Let's see
26
11
  what happens.
27
-
28
- Now I'm trying to make $$sign[A SIGN HERE]...
data/test/sdtest ADDED
@@ -0,0 +1,6 @@
1
+
2
+ sdiff test/data/$1/expected-output.txt /tmp/$1--actual-output.txt
3
+
4
+ echo ==========
5
+
6
+ sdiff test/data/$1/expected-error.txt /tmp/$1--actual-error.txt
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.11
4
+ version: 0.8.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-18 00:00:00.000000000 Z
11
+ date: 2017-04-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A smart text processor extensible in Ruby
14
14
  email: rubyhacker@gmail.com
@@ -124,6 +124,7 @@ files:
124
124
  - test/data/single_raw_line/expected-output.txt
125
125
  - test/data/single_raw_line/source.lt3
126
126
  - test/newtest
127
+ - test/sdtest
127
128
  - test/test.rb
128
129
  - test/try.lt
129
130
  - test/try2.lt