rpl 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/rpl +15 -10
- data/lib/rpl/words/repl.rb +8 -7
- data/lib/rpl.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c6d8ef069a2fd0babe1b3db4a7c73e278b9f90b7169e9a3ad6461a6a30d0978
|
4
|
+
data.tar.gz: ec4aa8e51d35ce0a1e274a6ce5f671ea38b199c6588595b0ab990feec09a8572
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8f02b7bc7d0dcbd4f0471cd92efca669e5e22f8899f66d342a09283fb2b9896915ea84610d0c329bfff0705659e2d684dccc102a17f977e7cd1bbb0589f0187
|
7
|
+
data.tar.gz: bc1cf8d172bd1f4bf19ebb6cbb5bfab56092ad212379646821b79ff81e5718f7f1e4c8aa71f613eec56538519efb8ebc699bec6a06c78c00d68b843ca1101972
|
data/bin/rpl
CHANGED
@@ -22,17 +22,22 @@ class RplRepl
|
|
22
22
|
|
23
23
|
loop do
|
24
24
|
input = Readline.readline( ' ', true )
|
25
|
-
break if input.nil? || input == 'quit'
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
26
|
+
break if input.nil? || input.strip == 'quit'
|
27
|
+
|
28
|
+
if input.strip == 'history'
|
29
|
+
Readline::HISTORY.each do |line|
|
30
|
+
pp line
|
31
|
+
end
|
32
|
+
elsif input.empty?
|
33
|
+
# Remove blank lines from history
|
34
|
+
Readline::HISTORY.pop
|
35
|
+
else
|
36
|
+
begin
|
37
|
+
@interpreter.run( input )
|
38
|
+
rescue ArgumentError => e
|
39
|
+
pp e
|
40
|
+
end
|
36
41
|
end
|
37
42
|
|
38
43
|
print_stack
|
data/lib/rpl/words/repl.rb
CHANGED
@@ -14,7 +14,7 @@ module RplLang
|
|
14
14
|
|
15
15
|
@dictionary.add_word( ['words'],
|
16
16
|
category,
|
17
|
-
'
|
17
|
+
'() print the categorized list of all words',
|
18
18
|
proc do
|
19
19
|
@dictionary.words
|
20
20
|
.to_a
|
@@ -27,12 +27,12 @@ module RplLang
|
|
27
27
|
|
28
28
|
@dictionary.add_word( ['history'],
|
29
29
|
category,
|
30
|
-
'',
|
30
|
+
'() print the REPL\'s history',
|
31
31
|
proc {} )
|
32
32
|
|
33
33
|
@dictionary.add_word( ['edit'],
|
34
34
|
category,
|
35
|
-
'( --
|
35
|
+
'( x -- y ) open object in $EDITOR',
|
36
36
|
proc do
|
37
37
|
args = stack_extract( [:any] )
|
38
38
|
|
@@ -54,24 +54,25 @@ module RplLang
|
|
54
54
|
@stack << Types.new_object( args[0].class, edited_value )
|
55
55
|
end )
|
56
56
|
|
57
|
+
category = 'DEBUG'
|
57
58
|
@dictionary.add_word( ['.s'],
|
58
59
|
category,
|
59
|
-
'
|
60
|
+
'() print internal state of stack',
|
60
61
|
proc { pp @stack } )
|
61
62
|
|
62
63
|
@dictionary.add_word( ['.d'],
|
63
64
|
category,
|
64
|
-
'
|
65
|
+
'() print internal state of dictionary',
|
65
66
|
proc { pp @dictionary } )
|
66
67
|
|
67
68
|
@dictionary.add_word( ['.v'],
|
68
69
|
category,
|
69
|
-
'
|
70
|
+
'() print internal state of variables',
|
70
71
|
proc { pp @dictionary.vars } )
|
71
72
|
|
72
73
|
@dictionary.add_word( ['.lv'],
|
73
74
|
category,
|
74
|
-
'
|
75
|
+
'() print internal state of local variables layers',
|
75
76
|
proc { pp @dictionary.local_vars_layers } )
|
76
77
|
end
|
77
78
|
end
|
data/lib/rpl.rb
CHANGED