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.
@@ -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
- compiler.parser = parser
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
- # absolute path, output into same directory as file
169
- dir = if fname[0] == File::SEPARATOR
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(dir, "#{basename_without_riml_ext}.vim")
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
@@ -1,4 +1,4 @@
1
1
  module Riml
2
- # last changed: Apr. 28, 2013
3
- VERSION = [0,2,5]
2
+ # last changed: May. 12, 2013
3
+ VERSION = [0,2,6]
4
4
  end
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.5
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-04-28 00:00:00.000000000 Z
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 superset of VimL that includes some nice features:\n classes,
31
- string interpolation, heredocs, default case-sensitive string\n comparison and
32
- other things most programmers take for granted.\n"
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: Relaxed VimL (Vimscript)
89
+ summary: Riml is a language that compiles into Vimscript
88
90
  test_files: []