livetext 0.9.27 → 0.9.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.lt3 +3 -2
- data/lib/livetext/expansion.rb +106 -0
- data/lib/livetext/formatter.rb +104 -0
- data/lib/livetext/functions.rb +9 -0
- data/lib/livetext/helpers.rb +23 -18
- data/lib/livetext/html.rb +73 -0
- data/lib/livetext/more.rb +24 -4
- data/lib/livetext/parser/general.rb +1 -1
- data/lib/livetext/parser/set.rb +10 -3
- data/lib/livetext/processor.rb +5 -0
- data/lib/livetext/standard.rb +16 -6
- data/lib/livetext/userapi.rb +39 -16
- data/lib/livetext/version.rb +1 -1
- data/lib/livetext.rb +1 -1
- data/plugin/bootstrap_menu.rb +140 -0
- data/plugin/misc/navbar.rb +162 -0
- data/test/snapshots/basic_formatting/expected-output.txt +1 -2
- data/test/snapshots/{basic_formatting/actual-error.txt → bootstrap_menu/expected-error.txt} +0 -0
- data/test/snapshots/bootstrap_menu/expected-output.txt +4 -0
- data/test/snapshots/bootstrap_menu/source.lt3 +17 -0
- data/test/snapshots/subset.txt +50 -48
- data/test/unit/all.rb +2 -2
- data/test/unit/lineparser.rb +1 -1
- data/test/unit/parser/general.rb +2 -2
- data/test/unit/parser/set.rb +0 -9
- metadata +9 -32
- data/lib/livetext/funcall.rb +0 -87
- data/lib/livetext/lineparser.rb +0 -575
- data/test/snapshots/basic_formatting/actual-output.txt +0 -13
- data/test/snapshots/basic_formatting/err-sdiff.txt +0 -1
- data/test/snapshots/basic_formatting/out-sdiff.txt +0 -14
- data/test/snapshots/functions/actual-error.txt +0 -19
- data/test/snapshots/functions/actual-output.txt +0 -0
- data/test/snapshots/functions/err-sdiff.txt +0 -20
- data/test/snapshots/import_bookish/toc.tmp +0 -0
- data/test/snapshots/mixin_bookish/toc.tmp +0 -0
- data/test/snapshots/more_complex_vars/actual-error.txt +0 -0
- data/test/snapshots/more_complex_vars/actual-output.txt +0 -4
- data/test/snapshots/more_complex_vars/err-sdiff.txt +0 -1
- data/test/snapshots/more_complex_vars/out-sdiff.txt +0 -5
- data/test/snapshots/more_functions/actual-error.txt +0 -19
- data/test/snapshots/more_functions/actual-output.txt +0 -0
- data/test/snapshots/more_functions/err-sdiff.txt +0 -20
- data/test/snapshots/raw_lines/actual-error.txt +0 -22
- data/test/snapshots/raw_lines/actual-output.txt +0 -0
- data/test/snapshots/raw_lines/err-sdiff.txt +0 -23
- data/test/snapshots/simple_vars/actual-error.txt +0 -0
- data/test/snapshots/simple_vars/actual-output.txt +0 -6
- data/test/snapshots/simple_vars/err-sdiff.txt +0 -1
- data/test/snapshots/simple_vars/out-sdiff.txt +0 -7
- data/test/snapshots/var_into_func/actual-error.txt +0 -19
- data/test/snapshots/var_into_func/actual-output.txt +0 -0
- data/test/snapshots/var_into_func/err-sdiff.txt +0 -20
- data/test/snapshots/var_into_func/out-sdiff.txt +0 -17
- data/test/unit/tokenizer.rb +0 -535
data/lib/livetext/lineparser.rb
DELETED
@@ -1,575 +0,0 @@
|
|
1
|
-
|
2
|
-
require_relative 'parsing'
|
3
|
-
require_relative 'funcall'
|
4
|
-
|
5
|
-
# Class LineParser handles the parsing of comments, dot commands, and
|
6
|
-
# simple formatting characters, as well as variables and functions.
|
7
|
-
|
8
|
-
class Livetext::LineParser < StringParser
|
9
|
-
include Livetext::ParsingConstants
|
10
|
-
include Livetext::LineParser::FunCall
|
11
|
-
|
12
|
-
FMTS = %w[* _ ~ `]
|
13
|
-
|
14
|
-
Ident = "[[:alpha:]]([[:alnum:]]|_)*"
|
15
|
-
Dotted = "#{Ident}(\\.#{Ident})*"
|
16
|
-
Func = "\\$\\$"
|
17
|
-
Var = "\\$"
|
18
|
-
Lbrack = "\\["
|
19
|
-
Colon = ":"
|
20
|
-
|
21
|
-
def initialize(line)
|
22
|
-
super
|
23
|
-
@rx_func_brack = Regexp.compile("^" + Func + Dotted + Lbrack)
|
24
|
-
@rx_func_colon = Regexp.compile("^" + Func + Dotted + Colon)
|
25
|
-
@rx_func_bare = Regexp.compile("^" + Func + Dotted)
|
26
|
-
@rx_var = Regexp.compile("^" + Var + Dotted)
|
27
|
-
@token = Null.dup
|
28
|
-
@tokenlist = []
|
29
|
-
@live = Livetext.new
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.api
|
33
|
-
Livetext.new.main.api
|
34
|
-
end
|
35
|
-
|
36
|
-
def api
|
37
|
-
@live.main.api
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.parse!(line)
|
41
|
-
return nil if line.nil?
|
42
|
-
line.chomp!
|
43
|
-
x = self.new(line)
|
44
|
-
api.tty "\n-- string: #{line.inspect}" if $testme
|
45
|
-
t = x.tokenize
|
46
|
-
api.tty "-- Tokens: #{t.inspect}" if $testme
|
47
|
-
result = x.evaluate
|
48
|
-
api.tty "-- result: #{result.inspect}" if $testme
|
49
|
-
result
|
50
|
-
end
|
51
|
-
|
52
|
-
|
53
|
-
def parse_formatting_brute_force
|
54
|
-
# For each format * _ ` ~
|
55
|
-
# search for: [Space|^] Char Char .* [\.,]|$
|
56
|
-
# search for: [Space|^] Char [^\[]* Space|$
|
57
|
-
# search for: [Space|^] Char \[ [^\]*] ]|$
|
58
|
-
end
|
59
|
-
|
60
|
-
def parse_formatting
|
61
|
-
loop do
|
62
|
-
case peek
|
63
|
-
when Escape; grab; add peek; grab
|
64
|
-
when "*", "_", "`", "~"
|
65
|
-
marker peek
|
66
|
-
add peek
|
67
|
-
when LF
|
68
|
-
break if eos?
|
69
|
-
when nil
|
70
|
-
break
|
71
|
-
else
|
72
|
-
add peek
|
73
|
-
end
|
74
|
-
grab
|
75
|
-
end
|
76
|
-
add_token(:str)
|
77
|
-
@tokenlist
|
78
|
-
end
|
79
|
-
|
80
|
-
def grab_str
|
81
|
-
@buffer = ""
|
82
|
-
loop do
|
83
|
-
@buffer << self.grab
|
84
|
-
break if remainder.empty? || self.peek == "$"
|
85
|
-
end
|
86
|
-
@buffer
|
87
|
-
end
|
88
|
-
|
89
|
-
def grab_dd
|
90
|
-
@buffer = self.grab(2)
|
91
|
-
add_token(:str, @buffer)
|
92
|
-
@buffer = ""
|
93
|
-
end
|
94
|
-
|
95
|
-
def grab_var
|
96
|
-
matched = @rx_var.match(remainder)
|
97
|
-
vname = matched[0]
|
98
|
-
add_token(:var, vname[1..-1])
|
99
|
-
grab(vname.length)
|
100
|
-
end
|
101
|
-
|
102
|
-
def parse_variables
|
103
|
-
@buffer = ""
|
104
|
-
loop do
|
105
|
-
case
|
106
|
-
when remainder.empty? # end of string
|
107
|
-
break
|
108
|
-
when self.peek != "$" # Junk
|
109
|
-
str = grab_str
|
110
|
-
add_token(:str, str)
|
111
|
-
when self.peek(2) == "$$" # Func?
|
112
|
-
grab_dd
|
113
|
-
when self.peek == "$" # Var?
|
114
|
-
grab_var
|
115
|
-
end
|
116
|
-
end
|
117
|
-
@tokenlist
|
118
|
-
end
|
119
|
-
|
120
|
-
def grab_until(char)
|
121
|
-
string = ""
|
122
|
-
loop do
|
123
|
-
break if remainder.empty? || peek == char
|
124
|
-
string << grab
|
125
|
-
end
|
126
|
-
# ch = grab # eat the delimiter
|
127
|
-
# check ch == char ?
|
128
|
-
string
|
129
|
-
end
|
130
|
-
|
131
|
-
def grab_func_param(which)
|
132
|
-
case which
|
133
|
-
when ":"
|
134
|
-
param = grab_until(" ") # don't eat the space
|
135
|
-
when "["
|
136
|
-
param = grab_until("]")
|
137
|
-
grab # eat the ]
|
138
|
-
else
|
139
|
-
ungrab # just "forget" this character
|
140
|
-
param = nil
|
141
|
-
# abort "#{__method__}: Can't happen - which = #{which.inspect}"
|
142
|
-
end
|
143
|
-
param
|
144
|
-
end
|
145
|
-
|
146
|
-
def grab_funcall
|
147
|
-
matched = func_name = param = nil
|
148
|
-
case
|
149
|
-
when remainder.empty?
|
150
|
-
return
|
151
|
-
when matched = @rx_func_brack.match(remainder)
|
152
|
-
func_name = matched[0]
|
153
|
-
grab(2) # eat the $$
|
154
|
-
func_name = grab(func_name.length-3) # $$...[
|
155
|
-
param = grab_func_param(grab) # "["
|
156
|
-
add_token(:func, func_name, :brackets, param)
|
157
|
-
# Livetext::TTY.puts "1 matched is #{matched.inspect}"
|
158
|
-
when matched = @rx_func_colon.match(remainder)
|
159
|
-
func_name = matched[0]
|
160
|
-
grab(2) # eat the $$
|
161
|
-
func_name = grab(func_name.length-3) # $$...:
|
162
|
-
param = grab_func_param(grab) # ":"
|
163
|
-
add_token(:func, func_name, :colon, param)
|
164
|
-
# Livetext::TTY.puts "2 matched is #{matched.inspect}"
|
165
|
-
when matched = @rx_func_bare.match(remainder)
|
166
|
-
func_name = matched[0]
|
167
|
-
grab(2) # eat the $$
|
168
|
-
func_name = grab(func_name.length-2) # $$...
|
169
|
-
add_token(:func, func_name, nil, nil)
|
170
|
-
# Livetext::TTY.puts "3 matched is #{matched.inspect}"
|
171
|
-
else
|
172
|
-
abort "#{__method__}: Can't happen"
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
def parse_functions
|
177
|
-
# Assume variables already expanded?
|
178
|
-
@buffer = ""
|
179
|
-
loop do
|
180
|
-
break if remainder.empty? # end of string
|
181
|
-
if self.peek(2) == "$$" # Func?
|
182
|
-
grab_funcall
|
183
|
-
else # Junk
|
184
|
-
add_token(:str, grab_str)
|
185
|
-
end
|
186
|
-
end
|
187
|
-
@tokenlist
|
188
|
-
end
|
189
|
-
|
190
|
-
def expand_function_calls
|
191
|
-
# Assume variables already resolved?
|
192
|
-
tokens = self.parse_functions
|
193
|
-
self.evaluate
|
194
|
-
end
|
195
|
-
|
196
|
-
def self.parse_formatting(str)
|
197
|
-
fmt = self.new(str)
|
198
|
-
loop do
|
199
|
-
case fmt.peek
|
200
|
-
when Escape; fmt.grab; fmt.add fmt.peek; fmt.grab
|
201
|
-
when "*", "_", "`", "~"
|
202
|
-
fmt.marker fmt.peek
|
203
|
-
fmt.add fmt.peek
|
204
|
-
when LF
|
205
|
-
break if fmt.eos?
|
206
|
-
when nil
|
207
|
-
break
|
208
|
-
else
|
209
|
-
fmt.add fmt.peek
|
210
|
-
end
|
211
|
-
fmt.grab
|
212
|
-
end
|
213
|
-
fmt.add_token(:str)
|
214
|
-
fmt.tokenlist
|
215
|
-
end
|
216
|
-
|
217
|
-
def embed(sym, str)
|
218
|
-
pre, post = SimpleFormats[sym]
|
219
|
-
pre + str + post
|
220
|
-
end
|
221
|
-
|
222
|
-
#########
|
223
|
-
|
224
|
-
def grab_string
|
225
|
-
weird = ["$", nil] # [Escape, "$", nil]
|
226
|
-
ch = grab
|
227
|
-
add ch # api.tty "-- gs @token = #{@token.inspect}"
|
228
|
-
loop do
|
229
|
-
ch = peek # api.tty "gs1 ch = #{ch.inspect}"
|
230
|
-
break if weird.include?(ch)
|
231
|
-
break if FMTS.include?(ch) && (self.prev == " ")
|
232
|
-
break if eos? # ch = grab # advance pointer # api.tty "gs3 ch = #{ch.inspect}"
|
233
|
-
add grab
|
234
|
-
end # ch = grab # advance pointer # api.tty "-- gs4 ch = #{ch.inspect}"; sleep 0.01
|
235
|
-
add_token :str, @token
|
236
|
-
end
|
237
|
-
|
238
|
-
def grab_token(ch)
|
239
|
-
finish = false
|
240
|
-
# api.tty "#{__method__}: ch = #{ch.inspect}"
|
241
|
-
case ch
|
242
|
-
when nil; finish = true # do nothing
|
243
|
-
when LF; finish = true # do nothing - break if eos?
|
244
|
-
when Escape; ch = self.escaped; add ch
|
245
|
-
when "$"; dollar
|
246
|
-
when *FMTS; marker(ch)
|
247
|
-
else grab_string
|
248
|
-
end
|
249
|
-
# api.tty "#{__method__}: AFTER CASE: api.data = #{api.data.inspect}"
|
250
|
-
[ch, finish, @token, @tokenlist]
|
251
|
-
end
|
252
|
-
|
253
|
-
def tokenize
|
254
|
-
ch = peek
|
255
|
-
loop do
|
256
|
-
ch = peek
|
257
|
-
stuff = grab_token(ch)
|
258
|
-
ch, finish, t, tlist = *stuff
|
259
|
-
break if finish
|
260
|
-
end
|
261
|
-
# api.tty "tokenize: i = #{self.i}"
|
262
|
-
# api.tty "tokenize: token = #{@token.inspect} tokenlist = #{@tokenlist.inspect}"
|
263
|
-
@tokenlist
|
264
|
-
end
|
265
|
-
|
266
|
-
# def self.get_vars
|
267
|
-
# grab
|
268
|
-
# case peek
|
269
|
-
# when LF, " ", nil
|
270
|
-
# add "$"
|
271
|
-
# add_token :str
|
272
|
-
# when "$"; double_dollar
|
273
|
-
## when "."; dollar_dot
|
274
|
-
# when /[A-Za-z]/
|
275
|
-
# add_token :str
|
276
|
-
# var = peek + grab_alpha_dot
|
277
|
-
# add_token(:var, var)
|
278
|
-
# else
|
279
|
-
# add "$" + peek
|
280
|
-
# add_token(:str)
|
281
|
-
# end
|
282
|
-
# end
|
283
|
-
#
|
284
|
-
# def self.parse_var_func # FIXME Hmm...
|
285
|
-
# loop do
|
286
|
-
# case peek
|
287
|
-
# when "$"
|
288
|
-
# dollar
|
289
|
-
# when LF
|
290
|
-
# break if eos?
|
291
|
-
# when nil
|
292
|
-
# break
|
293
|
-
# else
|
294
|
-
# add peek
|
295
|
-
# end
|
296
|
-
# grab
|
297
|
-
# end
|
298
|
-
# add_token(:str)
|
299
|
-
# @tokenlist
|
300
|
-
# end
|
301
|
-
|
302
|
-
def terminate?(terminators, ch)
|
303
|
-
if terminators.is_a? Regexp
|
304
|
-
terminators === ch
|
305
|
-
else
|
306
|
-
terminators.include?(ch)
|
307
|
-
end
|
308
|
-
end
|
309
|
-
|
310
|
-
def var_func_parse
|
311
|
-
char = self.peek
|
312
|
-
loop do
|
313
|
-
char = self.grab
|
314
|
-
break if char == LF || char == nil
|
315
|
-
self.escaped if char == Escape
|
316
|
-
self.dollar if char == "$" # Could be $$
|
317
|
-
self.add char
|
318
|
-
end
|
319
|
-
self.add_token(:str)
|
320
|
-
result = self.evaluate
|
321
|
-
result
|
322
|
-
end
|
323
|
-
|
324
|
-
def self.var_func_parse(str)
|
325
|
-
return nil if str.nil?
|
326
|
-
x = self.new(str.chomp)
|
327
|
-
char = x.peek
|
328
|
-
loop do
|
329
|
-
char = x.grab
|
330
|
-
break if char == LF || char == nil
|
331
|
-
x.escaped if char == Escape
|
332
|
-
x.dollar if char == "$" # Could be $$
|
333
|
-
x.add char
|
334
|
-
end
|
335
|
-
x.add_token(:str)
|
336
|
-
result = x.evaluate
|
337
|
-
result
|
338
|
-
end
|
339
|
-
|
340
|
-
def evaluate(tokens = @tokenlist)
|
341
|
-
@out = ""
|
342
|
-
return "" if tokens.empty?
|
343
|
-
gen = tokens.each
|
344
|
-
token = gen.next
|
345
|
-
loop do
|
346
|
-
break if token.nil?
|
347
|
-
sym, val = *token
|
348
|
-
case sym
|
349
|
-
when :str; eval_str(val)
|
350
|
-
when :var; eval_var(val)
|
351
|
-
when :func; eval_func(val, gen)
|
352
|
-
when *BITS; eval_bits(sym, val)
|
353
|
-
else
|
354
|
-
add_token :str
|
355
|
-
end
|
356
|
-
token = gen.next
|
357
|
-
end
|
358
|
-
@out
|
359
|
-
end
|
360
|
-
|
361
|
-
def add(str)
|
362
|
-
@token << str unless str.nil?
|
363
|
-
end
|
364
|
-
|
365
|
-
def add_token(kind, *token)
|
366
|
-
return if token.nil?
|
367
|
-
@tokenlist << [kind, token].flatten unless token.empty?
|
368
|
-
@token = Null.dup
|
369
|
-
end
|
370
|
-
|
371
|
-
def grab_alpha
|
372
|
-
str = grab
|
373
|
-
loop do
|
374
|
-
break if eos?
|
375
|
-
break if terminate?(NoAlpha, peek)
|
376
|
-
str << grab
|
377
|
-
end
|
378
|
-
str
|
379
|
-
end
|
380
|
-
|
381
|
-
def grab_alpha_dot
|
382
|
-
str = grab # Null.dup
|
383
|
-
loop do
|
384
|
-
break if eos?
|
385
|
-
break if terminate?(NoAlphaDot, peek)
|
386
|
-
str << grab
|
387
|
-
end
|
388
|
-
str
|
389
|
-
end
|
390
|
-
|
391
|
-
def dollar
|
392
|
-
c1 = grab # $
|
393
|
-
c2 = grab # ...
|
394
|
-
case c2
|
395
|
-
when " "; add_token :str, "$ "
|
396
|
-
when LF, nil; add_token :str, "$"
|
397
|
-
when "$"; double_dollar
|
398
|
-
when "."; dollar_dot
|
399
|
-
when /[A-Za-z]/; add_token(:var, c2 + grab_alpha_dot)
|
400
|
-
else add_token(:str, "$" + c2)
|
401
|
-
end
|
402
|
-
end
|
403
|
-
|
404
|
-
def finish_token(str, kind)
|
405
|
-
add str
|
406
|
-
add_token :str
|
407
|
-
grab
|
408
|
-
end
|
409
|
-
|
410
|
-
def marker(char)
|
411
|
-
add_token :str
|
412
|
-
sym = Syms[char]
|
413
|
-
return if embedded?
|
414
|
-
grab
|
415
|
-
case peek
|
416
|
-
when Space; finish_token(char + " ", :str)
|
417
|
-
when LF, nil; finish_token(char, :str)
|
418
|
-
when char; double_marker(char)
|
419
|
-
when LBrack; long_marker(char)
|
420
|
-
else
|
421
|
-
str = peek + collect!(sym, Blank)
|
422
|
-
add str
|
423
|
-
add_token sym, str
|
424
|
-
grab
|
425
|
-
end
|
426
|
-
end
|
427
|
-
|
428
|
-
def double_marker(char)
|
429
|
-
sym = Syms[char]
|
430
|
-
kind = sym
|
431
|
-
case lookahead # first char after **
|
432
|
-
when Space, LF, nil
|
433
|
-
pre, post = SimpleFormats[sym]
|
434
|
-
add_token kind
|
435
|
-
else
|
436
|
-
str = collect!(sym, Punc)
|
437
|
-
add_token kind, str
|
438
|
-
grab
|
439
|
-
end
|
440
|
-
end
|
441
|
-
|
442
|
-
def long_marker(char)
|
443
|
-
sym = Syms[char]
|
444
|
-
grab # skip left bracket
|
445
|
-
kind = sym # "param_#{sym}".to_sym
|
446
|
-
arg = collect!(sym, Param, true)
|
447
|
-
add_token kind, arg
|
448
|
-
end
|
449
|
-
|
450
|
-
def collect_bracketed(sym, terminators)
|
451
|
-
str = Null.dup # next is not " ","*","["
|
452
|
-
grab # ZZZ
|
453
|
-
loop do
|
454
|
-
if peek == Escape
|
455
|
-
grab
|
456
|
-
str << grab
|
457
|
-
next
|
458
|
-
end
|
459
|
-
if terminate?(terminators, peek)
|
460
|
-
break
|
461
|
-
end
|
462
|
-
str << peek # not a terminator
|
463
|
-
grab
|
464
|
-
end
|
465
|
-
|
466
|
-
if peek == "]" # skip right bracket
|
467
|
-
grab
|
468
|
-
end
|
469
|
-
add str
|
470
|
-
str
|
471
|
-
rescue => err
|
472
|
-
::STDERR.puts "ERR = #{err}\n#{err.backtrace}"
|
473
|
-
end
|
474
|
-
|
475
|
-
def escaped
|
476
|
-
grab # Eat the backslash
|
477
|
-
ch = grab # Take next char
|
478
|
-
ch
|
479
|
-
end
|
480
|
-
|
481
|
-
def collect!(sym, terminators, bracketed=nil)
|
482
|
-
return collect_bracketed(sym, terminators) if bracketed
|
483
|
-
str = Null.dup # next is not " ","*","["
|
484
|
-
grab # ZZZ
|
485
|
-
loop do
|
486
|
-
case
|
487
|
-
when peek.nil?
|
488
|
-
return str
|
489
|
-
when peek == Escape
|
490
|
-
str << escaped
|
491
|
-
next
|
492
|
-
when terminate?(terminators, peek)
|
493
|
-
break
|
494
|
-
else
|
495
|
-
str << peek # not a terminator
|
496
|
-
end
|
497
|
-
grab
|
498
|
-
end
|
499
|
-
ungrab
|
500
|
-
add str
|
501
|
-
str
|
502
|
-
rescue => err
|
503
|
-
::STDERR.puts "ERR = #{err}\n#{err.backtrace}"
|
504
|
-
end
|
505
|
-
|
506
|
-
def varsub(name)
|
507
|
-
live = Livetext.new
|
508
|
-
value = live.vars[name]
|
509
|
-
result = value || "[#{name} is undefined]"
|
510
|
-
result
|
511
|
-
end
|
512
|
-
|
513
|
-
def embedded?
|
514
|
-
! (['"', "'", " ", nil].include? prev)
|
515
|
-
end
|
516
|
-
|
517
|
-
# private
|
518
|
-
|
519
|
-
def eval_bits(sym, val)
|
520
|
-
# api.tty "eb: #{[sym, val].inspect}"
|
521
|
-
val = Livetext.interpolate(val)
|
522
|
-
@out << embed(sym, val)
|
523
|
-
end
|
524
|
-
|
525
|
-
def eval_func(val, gen)
|
526
|
-
param = nil
|
527
|
-
arg = gen.peek rescue :bogus
|
528
|
-
unless arg == :bogus
|
529
|
-
if [:colon, :brackets].include? arg[0]
|
530
|
-
arg = gen.next # for real
|
531
|
-
param = arg[1]
|
532
|
-
# FIXME - unsure - interpolate again??
|
533
|
-
# param = Livetext.interpolate(param)
|
534
|
-
end
|
535
|
-
end
|
536
|
-
str = funcall(val, param)
|
537
|
-
@out << str
|
538
|
-
end
|
539
|
-
|
540
|
-
def eval_var(val)
|
541
|
-
@out << varsub(val)
|
542
|
-
end
|
543
|
-
|
544
|
-
def eval_str(val)
|
545
|
-
@out << val unless val == "\n" # BUG
|
546
|
-
end
|
547
|
-
|
548
|
-
def expand_variables
|
549
|
-
rx = @rx_var
|
550
|
-
buffer = ""
|
551
|
-
loop do |i|
|
552
|
-
case # Var or Func or false alarm
|
553
|
-
when remainder.empty? # end of string
|
554
|
-
break
|
555
|
-
when self.peek(2) == "$$" # Func?
|
556
|
-
buffer << self.grab(2)
|
557
|
-
when self.peek == "$" # Var?
|
558
|
-
vname = rx.match(remainder)
|
559
|
-
puts "----"
|
560
|
-
p @line
|
561
|
-
p rx.match(@line)
|
562
|
-
p vname
|
563
|
-
puts "----"
|
564
|
-
# value = @live.vars[vname[1..-1]]
|
565
|
-
# @line.sub!(vname["result"], value)
|
566
|
-
add_token(:var, vname[1..-1])
|
567
|
-
grab(vname.length)
|
568
|
-
else # other
|
569
|
-
buffer << self.grab
|
570
|
-
end
|
571
|
-
end
|
572
|
-
buffer
|
573
|
-
end
|
574
|
-
|
575
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
Here are examples of <b></b>
|
2
|
-
and <i></i>
|
3
|
-
and <font size=+1><tt></tt></font>
|
4
|
-
as well as <b></b> examples
|
5
|
-
of <i></i>
|
6
|
-
and <font size=+1><tt></tt></font>.
|
7
|
-
<p>
|
8
|
-
|
9
|
-
Here are some random punctuation marks:
|
10
|
-
; # . : @ % ^ & $
|
11
|
-
<p>
|
12
|
-
|
13
|
-
No need to escape these:
|
@@ -1 +0,0 @@
|
|
1
|
-
ACTUAL | EXPECTED
|
@@ -1,14 +0,0 @@
|
|
1
|
-
ACTUAL | EXPECTED
|
2
|
-
Here are examples of <b></b> | Here are examples of <b>boldface</b>
|
3
|
-
and <i></i> | and <i>italics</i>
|
4
|
-
and <font size=+1><tt></tt></font> | and <font size=+1><tt>code</tt></font>
|
5
|
-
as well as <b></b> examples | as well as <b>more complex</b> examples
|
6
|
-
of <i></i> | of <i>italicized text</i>
|
7
|
-
and <font size=+1><tt></tt></font>. | and <font size=+1><tt>code font</tt></font>.
|
8
|
-
<p> <p>
|
9
|
-
|
10
|
-
Here are some random punctuation marks: Here are some random punctuation marks:
|
11
|
-
; # . : @ % ^ & $ | ; # . * _ ` : @ % ^ & $
|
12
|
-
<p> <p>
|
13
|
-
|
14
|
-
No need to escape these: | No need to escape these: * _ `
|
@@ -1,19 +0,0 @@
|
|
1
|
-
/Users/Hal/Dropbox/topx/git/livetext/lib/livetext/lineparser.rb:123:in `grab_func_param': wrong number of arguments (given 0, expected 1) (ArgumentError)
|
2
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/funcall.rb:55:in `grab_func_with_param'
|
3
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/funcall.rb:63:in `double_dollar'
|
4
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/lineparser.rb:387:in `dollar'
|
5
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/lineparser.rb:235:in `grab_token'
|
6
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/lineparser.rb:247:in `block in tokenize'
|
7
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/lineparser.rb:245:in `loop'
|
8
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/lineparser.rb:245:in `tokenize'
|
9
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/lineparser.rb:45:in `parse!'
|
10
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/userapi.rb:122:in `format'
|
11
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/userapi.rb:129:in `passthru'
|
12
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/helpers.rb:104:in `process_line'
|
13
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/helpers.rb:86:in `block in process_file'
|
14
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/helpers.rb:83:in `loop'
|
15
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/helpers.rb:83:in `process_file'
|
16
|
-
from ../../../bin/livetext:89:in `block in parse_command_line'
|
17
|
-
from ../../../bin/livetext:75:in `loop'
|
18
|
-
from ../../../bin/livetext:75:in `parse_command_line'
|
19
|
-
from ../../../bin/livetext:106:in `<main>'
|
File without changes
|
@@ -1,20 +0,0 @@
|
|
1
|
-
ACTUAL | EXPECTED
|
2
|
-
/Users/Hal/Dropbox/topx/git/livetext/lib/livetext/lineparse <
|
3
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livet <
|
4
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livet <
|
5
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livet <
|
6
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livet <
|
7
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livet <
|
8
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livet <
|
9
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livet <
|
10
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livet <
|
11
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livet <
|
12
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livet <
|
13
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livet <
|
14
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livet <
|
15
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livet <
|
16
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livet <
|
17
|
-
from ../../../bin/livetext:89:in `block in parse_co <
|
18
|
-
from ../../../bin/livetext:75:in `loop' <
|
19
|
-
from ../../../bin/livetext:75:in `parse_command_lin <
|
20
|
-
from ../../../bin/livetext:106:in `<main>' <
|
File without changes
|
File without changes
|
File without changes
|
@@ -1 +0,0 @@
|
|
1
|
-
ACTUAL | EXPECTED
|
@@ -1,19 +0,0 @@
|
|
1
|
-
/Users/Hal/Dropbox/topx/git/livetext/lib/livetext/lineparser.rb:123:in `grab_func_param': wrong number of arguments (given 0, expected 1) (ArgumentError)
|
2
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/funcall.rb:55:in `grab_func_with_param'
|
3
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/funcall.rb:63:in `double_dollar'
|
4
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/lineparser.rb:387:in `dollar'
|
5
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/lineparser.rb:235:in `grab_token'
|
6
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/lineparser.rb:247:in `block in tokenize'
|
7
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/lineparser.rb:245:in `loop'
|
8
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/lineparser.rb:245:in `tokenize'
|
9
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/lineparser.rb:45:in `parse!'
|
10
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/userapi.rb:122:in `format'
|
11
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/userapi.rb:129:in `passthru'
|
12
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/helpers.rb:104:in `process_line'
|
13
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/helpers.rb:86:in `block in process_file'
|
14
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/helpers.rb:83:in `loop'
|
15
|
-
from /Users/Hal/Dropbox/topx/git/livetext/lib/livetext/helpers.rb:83:in `process_file'
|
16
|
-
from ../../../bin/livetext:89:in `block in parse_command_line'
|
17
|
-
from ../../../bin/livetext:75:in `loop'
|
18
|
-
from ../../../bin/livetext:75:in `parse_command_line'
|
19
|
-
from ../../../bin/livetext:106:in `<main>'
|
File without changes
|