equation 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/equation_grammar.rb +70 -62
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53d1c83fe0fc09f8b53b716aa8cc1f687f3040519db6c52e448c7bdb733f7994
|
4
|
+
data.tar.gz: 5ba7d927c960fb443f04943ee15d4e10dc2ac6adc2738a341c512947363fbf5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47dae82304f39aa3f198f8cbb310c76a31176bf048cba00c4d8985dc4a2650bd4bd5570668ec570fb39720d9dbde27b327a71b8f1a0a4e6ee04a37ae19cc3623
|
7
|
+
data.tar.gz: 8ba44fd1839addcf2979b0391bc09de22448fdc8d12c3291f4921167ac6ad6e63c1c39826aa79dc6fc58b734704f80c7d4ba6449be0c39a74c070f04b794960f
|
data/lib/equation_grammar.rb
CHANGED
@@ -71,17 +71,21 @@ module Equation
|
|
71
71
|
end
|
72
72
|
|
73
73
|
module Logical1
|
74
|
-
def
|
74
|
+
def space1
|
75
75
|
elements[0]
|
76
76
|
end
|
77
77
|
|
78
|
-
def
|
78
|
+
def lhs
|
79
79
|
elements[1]
|
80
80
|
end
|
81
81
|
|
82
|
-
def
|
82
|
+
def space2
|
83
83
|
elements[2]
|
84
84
|
end
|
85
|
+
|
86
|
+
def tail
|
87
|
+
elements[3]
|
88
|
+
end
|
85
89
|
end
|
86
90
|
|
87
91
|
module Logical2
|
@@ -110,78 +114,82 @@ module Equation
|
|
110
114
|
end
|
111
115
|
|
112
116
|
i0, s0 = index, []
|
113
|
-
|
114
|
-
|
115
|
-
if
|
116
|
-
|
117
|
-
|
118
|
-
else
|
119
|
-
r3 = _nt_additive
|
117
|
+
r1 = _nt_space
|
118
|
+
s0 << r1
|
119
|
+
if r1
|
120
|
+
i2 = index
|
121
|
+
r3 = _nt_boolean_and
|
120
122
|
if r3
|
121
123
|
r3 = SyntaxNode.new(input, (index-1)...index) if r3 == true
|
122
|
-
|
124
|
+
r2 = r3
|
123
125
|
else
|
124
|
-
|
125
|
-
|
126
|
+
r4 = _nt_additive
|
127
|
+
if r4
|
128
|
+
r4 = SyntaxNode.new(input, (index-1)...index) if r4 == true
|
129
|
+
r2 = r4
|
130
|
+
else
|
131
|
+
@index = i2
|
132
|
+
r2 = nil
|
133
|
+
end
|
126
134
|
end
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
s6 << r7
|
144
|
-
if r7
|
145
|
-
r8 = _nt_space
|
146
|
-
s6 << r8
|
135
|
+
s0 << r2
|
136
|
+
if r2
|
137
|
+
r5 = _nt_space
|
138
|
+
s0 << r5
|
139
|
+
if r5
|
140
|
+
s6, i6 = [], index
|
141
|
+
loop do
|
142
|
+
i7, s7 = index, []
|
143
|
+
if (match_len = has_terminal?('||', false, index))
|
144
|
+
r8 = instantiate_node(SyntaxNode,input, index...(index + match_len))
|
145
|
+
@index += match_len
|
146
|
+
else
|
147
|
+
terminal_parse_failure('\'||\'')
|
148
|
+
r8 = nil
|
149
|
+
end
|
150
|
+
s7 << r8
|
147
151
|
if r8
|
148
|
-
|
149
|
-
|
150
|
-
if
|
151
|
-
|
152
|
-
|
153
|
-
else
|
154
|
-
r11 = _nt_additive
|
152
|
+
r9 = _nt_space
|
153
|
+
s7 << r9
|
154
|
+
if r9
|
155
|
+
i10 = index
|
156
|
+
r11 = _nt_boolean_and
|
155
157
|
if r11
|
156
158
|
r11 = SyntaxNode.new(input, (index-1)...index) if r11 == true
|
157
|
-
|
159
|
+
r10 = r11
|
158
160
|
else
|
159
|
-
|
160
|
-
|
161
|
+
r12 = _nt_additive
|
162
|
+
if r12
|
163
|
+
r12 = SyntaxNode.new(input, (index-1)...index) if r12 == true
|
164
|
+
r10 = r12
|
165
|
+
else
|
166
|
+
@index = i10
|
167
|
+
r10 = nil
|
168
|
+
end
|
169
|
+
end
|
170
|
+
s7 << r10
|
171
|
+
if r10
|
172
|
+
r13 = _nt_space
|
173
|
+
s7 << r13
|
161
174
|
end
|
162
|
-
end
|
163
|
-
s6 << r9
|
164
|
-
if r9
|
165
|
-
r12 = _nt_space
|
166
|
-
s6 << r12
|
167
175
|
end
|
168
176
|
end
|
177
|
+
if s7.last
|
178
|
+
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
|
179
|
+
r7.extend(Logical0)
|
180
|
+
else
|
181
|
+
@index = i7
|
182
|
+
r7 = nil
|
183
|
+
end
|
184
|
+
if r7
|
185
|
+
s6 << r7
|
186
|
+
else
|
187
|
+
break
|
188
|
+
end
|
169
189
|
end
|
170
|
-
|
171
|
-
|
172
|
-
r6.extend(Logical0)
|
173
|
-
else
|
174
|
-
@index = i6
|
175
|
-
r6 = nil
|
176
|
-
end
|
177
|
-
if r6
|
178
|
-
s5 << r6
|
179
|
-
else
|
180
|
-
break
|
181
|
-
end
|
190
|
+
r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
|
191
|
+
s0 << r6
|
182
192
|
end
|
183
|
-
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
|
184
|
-
s0 << r5
|
185
193
|
end
|
186
194
|
end
|
187
195
|
if s0.last
|