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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8616858e0c427809df04d9549c82e59533f7e3d6
|
4
|
+
data.tar.gz: 5417d980a44bcba6eae47087fa776c4a386cafb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 { |
|
23
|
-
| expression EXPONENTIATE expression { |
|
24
|
-
| expression ADD expression { |
|
25
|
-
| expression SUBTRACT expression { |
|
26
|
-
| expression MULTIPLY expression { |
|
27
|
-
| expression DIVIDE expression { |
|
28
|
-
| LPAREN expression RPAREN { |
|
29
|
-
| LPAREN error RPAREN { |
|
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
|
|
@@ -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(
|
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
|
data/lib/antelope/version.rb
CHANGED