Sha256: 216d1d4f6a2724919b8bd5ecc811d0f52207ded7dd440237960d4e9a62169408

Contents?: true

Size: 863 Bytes

Versions: 33

Compression:

Stored size: 863 Bytes

Contents

require 'sass/script'
require 'sass/script/css_lexer'

module Sass
  module Script
    # This is a subclass of {Parser} for use in parsing plain CSS properties.
    #
    # @see Sass::SCSS::CssParser
    class CssParser < Parser
      private

      # @private
      def lexer_class; CssLexer; end

      # We need a production that only does /,
      # since * and % aren't allowed in plain CSS
      production :div, :unary_plus, :div

      def string
        return number unless tok = try_tok(:string)
        return literal_node(tok.value, tok.source_range) unless @lexer.peek && @lexer.peek.type == :begin_interpolation
      end

      # Short-circuit all the SassScript-only productions
      alias_method :interpolation, :space
      alias_method :or_expr, :div
      alias_method :unary_div, :ident
      alias_method :paren, :string
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
sass-3.3.0.alpha.256 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.255 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.252 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.253 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.247 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.243 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.231 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.229 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.227 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.226 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.225 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.224 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.222 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.218 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.216 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.215 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.214 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.213 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.212 lib/sass/script/css_parser.rb
sass-3.3.0.alpha.211 lib/sass/script/css_parser.rb