Sha256: 7039769f5a48541e6cdf0eee9943db190727d81605d6475b60a564a24844cfc4

Contents?: true

Size: 743 Bytes

Versions: 25

Compression:

Stored size: 743 Bytes

Contents

class Template
  class Parser
    class Template < Language
      def code
        ::Code::Parser::Code
      end

      def opening_curly_bracket
        str("{")
      end

      def closing_curly_bracket
        str("}")
      end

      def backslash
        str("\\")
      end

      def code_part
        opening_curly_bracket << code << (closing_curly_bracket | any.absent)
      end

      def text_character
        (backslash.ignore << opening_curly_bracket) |
          (opening_curly_bracket.absent << any)
      end

      def text_part
        text_character.repeat(1)
      end

      def root
        (code_part.aka(:code) | text_part.aka(:text)).repeat |
          str("").aka(:text).repeat(1, 1)
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 3 rubygems

Version Path
template-ruby-0.6.3 lib/template/parser/template.rb
template-ruby-0.6.2 lib/template/parser/template.rb
template-ruby-0.6.1 lib/template/parser/template.rb
template-ruby-0.6.0 lib/template/parser/template.rb
template-ruby-0.5.6 lib/template/parser/template.rb
language-ruby-0.5.6 lib/template/parser/template.rb
code-ruby-0.5.6 lib/template/parser/template.rb
template-ruby-0.5.5 lib/template/parser/template.rb
language-ruby-0.5.5 lib/template/parser/template.rb
code-ruby-0.5.5 lib/template/parser/template.rb
template-ruby-0.5.4 lib/template/parser/template.rb
language-ruby-0.5.4 lib/template/parser/template.rb
code-ruby-0.5.4 lib/template/parser/template.rb
template-ruby-0.5.3 lib/template/parser/template.rb
language-ruby-0.5.3 lib/template/parser/template.rb
code-ruby-0.5.3 lib/template/parser/template.rb
template-ruby-0.5.2 lib/template/parser/template.rb
language-ruby-0.5.2 lib/template/parser/template.rb
code-ruby-0.5.2 lib/template/parser/template.rb
language-ruby-0.5.1 lib/template/parser/template.rb