nil 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,6 @@
1
+ # 1.0.4
2
+ - Fix bug with brackets in subroutines
3
+
1
4
  # 1.0.3
2
5
  - Add `-c` option to executable to print the compiled Ruby code
3
6
 
data/TODO.md ADDED
@@ -0,0 +1,7 @@
1
+ # Future Features
2
+
3
+ - Passing parameters to macros.
4
+
5
+ # Issues
6
+ - The `[` and `]` characters cause the interpreter to fail hard when used inside
7
+ a macro, the interpreter believing that they are invalid characters
@@ -8,7 +8,7 @@ module Nil
8
8
 
9
9
  def compile_subroutines(code)
10
10
  subroutines = {}
11
- sub_def_regex = Regexp.new ':(?<sub-name>[a-zA-Z0-9_]+)\{(?<sub-code>[><\-\+.,A-Za-z0-9:]+)\}'
11
+ sub_def_regex = Regexp.new ':(?<sub-name>[a-zA-Z0-9_]+)\{(?<sub-code>[\[\]><\-\+.,A-Za-z0-9:]+)\}'
12
12
  sub_call_regex = Regexp.new '([a-zA-Z0-9_]+):'
13
13
  code.scan(sub_def_regex).map do |sub|
14
14
  subroutines[sub[0]] = sub[1]
@@ -1,3 +1,3 @@
1
1
  module Nil
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
@@ -42,6 +42,13 @@ stack[sp] += 3
42
42
  puts stack[sp]
43
43
  CODE
44
44
  end
45
+
46
+ denies("error raised when brackets are inside subroutines") do
47
+ code = ":sub{+++[-]}sub:"
48
+ code = (Nil::MacroParser.new).parse code
49
+ topic.compile(code)
50
+ end.raises SyntaxError
51
+
45
52
  end
46
53
 
47
54
  context "MacroParser" do
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.3
4
+ version: 1.0.4
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: 2012-05-31 00:00:00.000000000 Z
12
+ date: 2012-06-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: trollop
@@ -42,6 +42,7 @@ files:
42
42
  - LICENSE
43
43
  - README.md
44
44
  - Rakefile
45
+ - TODO.md
45
46
  - bin/nil
46
47
  - lib/nil.rb
47
48
  - lib/nil/interpreter.rb