plurimath 0.11.0 → 0.11.3
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 +4 -4
- data/.gitignore +3 -0
- data/.rubocop_todo.yml +311 -58
- data/Gemfile +3 -2
- data/README.adoc +331 -15
- data/lib/plurimath/asciimath/parse.rb +6 -1
- data/lib/plurimath/asciimath/transform.rb +2 -0
- data/lib/plurimath/base_number_prefix.rb +43 -0
- data/lib/plurimath/configuration.rb +9 -1
- data/lib/plurimath/deprecation.rb +2 -1
- data/lib/plurimath/errors/configuration_error.rb +5 -1
- data/lib/plurimath/errors/deprecation_error.rb +2 -1
- data/lib/plurimath/errors/evaluation/division_by_zero_error.rb +13 -0
- data/lib/plurimath/errors/evaluation/error.rb +9 -0
- data/lib/plurimath/errors/evaluation/invalid_binding_error.rb +14 -0
- data/lib/plurimath/errors/evaluation/invalid_binding_key_error.rb +14 -0
- data/lib/plurimath/errors/evaluation/math_domain_error.rb +9 -0
- data/lib/plurimath/errors/evaluation/missing_variable_error.rb +13 -0
- data/lib/plurimath/errors/evaluation/non_finite_result_error.rb +13 -0
- data/lib/plurimath/errors/evaluation/unsupported_expression_error.rb +13 -0
- data/lib/plurimath/errors/evaluation.rb +18 -0
- data/lib/plurimath/errors/invalid_number.rb +17 -0
- data/lib/plurimath/errors/unsupported_base.rb +18 -0
- data/lib/plurimath/errors/{formatter/unsupported_locale.rb → unsupported_locale.rb} +1 -1
- data/lib/plurimath/errors.rb +9 -0
- data/lib/plurimath/formatter/numbers/base_notation.rb +55 -27
- data/lib/plurimath/formatter/numbers/format_options.rb +123 -17
- data/lib/plurimath/formatter/numbers/formatted_notation.rb +62 -0
- data/lib/plurimath/formatter/numbers/formatted_number.rb +87 -0
- data/lib/plurimath/formatter/numbers/fraction.rb +8 -17
- data/lib/plurimath/formatter/numbers/integer.rb +3 -0
- data/lib/plurimath/formatter/numbers/mathml_renderer.rb +56 -0
- data/lib/plurimath/formatter/numbers/notation_renderer.rb +58 -28
- data/lib/plurimath/formatter/numbers/number_renderer.rb +26 -13
- data/lib/plurimath/formatter/numbers/omml_renderer.rb +74 -0
- data/lib/plurimath/formatter/numbers/precision_resolver.rb +16 -3
- data/lib/plurimath/formatter/numbers/sign_renderer.rb +2 -1
- data/lib/plurimath/formatter/numbers/significant.rb +4 -2
- data/lib/plurimath/formatter/numbers/source.rb +46 -6
- data/lib/plurimath/formatter/numbers/text_renderer.rb +52 -0
- data/lib/plurimath/formatter/numbers.rb +6 -2
- data/lib/plurimath/formatter/standard.rb +6 -0
- data/lib/plurimath/formatter/supported_locales.rb +1 -1
- data/lib/plurimath/formatter.rb +0 -2
- data/lib/plurimath/html/parse.rb +5 -0
- data/lib/plurimath/html/transform.rb +26 -12
- data/lib/plurimath/latex/parse.rb +5 -0
- data/lib/plurimath/latex/transform.rb +2 -0
- data/lib/plurimath/math/core.rb +69 -14
- data/lib/plurimath/math/evaluation/evaluator.rb +147 -0
- data/lib/plurimath/math/evaluation/expression_parser.rb +215 -0
- data/lib/plurimath/math/evaluation/iteration.rb +63 -0
- data/lib/plurimath/math/evaluation.rb +13 -0
- data/lib/plurimath/math/formula.rb +9 -0
- data/lib/plurimath/math/function/abs.rb +4 -0
- data/lib/plurimath/math/function/arccos.rb +4 -0
- data/lib/plurimath/math/function/arcsin.rb +4 -0
- data/lib/plurimath/math/function/arctan.rb +4 -0
- data/lib/plurimath/math/function/ceil.rb +4 -0
- data/lib/plurimath/math/function/cos.rb +4 -0
- data/lib/plurimath/math/function/cosh.rb +4 -0
- data/lib/plurimath/math/function/cot.rb +4 -0
- data/lib/plurimath/math/function/coth.rb +4 -0
- data/lib/plurimath/math/function/csc.rb +4 -0
- data/lib/plurimath/math/function/csch.rb +4 -0
- data/lib/plurimath/math/function/exp.rb +4 -0
- data/lib/plurimath/math/function/fenced.rb +4 -0
- data/lib/plurimath/math/function/floor.rb +4 -0
- data/lib/plurimath/math/function/frac.rb +7 -0
- data/lib/plurimath/math/function/gcd.rb +9 -0
- data/lib/plurimath/math/function/lcm.rb +9 -0
- data/lib/plurimath/math/function/lg.rb +4 -0
- data/lib/plurimath/math/function/ln.rb +4 -0
- data/lib/plurimath/math/function/log.rb +19 -0
- data/lib/plurimath/math/function/max.rb +4 -0
- data/lib/plurimath/math/function/min.rb +4 -0
- data/lib/plurimath/math/function/mod.rb +15 -0
- data/lib/plurimath/math/function/overleftrightarrow.rb +2 -2
- data/lib/plurimath/math/function/power.rb +10 -0
- data/lib/plurimath/math/function/prod.rb +10 -0
- data/lib/plurimath/math/function/root.rb +7 -0
- data/lib/plurimath/math/function/sec.rb +4 -0
- data/lib/plurimath/math/function/sech.rb +4 -0
- data/lib/plurimath/math/function/sin.rb +4 -0
- data/lib/plurimath/math/function/sinh.rb +4 -0
- data/lib/plurimath/math/function/sqrt.rb +4 -0
- data/lib/plurimath/math/function/sum.rb +10 -0
- data/lib/plurimath/math/function/tan.rb +4 -0
- data/lib/plurimath/math/function/tanh.rb +4 -0
- data/lib/plurimath/math/function/text.rb +17 -0
- data/lib/plurimath/math/number.rb +44 -23
- data/lib/plurimath/math/symbols/cdot.rb +4 -0
- data/lib/plurimath/math/symbols/div.rb +4 -0
- data/lib/plurimath/math/symbols/hat.rb +4 -0
- data/lib/plurimath/math/symbols/minus.rb +4 -0
- data/lib/plurimath/math/symbols/pi.rb +5 -1
- data/lib/plurimath/math/symbols/plus.rb +4 -0
- data/lib/plurimath/math/symbols/slash.rb +4 -0
- data/lib/plurimath/math/symbols/symbol.rb +45 -0
- data/lib/plurimath/math/symbols/times.rb +4 -0
- data/lib/plurimath/math.rb +5 -1
- data/lib/plurimath/mathml/constants.rb +18 -0
- data/lib/plurimath/number_formatter.rb +63 -3
- data/lib/plurimath/omml/formula_transformation.rb +2 -1
- data/lib/plurimath/omml/translator.rb +4 -1
- data/lib/plurimath/setup/opal.rb.erb +13 -0
- data/lib/plurimath/unicode_math/parse.rb +98 -54
- data/lib/plurimath/unicode_math/parser.rb +7 -4
- data/lib/plurimath/unicode_math/parsing_rules/absence_rules.rb +33 -21
- data/lib/plurimath/unicode_math/parsing_rules/common_rules.rb +28 -16
- data/lib/plurimath/unicode_math/parsing_rules/constants_rules.rb +18 -7
- data/lib/plurimath/unicode_math/parsing_rules/masked.rb +35 -15
- data/lib/plurimath/unicode_math/parsing_rules/sub_sup.rb +98 -72
- data/lib/plurimath/unicode_math/transform.rb +1 -0
- data/lib/plurimath/utility.rb +1 -1
- data/lib/plurimath/version.rb +1 -1
- data/lib/plurimath.rb +2 -0
- metadata +24 -5
- data/lib/plurimath/errors/formatter/unsupported_base.rb +0 -21
- data/lib/plurimath/formatter/numbers/parts_renderer.rb +0 -30
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
module Plurimath
|
|
4
4
|
class UnicodeMath
|
|
5
5
|
class Parse < Parslet::Parser
|
|
6
|
+
include Plurimath::BaseNumberPrefix::Parser
|
|
6
7
|
include ParsingRules::Masked
|
|
7
8
|
include ParsingRules::SubSup
|
|
8
9
|
include ParsingRules::CommonRules
|
|
@@ -12,8 +13,10 @@ module Plurimath
|
|
|
12
13
|
rule(:an) { an_math | an_other }
|
|
13
14
|
rule(:box) { str("□") >> operand }
|
|
14
15
|
|
|
15
|
-
rule(:char) {
|
|
16
|
-
rule(:rows)
|
|
16
|
+
rule(:char) { absent_chars >> unicode.as(:unicode_symbols) }
|
|
17
|
+
rule(:rows) do
|
|
18
|
+
(str("@").as(:tr) >> space? >> rows.as(:trs).maybe) | (row.as(:tr) >> space? >> str("@") >> space? >> rows.as(:trs).maybe) | row.as(:tr)
|
|
19
|
+
end
|
|
17
20
|
|
|
18
21
|
rule(:space) { match(/\s/).repeat(1) | invisible_times }
|
|
19
22
|
rule(:other) { other_absent >> alphanumeric.as(:symbol) }
|
|
@@ -25,43 +28,81 @@ module Plurimath
|
|
|
25
28
|
rule(:n_ascii) { match["0-9"].repeat(1).as(:number) }
|
|
26
29
|
rule(:a_ascii) { match["A-Za-z"].repeat(1).as(:symbol) }
|
|
27
30
|
rule(:unicode) { str("&#x") >> match["0-9a-fA-F"].repeat >> str(";") }
|
|
28
|
-
rule(:an_math)
|
|
31
|
+
rule(:an_math) do
|
|
32
|
+
space.absent? >> match("[\u{1D400}-\u{1D7FF}\u{2102}-\u{2134}]")
|
|
33
|
+
end
|
|
29
34
|
|
|
30
|
-
rule(:td_value)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
rule(:
|
|
35
|
+
rule(:td_value) do
|
|
36
|
+
expression.as(:exp) >> space? >> td_value.as(:expr).maybe
|
|
37
|
+
end
|
|
38
|
+
rule(:an_other) do
|
|
39
|
+
(an_math | n_ascii).absent? >> alphanumeric.as(:alphanumeric)
|
|
40
|
+
end
|
|
41
|
+
rule(:function) do
|
|
42
|
+
root_functions | box | hbrack | arg_function | intent_function
|
|
43
|
+
end
|
|
44
|
+
rule(:op_array) do
|
|
45
|
+
op_matrixs | op_prefixed_matrixs | str("&") | str("") | str("\\array")
|
|
46
|
+
end
|
|
34
47
|
|
|
35
|
-
rule(:op_opener)
|
|
36
|
-
|
|
48
|
+
rule(:op_opener) do
|
|
49
|
+
open_paren | op_open_unicode | op_open_paren | op_open
|
|
50
|
+
end
|
|
51
|
+
rule(:op_closer) do
|
|
52
|
+
op_close_unicode | close_paren | op_close_paren | op_close
|
|
53
|
+
end
|
|
37
54
|
|
|
38
55
|
rule(:op_decimal) { decimal_marker | str(",") | str(".") }
|
|
39
|
-
rule(:diacritics)
|
|
40
|
-
|
|
56
|
+
rule(:diacritics) do
|
|
57
|
+
(char.as(:char) >> diacritics.as(:diacritics)) | char.as(:char)
|
|
58
|
+
end
|
|
59
|
+
rule(:open_paren) do
|
|
60
|
+
(op_masked_open >> (op_closer | op_opener)).as(:open_paren) | op_masked_open
|
|
61
|
+
end
|
|
41
62
|
|
|
42
|
-
rule(:matrix_only)
|
|
43
|
-
|
|
63
|
+
rule(:matrix_only) do
|
|
64
|
+
non_matrixs_absence? >> (op_matrixs | op_prefixed_matrixs)
|
|
65
|
+
end
|
|
66
|
+
rule(:close_paren) do
|
|
67
|
+
(op_masked_close >> (op_opener | op_closer)).as(:close_paren) | op_masked_close
|
|
68
|
+
end
|
|
44
69
|
|
|
45
70
|
rule(:diacriticbase) { an | n_ascii }
|
|
46
71
|
rule(:forward_slash) { str("/") | str("/") | str("⁄") }
|
|
47
72
|
|
|
48
73
|
rule(:root_functions) { qdrt | cbrt | sqrt | binary_root | nthrt }
|
|
49
74
|
rule(:op_over_choose) { (str("\\choose") | str("⒞")).as(:choose) }
|
|
50
|
-
rule(:op_masked_open)
|
|
75
|
+
rule(:op_masked_open) do
|
|
76
|
+
(str("\\left") | str("\\open") | str("├")).as(:paren_open_prefix) >> digits.as(:open_paren_mask).maybe
|
|
77
|
+
end
|
|
51
78
|
|
|
52
|
-
rule(:invisible_times)
|
|
79
|
+
rule(:invisible_times) do
|
|
80
|
+
str("⁢") | str("⁡") | str(" ") | (str("\\itimes") >> space?)
|
|
81
|
+
end
|
|
53
82
|
|
|
54
|
-
rule(:ordinary_symbols)
|
|
83
|
+
rule(:ordinary_symbols) do
|
|
84
|
+
op_ordinary_symbols | op_prefixed_ordinary_symbols
|
|
85
|
+
end
|
|
55
86
|
rule(:interval_a_ascii) { match["A-Za-z"].as(:symbol).repeat(1) }
|
|
56
87
|
|
|
57
|
-
rule(:negatable_symbols)
|
|
58
|
-
|
|
88
|
+
rule(:negatable_symbols) do
|
|
89
|
+
(forward_slash >> negated) | (negated >> str("̸"))
|
|
90
|
+
end
|
|
91
|
+
rule(:invisible_unicode) do
|
|
92
|
+
str("▒") | (str("\\naryand") | (str("\\of") >> space?))
|
|
93
|
+
end
|
|
59
94
|
|
|
60
95
|
rule(:invisible_unicode?) { invisible_unicode.maybe }
|
|
61
|
-
rule(:relational_symbols)
|
|
96
|
+
rule(:relational_symbols) do
|
|
97
|
+
op_relational_unicode | op_relational_symbols
|
|
98
|
+
end
|
|
62
99
|
|
|
63
|
-
rule(:hbrack_power_base_check)
|
|
64
|
-
|
|
100
|
+
rule(:hbrack_power_base_check) do
|
|
101
|
+
(sub_sup_operand >> (power_symbol | base_symbol)).present?
|
|
102
|
+
end
|
|
103
|
+
rule(:spaced_bracketed_operand) do
|
|
104
|
+
operand >> space? >> spaced_bracketed_operand.as(:expr).maybe
|
|
105
|
+
end
|
|
65
106
|
|
|
66
107
|
rule(:hbrack) do
|
|
67
108
|
(op_h_brackets >> str("(").present? >> exp_bracket.as(:first_value)) |
|
|
@@ -76,15 +117,15 @@ module Plurimath
|
|
|
76
117
|
op_prefixed_ordinary_negated |
|
|
77
118
|
op_ordinary_negated |
|
|
78
119
|
binary_negated |
|
|
79
|
-
absent_negated_unicodes >> unicode.as(:negated_operator)
|
|
120
|
+
(absent_negated_unicodes >> unicode.as(:negated_operator))
|
|
80
121
|
)
|
|
81
122
|
end
|
|
82
123
|
|
|
83
124
|
rule(:op_over) do
|
|
84
125
|
str("⁄").as(:bevelled) |
|
|
85
|
-
slash >> (str("sdiv") | str("sdivide") | str("sfrac")).as(:bevelled) |
|
|
126
|
+
(slash >> (str("sdiv") | str("sdivide") | str("sfrac")).as(:bevelled)) |
|
|
86
127
|
str("⊘").as(:no_display_style) |
|
|
87
|
-
slash >> (str("ndiv") | str("oslash")).as(:no_display_style) |
|
|
128
|
+
(slash >> (str("ndiv") | str("oslash")).as(:no_display_style)) |
|
|
88
129
|
(str("∕") | str("\\ldiv")).as(:ldiv) |
|
|
89
130
|
forward_slash |
|
|
90
131
|
str("\\over") |
|
|
@@ -95,14 +136,14 @@ module Plurimath
|
|
|
95
136
|
end
|
|
96
137
|
|
|
97
138
|
rule(:element_exp_script_validation?) do
|
|
98
|
-
((
|
|
139
|
+
((op_unary_functions | unary_arg_functions).absent? >> atom.as(:factor).maybe) >> (mini_sub_sup_present? >> operator >> mini_fraction.present?).absent?
|
|
99
140
|
end
|
|
100
141
|
|
|
101
142
|
rule(:spaced_exp_bracket) do
|
|
102
|
-
expression >> space? >> spaced_exp_bracket.as(:exp) |
|
|
103
|
-
mid_symbols >> space? >> spaced_exp_bracket.as(:expr) |
|
|
104
|
-
str("−").as(:symbol) >> space? >> spaced_exp_bracket.as(:expr) |
|
|
105
|
-
expression >> space?
|
|
143
|
+
(expression >> space? >> spaced_exp_bracket.as(:exp)) |
|
|
144
|
+
(mid_symbols >> space? >> spaced_exp_bracket.as(:expr)) |
|
|
145
|
+
(str("−").as(:symbol) >> space? >> spaced_exp_bracket.as(:expr)) |
|
|
146
|
+
(expression >> space?)
|
|
106
147
|
end
|
|
107
148
|
|
|
108
149
|
rule(:row) do
|
|
@@ -117,21 +158,24 @@ module Plurimath
|
|
|
117
158
|
end
|
|
118
159
|
|
|
119
160
|
rule(:slashed_operator) do
|
|
120
|
-
absent_slashed_values >> str("\\") >> (str("\\") | unicode | (n_ascii | a_ascii).repeat(1) | any).as(:slashed_value) |
|
|
121
|
-
absent_slashed_values >> str("\\").as(:slashed_value)
|
|
161
|
+
(absent_slashed_values >> str("\\") >> (str("\\") | unicode | (n_ascii | a_ascii).repeat(1) | any).as(:slashed_value)) |
|
|
162
|
+
(absent_slashed_values >> str("\\").as(:slashed_value))
|
|
122
163
|
end
|
|
123
164
|
|
|
124
165
|
rule(:number) do
|
|
125
|
-
|
|
166
|
+
hex_number |
|
|
167
|
+
binary_number |
|
|
168
|
+
octal_number |
|
|
169
|
+
(digits.as(:whole) >> op_decimal.as(:decimal) >> digits.as(:fractional)).as(:decimal_number) |
|
|
126
170
|
(op_decimal.as(:decimal) >> digits.as(:whole) >> space?).as(:decimal_number) |
|
|
127
171
|
digits.as(:digit)
|
|
128
172
|
end
|
|
129
173
|
|
|
130
174
|
rule(:numerator) do
|
|
131
|
-
(relational_symbols.absent? | exp_script.present?) >>
|
|
175
|
+
(relational_symbols.absent? | exp_script.present?) >> (
|
|
132
176
|
(unary_arg_functions >> numerator.as(:recursive_numerator).maybe) |
|
|
133
|
-
((absent_numerator_exp_script? >> op_nary.absent?) >> mini_fraction_exp_script_absent? >> exp_script >> space) >> numerator.as(:recursive_numerator).maybe |
|
|
134
|
-
(absent_numerator_exp_script? >> mini_fraction_exp_script_absent? >> exp_script) >> numerator.as(:recursive_numerator).maybe |
|
|
177
|
+
(((absent_numerator_exp_script? >> op_nary.absent?) >> mini_fraction_exp_script_absent? >> exp_script >> space) >> numerator.as(:recursive_numerator).maybe) |
|
|
178
|
+
((absent_numerator_exp_script? >> mini_fraction_exp_script_absent? >> exp_script) >> numerator.as(:recursive_numerator).maybe) |
|
|
135
179
|
(accents.as(:base) >> accents_subsup).as(:accents_subsup) |
|
|
136
180
|
sub_paren |
|
|
137
181
|
sup_paren |
|
|
@@ -139,7 +183,7 @@ module Plurimath
|
|
|
139
183
|
unary_arg_functions |
|
|
140
184
|
(frac_binary_absent >> numerator.as(:recursive_numerator)) |
|
|
141
185
|
(factor >> frac_binary_absent.maybe >> numerator.as(:recursive_numerator).maybe) |
|
|
142
|
-
operator.absent? >> operand >> frac_binary_absent.maybe |
|
|
186
|
+
(operator.absent? >> operand >> frac_binary_absent.maybe) |
|
|
143
187
|
frac_binary_absent
|
|
144
188
|
)
|
|
145
189
|
end
|
|
@@ -172,9 +216,9 @@ module Plurimath
|
|
|
172
216
|
end
|
|
173
217
|
|
|
174
218
|
rule(:interval_exp_bracket) do
|
|
175
|
-
str("(").as(:open_paren) >> interval_value.as(:left_value) >> str(",").as(:comma) >> interval_value.as(:right_value) >> str("]").as(:close_paren) |
|
|
176
|
-
|
|
177
|
-
|
|
219
|
+
(str("(").as(:open_paren) >> interval_value.as(:left_value) >> str(",").as(:comma) >> interval_value.as(:right_value) >> str("]").as(:close_paren)) |
|
|
220
|
+
(str("[").as(:open_paren) >> interval_value.as(:left_value) >> str(",").as(:comma) >> interval_value.as(:right_value) >> str(")").as(:close_paren)) |
|
|
221
|
+
((str("[") | str("]")).as(:open_paren) >> interval_value.as(:left_value) >> str(",").as(:comma) >> interval_value.as(:right_value) >> (str("[") | str("]")).as(:close_paren))
|
|
178
222
|
end
|
|
179
223
|
|
|
180
224
|
rule(:interval_value) do
|
|
@@ -191,15 +235,15 @@ module Plurimath
|
|
|
191
235
|
end
|
|
192
236
|
|
|
193
237
|
rule(:denominator) do
|
|
194
|
-
operator.absent? >> fraction.as(:frac) |
|
|
238
|
+
(operator.absent? >> fraction.as(:frac)) |
|
|
195
239
|
exp_script |
|
|
196
240
|
sub_paren |
|
|
197
241
|
sup_paren |
|
|
198
|
-
frac_binary_absent >> invisible_times.maybe >> relational_symbols.absent? >> denominator.as(:recursive_denominator) |
|
|
199
|
-
operator.absent? >> factor >> invisible_times.maybe >> relational_symbols.absent? >> denominator.as(:recursive_denominator) |
|
|
200
|
-
operator.absent? >> operand >> invisible_times.maybe >> relational_symbols.absent? >> denominator.as(:recursive_denominator) |
|
|
242
|
+
(frac_binary_absent >> invisible_times.maybe >> relational_symbols.absent? >> denominator.as(:recursive_denominator)) |
|
|
243
|
+
(operator.absent? >> factor >> invisible_times.maybe >> relational_symbols.absent? >> denominator.as(:recursive_denominator)) |
|
|
244
|
+
(operator.absent? >> operand >> invisible_times.maybe >> relational_symbols.absent? >> denominator.as(:recursive_denominator)) |
|
|
201
245
|
frac_binary_absent |
|
|
202
|
-
operator.absent? >> operand
|
|
246
|
+
(operator.absent? >> operand)
|
|
203
247
|
end
|
|
204
248
|
|
|
205
249
|
rule(:op_masked_close) do
|
|
@@ -207,10 +251,10 @@ module Plurimath
|
|
|
207
251
|
end
|
|
208
252
|
|
|
209
253
|
rule(:element) do
|
|
210
|
-
accents.present? >> (accents.as(:base) >> accents_subsup).as(:accents_subsup) |
|
|
211
|
-
accents.present? >> fraction.as(:frac) |
|
|
254
|
+
(accents.present? >> (accents.as(:base) >> accents_subsup).as(:accents_subsup)) |
|
|
255
|
+
(accents.present? >> fraction.as(:frac)) |
|
|
212
256
|
((op_unary_functions | unary_arg_functions).present? >> fraction.as(:frac)) |
|
|
213
|
-
mini_sub_sup_present? >> operator >> mini_fraction.as(:frac) |
|
|
257
|
+
(mini_sub_sup_present? >> operator >> mini_fraction.as(:frac)) |
|
|
214
258
|
accents |
|
|
215
259
|
diacritics_accents |
|
|
216
260
|
op_unicode_fractions |
|
|
@@ -218,7 +262,7 @@ module Plurimath
|
|
|
218
262
|
monospace_fonts |
|
|
219
263
|
array |
|
|
220
264
|
exp_script |
|
|
221
|
-
element_exp_script_validation? >> space? >> exp_script |
|
|
265
|
+
(element_exp_script_validation? >> space? >> exp_script) |
|
|
222
266
|
unary_arg_functions |
|
|
223
267
|
combined_symbols |
|
|
224
268
|
wrapper_symbols |
|
|
@@ -232,13 +276,13 @@ module Plurimath
|
|
|
232
276
|
end
|
|
233
277
|
|
|
234
278
|
rule(:expression) do
|
|
235
|
-
element >> other.as(:other) >> expression.as(:expr) |
|
|
236
|
-
element >> relational_symbols >> expression.as(:expr).maybe |
|
|
279
|
+
(element >> other.as(:other) >> expression.as(:expr)) |
|
|
280
|
+
(element >> relational_symbols >> expression.as(:expr).maybe) |
|
|
237
281
|
element |
|
|
238
|
-
element >> space? >> expression.as(:expr) |
|
|
239
|
-
slashed_operator >> space? >> expression.as(:expr).maybe |
|
|
240
|
-
element >> space? >> expression.as(:expr) >> space? >> expression.as(:expression).maybe |
|
|
241
|
-
mini_values >> space? >> expression.as(:expr).maybe
|
|
282
|
+
(element >> space? >> expression.as(:expr)) |
|
|
283
|
+
(slashed_operator >> space? >> expression.as(:expr).maybe) |
|
|
284
|
+
(element >> space? >> expression.as(:expr) >> space? >> expression.as(:expression).maybe) |
|
|
285
|
+
(mini_values >> space? >> expression.as(:expr).maybe)
|
|
242
286
|
end
|
|
243
287
|
|
|
244
288
|
root :expression
|
|
@@ -13,8 +13,11 @@ module Plurimath
|
|
|
13
13
|
@text = @text.gsub("&", "&")
|
|
14
14
|
@text = @text.gsub(""", "\"")
|
|
15
15
|
@text = @text.gsub(/⫷.*⫸/, "")
|
|
16
|
-
@text = @text.gsub(
|
|
17
|
-
@text =
|
|
16
|
+
@text = @text.gsub("\\\\", "\\")
|
|
17
|
+
@text = # Converting \u#{xxxx} encoding to &#x#{xxxx};
|
|
18
|
+
@text.gsub(/\\u([\da-fA-F]{1,5})\w{0,5}/) do
|
|
19
|
+
"&#x#{$1};"
|
|
20
|
+
end
|
|
18
21
|
@text = @text.strip
|
|
19
22
|
end
|
|
20
23
|
|
|
@@ -33,7 +36,7 @@ module Plurimath
|
|
|
33
36
|
def post_processing(tree)
|
|
34
37
|
{
|
|
35
38
|
labeled_tr_value: tree,
|
|
36
|
-
labeled_tr_id: @splitted
|
|
39
|
+
labeled_tr_id: @splitted,
|
|
37
40
|
}
|
|
38
41
|
end
|
|
39
42
|
|
|
@@ -41,7 +44,7 @@ module Plurimath
|
|
|
41
44
|
text unless text.include?("#") && !text.match?(LABELED_TR_REGEX)
|
|
42
45
|
|
|
43
46
|
text = text.gsub(/✎\(.*(\#).*\)/) do |str|
|
|
44
|
-
str
|
|
47
|
+
str.gsub("#", "\"replacement\"")
|
|
45
48
|
end
|
|
46
49
|
splitted = text.split("#")
|
|
47
50
|
splitted[0] = splitted.first.gsub("\"replacement\"", "#")
|
|
@@ -6,19 +6,31 @@ module Plurimath
|
|
|
6
6
|
module AbsenceRules
|
|
7
7
|
include Helper
|
|
8
8
|
|
|
9
|
-
rule(:frac_binary_absent)
|
|
9
|
+
rule(:frac_binary_absent) do
|
|
10
|
+
frac_binary_absent_symbols? >> binary_symbols
|
|
11
|
+
end
|
|
10
12
|
|
|
11
|
-
rule(:non_matrixs_absence?)
|
|
13
|
+
rule(:non_matrixs_absence?) do
|
|
14
|
+
(str("eqarray") | str("█") | str("cases") | str("Ⓒ")).absent?
|
|
15
|
+
end
|
|
12
16
|
|
|
13
|
-
rule(:sub_sup_binary_absent)
|
|
17
|
+
rule(:sub_sup_binary_absent) do
|
|
18
|
+
((slash >> str("times")) | str("×")).absent? >> binary_symbols
|
|
19
|
+
end
|
|
14
20
|
|
|
15
21
|
rule(:absent_negated_unicodes) { sqrt_symbols | root_symbols }
|
|
16
22
|
|
|
17
|
-
rule(:frac_binary_absent_symbols?)
|
|
23
|
+
rule(:frac_binary_absent_symbols?) do
|
|
24
|
+
((slash >> (str("times") | str("neq") | str("ne"))) | (str("×") | str("≠"))).absent?
|
|
25
|
+
end
|
|
18
26
|
|
|
19
|
-
rule(:binary_negated_absent_symbols?)
|
|
27
|
+
rule(:binary_negated_absent_symbols?) do
|
|
28
|
+
((slash >> str("dd")) | str("ⅆ")).absent?
|
|
29
|
+
end
|
|
20
30
|
|
|
21
|
-
rule(:mini_fraction_exp_script_absent?)
|
|
31
|
+
rule(:mini_fraction_exp_script_absent?) do
|
|
32
|
+
(operator >> mini_fraction).absent?
|
|
33
|
+
end
|
|
22
34
|
|
|
23
35
|
rule(:absent_chars) do
|
|
24
36
|
(
|
|
@@ -86,28 +98,28 @@ module Plurimath
|
|
|
86
98
|
op_prefixed_ordinary_symbols |
|
|
87
99
|
op_binary_symbols_prefixed |
|
|
88
100
|
op_prefixed_unary_symbols |
|
|
89
|
-
slash >> str("backcolor") |
|
|
90
|
-
slash >> str("naryand") |
|
|
91
|
-
slash >> str("sdivide") |
|
|
92
|
-
slash >> str("oslash") |
|
|
93
|
-
slash >> str("color") |
|
|
101
|
+
(slash >> str("backcolor")) |
|
|
102
|
+
(slash >> str("naryand")) |
|
|
103
|
+
(slash >> str("sdivide")) |
|
|
104
|
+
(slash >> str("oslash")) |
|
|
105
|
+
(slash >> str("color")) |
|
|
94
106
|
op_relational_symbols |
|
|
95
107
|
op_h_bracket_prefixed |
|
|
96
108
|
op_alphanumeric_fonts |
|
|
97
109
|
skip_symbols_prefixed |
|
|
98
|
-
slash >> str("sfrac") |
|
|
99
|
-
slash >> str("rect") |
|
|
100
|
-
slash >> str("sqrt") |
|
|
101
|
-
slash >> str("qdrt") |
|
|
102
|
-
slash >> str("cbrt") |
|
|
103
|
-
slash >> str("root") |
|
|
104
|
-
slash >> str("sdiv") |
|
|
105
|
-
slash >> str("ndiv") |
|
|
106
|
-
slash >> str("ldiv") |
|
|
110
|
+
(slash >> str("sfrac")) |
|
|
111
|
+
(slash >> str("rect")) |
|
|
112
|
+
(slash >> str("sqrt")) |
|
|
113
|
+
(slash >> str("qdrt")) |
|
|
114
|
+
(slash >> str("cbrt")) |
|
|
115
|
+
(slash >> str("root")) |
|
|
116
|
+
(slash >> str("sdiv")) |
|
|
117
|
+
(slash >> str("ndiv")) |
|
|
118
|
+
(slash >> str("ldiv")) |
|
|
107
119
|
op_prefixed_matrixs |
|
|
108
120
|
op_binary_symbols_prefixed |
|
|
109
121
|
op_prefixed_negated |
|
|
110
|
-
slash >> str("mid") |
|
|
122
|
+
(slash >> str("mid")) |
|
|
111
123
|
op_accent_prefixed |
|
|
112
124
|
prefixed_primes |
|
|
113
125
|
op_nary_text |
|
|
@@ -7,22 +7,34 @@ module Plurimath
|
|
|
7
7
|
include Helper
|
|
8
8
|
|
|
9
9
|
rule(:atom) { (diacritics >> diacriticbase.maybe) | an }
|
|
10
|
-
rule(:atoms) {
|
|
10
|
+
rule(:atoms) { atom.as(:atom) >> atoms.as(:atoms).maybe }
|
|
11
11
|
rule(:entity) { atoms | number }
|
|
12
12
|
|
|
13
13
|
rule(:operator) { match["-+*=.?:,`"].as(:operator) }
|
|
14
|
-
rule(:op_unary)
|
|
14
|
+
rule(:op_unary) do
|
|
15
|
+
op_prefixed_unary_arg_functions | op_unary_arg_functions | op_prefixed_unary_symbols | op_unary_symbols
|
|
16
|
+
end
|
|
15
17
|
|
|
16
|
-
rule(:mid_symbols)
|
|
18
|
+
rule(:mid_symbols) do
|
|
19
|
+
(slash >> str("mid").as(:mid_symbol)) | str("∣").as(:mid_symbol)
|
|
20
|
+
end
|
|
17
21
|
|
|
18
22
|
rule(:unary_spaces) { space | invisible_unicode }
|
|
19
23
|
rule(:custom_fonts) { str("double") | str("fraktur") | str("script") }
|
|
20
|
-
rule(:parsing_text)
|
|
21
|
-
|
|
24
|
+
rule(:parsing_text) do
|
|
25
|
+
str("\"") >> match("[^\"]").repeat(1).as(:text) >> str("\"")
|
|
26
|
+
end
|
|
27
|
+
rule(:alphanumeric) do
|
|
28
|
+
match("[\u{0041}-\u{005A}\u{0061}-\u{007A}\u{0391}-\u{2207}\u{3B1}-\u{3DD}\u{30}-\u{39}]")
|
|
29
|
+
end
|
|
22
30
|
|
|
23
31
|
rule(:op_h_brackets) { op_h_bracket | op_h_bracket_prefixed }
|
|
24
|
-
rule(:nary_functions)
|
|
25
|
-
|
|
32
|
+
rule(:nary_functions) do
|
|
33
|
+
(op_unary >> unary_spaces.maybe) | (op_unary_functions >> unary_spaces)
|
|
34
|
+
end
|
|
35
|
+
rule(:exclamation_symbols) do
|
|
36
|
+
(str("!") | str("!!")).as(:exclamation_symbol)
|
|
37
|
+
end
|
|
26
38
|
rule(:exclamation_symbols?) { exclamation_symbols.maybe }
|
|
27
39
|
|
|
28
40
|
rule(:mini_fraction) do
|
|
@@ -36,15 +48,15 @@ module Plurimath
|
|
|
36
48
|
rule(:fraction) do
|
|
37
49
|
mini_fraction |
|
|
38
50
|
binomial_fraction |
|
|
39
|
-
numerator.as(:numerator) >> space? >> (negatable_symbols.absent? >> op_over) >> space? >> denominator.as(:denominator)
|
|
51
|
+
(numerator.as(:numerator) >> space? >> (negatable_symbols.absent? >> op_over) >> space? >> denominator.as(:denominator))
|
|
40
52
|
end
|
|
41
53
|
|
|
42
54
|
rule(:fonts) do
|
|
43
55
|
unicoded_fonts |
|
|
44
|
-
str("\\") >> custom_fonts.as(:unicoded_font_class) >> str("H").as(:symbol) |
|
|
45
|
-
str("\\") >> str("mitBbb").as(:unicoded_font_class) >> match(/D|d|e|i|j/).as(:symbol)|
|
|
46
|
-
op_fonts >> match["A-Za-z"].as(:symbol) |
|
|
47
|
-
op_alphanumeric_fonts >> (match["A-Za-z"].as(:symbol) | match("[0-9]").as(:number))
|
|
56
|
+
(str("\\") >> custom_fonts.as(:unicoded_font_class) >> str("H").as(:symbol)) |
|
|
57
|
+
(str("\\") >> str("mitBbb").as(:unicoded_font_class) >> match(/D|d|e|i|j/).as(:symbol)) |
|
|
58
|
+
(op_fonts >> match["A-Za-z"].as(:symbol)) |
|
|
59
|
+
(op_alphanumeric_fonts >> (match["A-Za-z"].as(:symbol) | match("[0-9]").as(:number)))
|
|
48
60
|
end
|
|
49
61
|
|
|
50
62
|
rule(:unary_arg_functions) do
|
|
@@ -52,7 +64,7 @@ module Plurimath
|
|
|
52
64
|
(nary_functions >> space? >> (exp_bracket | soperand).as(:first_value)).as(:unary_function)
|
|
53
65
|
end
|
|
54
66
|
|
|
55
|
-
rule(:accents)
|
|
67
|
+
rule(:accents) do
|
|
56
68
|
(exp_bracket.as(:intermediate_exp).as(:first_value) >> str(" ").maybe >> repeated_accent_symbols).as(:accents) |
|
|
57
69
|
(str(" ").absent? >> factor.as(:first_value) >> str(" ").maybe >> repeated_accent_symbols).as(:accents)
|
|
58
70
|
end
|
|
@@ -65,12 +77,12 @@ module Plurimath
|
|
|
65
77
|
end
|
|
66
78
|
|
|
67
79
|
rule(:repeated_accent_symbols) do
|
|
68
|
-
(op_accent | op_accent_prefixed).repeat(1) >> prime_symbols.maybe |
|
|
80
|
+
((op_accent | op_accent_prefixed).repeat(1) >> prime_symbols.maybe) |
|
|
69
81
|
prime_symbols
|
|
70
82
|
end
|
|
71
83
|
|
|
72
84
|
rule(:prime_symbols) do
|
|
73
|
-
((slash >> prefixed_primes.as(:prefixed_prime) | primes).repeat(1).as(:prime_accent_symbols)
|
|
85
|
+
((slash >> prefixed_primes.as(:prefixed_prime)) | primes).repeat(1).as(:prime_accent_symbols)
|
|
74
86
|
end
|
|
75
87
|
|
|
76
88
|
rule(:operand) do
|
|
@@ -94,7 +106,7 @@ module Plurimath
|
|
|
94
106
|
monospace_fonts |
|
|
95
107
|
relational_symbols |
|
|
96
108
|
unary_arg_functions |
|
|
97
|
-
op_unary_functions >> unary_spaces >> (operand | exp_bracket).absent? |
|
|
109
|
+
(op_unary_functions >> unary_spaces >> (operand | exp_bracket).absent?) |
|
|
98
110
|
wrapper_symbols |
|
|
99
111
|
ordinary_symbols |
|
|
100
112
|
negatable_symbols |
|
|
@@ -8,7 +8,9 @@ module Plurimath
|
|
|
8
8
|
|
|
9
9
|
rule(:slash) { str("\\") }
|
|
10
10
|
rule(:slash?) { slash.maybe }
|
|
11
|
-
rule(:primes)
|
|
11
|
+
rule(:primes) do
|
|
12
|
+
str("⁗") | str("‴") | str("″") | str("′") | str("'") | str("'")
|
|
13
|
+
end
|
|
12
14
|
|
|
13
15
|
rule(:op_open) { slash >> arr_to_expression(Constants::OPEN_SYMBOLS.keys, :open_paren) }
|
|
14
16
|
|
|
@@ -33,13 +35,19 @@ module Plurimath
|
|
|
33
35
|
|
|
34
36
|
rule(:binary_symbols) { op_binary_symbols | op_binary_symbols_prefixed }
|
|
35
37
|
rule(:op_close_paren) { arr_to_expression(Constants::CLOSE_PARENTHESIS, :close_paren) }
|
|
36
|
-
rule(:binary_negated)
|
|
38
|
+
rule(:binary_negated) do
|
|
39
|
+
binary_negated_absent_symbols? >> (op_binary_negated | op_prefixed_binary_negated)
|
|
40
|
+
end
|
|
37
41
|
rule(:unicoded_fonts) { unicoded_fonts_to_expression(Constants::UNICODED_FONTS, :symbol) }
|
|
38
42
|
|
|
39
|
-
rule(:wrapper_symbols)
|
|
43
|
+
rule(:wrapper_symbols) do
|
|
44
|
+
arr_to_expression(Constants.wrapper_symbols, :symbol)
|
|
45
|
+
end
|
|
40
46
|
rule(:op_nary_symbols) { arr_to_expression(Constants::NARY_SYMBOLS.values, :nary_class) }
|
|
41
47
|
rule(:op_open_unicode) { arr_to_expression(Constants::OPEN_SYMBOLS.values, :open_paren) }
|
|
42
|
-
rule(:prefixed_primes)
|
|
48
|
+
rule(:prefixed_primes) do
|
|
49
|
+
str("pppprime") | str("ppprime") | str("pprime") | str("prime")
|
|
50
|
+
end
|
|
43
51
|
|
|
44
52
|
rule(:combined_symbols) { op_combined_symbols | op_combined_unicode }
|
|
45
53
|
rule(:op_close_unicode) { arr_to_expression(Constants::CLOSE_SYMBOLS.values, :close_paren) }
|
|
@@ -76,7 +84,10 @@ module Plurimath
|
|
|
76
84
|
rule(:op_unary_arg_functions) { arr_to_expression(Constants::UNARY_ARG_FUNCTIONS.values, :unary_arg_functions) }
|
|
77
85
|
|
|
78
86
|
rule(:op_prefixed_unary_symbols) { slash >> arr_to_expression(Constants::UNARY_SYMBOLS.keys, :unary_symbols) }
|
|
79
|
-
rule(:op_size_overrides_symbols)
|
|
87
|
+
rule(:op_size_overrides_symbols) do
|
|
88
|
+
str("Ⅎ") >> arr_to_expression(Constants::SIZE_OVERRIDES_SYMBOLS.keys,
|
|
89
|
+
:size_overrides)
|
|
90
|
+
end
|
|
80
91
|
|
|
81
92
|
rule(:op_binary_symbols_prefixed) { slash >> arr_to_expression(Constants::BINARY_SYMBOLS.keys, :binary_symbols) }
|
|
82
93
|
rule(:op_prefixed_binary_negated) { slash >> arr_to_expression(Constants::BINARY_SYMBOLS.keys, :binary_negated_operator) }
|
|
@@ -98,7 +109,7 @@ module Plurimath
|
|
|
98
109
|
end
|
|
99
110
|
end
|
|
100
111
|
|
|
101
|
-
def unicoded_fonts_to_expression(hash,
|
|
112
|
+
def unicoded_fonts_to_expression(hash, _name = nil)
|
|
102
113
|
type = hash.first.class
|
|
103
114
|
hash.reduce do |expression, expr_hash|
|
|
104
115
|
if expression.is_a?(type)
|
|
@@ -113,7 +124,7 @@ module Plurimath
|
|
|
113
124
|
type = expr_hash.first.class
|
|
114
125
|
expr_hash.reduce do |expression, (_, hex_code)|
|
|
115
126
|
expression = str(name).absent?.as(name).as(:unicoded_font_class) >> str(expression.last).as(:symbol) if expression.is_a?(type)
|
|
116
|
-
expression | str(name).absent?.as(name).as(:unicoded_font_class) >> str(hex_code).as(:symbol)
|
|
127
|
+
expression | (str(name).absent?.as(name).as(:unicoded_font_class) >> str(hex_code).as(:symbol))
|
|
117
128
|
end
|
|
118
129
|
else
|
|
119
130
|
str(expr_hash.values.last)
|
|
@@ -7,33 +7,53 @@ module Plurimath
|
|
|
7
7
|
include Helper
|
|
8
8
|
|
|
9
9
|
rule(:rect) { rect_symbols >> space? >> bracketed_masked_value(:rect) }
|
|
10
|
-
rule(:sqrt)
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
rule(:sqrt) do
|
|
11
|
+
(sqrt_symbols.as(:root_symbol) >> (exp_script | operand).as(:first_value)).as(:root)
|
|
12
|
+
end
|
|
13
|
+
rule(:qdrt) do
|
|
14
|
+
(qdrt_symbols.as(:root_symbol) >> (exp_script | operand).as(:first_value)).as(:root)
|
|
15
|
+
end
|
|
16
|
+
rule(:cbrt) do
|
|
17
|
+
(cbrt_symbols.as(:root_symbol) >> (exp_script | operand).as(:first_value)).as(:root)
|
|
18
|
+
end
|
|
13
19
|
|
|
14
|
-
rule(:color)
|
|
15
|
-
|
|
20
|
+
rule(:color) do
|
|
21
|
+
color_symbols >> space? >> bracketed_masked_value(:color)
|
|
22
|
+
end
|
|
23
|
+
rule(:phant) do
|
|
24
|
+
phantom_symbols >> space? >> bracketed_masked_value(:phantom)
|
|
25
|
+
end
|
|
16
26
|
|
|
17
|
-
rule(:backcolor)
|
|
27
|
+
rule(:backcolor) do
|
|
28
|
+
backcolor_symbols >> space? >> bracketed_masked_value(:backcolor)
|
|
29
|
+
end
|
|
18
30
|
|
|
19
31
|
rule(:cbrt_symbols) { str("∛") | str("\\cbrt") }
|
|
20
32
|
rule(:qdrt_symbols) { str("∜") | str("\\cbrt") }
|
|
21
33
|
rule(:rect_symbols) { str("▭") | str("\\rect") }
|
|
22
34
|
rule(:sqrt_symbols) { str("√") | str("\\sqrt") | str("\\surd") }
|
|
23
|
-
rule(:root_symbols)
|
|
35
|
+
rule(:root_symbols) do
|
|
36
|
+
str("⒭") | str("√") | str("\\root") | str("\\surd")
|
|
37
|
+
end
|
|
24
38
|
rule(:arg_function) do
|
|
25
|
-
str("ⓐ").as(:arg) >> str("(") >> a_ascii.as(:arg_arguments).maybe >> space? >> expression.as(:first_value).maybe >> str(")") |
|
|
26
|
-
str("ⓐ").as(:arg) >> a_ascii.as(:arg_arguments).maybe >> space? >> expression.as(:first_value).maybe
|
|
39
|
+
(str("ⓐ").as(:arg) >> str("(") >> a_ascii.as(:arg_arguments).maybe >> space? >> expression.as(:first_value).maybe >> str(")")) |
|
|
40
|
+
(str("ⓐ").as(:arg) >> a_ascii.as(:arg_arguments).maybe >> space? >> expression.as(:first_value).maybe)
|
|
27
41
|
end
|
|
28
42
|
|
|
29
43
|
rule(:color_symbols) { str("✎") | str("\\color") }
|
|
30
44
|
rule(:phantom_symbols) { str("⟡") | str("\\phantom") }
|
|
31
|
-
rule(:monospace_fonts)
|
|
45
|
+
rule(:monospace_fonts) do
|
|
46
|
+
(str("ᅲ") >> str("(") >> space? >> expression.as(:monospace_value) >> space? >> str(")")).as(:monospace)
|
|
47
|
+
end
|
|
32
48
|
|
|
33
49
|
rule(:backcolor_symbols) { str("☁") | str("\\backcolor") }
|
|
34
|
-
rule(:masked_recursive_value)
|
|
50
|
+
rule(:masked_recursive_value) do
|
|
51
|
+
((space? >> expression) | exp_bracket | exp_script).as(:expr) >> masked_recursive_value.as(:func_expr).maybe
|
|
52
|
+
end
|
|
35
53
|
|
|
36
|
-
rule(:root_invisible_character?)
|
|
54
|
+
rule(:root_invisible_character?) do
|
|
55
|
+
(str("\\naryand").absent? >> invisible_unicode).maybe
|
|
56
|
+
end
|
|
37
57
|
|
|
38
58
|
rule(:nthrt) do
|
|
39
59
|
(sqrt_symbols >> str("(") >> masked_recursive_value.as(:first_value) >> str("&") >> masked_recursive_value.as(:second_value) >> str(")")).as(:root)
|
|
@@ -44,8 +64,8 @@ module Plurimath
|
|
|
44
64
|
end
|
|
45
65
|
|
|
46
66
|
rule(:intent_function) do
|
|
47
|
-
str("ⓘ").as(:intent) >> str("(").as(:open_paren) >> parsing_text.as(:intent_arguments).maybe >> space? >> expression.as(:first_value).maybe >> str(")").as(:close_paren) |
|
|
48
|
-
str("ⓘ").as(:intent) >> expression.as(:intent_expr)
|
|
67
|
+
(str("ⓘ").as(:intent) >> str("(").as(:open_paren) >> parsing_text.as(:intent_arguments).maybe >> space? >> expression.as(:first_value).maybe >> str(")").as(:close_paren)) |
|
|
68
|
+
(str("ⓘ").as(:intent) >> expression.as(:intent_expr))
|
|
49
69
|
end
|
|
50
70
|
|
|
51
71
|
def masked_value(func_name)
|
|
@@ -53,7 +73,7 @@ module Plurimath
|
|
|
53
73
|
end
|
|
54
74
|
|
|
55
75
|
def bracketed_masked_value(func_name)
|
|
56
|
-
str("(") >>
|
|
76
|
+
str("(") >> masked_value(func_name).as(func_name) >> str(")")
|
|
57
77
|
end
|
|
58
78
|
end
|
|
59
79
|
end
|