riml 0.2.5 → 0.2.6
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.
- data/README.md +57 -34
- data/Rakefile +10 -1
- data/bin/riml +1 -1
- data/lib/ast_rewriter.rb +31 -5
- data/lib/compiler.rb +19 -16
- data/lib/grammar.y +134 -110
- data/lib/lexer.rb +7 -5
- data/lib/nodes.rb +20 -2
- data/lib/parser.output +13950 -0
- data/lib/parser.rb +1309 -1185
- data/lib/riml.rb +23 -9
- data/version.rb +2 -2
- metadata +8 -6
data/lib/riml.rb
CHANGED
@@ -33,10 +33,18 @@ module Riml
|
|
33
33
|
else
|
34
34
|
raise ArgumentError, "input must be nodes, tokens, code or file, is #{input.class}"
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
|
+
if compiler.parser == parser
|
38
|
+
compiling_cmdline_file = false
|
39
|
+
else
|
40
|
+
compiler.parser = parser
|
41
|
+
compiling_cmdline_file = true
|
42
|
+
end
|
43
|
+
|
37
44
|
output = compiler.compile(nodes)
|
45
|
+
|
38
46
|
if input.is_a?(File)
|
39
|
-
write_file(output, input.path)
|
47
|
+
write_file(output, input.path, compiling_cmdline_file)
|
40
48
|
else
|
41
49
|
output
|
42
50
|
end
|
@@ -164,16 +172,22 @@ module Riml
|
|
164
172
|
FILE_HEADER = File.read(File.expand_path("../header.vim", __FILE__)) % VERSION.join('.')
|
165
173
|
INCLUDE_COMMENT_FMT = File.read(File.expand_path("../included.vim", __FILE__))
|
166
174
|
|
167
|
-
def self.write_file(output, fname)
|
168
|
-
#
|
169
|
-
|
170
|
-
Pathname.new(fname).parent.to_s
|
171
|
-
# relative path, output into current working directory
|
172
|
-
else
|
175
|
+
def self.write_file(output, fname, cmdline_file = true)
|
176
|
+
# writing out a file that's compiled from cmdline, output into CWD
|
177
|
+
output_dir = if cmdline_file
|
173
178
|
Dir.getwd
|
179
|
+
# writing out a riml_source'd file
|
180
|
+
else
|
181
|
+
# absolute path
|
182
|
+
if fname[0] == File::SEPARATOR
|
183
|
+
Pathname.new(fname).parent.to_s
|
184
|
+
# relative path
|
185
|
+
else
|
186
|
+
File.join(Dir.getwd, Pathname.new(fname).parent.to_s)
|
187
|
+
end
|
174
188
|
end
|
175
189
|
basename_without_riml_ext = File.basename(fname).sub(/\.riml\Z/i, '')
|
176
|
-
full_path = File.join(
|
190
|
+
full_path = File.join(output_dir, "#{basename_without_riml_ext}.vim")
|
177
191
|
File.open(full_path, 'w') do |f|
|
178
192
|
f.write FILE_HEADER + output
|
179
193
|
end
|
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.6
|
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-
|
12
|
+
date: 2013-05-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: racc
|
@@ -27,9 +27,10 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
-
description: ! " Riml is a
|
31
|
-
|
32
|
-
|
30
|
+
description: ! " Riml is a subset of VimL with some added features, and it compiles
|
31
|
+
to plain\n Vimscript. Some of the added features include classes, string interpolation,\n
|
32
|
+
\ heredocs, default case-sensitive string comparison and default arguments in\n
|
33
|
+
\ functions. Give it a try!\n"
|
33
34
|
email: luke.gru@gmail.com
|
34
35
|
executables:
|
35
36
|
- riml
|
@@ -45,6 +46,7 @@ files:
|
|
45
46
|
- lib/class_map.rb
|
46
47
|
- lib/included.vim
|
47
48
|
- lib/constants.rb
|
49
|
+
- lib/parser.output
|
48
50
|
- lib/lexer.rb
|
49
51
|
- lib/grammar.y
|
50
52
|
- lib/compiler.rb
|
@@ -84,5 +86,5 @@ rubyforge_project:
|
|
84
86
|
rubygems_version: 1.8.25
|
85
87
|
signing_key:
|
86
88
|
specification_version: 3
|
87
|
-
summary:
|
89
|
+
summary: Riml is a language that compiles into Vimscript
|
88
90
|
test_files: []
|