antelope 0.3.0 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b105a775c988ea360d76ff423672de3f08292c8a
4
- data.tar.gz: fdb3bf76bd98071f22a514656daf4501c382f96d
3
+ metadata.gz: 8616858e0c427809df04d9549c82e59533f7e3d6
4
+ data.tar.gz: 5417d980a44bcba6eae47087fa776c4a386cafb2
5
5
  SHA512:
6
- metadata.gz: faafcddcc85dac20ed2ca352c54254b5c66db2e318d3ca0f5ab8aa3088285b5d97b5e4c96b15eb8095fab763ceb272c7448b35c4f76c3dfc0454fcb6bd419074
7
- data.tar.gz: 212594fc5006c2fc4880e311b47c9545cb006d85326de48bab240372dc1758a4446dbb6a93251ed6dab53d0e8fdda41ec9c2c843624de396335408436ec7fec2
6
+ metadata.gz: b39550335aaea311c99c0af16de97b84a8148747f664426a283c48f5f2622ec419ffc51cf4fbd68deb1ad546363caf0347c1e983d43ef150b53d28ac18cb3d58
7
+ data.tar.gz: 3d2b652ff10db8e7f090bf9f3f36f3f216d5caadf3082c4bc5790c558a292772f4ea18cab24471b3d91529c59f210d8843d939f2fd8835cb0c5dfbc8e1398b8b
data/examples/example.ace CHANGED
@@ -19,14 +19,14 @@
19
19
 
20
20
  %%
21
21
 
22
- expression: NUMBER { |a| a[1] }
23
- | expression EXPONENTIATE expression { |a, _, b| a** b }
24
- | expression ADD expression { |a, _, b| a + b }
25
- | expression SUBTRACT expression { |a, _, b| a - b }
26
- | expression MULTIPLY expression { |a, _, b| a * b }
27
- | expression DIVIDE expression { |a, _, b| a / b }
28
- | LPAREN expression RPAREN { |_, a, _| a }
29
- | LPAREN error RPAREN { |_, e, _| e[1] }
22
+ expression: NUMBER { |match| match[0][1] }
23
+ | expression EXPONENTIATE expression { |match| match[0]** match[2] }
24
+ | expression ADD expression { |match| match[0] + match[2] }
25
+ | expression SUBTRACT expression { |match| match[0] - match[2] }
26
+ | expression MULTIPLY expression { |match| match[0] * match[2] }
27
+ | expression DIVIDE expression { |match| match[0] / match[2] }
28
+ | LPAREN expression RPAREN { |match| match[1] }
29
+ | LPAREN error RPAREN { |match| match[1] }
30
30
 
31
31
  %%
32
32
 
@@ -39,7 +39,7 @@ module Antelope
39
39
  block = if block.empty?
40
40
  "DEFAULT_PROC"
41
41
  else
42
- "proc #{block}"
42
+ "proc { |match| #{block[1..-2]} }"
43
43
  end
44
44
 
45
45
  out << block << "],\n"
@@ -74,7 +74,7 @@ def parse_action(stack, input)
74
74
  when :reduce
75
75
  production = PRODUCTIONS[action.last]
76
76
  removing = stack.pop(production[1])
77
- value = instance_exec(*removing.map(&:first), &production[2])
77
+ value = instance_exec(removing.map(&:first), &production[2])
78
78
  goto = ACTION_TABLE[stack.last.last][production[0]]
79
79
  stack.push([value, goto.last])
80
80
  when :state
@@ -27,7 +27,6 @@ module Antelope
27
27
  def generate(options = {},
28
28
  generators = :guess,
29
29
  modifiers = DEFAULT_MODIFIERS)
30
- pp self
31
30
  mods = modifiers.map(&:last)
32
31
  .map { |x| x.new(self) }
33
32
  mods.each do |mod|
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Antelope
4
4
  # The current running version of antelope.
5
- VERSION = '0.3.0'.freeze
5
+ VERSION = '0.3.2'.freeze
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: antelope
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Rodi