Sha256: cc6f84e36c6f26cbe91dfc45f04b131b9a75cad815c9b3f9634447371b27dcb8

Contents?: true

Size: 736 Bytes

Versions: 11

Compression:

Stored size: 736 Bytes

Contents

# frozen_string_literal: true

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

      def whitespace
        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? <<
            (whitespace? << element << (whitespace? << comma).maybe).repeat <<
            (whitespace? << closing_square_bracket.ignore).maybe
        ).aka(:list) | String
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
code-ruby-0.7.2 lib/code/parser/list.rb
code-ruby-0.7.1 lib/code/parser/list.rb
code-ruby-0.7.0 lib/code/parser/list.rb
code-ruby-0.6.7 lib/code/parser/list.rb
code-ruby-0.6.6 lib/code/parser/list.rb
code-ruby-0.6.5 lib/code/parser/list.rb
code-ruby-0.6.4 lib/code/parser/list.rb
code-ruby-0.6.3 lib/code/parser/list.rb
code-ruby-0.6.2 lib/code/parser/list.rb
code-ruby-0.6.1 lib/code/parser/list.rb
code-ruby-0.6.0 lib/code/parser/list.rb