teepee 0.12.6 → 0.12.7
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/teepee/command-parser.rb +6 -0
- data/lib/teepee/commander.rb +27 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86c89b8367d7c548ca8489fc0c4d2cbb40487649
|
4
|
+
data.tar.gz: 441b9d33fb2f9392c316fd83e03fcf98b66d5e05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 092e7de71f78de726505ea2271a4c002a4e8afa4ece2fa7c832f569e792fff9d095063061d4ea661edd2fce929457ee3e7452fc2b745ef32cf450087637f5080
|
7
|
+
data.tar.gz: 1784bac371758e09ac7ab0d6f63c668764eb8462d5c69cc4780f27925e9875c9da24f95aa53cec7b125dcc5f11ac409ea15218a8dbf8ed362de127b72c41bd8d
|
@@ -396,8 +396,14 @@ module Teepee
|
|
396
396
|
@@commander.unless_operator expressions
|
397
397
|
when "do"
|
398
398
|
@@commander.do_operator expressions
|
399
|
+
when "prog1"
|
400
|
+
@@commander.prog1_operator expressions
|
401
|
+
when "progn"
|
402
|
+
@@commander.progn_operator expressions
|
399
403
|
when "cond"
|
400
404
|
@@commander.cond_operator expressions
|
405
|
+
when "case"
|
406
|
+
@@commander.case_operator expressions
|
401
407
|
else
|
402
408
|
command_error "unknown command #{command.to_html}"
|
403
409
|
end
|
data/lib/teepee/commander.rb
CHANGED
@@ -317,6 +317,21 @@ module Teepee
|
|
317
317
|
html_tag :br, nil
|
318
318
|
end
|
319
319
|
|
320
|
+
def case_operator expressions
|
321
|
+
value, _, *rest = strip expressions
|
322
|
+
if value and not rest.empty?
|
323
|
+
def cond_helper value, expressions
|
324
|
+
test_value, _, form, *rest = strip expressions
|
325
|
+
if equal value, test_value
|
326
|
+
form
|
327
|
+
elsif not rest.empty?
|
328
|
+
cond_helper value, rest
|
329
|
+
end
|
330
|
+
end
|
331
|
+
cond_helper value, rest
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
320
335
|
def cond_operator expressions
|
321
336
|
conditional, _, form, *rest = strip expressions
|
322
337
|
if true_constant? conditional
|
@@ -354,13 +369,13 @@ module Teepee
|
|
354
369
|
Math::E
|
355
370
|
end
|
356
371
|
|
357
|
-
def equal *
|
358
|
-
if
|
372
|
+
def equal *expressions
|
373
|
+
if expressions.empty?
|
359
374
|
true_constant
|
360
|
-
elsif
|
375
|
+
elsif expressions.length == 1
|
361
376
|
true_constant
|
362
377
|
else
|
363
|
-
|
378
|
+
expressions[0].to_s == expressions[1].to_s and equal *expressions.rest
|
364
379
|
end
|
365
380
|
end
|
366
381
|
|
@@ -634,6 +649,14 @@ module Teepee
|
|
634
649
|
"|"
|
635
650
|
end
|
636
651
|
|
652
|
+
def prog1_operator expressions
|
653
|
+
expressions.first
|
654
|
+
end
|
655
|
+
|
656
|
+
def progn_operator expressions
|
657
|
+
expressions.last
|
658
|
+
end
|
659
|
+
|
637
660
|
def radians2degrees radians
|
638
661
|
ensure_numeric(radians * 180.0 / Math::PI)
|
639
662
|
end
|