Sha256: cebc722bc30b5cda0774682f4e13e07a9a168ef61f5c4ca0d280de6acfb3ac0c

Contents?: true

Size: 781 Bytes

Versions: 21

Compression:

Stored size: 781 Bytes

Contents

class Code
  class Parser
    class List < Language
      def code
        ::Code::Parser::Code.new.present
      end

      def whitespace
        ::Code::Parser::Whitespace
      end

      def whitespace?
        whitespace.maybe
      end

      def opening_square_bracket
        str("[")
      end

      def closing_square_bracket
        str("]")
      end

      def comma
        str(",")
      end

      def element
        code
      end

      def root
        (
          opening_square_bracket.ignore << whitespace? <<
            element.repeat(0, 1) <<
            (whitespace? << comma << whitespace? << element).repeat <<
            (whitespace? << closing_square_bracket.ignore).maybe
        ).aka(:list) | ::Code::Parser::String
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 3 rubygems

Version Path
template-ruby-0.5.6 lib/code/parser/list.rb
language-ruby-0.5.6 lib/code/parser/list.rb
code-ruby-0.5.6 lib/code/parser/list.rb
template-ruby-0.5.5 lib/code/parser/list.rb
language-ruby-0.5.5 lib/code/parser/list.rb
code-ruby-0.5.5 lib/code/parser/list.rb
template-ruby-0.5.4 lib/code/parser/list.rb
language-ruby-0.5.4 lib/code/parser/list.rb
code-ruby-0.5.4 lib/code/parser/list.rb
template-ruby-0.5.3 lib/code/parser/list.rb
language-ruby-0.5.3 lib/code/parser/list.rb
code-ruby-0.5.3 lib/code/parser/list.rb
template-ruby-0.5.2 lib/code/parser/list.rb
language-ruby-0.5.2 lib/code/parser/list.rb
code-ruby-0.5.2 lib/code/parser/list.rb
language-ruby-0.5.1 lib/code/parser/list.rb
template-ruby-0.5.1 lib/code/parser/list.rb
code-ruby-0.5.1 lib/code/parser/list.rb
template-ruby-0.5.0 lib/code/parser/list.rb
language-ruby-0.5.0 lib/code/parser/list.rb