Sha256: b13a2a94d37606febf3a95e5cfc37ab8a1ce21640dc7d1538edb98a81b2b03ed

Contents?: true

Size: 1008 Bytes

Versions: 10

Compression:

Stored size: 1008 Bytes

Contents

module Csscss
  module Parser
    module BorderStyle
      extend Parser::Base

      class Parser < Parslet::Parser
        include Common

        rule(:border_style_side) {
          symbol_list(%w(none hidden dotted dashed solid
                         double groove ridge inset outset
                      ))
        }

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

        root(:border_style)
      end

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

        class << self
          def side_declaration(side, value)
            Declaration.from_parser("border-#{side}-style", value)
          end
        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_style.rb
csscss-1.3.2 lib/csscss/parser/border_style.rb
csscss-1.3.1 lib/csscss/parser/border_style.rb
csscss-1.3.0 lib/csscss/parser/border_style.rb
csscss-1.2.0 lib/csscss/parser/border_style.rb
csscss-1.1.0 lib/csscss/parser/border_style.rb
csscss-1.0.0 lib/csscss/parser/border_style.rb
csscss-0.2.1 lib/csscss/parser/border_style.rb
csscss-0.2.0 lib/csscss/parser/border_style.rb
csscss-0.1.0 lib/csscss/parser/border_style.rb