calyx 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/calyx.rb +8 -1
- data/lib/calyx/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a05cedb7d18bd77a1f73beb72f6a865de2d30b9
|
4
|
+
data.tar.gz: cc934ec5dfbbdabe10b3b2e61cbb36135b0b4b9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b9aa89b4265bba7d969eb9dbbdffd5bd61635b2572d78255e95aea4e01c34c6f3100220b1f71639a836e96285000ae7deb438d13b0bd9df2f974b55f309afc0
|
7
|
+
data.tar.gz: 1d478ba7285fcbd7f0659a7196af106b5b370742205c7415840fa63ee0a085958dbbe34dc576fc2dbefedd45b57d8d151681abd0e5baaffeba8827120a60b69e
|
data/lib/calyx.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module Calyx
|
2
2
|
class Grammar
|
3
3
|
class << self
|
4
|
+
attr_accessor :registry
|
5
|
+
|
4
6
|
def start(*productions, &production)
|
5
7
|
registry[:start] = construct_rule(productions)
|
6
8
|
end
|
@@ -9,8 +11,13 @@ module Calyx
|
|
9
11
|
registry[name.to_sym] = construct_rule(productions)
|
10
12
|
end
|
11
13
|
|
12
|
-
def
|
14
|
+
def inherit_registry(rules)
|
13
15
|
@registry ||= {}
|
16
|
+
@registry.merge!(rules || {})
|
17
|
+
end
|
18
|
+
|
19
|
+
def inherited(subclass)
|
20
|
+
subclass.inherit_registry(@registry)
|
14
21
|
end
|
15
22
|
|
16
23
|
def construct_rule(productions)
|
data/lib/calyx/version.rb
CHANGED