nil 1.0.2 → 1.0.3

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 (6) hide show
  1. data/CHANGELOG.md +3 -0
  2. data/Gemfile +2 -0
  3. data/bin/nil +20 -3
  4. data/lib/nil/version.rb +1 -1
  5. data/nil.gemspec +2 -0
  6. metadata +18 -2
@@ -1,3 +1,6 @@
1
+ # 1.0.3
2
+ - Add `-c` option to executable to print the compiled Ruby code
3
+
1
4
  # 1.0.2
2
5
  - Fix bug where instructions were interpreted out of order
3
6
 
data/Gemfile CHANGED
@@ -1,5 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gem 'trollop'
4
+
3
5
  group :development do
4
6
  gem 'pry'
5
7
  gem 'riot'
data/bin/nil CHANGED
@@ -1,14 +1,31 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'nil'
4
+ require 'trollop'
4
5
 
5
- code = ARGF.read
6
+ opts = Trollop::options do
7
+ version "nil #{Nil::VERSION} (c) 2012 wxl"
8
+ banner <<-EOS
9
+ nil is a brain**** macro compiler and interpreter
10
+
11
+ Usage:
12
+ nil [options] <filename>
13
+
14
+ where [options] are:
15
+ EOS
16
+
17
+ opt :compile_only, "Output compiled Ruby code to standard output instead of running it."
18
+ end
6
19
 
20
+ code = ARGF.read
7
21
  mp = Nil::MacroParser.new
8
22
  code = mp.parse code
9
-
10
23
  i = Nil::Interpreter.new
11
-
12
24
  i.compile code
13
25
 
26
+ if opts[:compile_only]
27
+ puts i.compiled_ruby
28
+ exit
29
+ end
30
+
14
31
  i.run
@@ -1,3 +1,3 @@
1
1
  module Nil
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
@@ -14,4 +14,6 @@ Gem::Specification.new do |gem|
14
14
  gem.name = "nil"
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Nil::VERSION
17
+
18
+ gem.add_dependency "trollop"
17
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nil
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,23 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
  date: 2012-05-31 00:00:00.000000000 Z
13
- dependencies: []
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: trollop
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
14
30
  description: A brain**** macro language and interpreter
15
31
  email:
16
32
  - wuffers.lightwolf@me.com