5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/xls_function/format_string/parse_rules/numbers.rb', line 5
def self.included(klass)
klass.class_eval do
rule(:digit_s) { str('#').as(:digit_s) }
rule(:digit_z) { str('0').as(:digit_z) }
rule(:digit_q) { str('?').as(:digit_q) }
rule(:number) { (digit_s | digit_z | digit_q).as(:number) }
rule(:suffixable) do
str(',').as(:string).repeat(1, 2) |
str('%').as(:string) |
str('.').as(:string)
end
rule(:numbers) do
(
(
number >> (texts.maybe >> number).repeat
) >> suffixable.maybe
).as(:numbers)
end
end
end
|