calyx 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/calyx.rb +8 -1
  3. data/lib/calyx/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09d1b54741a8049f2612d11f22f08bf0eb57449a
4
- data.tar.gz: e9f7226f41393052aaa307c190b189dea93f56f6
3
+ metadata.gz: 1a05cedb7d18bd77a1f73beb72f6a865de2d30b9
4
+ data.tar.gz: cc934ec5dfbbdabe10b3b2e61cbb36135b0b4b9b
5
5
  SHA512:
6
- metadata.gz: afb306a14c37d6c30100877b5e8883071e049e82e09d7654575cf3cb7950cb49e2fb9e500f5e4a65348e6af1455e9886b7c76727f4ff376db1cbdc3910bee4ec
7
- data.tar.gz: fc5c6dbccada9b530eb882f2819a42fd0f5cbdfb5c5cb93ca8e25001e022ca2a5d6c8fb67be10a5648718e1a6025add5ab8a3195f80b59239e504c7edc51ead1
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 registry
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
@@ -1,3 +1,3 @@
1
1
  module Calyx
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calyx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Rickerby