rpl 0.10.3 → 0.11.0

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rpl +15 -2
  3. data/lib/rpl/words/repl.rb +5 -0
  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: 4c6d8ef069a2fd0babe1b3db4a7c73e278b9f90b7169e9a3ad6461a6a30d0978
4
- data.tar.gz: ec4aa8e51d35ce0a1e274a6ce5f671ea38b199c6588595b0ab990feec09a8572
3
+ metadata.gz: 351033e886b47bece3ef9d5c143932c512c484bf92fce4128eb72edbdbdb7da3
4
+ data.tar.gz: 92812d157842f269ea72158f3db150ee62489aed54bba6d754ee2b4d6f386989
5
5
  SHA512:
6
- metadata.gz: b8f02b7bc7d0dcbd4f0471cd92efca669e5e22f8899f66d342a09283fb2b9896915ea84610d0c329bfff0705659e2d684dccc102a17f977e7cd1bbb0589f0187
7
- data.tar.gz: bc1cf8d172bd1f4bf19ebb6cbb5bfab56092ad212379646821b79ff81e5718f7f1e4c8aa71f613eec56538519efb8ebc699bec6a06c78c00d68b843ca1101972
6
+ metadata.gz: a5be657562ddfe9aa9329e3e5dcbf4cd9253428b11d8b2822ae09cd2d6a4a05e11d6864d474135b9275b4b0f338e87ee606fad898c118a274cb72633153a532b
7
+ data.tar.gz: ed16880b36a64da41863d07d281f46f0c9db1a3f2b8a2b75ba99ed3ebafb8439fd6c008ef84c39bf1382cd203c8885735d5655077b01da237d4c770d0d1c5514
data/bin/rpl CHANGED
@@ -20,12 +20,25 @@ class RplRepl
20
20
  end
21
21
  Readline.completion_append_character = ' '
22
22
 
23
+ prefill = ''
23
24
  loop do
25
+ Readline.pre_input_hook = lambda do
26
+ return if prefill.empty?
27
+
28
+ Readline.refresh_line
29
+ Readline.insert_text( prefill.to_s )
30
+ Readline.redisplay
31
+ end
32
+
24
33
  input = Readline.readline( ' ', true )
25
34
 
26
35
  break if input.nil? || input.strip == 'quit'
27
36
 
28
- if input.strip == 'history'
37
+ prefill = ''
38
+
39
+ if input.strip == 'edit'
40
+ prefill = @interpreter.stack.pop.to_s
41
+ elsif input.strip == 'history'
29
42
  Readline::HISTORY.each do |line|
30
43
  pp line
31
44
  end
@@ -62,7 +75,7 @@ options = { run_REPL: ARGV.empty?,
62
75
  Version = Rpl::VERSION
63
76
 
64
77
  OptionParser.new do |opts|
65
- opts.on('-s', "--state filename", "persist state in filename (default: #{options[:persistence_filename]}) (will be created if needed)") do |filename|
78
+ opts.on('-s', '--state filename', "persist state in filename (default: #{options[:persistence_filename]}) (will be created if needed)") do |filename|
66
79
  options[:persistence_filename] = File.expand_path( filename )
67
80
  end
68
81
 
@@ -31,6 +31,11 @@ module RplLang
31
31
  proc {} )
32
32
 
33
33
  @dictionary.add_word( ['edit'],
34
+ category,
35
+ '( x -- y ) put first stack object in prompt for modification',
36
+ proc {} )
37
+
38
+ @dictionary.add_word( ['extedit'],
34
39
  category,
35
40
  '( x -- y ) open object in $EDITOR',
36
41
  proc do
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.3'
8
+ VERSION = '0.11.0'
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.3
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gwenhael Le Moine