Sha256: 2a90d84c2f7544b4f8495af075e3100c6992e0b9115a68abc058d19659494045

Contents?: true

Size: 895 Bytes

Versions: 10

Compression:

Stored size: 895 Bytes

Contents

module Csscss
  module Parser
    module BorderWidth
      extend Parser::Base

      class Parser < Parslet::Parser
        include Common

        rule(:border_width_side) {
          symbol_list(%w(thin medium thick inherit)) | length
        }

        rule(:border_width) {
          (
           symbol("inherit") >> eof | (
             border_width_side.maybe.as(:top)    >>
             border_width_side.maybe.as(:right)  >>
             border_width_side.maybe.as(:bottom) >>
             border_width_side.maybe.as(:left)
           )
          ).as(:border_width)
        }

        root(:border_width)
      end

      class Transformer < Parslet::Transform
        @property = :border_width
        extend MultiSideTransformer

        def self.side_declaration(side, value)
          Declaration.from_parser("border-#{side}-width", value)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
csscss-1.3.3 lib/csscss/parser/border_width.rb
csscss-1.3.2 lib/csscss/parser/border_width.rb
csscss-1.3.1 lib/csscss/parser/border_width.rb
csscss-1.3.0 lib/csscss/parser/border_width.rb
csscss-1.2.0 lib/csscss/parser/border_width.rb
csscss-1.1.0 lib/csscss/parser/border_width.rb
csscss-1.0.0 lib/csscss/parser/border_width.rb
csscss-0.2.1 lib/csscss/parser/border_width.rb
csscss-0.2.0 lib/csscss/parser/border_width.rb
csscss-0.1.0 lib/csscss/parser/border_width.rb