rpl 0.10.2 → 0.10.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rpl +15 -10
  3. data/lib/rpl/words/repl.rb +8 -7
  4. data/lib/rpl.rb +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10af1c6c132173d66be7c554831cd2d86d289c401b5aa36ba16deaca62634ab6
4
- data.tar.gz: b0a72cece6e644b76c1dfe4a4a8533936d1025b464a64cbcfa82640549209b66
3
+ metadata.gz: 4c6d8ef069a2fd0babe1b3db4a7c73e278b9f90b7169e9a3ad6461a6a30d0978
4
+ data.tar.gz: ec4aa8e51d35ce0a1e274a6ce5f671ea38b199c6588595b0ab990feec09a8572
5
5
  SHA512:
6
- metadata.gz: ae2fc038218acbaced883355476dd1fcb77d325cda5db7dc7fc49eedc70d90a58b071f6efece38929d8ac292dd325ec6b663bc70cab31f73ee9f039d5e4847c5
7
- data.tar.gz: daabf61d638a593ca324eade777e0d26e959f29a0883b8af67c34647efd6efe7da5e5af777fac6a6ea7e4197495fa08bfe76cf9aca593c7849564d8e6fa00431
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
- pp Readline::HISTORY if input == 'history'
28
-
29
- # Remove blank lines from history
30
- Readline::HISTORY.pop if input.empty?
31
-
32
- begin
33
- @interpreter.run( input )
34
- rescue ArgumentError => e
35
- pp e
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
@@ -14,7 +14,7 @@ module RplLang
14
14
 
15
15
  @dictionary.add_word( ['words'],
16
16
  category,
17
- 'DEBUG',
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
- '( -- s ) Pop the interpreter\'s complete indentification string',
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
- 'DEBUG',
60
+ '() print internal state of stack',
60
61
  proc { pp @stack } )
61
62
 
62
63
  @dictionary.add_word( ['.d'],
63
64
  category,
64
- 'DEBUG',
65
+ '() print internal state of dictionary',
65
66
  proc { pp @dictionary } )
66
67
 
67
68
  @dictionary.add_word( ['.v'],
68
69
  category,
69
- 'DEBUG',
70
+ '() print internal state of variables',
70
71
  proc { pp @dictionary.vars } )
71
72
 
72
73
  @dictionary.add_word( ['.lv'],
73
74
  category,
74
- 'DEBUG',
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
@@ -5,7 +5,7 @@ require 'rpl/types'
5
5
  require 'rpl/words'
6
6
 
7
7
  class Rpl < Interpreter
8
- VERSION = '0.10.2'
8
+ VERSION = '0.10.3'
9
9
 
10
10
  include Types
11
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rpl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gwenhael Le Moine