proinsias 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b5403239c4f49400cae27fe6030b3f90537b58491f0a8ece5c10779d8144916
4
- data.tar.gz: bdbad991e14a84d22be5eeec3011b02119d7e82e78ca7d6cb4e21934c3b5c3f3
3
+ metadata.gz: 79aa89de95912b9d35ca94100b35865bad1a94a449b6f17eb4d330fe207e393b
4
+ data.tar.gz: aac883aea633286ff0b6ae361b353577c7af414103b57618c1291db250c69cec
5
5
  SHA512:
6
- metadata.gz: 69f88b67b14ca92c9ce86ecd79a9c751dfa75582f30fd96cbf563ab334aa79a14d88ed4f7a518fffdc84f7260a6f98eadf589834cf91367cb12c3f712511a59d
7
- data.tar.gz: cb7d80f469d43e72dc743f4ea84a7893cc43fc4e6be43dce644f16bf52055bb404cc9ad913fda44d2ce5a3a554f2d2a6a89c245b43a93d0c50c28b61eda59a13
6
+ metadata.gz: 164a37314d4df2e63ffa5f20d4abc9641444f107fe722d7ea30491e88f133ca136e8cdd0a5d0c88b1fe7c408f951fc399614d65b95a35758b92fe99a9b519362
7
+ data.tar.gz: d9086652a1f28ae886fd153770086efe521b8d2dc6e7a8564500cdf215edf05f740b4100a4753e323af729f103305bedfe40defe8b1d851ec256ce4638c9058b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- proinsias (1.1.0)
4
+ proinsias (1.2.0)
5
5
  moory (~> 1.2.6)
6
6
 
7
7
  GEM
@@ -1,2 +1,24 @@
1
1
  require_relative './filter'
2
2
  require_relative './controller'
3
+ require_relative './particle'
4
+ require_relative './form'
5
+
6
+ module Proinsias
7
+ module Configurations
8
+ def Configurations.get_controller(language)
9
+ Controller::const_get(
10
+ get_form(language)
11
+ )
12
+ end
13
+
14
+ def Configurations.get_form(language)
15
+ FORM[language]
16
+ end
17
+
18
+ def Configurations.get_filter_rules(language)
19
+ const_get(language)
20
+ .const_get('Filter')
21
+ .const_get('RULES')
22
+ end
23
+ end
24
+ end
@@ -1,36 +1,38 @@
1
1
  module Proinsias
2
2
  module Configurations
3
- module Filter
4
- RULES = """
5
- ^ : p / p / produce : ^
6
- ^ : q / q / produce : ^
7
- ^ : r / r / produce : ^
8
- ^ : s / s / produce : ^
9
-
10
- ^ : ¬ / ¬ / produce : ^
11
-
12
- ^ : ≡ / ≡ / produce : ^
13
- ^ : / / produce : ^
14
- ^ : / / produce : ^
15
- ^ : / / produce : ^
16
- ^ : / / produce : ^
17
- ^ : / / produce : ^
18
- ^ : = / = / produce : ^
19
-
20
- ^ : ( / ( / produce : ^
21
- ^ : ) / ) / produce : ^
22
-
23
- ^ : t : 0
24
- 0 : r : 1
25
- 1 : u : 2
26
- 2 : e / true / produce : ^
27
-
28
- ^ : f : 3
29
- 3 : a : 4
30
- 4 : l : 5
31
- 5 : s : 6
32
- 6 : e / false / produce : ^
33
- """
3
+ module Propositions
4
+ module Filter
5
+ RULES = """
6
+ ^ : p / p / produce : ^
7
+ ^ : q / q / produce : ^
8
+ ^ : r / r / produce : ^
9
+ ^ : s / s / produce : ^
10
+
11
+ ^ : ¬ / ¬ / produce : ^
12
+
13
+ ^ : / / produce : ^
14
+ ^ : / / produce : ^
15
+ ^ : / / produce : ^
16
+ ^ : / / produce : ^
17
+ ^ : / / produce : ^
18
+ ^ : / / produce : ^
19
+ ^ : = / = / produce : ^
20
+
21
+ ^ : ( / ( / produce : ^
22
+ ^ : ) / ) / produce : ^
23
+
24
+ ^ : t : 0
25
+ 0 : r : 1
26
+ 1 : u : 2
27
+ 2 : e / true / produce : ^
28
+
29
+ ^ : f : 3
30
+ 3 : a : 4
31
+ 4 : l : 5
32
+ 5 : s : 6
33
+ 6 : e / false / produce : ^
34
+ """
35
+ end
34
36
  end
35
37
  end
36
38
  end
@@ -0,0 +1,7 @@
1
+ module Proinsias
2
+ module Configurations
3
+ FORM = {
4
+ 'Propositions' => 'PIP'
5
+ }
6
+ end
7
+ end
@@ -0,0 +1,137 @@
1
+ module Proinsias
2
+ module Configurations
3
+ module Propositions
4
+ PARTICLE = [
5
+ # - CONSTANTS
6
+ {
7
+ glyph: 'true',
8
+ role: 'constant',
9
+ capacity: 0,
10
+ strength: 0,
11
+ disposition: 'Pessimistic',
12
+ },
13
+ {
14
+ glyph: 'false',
15
+ role: 'constant',
16
+ capacity: 0,
17
+ strength: 0,
18
+ disposition: 'Pessimistic',
19
+ },
20
+ # - VARIABLES
21
+ {
22
+ glyph: 'p',
23
+ role: 'variable',
24
+ capacity: 0,
25
+ strength: 0,
26
+ disposition: 'Pessimistic',
27
+ },
28
+ {
29
+ glyph: 'q',
30
+ role: 'variable',
31
+ capacity: 0,
32
+ strength: 0,
33
+ disposition: 'Pessimistic',
34
+ },
35
+ {
36
+ glyph: 'r',
37
+ role: 'variable',
38
+ capacity: 0,
39
+ strength: 0,
40
+ disposition: 'Pessimistic',
41
+ },
42
+ {
43
+ glyph: 's',
44
+ role: 'variable',
45
+ capacity: 0,
46
+ strength: 0,
47
+ disposition: 'Pessimistic',
48
+ },
49
+ {
50
+ glyph: 'e',
51
+ role: 'variable',
52
+ capacity: 0,
53
+ strength: 0,
54
+ disposition: 'Pessimistic',
55
+ },
56
+
57
+ # - OPERATORS
58
+ {
59
+ glyph: '¬',
60
+ role: 'prefix',
61
+ capacity: 1,
62
+ strength: 2,
63
+ disposition: 'Pessimistic',
64
+ },
65
+ {
66
+ glyph: '⇒',
67
+ role: 'infix',
68
+ capacity: 2,
69
+ strength: 11,
70
+ disposition: 'Pessimistic',
71
+ },
72
+ {
73
+ glyph: '⇐',
74
+ role: 'infix',
75
+ capacity: 2,
76
+ strength: 11,
77
+ disposition: 'Optimistic',
78
+ },
79
+ {
80
+ glyph: '≡',
81
+ role: 'infix',
82
+ capacity: 2,
83
+ strength: 12,
84
+ disposition: 'Optimistic',
85
+ },
86
+ {
87
+ glyph: '≢',
88
+ role: 'infix',
89
+ capacity: 2,
90
+ strength: 12,
91
+ disposition: 'Optimistic',
92
+ },
93
+ {
94
+ glyph: '∨',
95
+ role: 'infix',
96
+ capacity: 2,
97
+ strength: 10,
98
+ disposition: 'Optimistic',
99
+ },
100
+ {
101
+ glyph: '∧',
102
+ role: 'infix',
103
+ capacity: 2,
104
+ strength: 9,
105
+ disposition: 'Optimistic',
106
+ },
107
+ {
108
+ glyph: '=',
109
+ role: 'infix',
110
+ capacity: 2,
111
+ strength: 9,
112
+ disposition: 'Optimistic',
113
+ },
114
+
115
+ # -- OUTFIX
116
+ {
117
+ glyph: '(',
118
+ role: 'lparen',
119
+ capacity: 1,
120
+ strength: 0,
121
+ disposition: 'Pessimistic',
122
+ ephemeral: true,
123
+ sentinel: 'rparen',
124
+ },
125
+
126
+ # -- SENTINELS
127
+ {
128
+ glyph: ')',
129
+ role: 'rparen',
130
+ capacity: 1,
131
+ strength: 12,
132
+ disposition: 'Optimistic',
133
+ },
134
+ ]
135
+ end
136
+ end
137
+ end
@@ -2,18 +2,19 @@ require 'moory'
2
2
 
3
3
  module Proinsias
4
4
  class Director
5
- attr_accessor :consumer, :quarantine
5
+ attr_accessor :consumer, :quarantine, :language
6
6
 
7
7
  SKIP = proc {}
8
8
 
9
- def initialize(consumer:, quarantine:SKIP)
9
+ def initialize(consumer:, quarantine:SKIP, language: 'Propositions')
10
10
  @consumer = consumer
11
11
  @quarantine = quarantine
12
+ @language = language
12
13
  end
13
14
 
14
15
  def controller
15
16
  @controller ||= Moory::Logistic::Controller.new(
16
- Configurations::Controller::PIP
17
+ Configurations::get_controller(language)
17
18
  )
18
19
  end
19
20
 
@@ -2,9 +2,9 @@ require 'moory'
2
2
 
3
3
  module Proinsias
4
4
  module Filter
5
- def Filter.create(consumer:)
5
+ def Filter.create(consumer:, language:'Propositions')
6
6
  Moory::Filter.new(
7
- rules: Proinsias::Configurations::Filter::RULES,
7
+ rules: Configurations.get_filter_rules(language),
8
8
  consumer: consumer
9
9
  )
10
10
  end
@@ -10,7 +10,7 @@ module Proinsias
10
10
  end
11
11
 
12
12
  class Parser
13
- attr_accessor :consumer, :quarantine
13
+ attr_accessor :consumer, :quarantine, :language
14
14
 
15
15
  using NilExtension
16
16
 
@@ -20,9 +20,10 @@ module Proinsias
20
20
 
21
21
  SKIP = proc {}
22
22
 
23
- def initialize(consumer:nil, quarantine:SKIP)
23
+ def initialize(consumer:nil, quarantine:SKIP,language:'Propositions')
24
24
  @consumer = consumer
25
25
  @quarantine = quarantine
26
+ @language = language
26
27
  end
27
28
 
28
29
  def analyse(str)
@@ -50,14 +51,16 @@ module Proinsias
50
51
 
51
52
  def scanner
52
53
  @scanner ||= Proinsias::Scanner.new(
53
- consumer: director.method(:issue)
54
+ consumer: director.method(:issue),
55
+ language: language
54
56
  )
55
57
  end
56
58
 
57
59
  def director
58
60
  @director ||= Proinsias::Director.new(
59
61
  consumer: assembly_line.method(:issue),
60
- quarantine: quarantine
62
+ quarantine: quarantine,
63
+ language: language
61
64
  )
62
65
  end
63
66
 
@@ -2,13 +2,15 @@ module Proinsias
2
2
  class Scanner
3
3
  attr_accessor :consumer
4
4
 
5
- def initialize(consumer:)
5
+ def initialize(consumer:, language:'Propositions')
6
6
  @consumer = consumer
7
+ @language = language
7
8
  end
8
9
 
9
10
  def filter
10
11
  @filter ||= Proinsias::Filter.create(
11
- consumer: method(:forward)
12
+ consumer: method(:forward),
13
+ language: @language
12
14
  )
13
15
  end
14
16
 
@@ -5,139 +5,7 @@ module Proinsias
5
5
  end
6
6
 
7
7
  def Particle.glyph_properties(glyph)
8
- DEFINITIONS.detect { |p| p[:glyph] == glyph }
8
+ Configurations::Propositions::PARTICLE.detect { |p| p[:glyph] == glyph }
9
9
  end
10
-
11
- DEFINITIONS = [
12
- # - CONSTANTS
13
- {
14
- glyph: 'true',
15
- role: 'constant',
16
- capacity: 0,
17
- strength: 0,
18
- disposition: 'Pessimistic',
19
- },
20
- {
21
- glyph: 'false',
22
- role: 'constant',
23
- capacity: 0,
24
- strength: 0,
25
- disposition: 'Pessimistic',
26
- },
27
- # - VARIABLES
28
- {
29
- glyph: 'p',
30
- role: 'variable',
31
- capacity: 0,
32
- strength: 0,
33
- disposition: 'Pessimistic',
34
- },
35
- {
36
- glyph: 'q',
37
- role: 'variable',
38
- capacity: 0,
39
- strength: 0,
40
- disposition: 'Pessimistic',
41
- },
42
- {
43
- glyph: 'r',
44
- role: 'variable',
45
- capacity: 0,
46
- strength: 0,
47
- disposition: 'Pessimistic',
48
- },
49
- {
50
- glyph: 's',
51
- role: 'variable',
52
- capacity: 0,
53
- strength: 0,
54
- disposition: 'Pessimistic',
55
- },
56
- {
57
- glyph: 'e',
58
- role: 'variable',
59
- capacity: 0,
60
- strength: 0,
61
- disposition: 'Pessimistic',
62
- },
63
-
64
- # - OPERATORS
65
- {
66
- glyph: '¬',
67
- role: 'prefix',
68
- capacity: 1,
69
- strength: 2,
70
- disposition: 'Pessimistic',
71
- },
72
- {
73
- glyph: '⇒',
74
- role: 'infix',
75
- capacity: 2,
76
- strength: 11,
77
- disposition: 'Pessimistic',
78
- },
79
- {
80
- glyph: '⇐',
81
- role: 'infix',
82
- capacity: 2,
83
- strength: 11,
84
- disposition: 'Optimistic',
85
- },
86
- {
87
- glyph: '≡',
88
- role: 'infix',
89
- capacity: 2,
90
- strength: 12,
91
- disposition: 'Optimistic',
92
- },
93
- {
94
- glyph: '≢',
95
- role: 'infix',
96
- capacity: 2,
97
- strength: 12,
98
- disposition: 'Optimistic',
99
- },
100
- {
101
- glyph: '∨',
102
- role: 'infix',
103
- capacity: 2,
104
- strength: 10,
105
- disposition: 'Optimistic',
106
- },
107
- {
108
- glyph: '∧',
109
- role: 'infix',
110
- capacity: 2,
111
- strength: 9,
112
- disposition: 'Optimistic',
113
- },
114
- {
115
- glyph: '=',
116
- role: 'infix',
117
- capacity: 2,
118
- strength: 9,
119
- disposition: 'Optimistic',
120
- },
121
-
122
- # -- OUTFIX
123
- {
124
- glyph: '(',
125
- role: 'lparen',
126
- capacity: 1,
127
- strength: 0,
128
- disposition: 'Pessimistic',
129
- ephemeral: true,
130
- sentinel: 'rparen',
131
- },
132
-
133
- # -- SENTINELS
134
- {
135
- glyph: ')',
136
- role: 'rparen',
137
- capacity: 1,
138
- strength: 12,
139
- disposition: 'Optimistic',
140
- },
141
- ]
142
10
  end
143
11
  end
@@ -1,3 +1,3 @@
1
1
  module Proinsias
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proinsias
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam W. Grant
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-14 00:00:00.000000000 Z
11
+ date: 2018-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -91,6 +91,8 @@ files:
91
91
  - lib/proinsias/configurations/configurations.rb
92
92
  - lib/proinsias/configurations/controller.rb
93
93
  - lib/proinsias/configurations/filter.rb
94
+ - lib/proinsias/configurations/form.rb
95
+ - lib/proinsias/configurations/particle.rb
94
96
  - lib/proinsias/parser/director.rb
95
97
  - lib/proinsias/parser/filter.rb
96
98
  - lib/proinsias/parser/parser.rb