riml 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/README.md +37 -2
- data/Rakefile +4 -4
- data/lib/class_map.rb +1 -1
- data/lib/compiler.rb +0 -4
- data/lib/constants.rb +1 -1
- data/lib/grammar.y +8 -3
- data/lib/lexer.rb +22 -10
- data/lib/nodes.rb +0 -8
- data/lib/parser.rb +1194 -1208
- data/lib/repl.rb +11 -4
- data/version.rb +2 -2
- metadata +18 -2
data/lib/repl.rb
CHANGED
@@ -12,9 +12,15 @@ module Riml
|
|
12
12
|
attr_reader :parser, :compiler
|
13
13
|
private :parser, :compiler
|
14
14
|
|
15
|
-
EXIT_ON = %w(quit exit q e)
|
16
15
|
COMPILE_ON = %w(compile c)
|
17
|
-
RELOAD_ON = %w(reload
|
16
|
+
RELOAD_ON = %w(reload r)
|
17
|
+
EXIT_ON = %w(quit q)
|
18
|
+
|
19
|
+
HELP_MSG = <<msg
|
20
|
+
compile riml line(s): #{COMPILE_ON.join(', ')}
|
21
|
+
clear previous class definitions: #{RELOAD_ON.join(', ')}
|
22
|
+
exit repl: #{EXIT_ON.join(', ')}
|
23
|
+
msg
|
18
24
|
|
19
25
|
def initialize(vi_readline = false)
|
20
26
|
@indent_amount = 0
|
@@ -25,17 +31,19 @@ module Riml
|
|
25
31
|
end
|
26
32
|
|
27
33
|
def run
|
34
|
+
puts HELP_MSG, "\n"
|
28
35
|
while @line = Readline.readline(current_indent, true)
|
29
36
|
line.strip!
|
30
37
|
next if line.empty?
|
31
38
|
line_dc = line.downcase
|
32
|
-
exit_repl if EXIT_ON.include?(line_dc)
|
33
39
|
if COMPILE_ON.include?(line_dc)
|
34
40
|
next if current_compilation_unit.empty?
|
35
41
|
compile_unit!
|
36
42
|
elsif RELOAD_ON.include?(line_dc)
|
37
43
|
reload!
|
38
44
|
puts "reloaded"
|
45
|
+
elsif EXIT_ON.include?(line_dc)
|
46
|
+
exit_repl
|
39
47
|
else
|
40
48
|
current_compilation_unit << line
|
41
49
|
check_indents
|
@@ -71,7 +79,6 @@ module Riml
|
|
71
79
|
viml = Riml.compile(current_compilation_unit.join("\n"), parser, compiler).chomp
|
72
80
|
puts viml, "\n"
|
73
81
|
rescue => e
|
74
|
-
raise unless e.kind_of?(RimlError)
|
75
82
|
print_error(e)
|
76
83
|
reload!
|
77
84
|
ensure
|
data/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: racc
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: minitest
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 2.5.1
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.5.1
|
30
46
|
description: ! " Riml is a subset of VimL with some added features, and it compiles
|
31
47
|
to plain\n Vimscript. Some of the added features include classes, string interpolation,\n
|
32
48
|
\ heredocs, default case-sensitive string comparison and default arguments in\n
|