pegarus 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/Rakefile +1 -1
  2. data/lib/pegarus/ast/grammar.rb +4 -4
  3. data/lib/pegarus/machine/instructions.rb +3 -1
  4. data/lib/pegarus/version.rb +1 -1
  5. data/spec/rbx/tags/matching/evaluator/character_tags.txt +2 -0
  6. data/spec/rbx/tags/matching/evaluator/choice_tags.txt +2 -0
  7. data/spec/rbx/tags/matching/evaluator/concatenation_tags.txt +1 -0
  8. data/spec/rbx/tags/matching/evaluator/if_tags.txt +1 -0
  9. data/spec/rbx/tags/matching/evaluator/unless_tags.txt +1 -0
  10. data/spec/rbx/tags/matching/machine/any_tags.txt +3 -0
  11. data/spec/rbx/tags/matching/machine/character_tags.txt +3 -0
  12. data/spec/rbx/tags/matching/machine/choice_tags.txt +3 -0
  13. data/spec/rbx/tags/matching/machine/concatenation_tags.txt +3 -0
  14. data/spec/rbx/tags/matching/machine/if_tags.txt +3 -0
  15. data/spec/rbx/tags/matching/machine/unless_tags.txt +3 -0
  16. data/spec/rbx/tags/matching/rubinius/any_tags.txt +1 -0
  17. data/spec/rbx/tags/matching/rubinius/character_tags.txt +2 -0
  18. data/spec/rbx/tags/matching/rubinius/choice_tags.txt +2 -0
  19. data/spec/rbx/tags/matching/rubinius/concatenation_tags.txt +1 -0
  20. data/spec/rbx/tags/matching/rubinius/if_tags.txt +1 -0
  21. data/spec/rbx/tags/matching/rubinius/unless_tags.txt +1 -0
  22. data/spec/ruby/tags/matching/evaluator/character_tags.txt +2 -0
  23. data/spec/ruby/tags/matching/evaluator/choice_tags.txt +2 -0
  24. data/spec/ruby/tags/matching/evaluator/concatenation_tags.txt +1 -0
  25. data/spec/ruby/tags/matching/evaluator/if_tags.txt +1 -0
  26. data/spec/ruby/tags/matching/evaluator/unless_tags.txt +1 -0
  27. data/spec/ruby/tags/matching/machine/any_tags.txt +3 -0
  28. data/spec/ruby/tags/matching/machine/character_tags.txt +3 -0
  29. data/spec/ruby/tags/matching/machine/choice_tags.txt +3 -0
  30. data/spec/ruby/tags/matching/machine/concatenation_tags.txt +3 -0
  31. data/spec/ruby/tags/matching/machine/if_tags.txt +3 -0
  32. data/spec/ruby/tags/matching/machine/unless_tags.txt +3 -0
  33. metadata +30 -2
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ BASE_DIR = File.expand_path('../', __FILE__)
6
6
  RUBY = ENV["RUBY"] || "rbx"
7
7
 
8
8
  def spec(target)
9
- sh("mspec -t #{target} -T -I#{BASE_DIR} spec") { |ok, res| }
9
+ sh("mspec ci -t #{target} -T -I#{BASE_DIR} spec") { |ok, res| }
10
10
  end
11
11
 
12
12
  desc "Run the specs with $RUBY or 'rbx' (default)"
@@ -25,9 +25,9 @@ module Pegarus
25
25
  end
26
26
  end
27
27
 
28
- def set_variable(name, *pattern)
28
+ def set_variable(name, pattern)
29
29
  variable = get_variable name
30
- variable.pattern = *pattern
30
+ variable.pattern = pattern
31
31
  variable
32
32
  end
33
33
 
@@ -46,8 +46,8 @@ module Pegarus
46
46
  def method_missing(sym, *args)
47
47
  name = sym.to_s
48
48
 
49
- if name[-1] == ?=
50
- set_variable name[0..-2], *args
49
+ if name[-1] == ?= and args.size == 1
50
+ set_variable name[0..-2], args.first
51
51
  else
52
52
  get_variable name
53
53
  end
@@ -39,7 +39,9 @@ module Pegarus
39
39
  end
40
40
 
41
41
  instruction :commit do |state, label|
42
- state.stack[-3..-1] = nil
42
+ state.stack.pop
43
+ state.stack.pop
44
+ state.stack.pop
43
45
  state.ip = label
44
46
  end
45
47
 
@@ -1,3 +1,3 @@
1
1
  module Pegarus
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -0,0 +1,2 @@
1
+ fails:Character#match returns the index of the character following the matched substring
2
+ fails:Character#match returns 0 when pattern is empty
@@ -0,0 +1,2 @@
1
+ fails:Choice#match matches the first pattern if both match
2
+ fails:Choice#match matches the second pattern if the first does not match
@@ -0,0 +1 @@
1
+ fails:Concatenation#match returns the index of the character following the matched substring
@@ -0,0 +1 @@
1
+ fails:If#match returns the index of the character following the matched substring
@@ -0,0 +1 @@
1
+ fails:Unless#match returns the index of the character following the matched substring
@@ -0,0 +1,3 @@
1
+ fails:Any#match returns nil when the subject is empty
2
+ fails:Any#match returns nil if there are not N characters to match in the subject
3
+ fails:Any#match returns the index of the character following the matched substring
@@ -0,0 +1,3 @@
1
+ fails:Character#match returns nil when the subject is empty
2
+ fails:Character#match returns nil when the subject does not match completely
3
+ fails:Character#match returns the index of the character following the matched substring
@@ -0,0 +1,3 @@
1
+ fails:Choice#match returns nil if none of the patterns match
2
+ fails:Choice#match matches the first pattern if both match
3
+ fails:Choice#match matches the second pattern if the first does not match
@@ -0,0 +1,3 @@
1
+ fails:Concatenation#match returns nil if the first pattern does not match
2
+ fails:Concatenation#match returns nil if the second pattern does not match
3
+ fails:Concatenation#match returns the index of the character following the matched substring
@@ -0,0 +1,3 @@
1
+ fails:If#match returns nil if the first pattern does not match
2
+ fails:If#match returns nil if the second pattern does not match
3
+ fails:If#match returns the index of the character following the matched substring
@@ -0,0 +1,3 @@
1
+ fails:Unless#match returns nil if the first pattern does not match
2
+ fails:Unless#match returns nil if the second pattern match
3
+ fails:Unless#match returns the index of the character following the matched substring
@@ -0,0 +1 @@
1
+ fails:Any#match returns the index of the character following the matched substring
@@ -0,0 +1,2 @@
1
+ fails:Character#match returns the index of the character following the matched substring
2
+ fails:Character#match returns 0 when pattern is empty
@@ -0,0 +1,2 @@
1
+ fails:Choice#match matches the first pattern if both match
2
+ fails:Choice#match matches the second pattern if the first does not match
@@ -0,0 +1 @@
1
+ fails:Concatenation#match returns the index of the character following the matched substring
@@ -0,0 +1 @@
1
+ fails:If#match returns the index of the character following the matched substring
@@ -0,0 +1 @@
1
+ fails:Unless#match returns the index of the character following the matched substring
@@ -0,0 +1,2 @@
1
+ fails:Character#match returns the index of the character following the matched substring
2
+ fails:Character#match returns 0 when pattern is empty
@@ -0,0 +1,2 @@
1
+ fails:Choice#match matches the first pattern if both match
2
+ fails:Choice#match matches the second pattern if the first does not match
@@ -0,0 +1 @@
1
+ fails:Concatenation#match returns the index of the character following the matched substring
@@ -0,0 +1 @@
1
+ fails:If#match returns the index of the character following the matched substring
@@ -0,0 +1 @@
1
+ fails:Unless#match returns the index of the character following the matched substring
@@ -0,0 +1,3 @@
1
+ fails:Any#match returns nil when the subject is empty
2
+ fails:Any#match returns nil if there are not N characters to match in the subject
3
+ fails:Any#match returns the index of the character following the matched substring
@@ -0,0 +1,3 @@
1
+ fails:Character#match returns nil when the subject is empty
2
+ fails:Character#match returns nil when the subject does not match completely
3
+ fails:Character#match returns the index of the character following the matched substring
@@ -0,0 +1,3 @@
1
+ fails:Choice#match returns nil if none of the patterns match
2
+ fails:Choice#match matches the first pattern if both match
3
+ fails:Choice#match matches the second pattern if the first does not match
@@ -0,0 +1,3 @@
1
+ fails:Concatenation#match returns nil if the first pattern does not match
2
+ fails:Concatenation#match returns nil if the second pattern does not match
3
+ fails:Concatenation#match returns the index of the character following the matched substring
@@ -0,0 +1,3 @@
1
+ fails:If#match returns nil if the first pattern does not match
2
+ fails:If#match returns nil if the second pattern does not match
3
+ fails:If#match returns the index of the character following the matched substring
@@ -0,0 +1,3 @@
1
+ fails:Unless#match returns nil if the first pattern does not match
2
+ fails:Unless#match returns nil if the second pattern match
3
+ fails:Unless#match returns the index of the character following the matched substring
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 0.1.0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Brian Ford
@@ -71,6 +71,34 @@ files:
71
71
  - lib/pegarus/rubinius.rb
72
72
  - lib/pegarus/version.rb
73
73
  - lib/pegarus.rb
74
+ - spec/rbx/tags/matching/evaluator/character_tags.txt
75
+ - spec/rbx/tags/matching/evaluator/choice_tags.txt
76
+ - spec/rbx/tags/matching/evaluator/concatenation_tags.txt
77
+ - spec/rbx/tags/matching/evaluator/if_tags.txt
78
+ - spec/rbx/tags/matching/evaluator/unless_tags.txt
79
+ - spec/rbx/tags/matching/machine/any_tags.txt
80
+ - spec/rbx/tags/matching/machine/character_tags.txt
81
+ - spec/rbx/tags/matching/machine/choice_tags.txt
82
+ - spec/rbx/tags/matching/machine/concatenation_tags.txt
83
+ - spec/rbx/tags/matching/machine/if_tags.txt
84
+ - spec/rbx/tags/matching/machine/unless_tags.txt
85
+ - spec/rbx/tags/matching/rubinius/any_tags.txt
86
+ - spec/rbx/tags/matching/rubinius/character_tags.txt
87
+ - spec/rbx/tags/matching/rubinius/choice_tags.txt
88
+ - spec/rbx/tags/matching/rubinius/concatenation_tags.txt
89
+ - spec/rbx/tags/matching/rubinius/if_tags.txt
90
+ - spec/rbx/tags/matching/rubinius/unless_tags.txt
91
+ - spec/ruby/tags/matching/evaluator/character_tags.txt
92
+ - spec/ruby/tags/matching/evaluator/choice_tags.txt
93
+ - spec/ruby/tags/matching/evaluator/concatenation_tags.txt
94
+ - spec/ruby/tags/matching/evaluator/if_tags.txt
95
+ - spec/ruby/tags/matching/evaluator/unless_tags.txt
96
+ - spec/ruby/tags/matching/machine/any_tags.txt
97
+ - spec/ruby/tags/matching/machine/character_tags.txt
98
+ - spec/ruby/tags/matching/machine/choice_tags.txt
99
+ - spec/ruby/tags/matching/machine/concatenation_tags.txt
100
+ - spec/ruby/tags/matching/machine/if_tags.txt
101
+ - spec/ruby/tags/matching/machine/unless_tags.txt
74
102
  - spec/ast/choice_spec.rb
75
103
  - spec/ast/concatenation_spec.rb
76
104
  - spec/ast/difference_spec.rb