Module: XlsFunction::FormatString::ParseRules::Texts

Included in:
XlsFunction::FormatString::Parser
Defined in:
lib/xls_function/format_string/parse_rules/texts.rb

Class Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/xls_function/format_string/parse_rules/texts.rb', line 5

def self.included(klass)
  klass.class_eval do
    rule(:space) { match('\s').repeat(1) }

    rule(:default) { str('G/標準').as(:placeholder) }
    rule(:placeholder) { str('@').as(:placeholder) }

    rule(:escaped_string) { str('!') >> match('.').as(:string) }

    rule(:string) do
      (expr_sep | time | ampm | date | number).absent? >> any.as(:string)
    end

    rule(:text) { (escaped_string | placeholder | default | string).as(:text) }
    rule(:texts) { text.repeat(1).as(:texts) }
  end
end